w11 - cpp 0.794
Backend server for Rlink and w11
Loading...
Searching...
No Matches
RlinkPacketBufSnd.ipp
Go to the documentation of this file.
1// $Id: RlinkPacketBufSnd.ipp 1186 2019-07-12 17:49:59Z mueller $
2// SPDX-License-Identifier: GPL-3.0-or-later
3// Copyright 2014-2015 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4//
5// Revision History:
6// Date Rev Version Comment
7// 2015-04-11 666 1.1 handle xon/xoff escaping, add (Set)XonEscape()
8// 2014-11-08 602 1.0 Initial version
9// 2014-11-02 600 0.1 First draft (re-organize PacketBuf for rlink v4)
10// ---------------------------------------------------------------------------
11
16// all method definitions in namespace Retro
17namespace Retro {
18
19//------------------------------------------+-----------------------------------
21
22inline void RlinkPacketBufSnd::PutWithCrc(uint8_t data)
23{
24 fPktBuf.push_back(data);
25 fCrc.AddData(data);
26 return;
27}
28
29//------------------------------------------+-----------------------------------
31
33{
34 fXonEscape = xon;
35 return;
36}
37
38//------------------------------------------+-----------------------------------
40
42{
43 return fXonEscape;
44}
45
46//------------------------------------------+-----------------------------------
48
49inline void RlinkPacketBufSnd::PutWithCrc(uint16_t data)
50{
51 uint8_t datl = data & 0xff;
52 uint8_t dath = (data>>8) & 0xff;
53 fPktBuf.push_back(datl);
54 fPktBuf.push_back(dath);
55 fCrc.AddData(datl);
56 fCrc.AddData(dath);
57 return;
58}
59
60//------------------------------------------+-----------------------------------
62
64{
65 uint16_t data = fCrc.Crc();
66 uint8_t datl = data & 0xff;
67 uint8_t dath = (data>>8) & 0xff;
68 fPktBuf.push_back(datl);
69 fPktBuf.push_back(dath);
70 return;
71}
72
73//------------------------------------------+-----------------------------------
75
76inline void RlinkPacketBufSnd::PutRawEsc(uint8_t ec)
77{
78 fRawBuf.push_back(kSymEsc);
79 uint8_t ed = kSymEdPref | ((~ec)&0x7)<<3 | ec;
80 fRawBuf.push_back(ed);
81 return;
82}
83
84//------------------------------------------+-----------------------------------
86
87inline size_t RlinkPacketBufSnd::RawSize() const
88{
89 return fRawBuf.size();
90}
91
92} // end namespace Retro
uint16_t Crc() const
FIXME_docs.
Definition: RlinkCrc16.ipp:48
void AddData(uint8_t data)
FIXME_docs.
Definition: RlinkCrc16.ipp:38
bool fXonEscape
escape XON/XOFF
std::vector< uint8_t > fRawBuf
raw data buffer
void PutWithCrc(uint8_t data)
FIXME_docs.
size_t RawSize() const
FIXME_docs.
void SetXonEscape(bool xon)
FIXME_docs.
void PutRawEsc(uint8_t ec)
FIXME_docs.
bool XonEscape() const
FIXME_docs.
static const uint8_t kSymEsc
VHDL def escape 1100 1010.
RlinkCrc16 fCrc
crc accumulator
std::vector< uint8_t > fPktBuf
packet buffer
static const uint8_t kSymEdPref
VHDL def ed_pref 0100 0000.
Declaration of class ReventLoop.
Definition: ReventLoop.cpp:47