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 21 commits into
base: devel
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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 @@ -459,5 +446,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 @@
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 @@
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 @@
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 @@
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 MemoryMgmt {

Check failure on line 111 in RPI/Top/topology.fpp

View workflow job for this annotation

GitHub Actions / Spell checking

`Mgmt` is not a recognized word. (unrecognized-spelling)
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 @@
}

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="cmdSeq.CS_SequencesCompleted"/>
<channel name="fileUplink.FilesReceived"/>
<channel name="fileUplink.PacketsReceived"/>
<channel name="fileUplinkBufferManager.TotalBuffs"/>
<channel name="fileUplinkBufferManager.CurrBuffs"/>
<channel name="fileUplinkBufferManager.HiBuffs"/>
<channel name="commsBufferManager.TotalBuffs"/>
<channel name="commsBufferManager.CurrBuffs"/>
<channel name="commsBufferManager.HiBuffs"/>
<channel name="fileDownlink.FilesSent"/>
<channel name="fileDownlink.PacketsSent"/>
<channel name="fileManager.CommandsExecuted"/>
Expand All @@ -32,8 +32,8 @@
<channel name="fileDownlink.Warnings"/>
<channel name="health.PingLateWarnings"/>
<channel name="fileManager.Errors"/>
<channel name="fileUplinkBufferManager.NoBuffs"/>
<channel name="fileUplinkBufferManager.EmptyBuffs"/>
<channel name="commsBufferManager.NoBuffs"/>
<channel name="commsBufferManager.EmptyBuffs"/>
<channel name="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,
};

// Ping entries are autocoded, however; this code is not properly exported. Thus, it is copied here.
Expand Down Expand Up @@ -111,21 +117,23 @@ void configureTopology() {
health.setPingEntries(pingEntries, FW_NUM_ARRAY_ELEMENTS(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");

Expand Down Expand Up @@ -206,6 +214,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