w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
Rw11CntlDZ11.hpp
Go to the documentation of this file.
1// $Id: Rw11CntlDZ11.hpp 1185 2019-07-12 17:29:12Z mueller $
2// SPDX-License-Identifier: GPL-3.0-or-later
3// Copyright 2019- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4//
5// Revision History:
6// Date Rev Version Comment
7// 2019-05-19 1150 1.0 Initial version
8// 2019-05-04 1146 0.1 First draft
9// ---------------------------------------------------------------------------
10
11
16#ifndef included_Retro_Rw11CntlDZ11
17#define included_Retro_Rw11CntlDZ11 1
18
19#include "Rw11CntlBase.hpp"
20#include "Rw11UnitDZ11.hpp"
21
22namespace Retro {
23
24 class Rw11CntlDZ11 : public Rw11CntlBase<Rw11UnitDZ11,8> {
25 public:
26
29
30 void Config(const std::string& name, uint16_t base, int lam);
31
32 virtual void Start();
33
34 virtual void UnitSetup(size_t ind);
35 virtual void UnitSetupAll();
36 void Wakeup();
37
38 void SetRxQlim(uint16_t qlim);
39 uint16_t RxQlim() const;
40 void SetRxRlim(uint16_t rlim);
41 uint16_t RxRlim() const;
42 void SetTxRlim(uint16_t rlim);
43 uint16_t TxRlim() const;
44 void SetModCntl(bool modcntl);
45 bool ModCntl() const;
46
47 uint16_t Itype() const;
48 bool Buffered() const;
49 uint16_t FifoSize() const;
50
51 virtual void Dump(std::ostream& os, int ind=0, const char* text=0,
52 int detail=0) const;
53
54 // some constants (also defined in cpp)
55 static const uint16_t kIbaddr = 0160100;
56 static const int kLam = 3;
57
58 static const uint16_t kCNTL = 000;
59 static const uint16_t kSTAT = 002;
60 static const uint16_t kFUSE = 004;
61 static const uint16_t kFDAT = 006;
62
63 static const uint16_t kProbeOff = kCNTL;
64 static const bool kProbeInt = true;
65 static const bool kProbeRem = true;
66
67 static const uint16_t kFifoMaxSize = 127;
68
69 // cntl read view
70 static const uint16_t kCNTL_V_AWDTH = 8;
71 static const uint16_t kCNTL_B_AWDTH = 0007;
72 static const uint16_t kCNTL_V_SSEL = 3;
73 static const uint16_t kCNTL_B_SSEL = 0003;
74 static const uint16_t kCNTL_M_MSE = kWBit02;
75 static const uint16_t kCNTL_M_MAINT = kWBit01;
76 // cntl write view
77 static const uint16_t kCNTL_V_DATA = 8;
78 static const uint16_t kCNTL_B_DATA = 0377;
79 static const uint16_t kCNTL_V_RRLIM = 12;
80 static const uint16_t kCNTL_B_RRLIM = 0007;
81 static const uint16_t kCNTL_V_TRLIM = 8;
82 static const uint16_t kCNTL_B_TRLIM = 0007;
83 static const uint16_t kCNTL_M_RCLR = kWBit06;
84 static const uint16_t kCNTL_M_TCLR = kWBit05;
85 static const uint16_t kCNTL_M_FUNC = 0007;
86
87 static const uint16_t kSSEL_DTLE = 0;
88 static const uint16_t kSSEL_BRRK = 1;
89 static const uint16_t kSSEL_CORI = 2;
90 static const uint16_t kSSEL_RLCN = 3;
91
92 static const uint16_t kFUNC_NOOP = 0;
93 static const uint16_t kFUNC_SCO = 1;
94 static const uint16_t kFUNC_SRING = 2;
95 static const uint16_t kFUNC_SRLIM = 3;
96
97 static const uint16_t kCAL_DTR = 0;
98 static const uint16_t kCAL_BRK = 1;
99 static const uint16_t kCAL_RXON = 2;
100 static const uint16_t kCAL_CSR = 3;
101
102 static const uint16_t kFUSE_V_RFUSE = 8;
103 static const uint16_t kFUSE_B_RFUSE = 0177;
104 static const uint16_t kFUSE_M_TFUSE = 0177;
105
106 static const uint16_t kFDAT_M_VAL = kWBit15;
107 static const uint16_t kFDAT_M_LAST = kWBit14;
108 static const uint16_t kFDAT_M_FERR = kWBit13;
109 static const uint16_t kFDAT_M_CAL = kWBit11;
110 static const uint16_t kFDAT_V_LINE = 8;
111 static const uint16_t kFDAT_B_LINE = 0007;
112 static const uint16_t kFDAT_M_BUF = 0xFF;
113
114 static const uint16_t kCALCSR_M_MSE = kWBit05;
115 static const uint16_t kCALCSR_M_CLR = kWBit04;
116 static const uint16_t kCALCSR_M_MAINT= kWBit03;
117
118 // statistics counter indices
119 enum stats {
131 };
132
133 protected:
135 void RxProcess(uint16_t fuse);
136 void TxProcess(const RlinkCommand& cmd, bool prim,
137 uint16_t fuse);
138 int TxRcvHandler();
139 bool NextBusyRxUnit();
140
141 protected:
142 size_t fPC_fdat;
143 size_t fPC_fuse;
144 uint16_t fRxQlim;
145 uint16_t fRxRlim;
146 uint16_t fTxRlim;
147 bool fModCntl;
148 uint16_t fItype;
149 uint16_t fFsize;
150 uint16_t fTxRblkSize;
152 size_t fRxCurUnit;
153 uint16_t fLastFuse;
154 uint8_t fCurDtr;
155 uint8_t fCurBrk;
156 uint8_t fCurRxon;
157 uint8_t fCurCsr;
158 };
159
160} // end namespace Retro
161
162#include "Rw11CntlDZ11.ipp"
163
164#endif
static const uint16_t kWBit14
Definition: Rbits.hpp:46
static const uint16_t kWBit06
Definition: Rbits.hpp:38
static const uint16_t kWBit01
Definition: Rbits.hpp:33
static const uint16_t kWBit15
Definition: Rbits.hpp:47
static const uint16_t kWBit03
Definition: Rbits.hpp:35
static const uint16_t kWBit13
Definition: Rbits.hpp:45
static const uint16_t kWBit04
Definition: Rbits.hpp:36
static const uint16_t kWBit11
Definition: Rbits.hpp:43
static const uint16_t kWBit05
Definition: Rbits.hpp:37
static const uint16_t kWBit02
Definition: Rbits.hpp:34
Implemenation (inline) of Rw11CntlBase.
uint16_t RxQlim() const
FIXME_docs.
static const bool kProbeRem
probr rem active
int TxRcvHandler()
FIXME_docs.
uint16_t Itype() const
FIXME_docs.
static const uint16_t kFDAT_M_VAL
fdat.val mask
static const uint16_t kCAL_BRK
static const uint16_t kProbeOff
probe address offset (cntl)
uint16_t RxRlim() const
FIXME_docs.
void SetTxRlim(uint16_t rlim)
FIXME_docs.
static const uint16_t kCNTL_M_MAINT
cntl.maint mask
static const uint16_t kCNTL_B_SSEL
cntl.ssel bit mask
static const uint16_t kCNTL_V_AWDTH
cntl.awdth shift
static const uint16_t kFUSE_M_TFUSE
tfuse mask
void SetRxQlim(uint16_t qlim)
FIXME_docs.
static const uint16_t kFUNC_SRLIM
uint8_t fCurCsr
current csr
bool fTxQueBusy
tx queue busy
virtual void UnitSetupAll()
FIXME_docs.
static const uint16_t kCNTL_V_SSEL
cntl.ssel shift
static const uint16_t kCNTL
CNTL and CSR reg offset.
uint16_t fTxRblkSize
tx rblk chunk size
uint16_t TxRlim() const
FIXME_docs.
static const uint16_t kSSEL_BRRK
virtual void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
static const uint16_t kFUSE_V_RFUSE
rfuse shift
void SetRxRlim(uint16_t rlim)
FIXME_docs.
static const bool kProbeInt
probe int active
static const uint16_t kCNTL_B_DATA
cntl.data bit mask
void TxProcess(const RlinkCommand &cmd, bool prim, uint16_t fuse)
FIXME_docs.
static const uint16_t kFDAT_M_CAL
fdat.cal mask
uint16_t fFsize
fifo size
static const uint16_t kCNTL_M_TCLR
cntl.rclr mask
static const uint16_t kFDAT_V_LINE
fdat.line shift
static const uint16_t kSSEL_DTLE
int AttnHandler(RlinkServer::AttnArgs &args)
FIXME_docs.
uint16_t fLastFuse
last seen fuse
static const uint16_t kSSEL_RLCN
static const uint16_t kCNTL_V_DATA
cntl.data shift
static const uint16_t kCNTL_M_RCLR
cntl.rclr mask
void SetModCntl(bool modcntl)
FIXME_docs.
size_t fPC_fuse
PrimClist: fuse index.
uint16_t fRxRlim
rx interrupt rate limit
@ kStatNDropMaint
drop because maint=1
@ kStatNCalBrk
cal brk received
@ kStatNCalBad
cal invalid
@ kStatNCalDtr
cal dtr received
@ kStatNDropRxon
drop because rxon=0
@ kStatNCalCsr
cal csr received
@ kStatNDropMse
drop because mse=0
@ kStatNTxQue
queue rblk
@ kStatNCalRxon
cal rxon received
static const uint16_t kCAL_DTR
~Rw11CntlDZ11()
Destructor.
static const uint16_t kFDAT_M_LAST
fdat.last mask
static const uint16_t kCNTL_M_MSE
cntl.mse mask
bool fModCntl
modem control enable
static const uint16_t kCNTL_V_RRLIM
cntl.rrlim shift
bool ModCntl() const
FIXME_docs.
static const uint16_t kFDAT
FDAT and TDR/MSR reg offset.
uint16_t fRxQlim
rx queue limit
static const uint16_t kCAL_RXON
static const uint16_t kCNTL_B_TRLIM
cntl.trlim bit mask
static const uint16_t kCNTL_B_RRLIM
cntl.rrlim bit mask
uint16_t FifoSize() const
FIXME_docs.
bool Buffered() const
FIXME_docs.
void Wakeup()
FIXME_docs.
uint8_t fCurBrk
current brk
bool NextBusyRxUnit()
FIXME_docs.
void RxProcess(uint16_t fuse)
FIXME_docs.
static const uint16_t kCAL_CSR
void Config(const std::string &name, uint16_t base, int lam)
FIXME_docs.
static const uint16_t kCNTL_M_FUNC
cntl.func mask
static const uint16_t kCNTL_B_AWDTH
cntl.awdth bit mask
size_t fPC_fdat
PrimClist: fdat index.
static const uint16_t kCNTL_V_TRLIM
cntl.trlim shift
static const uint16_t kFifoMaxSize
maximal fifo size
virtual void Start()
FIXME_docs.
size_t fRxCurUnit
rx current unit
virtual void UnitSetup(size_t ind)
FIXME_docs.
uint8_t fCurRxon
current rxon
static const uint16_t kFDAT_B_LINE
fdat.line bit mask
Rw11CntlDZ11()
Default constructor.
uint16_t fItype
interface type
static const uint16_t kFUSE_B_RFUSE
rfuse bit mask
static const uint16_t kFUNC_SRING
uint8_t fCurDtr
current dtr
static const uint16_t kFUNC_SCO
static const uint16_t kCALCSR_M_MAINT
fdat_cal.maint mask
uint16_t fTxRlim
tx interrupt rate limit
static const uint16_t kFDAT_M_BUF
fdat.buf mask
static const uint16_t kFUNC_NOOP
static const uint16_t kCALCSR_M_MSE
fdat_cal.mse mask
static const uint16_t kSSEL_CORI
static const uint16_t kCALCSR_M_CLR
fdat_cal.clr mask
static const int kLam
DZ11 default lam.
static const uint16_t kIbaddr
DZ11 default address.
static const uint16_t kFDAT_M_FERR
fdat.ferr mask
static const uint16_t kSTAT
STAT and RBUF/LPR reg offset.
static const uint16_t kFUSE
FUSE and TCR reg offset.
Declaration of class ReventLoop.
Definition: ReventLoop.cpp:47