47#ifndef included_Retro_RlinkConnect
48#define included_Retro_RlinkConnect 1
119 uint32_t
SysId()
const;
154 const std::string& name =
"");
156 const std::shared_ptr<RlogFile>&
LogFileSPtr()
const;
161 void Print(std::ostream& os)
const;
162 void Dump(std::ostream& os,
int ind=0,
const char* text=0,
238 [[noreturn]]
void BadPort(
const char* meth);
static const uint16_t kWBit14
static const uint16_t kWBit15
static const uint16_t kWBit07
static const uint16_t kRLCNTL_M_AnEna
RLCNTL: an enable.
std::recursive_mutex fConnectMutex
mutex to lock whole connect
static const uint16_t kRbaddr_RLCNTL
rlink core reg RLCNTL
void SetTimeout(const Rtime &timeout)
FIXME_docs.
void AddrMapClear()
FIXME_docs.
int WaitAttn(const Rtime &timeout, Rtime &twait, uint16_t &apat, RerrMsg &emsg)
Wait for an attention notify.
void SetLogFileName(const std::string &name)
FIXME_docs.
uint32_t LogBaseData() const
FIXME_docs.
static const uint16_t kRLSTAT_B_LCmd
RLSTAT: lcmd.
bool LogOpen(const std::string &name, RerrMsg &emsg)
FIXME_docs.
bool SndAttn(RerrMsg &emsg)
FIXME_docs.
static const uint16_t kRbaddr_RLID1
rlink core reg RLID1
void SetLogBaseAddr(uint32_t base)
FIXME_docs.
uint32_t LogBaseAddr() const
FIXME_docs.
void HandleUnsolicitedData()
Handle unsolicited data from port.
uint16_t fAttnNotiPatt
attn notifier pattern
bool AddrMapInsert(const std::string &name, uint16_t addr)
FIXME_docs.
bool AddrMapErase(const std::string &name)
FIXME_docs.
RlinkPacketBufSnd fSndPkt
send packet buffer
static const uint16_t kSBCNTL_V_RLMON
SBCNTL: rlmon enable bit.
uint32_t SysId() const
FIXME_docs.
uint32_t fTraceLevel
trace 0=off,1=buf,2=char
uint32_t fDumpLevel
dump 0=off,1=err,2=chk,3=all
void SetLogBaseStat(uint32_t base)
FIXME_docs.
bool ServerActiveInside() const
Indicates whether server is active and caller is inside server thread.
static const uint16_t kRbufBlkDelta
rbuf needed for rblk or wblk
RlinkPort::port_uptr_t fupPort
uptr to port
bool Exec(RlinkCommandList &clist, RerrMsg &emsg)
FIXME_docs.
uint32_t fLogBaseData
log: base for data
Rtime fTimeout
response timeout
bool LinkInit(RerrMsg &emsg)
FIXME_docs.
@ kStatNInit
init commands
@ kStatNErrCrc
decode: crc mismatch
@ kStatNWblk
wblk commands
@ kStatNExecPart
ExecPart() calls.
@ kStatNErrMiss
decode: missing data
@ kStatNSndOob
SndOob() calls.
@ kStatNErrLen
decode: length mismatch
@ kStatNAttn
attn commands
@ kStatNChkData
expect data failed
@ kStatNExpStat
expect for stat explicit
@ kStatNNoExpStat
no expect for stat
@ kStatNExpDone
expect for done defined
@ kStatNErrCmd
decode: command mismatch
@ kStatNErrNak
decode: nak seen
@ kStatNExpData
expect for data defined
@ kStatNRblkWord
words rcvd with rblk
@ kStatNChkDone
expect done failed
@ kStatNCmd
commands executed
@ kStatNWreg
wreg commands
@ kStatNExec
Exec() calls.
@ kStatNLabo
labo commands
@ kStatNRreg
rreg commands
@ kStatNChkStat
expect stat failed
@ kStatNRblk
rblk commands
@ kStatNWblkWord
words send with wblk
uint32_t fUsrAcc
USR_ACCESS of connected device.
bool ServerActive() const
Indicates whether server is active.
Rstats & RcvStats()
FIXME_docs.
uint32_t PrintLevel() const
FIXME_docs.
static const uint16_t kRLCNTL_M_AtoVal
RLCNTL: ato value.
size_t RbufSize() const
FIXME_docs.
bool fLinkInitDeferred
noinit attr seen on Open
void EncodeRequest(RlinkCommandList &clist, size_t ibeg, size_t iend)
FIXME_docs.
const Rtime & Timeout() const
FIXME_docs.
~RlinkConnect()
Destructor.
void ProcessUnsolicitedData()
Process data still pending in the input buffer.
static const uint16_t kRLSTAT_V_LCmd
RLSTAT: lcmd.
void SetDumpLevel(uint32_t lvl)
FIXME_docs.
void LogUseStream(std::ostream *pstr, const std::string &name="")
FIXME_docs.
uint8_t fSeqNumber[8]
command sequence number
RlogFile & LogFile() const
FIXME_docs.
bool try_lock()
FIXME_docs.
static const uint16_t kRLSTAT_M_BAbo
RLSTAT: babo.
uint32_t LogBaseStat() const
FIXME_docs.
static const uint16_t kRbufPrudentDelta
Rbuf space reserve.
void Print(std::ostream &os) const
FIXME_docs.
Rtime fTsLastAttnNoti
time stamp last attn notify
RlinkContext & Context()
FIXME_docs.
static const uint16_t kSBCNTL_V_RLBMON
SBCNTL: rlbmon enable bit.
RlinkConnect()
Default constructor.
bool SndOob(uint16_t addr, uint16_t data, RerrMsg &emsg)
FIXME_docs.
uint32_t fSysId
SYSID of connected device.
void ProcessAttnNotify()
Process attention notify packets.
static const uint16_t kRLSTAT_M_RBSize
RLSTAT: rbuf size.
bool ReadResponse(const Rtime &timeout, RerrMsg &emsg)
Read data from port until complete response packet seen.
void BadPort(const char *meth)
Port not connected or not open abort.
RlinkContext fContext
default context
static const uint16_t kSBCNTL_V_RBMON
SBCNTL: rbmon enable bit.
static const uint16_t kRbaddr_RLUA1
rlink opt. reg RLUA1
size_t BlockSizeMax() const
FIXME_docs.
bool IsOpen() const
FIXME_docs.
uint32_t DumpLevel() const
FIXME_docs.
static const uint16_t kRbaddr_RLID0
rlink core reg RLID0
RlinkPacketBufRcv fRcvPkt
receive packet buffer
uint32_t fLogBaseAddr
log: base for addr
RlinkServer * Server() const
FIXME_docs.
RlinkConnect(const RlinkConnect &)=delete
const std::shared_ptr< RlogFile > & LogFileSPtr() const
FIXME_docs.
static const uint16_t kRbaddr_RMBASE
rlink opt. rbd_rbmon
void SetLogBaseData(uint32_t base)
FIXME_docs.
bool ServerActiveOutside() const
Indicates whether server is active and caller is outside server thread.
bool ExecPart(RlinkCommandList &clist, size_t ibeg, size_t iend, RerrMsg &emsg)
FIXME_docs.
static const uint16_t kRbaddr_RLSTAT
rlink core reg RLSTAT
uint32_t TraceLevel() const
FIXME_docs.
RlinkConnect & operator=(const RlinkConnect &)=delete
Rstats & Stats()
FIXME_docs.
RlinkPort & Port()
FIXME_docs.
void SetPrintLevel(uint32_t lvl)
FIXME_docs.
uint32_t fPrintLevel
print 0=off,1=err,2=chk,3=all
bool HasPort() const
FIXME_docs.
void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
size_t BlockSizePrudent() const
FIXME_docs.
RlinkAddrMap fAddrMap
name<->address mapping
bool fHasRbmon
has rbd_rbmon (rbus monitor)
static const uint16_t kRLCNTL_M_AtoEna
RLCNTL: ato enable.
uint32_t fLogBaseStat
log: base for stat
bool HasRbmon() const
FIXME_docs.
uint32_t UsrAcc() const
FIXME_docs.
RlinkServer * fpServ
ptr to server (optional)
size_t fRbufSize
Rbuf size (in bytes)
Rstats & SndStats()
FIXME_docs.
void SetServer(RlinkServer *pserv)
FIXME_docs.
void AcceptResponse()
Accept response packet received with ReadResponse().
const RlinkAddrMap & AddrMap() const
FIXME_docs.
static const uint16_t kRbaddr_RLUA0
rlink opt. reg RLUA0
bool fLinkInitDone
LinkInit done.
void SetTraceLevel(uint32_t lvl)
FIXME_docs.
int DecodeResponse(RlinkCommandList &clist, size_t ibeg, size_t iend)
FIXME_docs.
bool LinkInitDone() const
FIXME_docs.
bool Open(const std::string &name, RerrMsg &emsg)
FIXME_docs.
std::shared_ptr< RlogFile > fspLog
log file ptr
bool DecodeAttnNotify(uint16_t &apat)
Decodes an attention notify packet.
const std::string & LogFileName() const
FIXME_docs.
std::unique_ptr< RlinkPort > port_uptr_t
Declaration of class ReventLoop.