Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split Deframer into FrameAccumulator Deframer and Router #3250

Open
wants to merge 53 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
7b65b2e
Split Router out of Deframer - initial implementation
thomas-bc Jun 7, 2024
4983004
Rename variable to packetBuffer and resolve conversion warnings
thomas-bc Jun 7, 2024
01e62e4
Add test cases for each incoming packet type
thomas-bc Jun 7, 2024
450a78a
Adjust comments and stuff
thomas-bc Jun 7, 2024
3774af5
Update Ref topology with Router
thomas-bc Jun 8, 2024
982db63
WIP - FrameAccumulator
LeStarch Jun 13, 2024
e5f1ba2
Add lightweight deframer
thomas-bc Jul 23, 2024
2192847
Working frame detector, accumulator, and fprime packet
LeStarch Jul 19, 2024
728a2a3
CCSDS implementation and better checksums
LeStarch Jul 19, 2024
cce1aeb
Fixing overly small start word to use SCID as well
LeStarch Jul 22, 2024
7c9486a
Fixing frame accumulator for new structure
LeStarch Jul 24, 2024
88eba2b
Minor cleanup to frame detectors
LeStarch Aug 22, 2024
3d6852e
Add CCSDS Deframers and F´ minimal deframer
thomas-bc Sep 25, 2024
7706122
Clean up comments
thomas-bc Sep 25, 2024
c7db8e4
Update Ref topology with Accumulator/Deframer/Router
thomas-bc Sep 25, 2024
251caa9
Update buffer manager
thomas-bc Sep 25, 2024
1acb643
Merge latest devel to get latest changes
thomas-bc Sep 25, 2024
44ad2ae
Upgrade Router.cpp to latest Fw::Logger
thomas-bc Sep 25, 2024
4b17736
Update RPI deployment to use FrameAccumulator/Router
thomas-bc Sep 25, 2024
e6458d3
Remove CCSDS Deframers
thomas-bc Sep 30, 2024
0da8df1
Merge branch 'devel' into preliminary-ccsds-work
thomas-bc Sep 30, 2024
6538397
Merge branch 'devel' into preliminary-ccsds-work
thomas-bc Jan 22, 2025
006f27e
Merge branch 'devel' into preliminary-ccsds-work
thomas-bc Jan 28, 2025
bcde1ee
Merge branch 'devel' into preliminary-ccsds-work
thomas-bc Jan 28, 2025
44f4292
Add first pass at UTs
thomas-bc Jan 31, 2025
13f8cd1
add buffer accumulation testing
thomas-bc Feb 1, 2025
e2b5426
start SDD and rename author
thomas-bc Feb 1, 2025
5c22baf
Fix static analysis warnings and add comments to UTs
thomas-bc Feb 3, 2025
82fcd9b
Spelling
thomas-bc Feb 3, 2025
9007b8e
Add FprimeFrameDetector UTs
thomas-bc Feb 3, 2025
78e1aad
Fix CI issue
thomas-bc Feb 3, 2025
5a5ba8a
Fix test component creation
thomas-bc Feb 4, 2025
99836d6
Add first pass at SDDs
thomas-bc Feb 4, 2025
76820e6
Rename FrameAccumulator allocation ports
thomas-bc Feb 4, 2025
e6edd7a
Add review comments
thomas-bc Feb 6, 2025
4562b8a
Merge branch 'devel' into preliminary-ccsds-work
thomas-bc Feb 11, 2025
8c2e259
Functional one-off detection
thomas-bc Feb 14, 2025
f93458b
Fix algorithms and rename Deframer to FprimeDeframer
thomas-bc Feb 19, 2025
892607d
Remove file
thomas-bc Feb 19, 2025
d21a591
Remove templated detectors
thomas-bc Feb 20, 2025
85fe64a
Improve test code
thomas-bc Feb 20, 2025
064be5b
Merge branch 'devel' into preliminary-ccsds-work
thomas-bc Feb 20, 2025
f95bc79
Rename frame Footer to Trailer, and improve SDDs
thomas-bc Feb 20, 2025
c02006a
finish renaming footer to trailer and add implementation note
thomas-bc Feb 20, 2025
c619f98
Fix spelling and CI warning
thomas-bc Feb 20, 2025
eb52a3c
Fix test code
thomas-bc Feb 20, 2025
7df46bb
More CI and spelling fixes
thomas-bc Feb 20, 2025
8cc6dc7
Add back virtual destructor
thomas-bc Feb 20, 2025
cada0b0
appease pedantic warnings
thomas-bc Feb 21, 2025
d481d9e
Fix declaration ordering for safe destruction
thomas-bc Feb 21, 2025
fdfaa0d
Run formatting and add a few comments
thomas-bc Feb 26, 2025
93543dc
Add RouterInterface.fppi and use it in Router
thomas-bc Feb 27, 2025
325c3f0
Merge remote-tracking branch 'nasa/devel' into preliminary-ccsds-work
thomas-bc Feb 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -362,14 +362,17 @@ genshi
getblocks
getchildren
getcontext
getcrc
getdata
getdefaultencoding
getextern
getf
geti
getinput
getlength
getm
getquaternion
getstart
gett
gettime
getty
Expand Down Expand Up @@ -517,6 +520,7 @@ listdir
Listst
LJR
lld
llu
LOCALSTATEDIR
LOGGERRULES
loglvl
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ RemoteSystemsTempFiles
Dict
*.core

**/coverage/
*.gcov
!**/test/ut/output/*.gcov
GTestBase.*
Expand Down
4 changes: 4 additions & 0 deletions Fw/Buffer/Buffer.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ module Fw {
$size: U32
) -> Fw.Buffer


@ Port for sending data buffer along with context buffer
@ This is useful for passing data that needs context to be interpreted
port DataWithContext(ref data: Fw.Buffer, ref context: Fw.Buffer)
}
1 change: 1 addition & 0 deletions RPI/Top/RPITopologyDefs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "RPI/Top/FppConstantsAc.hpp"
#include "Svc/FramingProtocol/FprimeProtocol.hpp"
#include "Svc/LinuxTimer/LinuxTimer.hpp"
#include <Svc/FrameAccumulator/FrameDetector/FprimeFrameDetector.hpp>

namespace RPI {

Expand Down
42 changes: 22 additions & 20 deletions RPI/Top/instances.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,13 @@ module RPI {

instance fatalHandler: Svc.FatalHandler base id 100

instance fileUplinkBufferManager: Svc.BufferManager base id 900 \
instance commsBufferManager: Svc.BufferManager base id 900 \
{

phase Fpp.ToCpp.Phases.configConstants """
enum {
STORE_SIZE = 3000,
QUEUE_SIZE = 30,
STORE_COUNT = 30,
MGR_ID = 200
};
"""
Expand All @@ -193,10 +193,10 @@ module RPI {
{
Svc::BufferManager::BufferBins bufferBins;
memset(&bufferBins, 0, sizeof(bufferBins));
using namespace ConfigConstants::RPI_fileUplinkBufferManager;
using namespace ConfigConstants::RPI_commsBufferManager;
bufferBins.bins[0].bufferSize = STORE_SIZE;
bufferBins.bins[0].numBuffers = QUEUE_SIZE;
RPI::fileUplinkBufferManager.setup(
bufferBins.bins[0].numBuffers = STORE_COUNT;
RPI::commsBufferManager.setup(
MGR_ID,
0,
Allocation::mallocator,
Expand All @@ -207,15 +207,13 @@ module RPI {
"""

phase Fpp.ToCpp.Phases.tearDownComponents """
RPI::fileUplinkBufferManager.cleanup();
RPI::commsBufferManager.cleanup();
"""

}

instance fatalAdapter: Svc.AssertFatalAdapter base id 1000

instance staticMemory: Svc.StaticMemory base id 1200

instance downlink: Svc.Framer base id 1220 \
{

Expand All @@ -229,18 +227,7 @@ module RPI {

}

instance uplink: Svc.Deframer base id 1240 \
{

phase Fpp.ToCpp.Phases.configObjects """
Svc::FprimeDeframing deframing;
"""

phase Fpp.ToCpp.Phases.configComponents """
RPI::uplink.setup(ConfigObjects::RPI_uplink::deframing);
"""

}
instance deframer: Svc.FprimeDeframer base id 1240

instance comm: Drv.TcpClient base id 1260 \
{
Expand Down Expand Up @@ -465,5 +452,20 @@ module RPI {
"""
}

instance frameAccumulator: Svc.FrameAccumulator base id 2900 \
{
phase Fpp.ToCpp.Phases.configObjects """
Svc::FrameDetectors::FprimeFrameDetector fprimeFrameDetector;
"""

phase Fpp.ToCpp.Phases.configComponents """
{
frameAccumulator.configure(ConfigObjects::RPI_frameAccumulator::fprimeFrameDetector, 1, Allocation::mallocator, 2048);
}

"""
}

instance uplinkRouter: Svc.Router base id 3000

}
39 changes: 21 additions & 18 deletions RPI/Top/topology.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ module RPI {
instance cmdDisp
instance cmdSeq
instance comm
instance deframer
instance downlink
instance eventLogger
instance fatalAdapter
instance fatalHandler
instance fileDownlink
instance fileUplink
instance fileUplinkBufferManager
instance frameAccumulator
instance commsBufferManager
instance gpio17Drv
instance gpio23Drv
instance gpio24Drv
Expand All @@ -31,11 +33,10 @@ module RPI {
instance rateGroupDriverComp
instance rpiDemo
instance spiDrv
instance staticMemory
instance textLogger
instance uartDrv
instance uplink
instance uartBufferManager
instance uplinkRouter

# ----------------------------------------------------------------------
# Pattern graph specifiers
Expand Down Expand Up @@ -71,13 +72,6 @@ module RPI {
eventLogger.FatalAnnounce -> fatalHandler.FatalReceive
}

connections FileUplinkBuffers {
fileUplink.bufferSendOut -> fileUplinkBufferManager.bufferSendIn
uplink.bufferAllocate -> fileUplinkBufferManager.bufferGetCallee
uplink.bufferDeallocate -> fileUplinkBufferManager.bufferSendIn
uplink.bufferOut -> fileUplink.bufferSendIn
}

connections GPIO {
rpiDemo.GpioRead -> gpio25Drv.gpioRead
rpiDemo.GpioRead -> gpio17Drv.gpioRead
Expand Down Expand Up @@ -114,11 +108,14 @@ module RPI {
rpiDemo.SpiReadWrite -> spiDrv.SpiReadWrite
}

connections StaticMemory {
comm.allocate -> staticMemory.bufferAllocate[0]
comm.deallocate -> staticMemory.bufferDeallocate[1]
downlink.framedAllocate -> staticMemory.bufferAllocate[1]
uplink.framedDeallocate -> staticMemory.bufferDeallocate[0]
connections MemoryAllocations {
comm.allocate -> commsBufferManager.bufferGetCallee
comm.deallocate -> commsBufferManager.bufferSendIn
downlink.framedAllocate -> commsBufferManager.bufferGetCallee
fileUplink.bufferSendOut -> commsBufferManager.bufferSendIn
frameAccumulator.bufferAllocate -> commsBufferManager.bufferGetCallee
frameAccumulator.bufferDeallocate -> commsBufferManager.bufferSendIn
uplinkRouter.bufferDeallocate -> commsBufferManager.bufferSendIn
}

connections UART {
Expand All @@ -129,9 +126,15 @@ module RPI {
}

connections Uplink {
cmdDisp.seqCmdStatus -> uplink.cmdResponseIn
comm.$recv -> uplink.framedIn
uplink.comOut -> cmdDisp.seqCmdBuff
comm.$recv -> frameAccumulator.dataIn

frameAccumulator.frameOut -> deframer.framedIn
deframer.deframedOut -> uplinkRouter.dataIn

uplinkRouter.commandOut -> cmdDisp.seqCmdBuff
uplinkRouter.fileOut -> fileUplink.bufferSendIn

cmdDisp.seqCmdStatus -> uplinkRouter.cmdResponseIn
}

}
Expand Down
10 changes: 5 additions & 5 deletions Ref/Top/RefPackets.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<channel name="Ref.cmdSeq.CS_SequencesCompleted"/>
<channel name="Ref.fileUplink.FilesReceived"/>
<channel name="Ref.fileUplink.PacketsReceived"/>
<channel name="Ref.fileUplinkBufferManager.TotalBuffs"/>
<channel name="Ref.fileUplinkBufferManager.CurrBuffs"/>
<channel name="Ref.fileUplinkBufferManager.HiBuffs"/>
<channel name="Ref.commsBufferManager.TotalBuffs"/>
<channel name="Ref.commsBufferManager.CurrBuffs"/>
<channel name="Ref.commsBufferManager.HiBuffs"/>
<channel name="Ref.fileDownlink.FilesSent"/>
<channel name="Ref.fileDownlink.PacketsSent"/>
<channel name="Ref.fileManager.CommandsExecuted"/>
Expand All @@ -32,8 +32,8 @@
<channel name="Ref.fileDownlink.Warnings"/>
<channel name="Ref.health.PingLateWarnings"/>
<channel name="Ref.fileManager.Errors"/>
<channel name="Ref.fileUplinkBufferManager.NoBuffs"/>
<channel name="Ref.fileUplinkBufferManager.EmptyBuffs"/>
<channel name="Ref.commsBufferManager.NoBuffs"/>
<channel name="Ref.commsBufferManager.EmptyBuffs"/>
<channel name="Ref.fileManager.Errors"/>
</packet>

Expand Down
38 changes: 23 additions & 15 deletions Ref/Top/RefTopology.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <Fw/Types/MallocAllocator.hpp>
#include <Os/Console.hpp>
#include <Svc/FramingProtocol/FprimeProtocol.hpp>
#include <Svc/FrameAccumulator/FrameDetector/FprimeFrameDetector.hpp>

// Used for 1Hz synthetic cycling
#include <Os/Mutex.hpp>
Expand All @@ -33,7 +34,8 @@ Fw::MallocAllocator mallocator;
// The reference topology uses the F´ packet protocol when communicating with the ground and therefore uses the F´
// framing and deframing implementations.
Svc::FprimeFraming framing;
Svc::FprimeDeframing deframing;
Svc::FrameDetectors::FprimeFrameDetector frameDetector;


// The reference topology divides the incoming clock signal (1Hz) into sub-signals: 1Hz, 1/2Hz, and 1/4Hz and
// zero offset for all the dividers
Expand All @@ -54,12 +56,16 @@ enum TopologyConstants {
FILE_DOWNLINK_FILE_QUEUE_DEPTH = 10,
HEALTH_WATCHDOG_CODE = 0x123,
COMM_PRIORITY = 100,
UPLINK_BUFFER_MANAGER_STORE_SIZE = 3000,
UPLINK_BUFFER_MANAGER_QUEUE_SIZE = 30,
UPLINK_BUFFER_MANAGER_ID = 200,
// Buffer manager for Uplink/Downlink
COMMS_BUFFER_MANAGER_STORE_SIZE = 2048,
COMMS_BUFFER_MANAGER_STORE_COUNT = 20,
COMMS_BUFFER_MANAGER_FILE_STORE_SIZE = 3000,
COMMS_BUFFER_MANAGER_FILE_QUEUE_SIZE = 30,
COMMS_BUFFER_MANAGER_ID = 200,
// Buffer manager for Data Products
DP_BUFFER_MANAGER_STORE_SIZE = 10000,
DP_BUFFER_MANAGER_QUEUE_SIZE = 10,
DP_BUFFER_MANAGER_ID = 300
DP_BUFFER_MANAGER_STORE_COUNT = 10,
DP_BUFFER_MANAGER_ID = 300,
};

/**
Expand Down Expand Up @@ -94,21 +100,23 @@ void configureTopology() {
FW_NUM_ARRAY_ELEMENTS(ConfigObjects::Ref_health::pingEntries), HEALTH_WATCHDOG_CODE);

// Buffer managers need a configured set of buckets and an allocator used to allocate memory for those buckets.
Svc::BufferManager::BufferBins upBuffMgrBins;
memset(&upBuffMgrBins, 0, sizeof(upBuffMgrBins));
upBuffMgrBins.bins[0].bufferSize = UPLINK_BUFFER_MANAGER_STORE_SIZE;
upBuffMgrBins.bins[0].numBuffers = UPLINK_BUFFER_MANAGER_QUEUE_SIZE;
fileUplinkBufferManager.setup(UPLINK_BUFFER_MANAGER_ID, 0, mallocator, upBuffMgrBins);
Svc::BufferManager::BufferBins commsBuffMgrBins;
memset(&commsBuffMgrBins, 0, sizeof(commsBuffMgrBins));
commsBuffMgrBins.bins[0].bufferSize = COMMS_BUFFER_MANAGER_STORE_SIZE;
commsBuffMgrBins.bins[0].numBuffers = COMMS_BUFFER_MANAGER_STORE_COUNT;
commsBuffMgrBins.bins[1].bufferSize = COMMS_BUFFER_MANAGER_FILE_STORE_SIZE;
commsBuffMgrBins.bins[1].numBuffers = COMMS_BUFFER_MANAGER_FILE_QUEUE_SIZE;
commsBufferManager.setup(COMMS_BUFFER_MANAGER_ID, 0, mallocator, commsBuffMgrBins);

Svc::BufferManager::BufferBins dpBuffMgrBins;
memset(&dpBuffMgrBins, 0, sizeof(dpBuffMgrBins));
dpBuffMgrBins.bins[0].bufferSize = DP_BUFFER_MANAGER_STORE_SIZE;
dpBuffMgrBins.bins[0].numBuffers = DP_BUFFER_MANAGER_QUEUE_SIZE;
dpBuffMgrBins.bins[0].numBuffers = DP_BUFFER_MANAGER_STORE_COUNT;
dpBufferManager.setup(DP_BUFFER_MANAGER_ID, 0, mallocator, dpBuffMgrBins);

// Framer and Deframer components need to be passed a protocol handler
downlink.setup(framing);
uplink.setup(deframing);
framer.setup(framing);
frameAccumulator.configure(frameDetector, 1, mallocator, 2048);

Fw::FileNameString dpDir("./DpCat");
Fw::FileNameString dpState("./DpCat/DpState.dat");
Expand Down Expand Up @@ -192,6 +200,6 @@ void teardownTopology(const TopologyState& state) {

// Resource deallocation
cmdSeq.deallocateBuffer(mallocator);
fileUplinkBufferManager.cleanup();
commsBufferManager.cleanup();
}
}; // namespace Ref
20 changes: 11 additions & 9 deletions Ref/Top/instances.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,33 +137,35 @@ module Ref {
# ----------------------------------------------------------------------

@ Communications driver. May be swapped with other comm drivers like UART
@ Note: Here we have TCP reliable uplink and UDP (low latency) downlink
instance comm: Drv.TcpClient base id 0x4000

instance downlink: Svc.Framer base id 0x4100
instance framer: Svc.Framer base id 0x4100

instance fatalAdapter: Svc.AssertFatalAdapter base id 0x4200

instance fatalHandler: Svc.FatalHandler base id 0x4300

instance fileUplinkBufferManager: Svc.BufferManager base id 0x4400
instance commsBufferManager: Svc.BufferManager base id 0x4400

instance posixTime: Svc.PosixTime base id 0x4500

instance rateGroupDriverComp: Svc.RateGroupDriver base id 0x4600

instance recvBuffComp: Ref.RecvBuff base id 0x4700

instance staticMemory: Svc.StaticMemory base id 0x4800
instance version: Svc.Version base id 0x4800

instance textLogger: Svc.PassiveTextLogger base id 0x4900

instance uplink: Svc.Deframer base id 0x4A00
instance systemResources: Svc.SystemResources base id 0x4A00

instance systemResources: Svc.SystemResources base id 0x4B00
instance dpBufferManager: Svc.BufferManager base id 0x4B00

instance dpBufferManager: Svc.BufferManager base id 0x4C00

instance version: Svc.Version base id 0x4D00
instance frameAccumulator: Svc.FrameAccumulator base id 0x4C00

instance deframer: Svc.FprimeDeframer base id 0x4D00

instance uplinkRouter: Svc.Router base id 0x4E00

}

Loading
Loading