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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.74/] [tools/] [src/] [librlink/] [RlinkPacketBufRcv.ipp] - Blame information for rev 38

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 wfjm
// $Id: RlinkPacketBufRcv.ipp 606 2014-11-24 07:08:51Z mueller $
2
//
3
// Copyright 2014- by Walter F.J. Mueller 
4
//
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
// 2014-11-23   606   1.0    Initial version
17
// 2014-11-02   600   0.1    First draft (re-organize PacketBuf for rlink v4)
18
// ---------------------------------------------------------------------------
19
 
20
/*!
21
  \file
22
  \version $Id: RlinkPacketBufRcv.ipp 606 2014-11-24 07:08:51Z mueller $
23
  \brief   Implemenation (inline) of class RlinkPacketBuf.
24
*/
25
 
26
// all method definitions in namespace Retro
27
namespace Retro {
28
 
29
//------------------------------------------+-----------------------------------
30
//! FIXME_docs
31
 
32
inline bool RlinkPacketBufRcv::CheckSize(size_t nbyte) const
33
{
34
  return fPktBuf.size()-fNDone >= nbyte;
35
}
36
 
37
//------------------------------------------+-----------------------------------
38
//! FIXME_docs
39
 
40
inline void RlinkPacketBufRcv::GetWithCrc(uint8_t& data)
41
{
42
  data = fPktBuf[fNDone++];
43
  fCrc.AddData(data);
44
}
45
 
46
//------------------------------------------+-----------------------------------
47
//! FIXME_docs
48
 
49
inline void RlinkPacketBufRcv::GetWithCrc(uint16_t& data)
50
{
51
  uint8_t datl = fPktBuf[fNDone++];
52
  uint8_t dath = fPktBuf[fNDone++];
53
  fCrc.AddData(datl);
54
  fCrc.AddData(dath);
55
  data = uint16_t(datl) | (uint16_t(dath) << 8);
56
}
57
 
58
//------------------------------------------+-----------------------------------
59
//! FIXME_docs
60
 
61
inline bool RlinkPacketBufRcv::CheckCrc()
62
{
63
  uint8_t  datl = fPktBuf[fNDone++];
64
  uint8_t  dath = fPktBuf[fNDone++];
65
  uint16_t data = uint16_t(datl) | (uint16_t(dath) << 8);
66
  return data == fCrc.Crc();
67
}
68
 
69
//------------------------------------------+-----------------------------------
70
//! FIXME_docs
71
 
72
inline int RlinkPacketBufRcv::NakIndex() const
73
{
74
  return fNakIndex;
75
}
76
 
77
} // end namespace Retro

powered by: WebSVN 2.1.0

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