97 fExpectStatusSet(false),
99 fExpectStatusMsk(0x0),
107 : fRequest(rhs.fRequest),
108 fAddress(rhs.fAddress),
111 fpBlockExt(rhs.fpBlockExt),
112 fBlockExtSize(rhs.fBlockExtSize),
113 fBlockDone(rhs.fBlockDone),
114 fStatus(rhs.fStatus),
116 fRcvSize(rhs.fRcvSize),
117 fExpectStatusSet(rhs.fExpectStatusSet),
118 fExpectStatusVal(rhs.fExpectStatusVal),
119 fExpectStatusMsk(rhs.fExpectStatusMsk),
185 throw Rexception(
"RlinkCommand::SetCommand()",
"Bad args: invalid cmd");
213 if (block.size() == 0 || block.size() > 65535)
214 throw Rexception(
"RlinkCommand::SetBlockWrite()",
215 "Bad args: invalid block size");
228 if (block.size() == 0 || block.size() > 65535)
229 throw Rexception(
"RlinkCommand::SetBlockWrite()",
230 "Bad args: invalid block size");
243 if (size == 0 || size > 65535)
244 throw Rexception(
"RlinkCommand::SetBlockRead()",
245 "Bad args: invalid block size");
259 if (pblock ==
nullptr)
260 throw Rexception(
"RlinkCommand::SetBlockExt()",
261 "Bad args: pblock is null");
262 if (size == 0 || size > 65535)
263 throw Rexception(
"RlinkCommand::SetBlockExt()",
264 "Bad args: invalid block size");
285 size_t dbase,
size_t sbase)
const
319 os <<
" CANCELED" << endl;
334 if (
Expect().DataMask() != 0xffff) {
337 }
else if (
Expect().DataIsChecked()) {
356 }
else if (
Expect().DoneIsChecked()) {
395 size_t dwidth = (dbase==2) ? 16 : ((dbase==8) ? 6 : 4);
399 size_t ncol = (80-4-5)/(dwidth+2);
404 for (
size_t i=0; i<size; i++) {
405 if (i%ncol == 0) os <<
"\n " <<
RosPrintf(i,
"d",4) <<
": ";
408 if (!
Expect().BlockCheck(i, pdat[i])) {
422 for (
size_t i=0; i<size; i++) {
423 if (!
Expect().BlockCheck(i, pdat[i])) {
424 os <<
"\n FAIL d[" <<
RosPrintf(i,
"d",4) <<
"]: "
427 if (i < emskvec.size() && emskvec[i]!=0xffff) {
438 size_t ncol = (80-4-5)/(dwidth+2);
439 for (
size_t i=0; i<size; i++) {
440 if (i%ncol == 0) os <<
"\n " <<
RosPrintf(i,
"d",4) <<
": ";
524 os << bl << (text?text:
"--") <<
"RlinkCommand @ " <<
this << endl;
532 os << bl <<
" fBlock.size: " <<
RosPrintf(
fBlock.size(),
"d",4) << endl;
533 os << bl <<
" fpBlockExt: " <<
fpBlockExt << endl;
541 size_t ncol = max(1, (80-ind-4-5)/(4+1));
542 os << bl <<
" block data:";
544 if (i%ncol == 0) os <<
"\n" << bl <<
" " <<
RosPrintf(i,
"d",4) <<
": ";
562 static const char* cmdname[8] = {
"rreg",
"rblk",
"wreg",
"wblk",
563 "labo",
"attn",
"init",
"????"};
565 return cmdname[cmd&0x7];
596 if (&rhs ==
this)
return *
this;
size_t MaxNameLength() const
FIXME_docs.
bool Find(const std::string &name, uint16_t &addr) const
FIXME_docs.
const std::vector< uint16_t > & BlockValue() const
FIXME_docs.
const std::vector< uint16_t > & BlockMask() const
FIXME_docs.
bool BlockIsChecked(size_t ind) const
FIXME_docs.
void SetCommand(uint8_t cmd, uint16_t addr=0, uint16_t data=0)
FIXME_docs.
void SetExpect(exp_uptr_t &&upexp)
FIXME_docs.
static const uint8_t kStat_B_Stat
RlinkCommand()
Default constructor.
static const uint32_t kFlagPktEnd
command last in packet
static const uint8_t kCmdInit
command code send initialize
uint8_t fExpectStatusVal
status value
void SetBlockExt(uint16_t *pblock, size_t size)
FIXME_docs.
static const uint32_t kFlagSend
command send
~RlinkCommand()
Destructor.
uint8_t Request() const
FIXME_docs.
static const uint8_t kCmdRblk
command code read block
uint8_t fExpectStatusMsk
status mask
void SetBlockRead(size_t size)
FIXME_docs.
static const uint32_t kFlagChkStat
stat expect check failed
uint8_t fStatus
rlink command status
size_t fBlockDone
valid transfer count
bool TestFlagAny(uint32_t mask) const
FIXME_docs.
static const uint8_t kStat_M_RbErr
stat: rberr flag set
uint8_t SeqNumber() const
FIXME_docs.
static const char * CommandName(uint8_t cmd)
FIXME_docs.
size_t fBlockExtSize
transfer size if data external
void CmdRblk(uint16_t addr, size_t size)
FIXME_docs.
bool ExpectStatusSet() const
FIXME_docs.
void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
uint8_t fRequest
rlink request (cmd+seqnum)
bool StatusIsChecked() const
FIXME_docs.
bool fExpectStatusSet
stat chk set explicitely
void Print(std::ostream &os, const RlinkAddrMap *pamap=0, size_t abase=16, size_t dbase=16, size_t sbase=16) const
FIXME_docs.
static const uint32_t kFlagErrNak
error: nak abort
static const uint8_t kStat_M_RbNak
stat: rbnak flag set
uint16_t fAddress
rbus address
static const uint8_t kStat_M_Attn
stat: attn flag set
static const uint8_t kStat_M_RbTout
stat: rbtout flag set
static const uint32_t kFlagDone
command done
RlinkCommand & operator=(const RlinkCommand &rhs)
FIXME_docs.
static const uint32_t kFlagLabo
command labo'ed
uint8_t Command() const
FIXME_docs.
uint16_t * fpBlockExt
external data for blk commands
size_t BlockSize() const
FIXME_docs.
static const uint8_t kCmdRreg
command code read register
static const uint32_t kFlagChkDone
done expect check failed
std::vector< uint16_t > fBlock
data vector for blk commands
static const uint8_t kStat_V_Stat
static const uint8_t kCmdWreg
command code write register
static const uint32_t kFlagPktBeg
command first in packet
void CmdWblk(uint16_t addr, const std::vector< uint16_t > &block)
FIXME_docs.
void SetAddress(uint16_t addr)
FIXME_docs.
static const RflagName * FlagNames()
FIXME_docs.
size_t BlockDone() const
FIXME_docs.
static const uint32_t kFlagErrDec
error: decode error
bool HasExpect() const
FIXME_docs.
exp_uptr_t fupExpect
pointer to expect container
size_t fRcvSize
receive size for command
static const uint8_t kStat_M_Stat
stat: external stat bits
static const uint32_t kFlagChkData
data expect check failed
static const uint8_t kCmdAttn
command code get attention
std::unique_ptr< RlinkCommandExpect > exp_uptr_t
static const uint8_t kCmdLabo
command code list abort
const RlinkCommandExpect & Expect() const
FIXME_docs.
void SetBlockWrite(const std::vector< uint16_t > &block)
FIXME_docs.
std::string CommandInfo() const
FIXME_docs.
uint16_t * BlockPointer()
FIXME_docs.
uint32_t fFlags
state bits
static const uint32_t kFlagInit
cmd,addr,data setup
static const uint8_t kCmdWblk
command code write block
I/O appicator to generate fill characters.
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.