OpenCores
URL https://opencores.org/ocsvn/w11/w11/trunk

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.7/] [tools/] [src/] [librlink/] [RlinkPacketBufSnd.hpp] - Blame information for rev 33

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 wfjm
// $Id: RlinkPacketBufSnd.hpp 666 2015-04-12 21:17:54Z mueller $
2 27 wfjm
//
3 30 wfjm
// Copyright 2014-2015 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4 27 wfjm
//
5
// This program is free software; you may redistribute and/or modify it under
6
// the terms of the GNU General Public License as published by the Free
7
// Software Foundation, either version 2, or at your option any later version.
8
//
9
// This program is distributed in the hope that it will be useful, but
10
// WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
// or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
// for complete details.
13
// 
14
// Revision History: 
15
// Date         Rev Version  Comment
16 30 wfjm
// 2015-04-11   666   1.1    handle xon/xoff escaping, add (Set)XonEscape()
17 28 wfjm
// 2014-12-25   621   1.0.1  Reorganize packet send/revd stats
18 27 wfjm
// 2014-11-14   604   1.0    Initial version
19
// 2014-11-02   600   0.1    First draft (re-organize PacketBuf for rlink v4)
20
// ---------------------------------------------------------------------------
21
 
22
 
23
/*!
24
  \file
25 30 wfjm
  \version $Id: RlinkPacketBufSnd.hpp 666 2015-04-12 21:17:54Z mueller $
26 27 wfjm
  \brief   Declaration of class RlinkPacketBufSnd.
27
*/
28
 
29
#ifndef included_Retro_RlinkPacketBufSnd
30
#define included_Retro_RlinkPacketBufSnd
31
 
32
#include "RlinkPacketBuf.hpp"
33
#include "RlinkPort.hpp"
34
 
35
namespace Retro {
36
 
37
  class RlinkPacketBufSnd : public RlinkPacketBuf {
38
    public:
39
 
40
                    RlinkPacketBufSnd();
41
                    ~RlinkPacketBufSnd();
42
 
43 30 wfjm
      void          SetXonEscape(bool xon);
44
      bool          XonEscape() const;
45
 
46 27 wfjm
      void          Init();
47
 
48
      void          PutWithCrc(uint8_t data);
49
      void          PutWithCrc(uint16_t data);
50
      void          PutWithCrc(const uint16_t* pdata, size_t count);
51
      void          PutCrc();
52
 
53
      void          PutRawEsc(uint8_t ec);
54
 
55
      bool          SndPacket(RlinkPort* port, RerrMsg& emsg);
56
      bool          SndOob(RlinkPort* port, uint16_t addr, uint16_t data,
57
                           RerrMsg& emsg);
58
      bool          SndKeep(RlinkPort* port, RerrMsg& emsg);
59
      bool          SndAttn(RlinkPort* port, RerrMsg& emsg);
60
      bool          SndNak(RlinkPort* port, RerrMsg& emsg);
61
      bool          SndUnJam(RlinkPort* port, RerrMsg& emsg);
62
 
63
      size_t        RawSize() const;
64
 
65
      void          Dump(std::ostream& os, int ind=0, const char* text=0) const;
66
 
67
   // statistics counter indices
68
      enum stats {
69 28 wfjm
        kStatNTxPktByt=0,                   //!< Tx packet bytes send
70 30 wfjm
        kStatNTxEsc,                        //!< Tx esc escapes
71
        kStatNTxXEsc                        //!< Tx xon escapes
72 27 wfjm
      };
73
 
74
    protected:
75
      bool          SndRaw(RlinkPort* port, RerrMsg& emsg);
76
 
77
    protected:
78 30 wfjm
      bool          fXonEscape;             //!< escape XON/XOFF
79 27 wfjm
      std::vector<uint8_t> fRawBuf;         //!< raw data buffer
80
  };
81
 
82
} // end namespace Retro
83
 
84
#include "RlinkPacketBufSnd.ipp"
85
 
86
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.