w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
Retro::RlinkPacketBufRcv Class Reference

FIXME_docs. More...

#include <RlinkPacketBufRcv.hpp>

Inheritance diagram for Retro::RlinkPacketBufRcv:
[legend]
Collaboration diagram for Retro::RlinkPacketBufRcv:
[legend]

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
 
RlinkPacketBufoperator= (const RlinkPacketBuf &)=delete
 
size_t PktSize () const
 FIXME_docs.
 
uint32_t Flags () const
 FIXME_docs.
 
bool TestFlag (uint32_t mask) const
 FIXME_docs.
 
RstatsStats ()
 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
 

Detailed Description

FIXME_docs.

Definition at line 29 of file RlinkPacketBufRcv.hpp.

Member Enumeration Documentation

◆ pkt_state

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.

◆ stats

Enumerator
kStatNRxPktByt 

Rx packet bytes rcvd.

kStatNRxDrop 

Rx bytes dropped.

kStatNRxSop 

Rx SOP commas seen.

kStatNRxEop 

Rx EOP commas seen.

kStatNRxNak 

Rx NAK commas seen.

kStatNRxAttn 

Rx ATTN commas seen.

kStatNRxEsc 

Rx data escapes.

kStatNRxClobber 

Rx clobbered escapes.

kStatNRxNakCcrc 

Rx NAK Ccrc seen.

kStatNRxNakDcrc 

Rx NAK Dcrc seen.

kStatNRxNakFrame 

Rx NAK Frame seen.

kStatNRxNakUnused 

Rx NAK Unused seen.

kStatNRxNakCmd 

Rx NAK Cmd seen.

kStatNRxNakCnt 

Rx NAK Cnt seen.

kStatNRxNakRtOvlf 

Rx NAK RtOvlf seen.

kStatNRxNakRtWblk 

Rx NAK RtWblk seen.

kStatNRxNakInval 

Rx NAK invalid seen.

Definition at line 63 of file RlinkPacketBufRcv.hpp.

◆ rcv_state

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.

Constructor & Destructor Documentation

◆ RlinkPacketBufRcv()

◆ ~RlinkPacketBufRcv()

Retro::RlinkPacketBufRcv::~RlinkPacketBufRcv ( )

Destructor.

Definition at line 79 of file RlinkPacketBufRcv.cpp.

Member Function Documentation

◆ ReadData()

◆ ProcessData()

◆ AcceptPacket()

◆ FlushRaw()

void Retro::RlinkPacketBufRcv::FlushRaw ( )

FIXME_docs.

Definition at line 158 of file RlinkPacketBufRcv.cpp.

References fEscSeen, fRawBufDone, and fRawBufSize.

◆ PacketState()

◆ CheckNak()

bool Retro::RlinkPacketBufRcv::CheckNak ( ) const
inline

FIXME_docs.

Definition at line 22 of file RlinkPacketBufRcv.ipp.

References fNakIndex, and fNDone.

Referenced by Retro::RlinkConnect::DecodeResponse().

◆ CheckSize()

bool Retro::RlinkPacketBufRcv::CheckSize ( size_t  nbyte) const
inline

◆ GetWithCrc() [1/3]

void Retro::RlinkPacketBufRcv::GetWithCrc ( uint8_t &  data)
inline

◆ GetWithCrc() [2/3]

void Retro::RlinkPacketBufRcv::GetWithCrc ( uint16_t &  data)
inline

◆ GetWithCrc() [3/3]

void Retro::RlinkPacketBufRcv::GetWithCrc ( uint16_t *  pdata,
size_t  count 
)

FIXME_docs.

Definition at line 179 of file RlinkPacketBufRcv.cpp.

References GetWithCrc().

◆ CheckCrc()

bool Retro::RlinkPacketBufRcv::CheckCrc ( )
inline

◆ NakIndex()

int Retro::RlinkPacketBufRcv::NakIndex ( ) const
inline

FIXME_docs.

Definition at line 70 of file RlinkPacketBufRcv.ipp.

References fNakIndex.

◆ NakCode()

uint8_t Retro::RlinkPacketBufRcv::NakCode ( ) const
inline

FIXME_docs.

Definition at line 78 of file RlinkPacketBufRcv.ipp.

References fNakCode.

Referenced by Retro::RlinkConnect::DecodeResponse().

◆ Dump()

void Retro::RlinkPacketBufRcv::Dump ( std::ostream &  os,
int  ind = 0,
const char *  text = 0,
int  detail = 0 
) const

◆ ProcessDataIdle()

◆ ProcessDataFill()

◆ GetEcode()

Member Data Documentation

◆ fRawBuf

uint8_t Retro::RlinkPacketBufRcv::fRawBuf[4096]
protected

raw data buffer

Definition at line 96 of file RlinkPacketBufRcv.hpp.

Referenced by Dump(), GetEcode(), ProcessDataFill(), ProcessDataIdle(), and ReadData().

◆ fRawBufSize

size_t Retro::RlinkPacketBufRcv::fRawBufSize
protected

of valid bytes in RawBuf

Definition at line 97 of file RlinkPacketBufRcv.hpp.

Referenced by Dump(), FlushRaw(), GetEcode(), ProcessData(), ProcessDataFill(), ProcessDataIdle(), and ReadData().

◆ fRawBufDone

size_t Retro::RlinkPacketBufRcv::fRawBufDone
protected

of processed bytes in RawBuf

Definition at line 98 of file RlinkPacketBufRcv.hpp.

Referenced by Dump(), FlushRaw(), GetEcode(), ProcessData(), ProcessDataFill(), ProcessDataIdle(), and ReadData().

◆ fRcvState

enum rcv_state Retro::RlinkPacketBufRcv::fRcvState
protected

receive FSM state

Definition at line 99 of file RlinkPacketBufRcv.hpp.

Referenced by AcceptPacket(), Dump(), PacketState(), ProcessData(), ProcessDataFill(), and ProcessDataIdle().

◆ fNDone

size_t Retro::RlinkPacketBufRcv::fNDone
protected

number of pkt bytes processed

Definition at line 100 of file RlinkPacketBufRcv.hpp.

Referenced by AcceptPacket(), CheckCrc(), CheckNak(), CheckSize(), Dump(), and GetWithCrc().

◆ fEscSeen

bool Retro::RlinkPacketBufRcv::fEscSeen
protected

last char was Escape

Definition at line 101 of file RlinkPacketBufRcv.hpp.

Referenced by Dump(), FlushRaw(), GetEcode(), ProcessDataFill(), and ProcessDataIdle().

◆ fNakIndex

int Retro::RlinkPacketBufRcv::fNakIndex
protected

index of active nak (-1 if no)

Definition at line 102 of file RlinkPacketBufRcv.hpp.

Referenced by AcceptPacket(), CheckNak(), Dump(), NakIndex(), and ProcessDataFill().

◆ fNakCode

uint8_t Retro::RlinkPacketBufRcv::fNakCode
protected

code of active nak

Definition at line 103 of file RlinkPacketBufRcv.hpp.

Referenced by AcceptPacket(), Dump(), NakCode(), and ProcessDataFill().

◆ fDropData

std::vector<uint8_t> Retro::RlinkPacketBufRcv::fDropData
protected

dropped data buffer

Definition at line 104 of file RlinkPacketBufRcv.hpp.

Referenced by AcceptPacket(), Dump(), and ProcessDataIdle().


The documentation for this class was generated from the following files: