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 and Router #2900

Draft
wants to merge 33 commits into
base: devel
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 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
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 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.Deframer 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.frameAllocate -> commsBufferManager.bufferGetCallee
frameAccumulator.dataDeallocate -> 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.Deframer base id 0x4D00

instance uplinkRouter: Svc.Router base id 0x4E00

}

Loading
Loading