F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
TmFramer.hpp
Go to the documentation of this file.
1
// ======================================================================
2
// \title TmFramer.hpp
3
// \author thomas-bc
4
// \brief hpp file for TmFramer component implementation class
5
// ======================================================================
6
7
#ifndef Svc_CCSDS_TmFramer_HPP
8
#define Svc_CCSDS_TmFramer_HPP
9
10
#include "
Svc/CCSDS/TmFramer/TmFramerComponentAc.hpp
"
11
#include "
Svc/CCSDS/Types/FppConstantsAc.hpp
"
12
#include "
Svc/CCSDS/Types/SpacePacketHeaderSerializableAc.hpp
"
13
#include "
Svc/CCSDS/Types/TMHeaderSerializableAc.hpp
"
14
#include "
Svc/CCSDS/Types/TMTrailerSerializableAc.hpp
"
15
16
namespace
Svc
{
17
18
namespace
CCSDS {
19
20
class
TmFramer
final :
public
TmFramerComponentBase
{
21
friend
class
TmFramerTester
;
22
23
static_assert(
ComCfg::TmFrameFixedSize
>
TMHeader::SERIALIZED_SIZE
+
TMTrailer::SERIALIZED_SIZE
,
24
"TM Frame Fixed Size must be at least large enough to hold header, trailer and data"
);
25
// These are to ensure the frame can hold the packet buffer, its SP header and an idle packet of 1 byte
26
// This is because TM specifies a frame to be padded with an idle packet of at least 1 byte of idle data
27
static_assert(
28
ComCfg::TmFrameFixedSize
>=
FW_COM_BUFFER_MAX_SIZE
+ (2 *
SpacePacketHeader::SERIALIZED_SIZE
) + 1,
29
"TM Frame Fixed Size must be at least large enough to hold a full com buffer, 2 SP headers and 1 byte"
);
30
static_assert(
31
ComCfg::TmFrameFixedSize
>=
FW_FILE_BUFFER_MAX_SIZE
+ (2 *
SpacePacketHeader::SERIALIZED_SIZE
) + 1,
32
"TM Frame Fixed Size must be at least large enough to hold a full com buffer, 2 SP headers and 1 byte"
);
33
34
static
constexpr
U8
IDLE_DATA_PATTERN = 0x44;
35
36
enum class
BufferOwnershipState {
37
NOT_OWNED,
38
OWNED,
39
};
40
41
public
:
42
// ----------------------------------------------------------------------
43
// Component construction and destruction
44
// ----------------------------------------------------------------------
45
47
TmFramer
(
const
char
*
const
compName
48
);
49
51
~TmFramer
();
52
53
private
:
54
// ----------------------------------------------------------------------
55
// Handler implementations for typed input ports
56
// ----------------------------------------------------------------------
57
62
void
comStatusIn_handler(
FwIndexType
portNum,
63
Fw::Success
& condition
64
)
override
;
65
72
void
dataIn_handler(
FwIndexType
portNum,
73
Fw::Buffer
& data,
74
const
ComCfg::FrameContext
& context)
override
;
75
79
void
dataReturnIn_handler(
FwIndexType
portNum,
80
Fw::Buffer
& data,
81
const
ComCfg::FrameContext
& context)
override
;
82
83
// ----------------------------------------------------------------------
84
// Helpers
85
// ----------------------------------------------------------------------
86
private
:
90
void
fill_with_idle_packet(
Fw::SerializeBufferBase
& serializer);
91
92
// ----------------------------------------------------------------------
93
// Members
94
// ----------------------------------------------------------------------
95
private
:
96
// Because the TM protocol use fixed width frames, and only one frame is in transit between ComQueue and
97
// ComInterface at a time, we can use a member fixed-size buffer to hold the frame data
98
U8
m_frameBuffer[
ComCfg::TmFrameFixedSize
];
99
BufferOwnershipState m_bufferState = BufferOwnershipState::OWNED;
100
101
// Current implementation uses a single virtual channel, so we can use a single virtual frame count
102
U8
m_masterFrameCount;
103
U8
m_virtualFrameCount;
104
};
105
106
}
// namespace CCSDS
107
}
// namespace Svc
108
109
#endif
TmFramerComponentAc.hpp
SpacePacketHeaderSerializableAc.hpp
Svc::CCSDS::TmFramer
Definition:
TmFramer.hpp:20
Svc::CCSDS::TMHeader::SERIALIZED_SIZE
The size of the serial representation.
Definition:
TMHeaderSerializableAc.hpp:32
Svc::CCSDS::TmFramer::~TmFramer
~TmFramer()
Destroy TmFramer object.
Definition:
TmFramer.cpp:22
TMTrailerSerializableAc.hpp
Fw::SerializeBufferBase
Definition:
Serializable.hpp:54
Svc::CCSDS::TmFramer::TmFramerTester
friend class TmFramerTester
Definition:
TmFramer.hpp:21
Svc::CCSDS::TMTrailer::SERIALIZED_SIZE
The size of the serial representation.
Definition:
TMTrailerSerializableAc.hpp:32
FW_COM_BUFFER_MAX_SIZE
#define FW_COM_BUFFER_MAX_SIZE
Definition:
FpConfig.h:182
ComCfg::TmFrameFixedSize
Definition:
FppConstantsAc.hpp:142
U8
uint8_t U8
8-bit unsigned integer
Definition:
BasicTypes.h:56
TMHeaderSerializableAc.hpp
FwIndexType
PlatformIndexType FwIndexType
Definition:
FwIndexTypeAliasAc.h:15
ComCfg::FrameContext
Type used to pass context info between components during framing/deframing.
Definition:
FrameContextSerializableAc.hpp:20
Svc
RateGroupDivider component implementation.
Definition:
ActiveRateGroupCfg.hpp:18
Fw::Buffer
Definition:
Buffer.hpp:45
Svc::CCSDS::SpacePacketHeader::SERIALIZED_SIZE
The size of the serial representation.
Definition:
SpacePacketHeaderSerializableAc.hpp:32
Svc::CCSDS::TmFramerComponentBase
Auto-generated base for TmFramer component.
Definition:
TmFramerComponentAc.hpp:33
Svc::CCSDS::TmFramer::TmFramer
TmFramer(const char *const compName)
Construct TmFramer object.
Definition:
TmFramer.cpp:19
FW_FILE_BUFFER_MAX_SIZE
#define FW_FILE_BUFFER_MAX_SIZE
Max size of file buffer (i.e. chunk of file)
Definition:
FpConfig.h:249
Fw::Success
Success/Failure.
Definition:
SuccessEnumAc.hpp:17
FppConstantsAc.hpp
Svc
CCSDS
TmFramer
TmFramer.hpp
Generated by
1.8.14