28using namespace std::placeholders;
126 for (
size_t i=0; i<
NUnit(); i++) {
164 "Bad state: started, no lam, not enable, not found");
192 uint16_t(1)<<
fLam,
this);
216 for (
size_t i=0; i<
NUnit(); i++) {
217 if (
fspUnit[i]->HasVirt()) co |= uint8_t(1)<<i;
250 if (qlim == 0) qlim =
fFsize;
253 "Bad args: qlim larger than fifosize");
265 throw Rexception(
"Rw11CntlDZ11::SetRxRlim",
"Bad args: rlim too large");
278 throw Rexception(
"Rw11CntlDZ11::SetTxRlim",
"Bad args: rlim too large");
302 os << bl << (text?text:
"--") <<
"Rw11CntlDZ11 @ " <<
this << endl;
303 os << bl <<
" fPC_fdat: " <<
fPC_fdat << endl;
304 os << bl <<
" fPC_fuse: " <<
fPC_fuse << endl;
349 uint16_t nmax =
fRxQlim - rfuse;
350 vector<uint16_t> iblock;
351 iblock.reserve(nmax);
352 while (iblock.size() < nmax) {
355 if (qsize > nmax-iblock.size()) qsize = nmax-iblock.size();
356 for (
size_t i=0; i<qsize; i++) {
367 iblock.push_back(iwrd);
373 if (iblock.size() == 0)
return;
377 lmsg <<
"-I " <<
Name() <<
": rx "
379 <<
" size=" <<
RosPrintf(iblock.size(),
"d",3);
401 if (done == 0)
return;
406 bool lastseen =
false;
409 size_t sndcnt[
kNUnit] = {};
411 for (
size_t i=0; i < done; i++) {
412 uint16_t xwrd = xbuf[i];
418 if (last) lastseen =
true;
420 fspUnit[line]->StatIncTx(0,
true);
468 lmsg <<
"-E " <<
Name() <<
": cal code bad:" <<
RosPrintf(line,
"d");
473 fspUnit[line]->StatIncTx(ochr);
474 sndbuf[line][sndcnt[line]++] = ochr;
478 for (
size_t i = 0; i <
kNUnit; i++) {
479 if (sndcnt[i])
fspUnit[i]->Snd(sndbuf[i], sndcnt[i]);
487 if ((!
fTxQueBusy) && done > 0 && (!lastseen)) {
495 lmsg <<
"-I " <<
Name() <<
": tx "
496 <<
" pr,si,do=" << prim
499 <<
" last=" << lastseen
503 lmsg <<
" rfuse=" <<
RosPrintf(rfuse,
"d",3);
542 for (
size_t i=0; i<
NUnit(); i++) {
size_t AddAttn()
FIXME_docs.
static const uint8_t kStat_M_RbNak
stat: rbnak flag set
static const uint8_t kStat_M_RbTout
stat: rbtout flag set
size_t BlockSize() const
FIXME_docs.
size_t BlockDone() const
FIXME_docs.
uint16_t * BlockPointer()
FIXME_docs.
void AddAttnHandler(attnhdl_t &&attnhdl, uint16_t mask, void *cdata=nullptr)
FIXME_docs.
void QueueAction(actnhdl_t &&actnhdl)
FIXME_docs.
void GetAttnInfo(AttnArgs &args, RlinkCommandList &clist)
FIXME_docs.
bool Exec(RlinkCommandList &clist, RerrMsg &emsg)
FIXME_docs.
I/O appicator to generate fill characters.
void Inc(size_t ind, double val=1.)
FIXME_docs.
void Define(size_t ind, const std::string &name, const std::string &text)
FIXME_docs.
Implemenation (inline) of Rw11CntlBase.
static const size_t kNUnit
number of units
virtual void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
virtual size_t NUnit() const
FIXME_docs.
std::shared_ptr< Rw11UnitDZ11 > fspUnit[NU]
static const bool kProbeRem
probr rem active
int TxRcvHandler()
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)
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
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
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
@ 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
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
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.
int fLam
attn bit number (-1 of none)
uint32_t fTraceLevel
trace level; 0=off;1=cntl
RlinkCommandList fPrimClist
clist for attn primary info
uint16_t Base() const
FIXME_docs.
Rw11Probe fProbe
controller probe context
Rw11Cpu & Cpu() const
FIXME_docs.
void ConfigCntl(const std::string &name, uint16_t base, int lam, uint16_t probeoff, bool probeint, bool proberem)
FIXME_docs.
bool fStarted
true if Start() called
RlinkServer & Server() const
FIXME_docs.
const std::string & Name() const
FIXME_docs.
RlogFile & LogFile() const
FIXME_docs.
uint16_t fBase
controller base address
void AllIAddrMapInsert(const std::string &name, uint16_t ibaddr)
FIXME_docs.
uint16_t ExecRibr(uint16_t ibaddr)
FIXME_docs.
int AddRbibr(RlinkCommandList &clist, uint16_t ibaddr, size_t size)
FIXME_docs.
void ExecWibr(uint16_t ibaddr0, uint16_t data0, uint16_t ibaddr1=0, uint16_t data1=0, uint16_t ibaddr2=0, uint16_t data2=0)
FIXME_docs.
int AddRibr(RlinkCommandList &clist, uint16_t ibaddr)
FIXME_docs.
int AddWbibr(RlinkCommandList &clist, uint16_t ibaddr, const std::vector< uint16_t > &block)
FIXME_docs.
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.
Declaration of class ReventLoop.
bool Found() const
FIXME_docs.
uint16_t DataRem() const
FIXME_docs.