w11 - cpp 0.794
Backend server for Rlink and w11
|
FIXME_docs. More...
#include <RlinkPacketBufRcv.hpp>
Public Types | |
enum | pkt_state { kPktPend =0 , kPktResp , kPktAttn , kPktError } |
enum | stats { kStatNRxPktByt =0 , kStatNRxDrop , kStatNRxSop , kStatNRxEop , kStatNRxNak , kStatNRxAttn , kStatNRxEsc , kStatNRxClobber , kStatNRxNakCcrc , kStatNRxNakDcrc , kStatNRxNakFrame , kStatNRxNakUnused , kStatNRxNakCmd , kStatNRxNakCnt , kStatNRxNakRtOvlf , kStatNRxNakRtWblk , kStatNRxNakInval } |
Public Member Functions | |
RlinkPacketBufRcv () | |
Default constructor. | |
~RlinkPacketBufRcv () | |
Destructor. | |
int | ReadData (RlinkPort &port, const Rtime &timeout, RerrMsg &emsg) |
FIXME_docs. | |
bool | ProcessData () |
FIXME_docs. | |
void | AcceptPacket () |
FIXME_docs. | |
void | FlushRaw () |
FIXME_docs. | |
pkt_state | PacketState () |
FIXME_docs. | |
bool | CheckNak () const |
FIXME_docs. | |
bool | CheckSize (size_t nbyte) const |
FIXME_docs. | |
void | GetWithCrc (uint8_t &data) |
FIXME_docs. | |
void | GetWithCrc (uint16_t &data) |
FIXME_docs. | |
void | GetWithCrc (uint16_t *pdata, size_t count) |
FIXME_docs. | |
bool | CheckCrc () |
FIXME_docs. | |
int | NakIndex () const |
FIXME_docs. | |
uint8_t | NakCode () const |
FIXME_docs. | |
void | Dump (std::ostream &os, int ind=0, const char *text=0, int detail=0) const |
FIXME_docs. | |
Public Member Functions inherited from Retro::RlinkPacketBuf | |
RlinkPacketBuf () | |
Default constructor. | |
~RlinkPacketBuf () | |
Destructor. | |
RlinkPacketBuf (const RlinkPacketBuf &)=delete | |
RlinkPacketBuf & | operator= (const RlinkPacketBuf &)=delete |
size_t | PktSize () const |
FIXME_docs. | |
uint32_t | Flags () const |
FIXME_docs. | |
bool | TestFlag (uint32_t mask) const |
FIXME_docs. | |
Rstats & | Stats () |
FIXME_docs. | |
void | Dump (std::ostream &os, int ind=0, const char *text=0, int detail=0) const |
FIXME_docs. | |
Protected Types | |
enum | rcv_state { kRcvIdle =0 , kRcvFill , kRcvDone , kRcvError } |
Protected Member Functions | |
void | ProcessDataIdle () |
FIXME_docs. | |
void | ProcessDataFill () |
FIXME_docs. | |
uint8_t | GetEcode () |
FIXME_docs. | |
Protected Member Functions inherited from Retro::RlinkPacketBuf | |
void | SetFlagBit (uint32_t mask) |
FIXME_docs. | |
void | ClearFlagBit (uint32_t mask) |
FIXME_docs. | |
Protected Attributes | |
uint8_t | fRawBuf [4096] |
raw data buffer | |
size_t | fRawBufSize |
size_t | fRawBufDone |
enum rcv_state | fRcvState |
receive FSM state | |
size_t | fNDone |
number of pkt bytes processed | |
bool | fEscSeen |
last char was Escape | |
int | fNakIndex |
index of active nak (-1 if no) | |
uint8_t | fNakCode |
code of active nak | |
std::vector< uint8_t > | fDropData |
dropped data buffer | |
Protected Attributes inherited from Retro::RlinkPacketBuf | |
std::vector< uint8_t > | fPktBuf |
packet buffer | |
RlinkCrc16 | fCrc |
crc accumulator | |
uint32_t | fFlags |
request/response flags | |
Rstats | fStats |
statistics | |
Additional Inherited Members | |
Static Public Attributes inherited from Retro::RlinkPacketBuf | |
static const uint32_t | kFlagSopSeen = 1<<0 |
sop was seen | |
static const uint32_t | kFlagEopSeen = 1<<1 |
eop was seen | |
static const uint32_t | kFlagNakSeen = 1<<2 |
nak was seen | |
static const uint32_t | kFlagAttnSeen = 1<<3 |
attn was seen | |
static const uint32_t | kFlagErrTout = 1<<16 |
err: timeout on read | |
static const uint32_t | kFlagErrIO = 1<<17 |
err: IO error on read | |
static const uint32_t | kFlagErrFrame = 1<<18 |
err: frame error | |
static const uint32_t | kFlagErrClobber = 1<<19 |
err: clobbered esc | |
static const uint8_t | kSymEsc = 0xCA |
VHDL def escape 1100 1010. | |
static const uint8_t | kSymFill = 0xD5 |
VHDL def fill 1101 0101. | |
static const uint8_t | kSymXon = 0x11 |
VHDL def xon 0001 0001. | |
static const uint8_t | kSymXoff = 0x13 |
VHDL def xoff 0001 0011. | |
static const uint8_t | kSymEdPref = 0x40 |
VHDL def ed_pref 0100 0000. | |
static const uint8_t | kEcSop = 0x00 |
VHDL def ec_sop 000. | |
static const uint8_t | kEcEop = 0x01 |
VHDL def ec_eop 001. | |
static const uint8_t | kEcNak = 0x02 |
VHDL def ec_nak 010. | |
static const uint8_t | kEcAttn = 0x03 |
VHDL def ec_attn 011. | |
static const uint8_t | kEcXon = 0x04 |
VHDL def ec_xon 100. | |
static const uint8_t | kEcXoff = 0x05 |
VHDL def ec_xoff 101. | |
static const uint8_t | kEcFill = 0x06 |
VHDL def ec_fill 110. | |
static const uint8_t | kEcEsc = 0x07 |
VHDL def ec_esc 111. | |
static const uint8_t | kEcClobber = 0xff |
invalid Ecode | |
static const uint8_t | kNcCcrc = 0x00 |
VHDL def nak_ccrc 000. | |
static const uint8_t | kNcDcrc = 0x01 |
VHDL def nak_dcrc 001. | |
static const uint8_t | kNcFrame = 0x02 |
VHDL def nak_frame 010. | |
static const uint8_t | kNcUnused = 0x03 |
VHDL def nak_unused 011. | |
static const uint8_t | kNcCmd = 0x04 |
VHDL def nak_cmd 100. | |
static const uint8_t | kNcCnt = 0x05 |
VHDL def nak_cnt 101. | |
static const uint8_t | kNcRtOvlf = 0x06 |
VHDL def nak_rtovfl 110. | |
static const uint8_t | kNcRtWblk = 0x07 |
VHDL def nak_rtwblk 111. | |
static const uint8_t | kNcInval = 0x08 |
invalid NAK | |
FIXME_docs.
Definition at line 29 of file RlinkPacketBufRcv.hpp.
Enumerator | |
---|---|
kPktPend | pending, still being filled |
kPktResp | response packet (SOP+EOP) |
kPktAttn | attn notify packet (ATTN+EOP) |
kPktError | erroneous packet |
Definition at line 41 of file RlinkPacketBufRcv.hpp.
Definition at line 63 of file RlinkPacketBufRcv.hpp.
|
protected |
Enumerator | |
---|---|
kRcvIdle | wait for SOP or ATTN |
kRcvFill | fill packet till EOP seen |
kRcvDone | packet ok, EOP seen |
kRcvError | packet framing error |
Definition at line 88 of file RlinkPacketBufRcv.hpp.
Retro::RlinkPacketBufRcv::RlinkPacketBufRcv | ( | ) |
Default constructor.
Definition at line 46 of file RlinkPacketBufRcv.cpp.
References Retro::Rstats::Define(), Retro::RlinkPacketBuf::fStats, kStatNRxAttn, kStatNRxClobber, kStatNRxDrop, kStatNRxEop, kStatNRxEsc, kStatNRxNak, kStatNRxNakCcrc, kStatNRxNakCmd, kStatNRxNakCnt, kStatNRxNakDcrc, kStatNRxNakFrame, kStatNRxNakInval, kStatNRxNakRtOvlf, kStatNRxNakRtWblk, kStatNRxNakUnused, kStatNRxPktByt, and kStatNRxSop.
Retro::RlinkPacketBufRcv::~RlinkPacketBufRcv | ( | ) |
Destructor.
Definition at line 79 of file RlinkPacketBufRcv.cpp.
FIXME_docs.
Definition at line 85 of file RlinkPacketBufRcv.cpp.
References fRawBuf, fRawBufDone, fRawBufSize, Retro::RerrMsg::Init(), Retro::Rtime::IsZero(), Retro::RlinkPort::kEof, Retro::RlinkPacketBuf::kFlagErrIO, Retro::RlinkPacketBuf::kFlagErrTout, Retro::RlinkPort::kTout, Retro::RlinkPort::Read(), and Retro::RlinkPacketBuf::SetFlagBit().
Referenced by Retro::RlinkConnect::HandleUnsolicitedData(), Retro::RlinkConnect::ReadResponse(), and Retro::RlinkConnect::WaitAttn().
bool Retro::RlinkPacketBufRcv::ProcessData | ( | ) |
FIXME_docs.
Definition at line 118 of file RlinkPacketBufRcv.cpp.
References fRawBufDone, fRawBufSize, fRcvState, kRcvFill, kRcvIdle, ProcessDataFill(), and ProcessDataIdle().
Referenced by Retro::RlinkConnect::ProcessUnsolicitedData(), Retro::RlinkConnect::ReadResponse(), and Retro::RlinkConnect::WaitAttn().
void Retro::RlinkPacketBufRcv::AcceptPacket | ( | ) |
FIXME_docs.
Definition at line 142 of file RlinkPacketBufRcv.cpp.
References Retro::RlinkCrc16::Clear(), Retro::RlinkPacketBuf::fCrc, fDropData, Retro::RlinkPacketBuf::fFlags, fNakCode, fNakIndex, fNDone, Retro::RlinkPacketBuf::fPktBuf, fRcvState, and kRcvIdle.
Referenced by Retro::RlinkConnect::AcceptResponse(), Retro::RlinkConnect::ProcessAttnNotify(), Retro::RlinkConnect::ProcessUnsolicitedData(), Retro::RlinkConnect::ReadResponse(), and Retro::RlinkConnect::WaitAttn().
void Retro::RlinkPacketBufRcv::FlushRaw | ( | ) |
FIXME_docs.
Definition at line 158 of file RlinkPacketBufRcv.cpp.
References fEscSeen, fRawBufDone, and fRawBufSize.
RlinkPacketBufRcv::pkt_state Retro::RlinkPacketBufRcv::PacketState | ( | ) |
FIXME_docs.
Definition at line 169 of file RlinkPacketBufRcv.cpp.
References fRcvState, Retro::RlinkPacketBuf::kFlagSopSeen, kPktAttn, kPktError, kPktPend, kPktResp, kRcvDone, kRcvFill, kRcvIdle, and Retro::RlinkPacketBuf::TestFlag().
Referenced by Retro::RlinkConnect::ProcessUnsolicitedData(), Retro::RlinkConnect::ReadResponse(), and Retro::RlinkConnect::WaitAttn().
|
inline |
FIXME_docs.
Definition at line 22 of file RlinkPacketBufRcv.ipp.
References fNakIndex, and fNDone.
Referenced by Retro::RlinkConnect::DecodeResponse().
|
inline |
FIXME_docs.
Definition at line 30 of file RlinkPacketBufRcv.ipp.
References fNDone, and Retro::RlinkPacketBuf::fPktBuf.
Referenced by Retro::RlinkConnect::DecodeAttnNotify(), and Retro::RlinkConnect::DecodeResponse().
|
inline |
FIXME_docs.
Definition at line 38 of file RlinkPacketBufRcv.ipp.
References Retro::RlinkCrc16::AddData(), Retro::RlinkPacketBuf::fCrc, fNDone, and Retro::RlinkPacketBuf::fPktBuf.
Referenced by Retro::RlinkConnect::DecodeAttnNotify(), Retro::RlinkConnect::DecodeResponse(), and GetWithCrc().
|
inline |
FIXME_docs.
Definition at line 47 of file RlinkPacketBufRcv.ipp.
References Retro::RlinkCrc16::AddData(), Retro::RlinkPacketBuf::fCrc, fNDone, and Retro::RlinkPacketBuf::fPktBuf.
void Retro::RlinkPacketBufRcv::GetWithCrc | ( | uint16_t * | pdata, |
size_t | count | ||
) |
|
inline |
FIXME_docs.
Definition at line 59 of file RlinkPacketBufRcv.ipp.
References Retro::RlinkCrc16::Crc(), Retro::RlinkPacketBuf::fCrc, fNDone, and Retro::RlinkPacketBuf::fPktBuf.
Referenced by Retro::RlinkConnect::DecodeAttnNotify(), and Retro::RlinkConnect::DecodeResponse().
|
inline |
|
inline |
FIXME_docs.
Definition at line 78 of file RlinkPacketBufRcv.ipp.
References fNakCode.
Referenced by Retro::RlinkConnect::DecodeResponse().
void Retro::RlinkPacketBufRcv::Dump | ( | std::ostream & | os, |
int | ind = 0 , |
||
const char * | text = 0 , |
||
int | detail = 0 |
||
) | const |
FIXME_docs.
Definition at line 189 of file RlinkPacketBufRcv.cpp.
References Retro::RlinkPacketBuf::Dump(), fDropData, fEscSeen, fNakCode, fNakIndex, fNDone, fRawBuf, fRawBufDone, fRawBufSize, fRcvState, and Retro::RosPrintf().
Referenced by Retro::RlinkConnect::Dump().
|
protected |
FIXME_docs.
Definition at line 221 of file RlinkPacketBufRcv.cpp.
References fDropData, fEscSeen, fRawBuf, fRawBufDone, fRawBufSize, fRcvState, Retro::RlinkPacketBuf::fStats, GetEcode(), Retro::Rstats::Inc(), Retro::RlinkPacketBuf::kEcAttn, Retro::RlinkPacketBuf::kEcSop, Retro::RlinkPacketBuf::kFlagAttnSeen, Retro::RlinkPacketBuf::kFlagSopSeen, kRcvFill, kStatNRxDrop, Retro::RlinkPacketBuf::kSymEsc, and Retro::RlinkPacketBuf::SetFlagBit().
Referenced by ProcessData().
|
protected |
FIXME_docs.
Definition at line 272 of file RlinkPacketBufRcv.cpp.
References fEscSeen, fNakCode, fNakIndex, Retro::RlinkPacketBuf::fPktBuf, fRawBuf, fRawBufDone, fRawBufSize, fRcvState, Retro::RlinkPacketBuf::fStats, GetEcode(), Retro::Rstats::Inc(), Retro::RlinkPacketBuf::kEcClobber, Retro::RlinkPacketBuf::kEcEop, Retro::RlinkPacketBuf::kEcEsc, Retro::RlinkPacketBuf::kEcFill, Retro::RlinkPacketBuf::kEcNak, Retro::RlinkPacketBuf::kEcXoff, Retro::RlinkPacketBuf::kEcXon, Retro::RlinkPacketBuf::kFlagAttnSeen, Retro::RlinkPacketBuf::kFlagEopSeen, Retro::RlinkPacketBuf::kFlagErrClobber, Retro::RlinkPacketBuf::kFlagErrFrame, Retro::RlinkPacketBuf::kFlagNakSeen, Retro::RlinkPacketBuf::kNcCcrc, Retro::RlinkPacketBuf::kNcCmd, Retro::RlinkPacketBuf::kNcCnt, Retro::RlinkPacketBuf::kNcDcrc, Retro::RlinkPacketBuf::kNcFrame, Retro::RlinkPacketBuf::kNcInval, Retro::RlinkPacketBuf::kNcRtOvlf, Retro::RlinkPacketBuf::kNcRtWblk, Retro::RlinkPacketBuf::kNcUnused, kRcvDone, kRcvError, kStatNRxNakCcrc, kStatNRxNakCmd, kStatNRxNakCnt, kStatNRxNakDcrc, kStatNRxNakFrame, kStatNRxNakInval, kStatNRxNakRtOvlf, kStatNRxNakRtWblk, kStatNRxNakUnused, kStatNRxPktByt, Retro::RlinkPacketBuf::kSymEsc, Retro::RlinkPacketBuf::kSymFill, Retro::RlinkPacketBuf::kSymXoff, Retro::RlinkPacketBuf::kSymXon, Retro::RlinkPacketBuf::PktSize(), Retro::RlinkPacketBuf::SetFlagBit(), and Retro::RlinkPacketBuf::TestFlag().
Referenced by ProcessData().
|
protected |
FIXME_docs.
Definition at line 360 of file RlinkPacketBufRcv.cpp.
References fEscSeen, fRawBuf, fRawBufDone, fRawBufSize, Retro::RlinkPacketBuf::fStats, Retro::Rstats::Inc(), Retro::RlinkPacketBuf::kEcAttn, Retro::RlinkPacketBuf::kEcClobber, Retro::RlinkPacketBuf::kEcEop, Retro::RlinkPacketBuf::kEcNak, Retro::RlinkPacketBuf::kEcSop, kStatNRxAttn, kStatNRxClobber, kStatNRxEop, kStatNRxEsc, kStatNRxNak, kStatNRxSop, and Retro::RlinkPacketBuf::kSymEdPref.
Referenced by ProcessDataFill(), and ProcessDataIdle().
|
protected |
raw data buffer
Definition at line 96 of file RlinkPacketBufRcv.hpp.
Referenced by Dump(), GetEcode(), ProcessDataFill(), ProcessDataIdle(), and ReadData().
|
protected |
Definition at line 97 of file RlinkPacketBufRcv.hpp.
Referenced by Dump(), FlushRaw(), GetEcode(), ProcessData(), ProcessDataFill(), ProcessDataIdle(), and ReadData().
|
protected |
Definition at line 98 of file RlinkPacketBufRcv.hpp.
Referenced by Dump(), FlushRaw(), GetEcode(), ProcessData(), ProcessDataFill(), ProcessDataIdle(), and ReadData().
|
protected |
receive FSM state
Definition at line 99 of file RlinkPacketBufRcv.hpp.
Referenced by AcceptPacket(), Dump(), PacketState(), ProcessData(), ProcessDataFill(), and ProcessDataIdle().
|
protected |
number of pkt bytes processed
Definition at line 100 of file RlinkPacketBufRcv.hpp.
Referenced by AcceptPacket(), CheckCrc(), CheckNak(), CheckSize(), Dump(), and GetWithCrc().
|
protected |
last char was Escape
Definition at line 101 of file RlinkPacketBufRcv.hpp.
Referenced by Dump(), FlushRaw(), GetEcode(), ProcessDataFill(), and ProcessDataIdle().
|
protected |
index of active nak (-1 if no)
Definition at line 102 of file RlinkPacketBufRcv.hpp.
Referenced by AcceptPacket(), CheckNak(), Dump(), NakIndex(), and ProcessDataFill().
|
protected |
code of active nak
Definition at line 103 of file RlinkPacketBufRcv.hpp.
Referenced by AcceptPacket(), Dump(), NakCode(), and ProcessDataFill().
|
protected |
dropped data buffer
Definition at line 104 of file RlinkPacketBufRcv.hpp.
Referenced by AcceptPacket(), Dump(), and ProcessDataIdle().