F´ Flight Software - C/C++ Documentation  NASA-v1.6.0
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Deframer.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title Deframer.hpp
3 // \author mstarch, bocchino
4 // \brief hpp file for Deframer component implementation class
5 //
6 // \copyright
7 // Copyright 2009-2022, by the California Institute of Technology.
8 // ALL RIGHTS RESERVED. United States Government Sponsorship
9 // acknowledged.
10 //
11 // ======================================================================
12 
13 #ifndef Svc_Deframer_HPP
14 #define Svc_Deframer_HPP
15 
16 #include "Svc/Deframer/DeframerComponentAc.hpp"
20 #include "config/DeframerCfg.hpp"
21 
22 namespace Svc {
23 
37 class Deframer :
38  public DeframerComponentBase,
40 {
41  public:
42 
43  // ----------------------------------------------------------------------
44  // Construction, initialization, and destruction
45  // ----------------------------------------------------------------------
46 
48  Deframer(
49  const char* const compName
50  );
51 
53  void init(
54  const NATIVE_INT_TYPE instance = 0
55  );
56 
58  ~Deframer();
59 
61  void setup(
62  DeframingProtocol& protocol
63  );
64 
65  PRIVATE:
66 
67  // ----------------------------------------------------------------------
68  // Handler implementations for user-defined typed input ports
69  // ----------------------------------------------------------------------
70 
72  void cmdResponseIn_handler(
73  NATIVE_INT_TYPE portNum,
74  FwOpcodeType opcode,
75  U32 cmdSeq,
76  const Fw::CmdResponse& response
77  );
78 
80  void framedIn_handler(
81  const NATIVE_INT_TYPE portNum,
82  Fw::Buffer& recvBuffer,
83  const Drv::RecvStatus& recvStatus
84  );
85 
87  void schedIn_handler(
88  const NATIVE_INT_TYPE portNum,
89  NATIVE_UINT_TYPE context
90  );
91 
92  // ----------------------------------------------------------------------
93  // Implementation of DeframingProtocolInterface
94  // ----------------------------------------------------------------------
95 
98  void route(
99  Fw::Buffer& packetBuffer
100  );
101 
105  Fw::Buffer allocate(
106  const U32 size
107  );
108 
109  // ----------------------------------------------------------------------
110  // Helper methods
111  // ----------------------------------------------------------------------
112 
115  void processBuffer(
116  Fw::Buffer& buffer
117  );
118 
120  void processRing();
121 
122  // ----------------------------------------------------------------------
123  // Member variables
124  // ----------------------------------------------------------------------
125 
127  DeframingProtocol* m_protocol;
128 
130  Types::CircularBuffer m_inRing;
131 
133  U8 m_ringBuffer[DeframerCfg::RING_BUFFER_SIZE];
134 
136  U8 m_pollBuffer[DeframerCfg::POLL_BUFFER_SIZE];
137 
138 };
139 
140 } // end namespace Svc
141 
142 #endif
Svc::DeframingProtocolInterface
interface supplied to the deframing protocol
Definition: DeframingProtocolInterface.hpp:29
U8
uint8_t U8
8-bit unsigned integer
Definition: BasicTypes.hpp:73
DeframingProtocol.hpp
NATIVE_UINT_TYPE
unsigned int NATIVE_UINT_TYPE
native unsigned integer type declaration
Definition: BasicTypes.hpp:28
Svc::Deframer::Deframer
Deframer(const char *const compName)
Construct Deframer instance.
Definition: Deframer.cpp:39
Fw::Buffer
Definition: Buffer.hpp:43
NATIVE_INT_TYPE
int NATIVE_INT_TYPE
native integer type declaration
Definition: BasicTypes.hpp:27
DeframerCfg.hpp
CircularBuffer.hpp
FwOpcodeType
#define FwOpcodeType
Type representation for a command opcode.
Definition: FpConfig.hpp:62
DeframingProtocolInterface.hpp
Svc::Deframer::setup
void setup(DeframingProtocol &protocol)
Set up the instance.
Definition: Deframer.cpp:54
Svc::Deframer::~Deframer
~Deframer()
Destroy Deframer instance.
Definition: Deframer.cpp:52
Svc
Definition: ActiveRateGroupCfg.hpp:18
Svc::DeframingProtocol
Abstract base class representing a deframing protocol.
Definition: DeframingProtocol.hpp:33
Svc::Deframer
Generic deframing component using DeframingProtocol implementation for actual deframing.
Definition: Deframer.hpp:37
Types::CircularBuffer
Definition: CircularBuffer.hpp:28
Svc::DeframerCfg::RING_BUFFER_SIZE
static const U32 RING_BUFFER_SIZE
The size of the circular buffer in bytes.
Definition: DeframerCfg.hpp:15
Svc::DeframerCfg::POLL_BUFFER_SIZE
static const U32 POLL_BUFFER_SIZE
The size of the polling buffer in bytes.
Definition: DeframerCfg.hpp:17
Svc::Deframer::init
void init(const NATIVE_INT_TYPE instance=0)
Initialize Deframer instance.
Definition: Deframer.cpp:48