From d014f30a96a5d084f00e90dbcbdee9ed90f113cb Mon Sep 17 00:00:00 2001 From: Thomas Boyer-Chammard <49786685+thomas-bc@users.noreply.github.com> Date: Wed, 3 Sep 2025 18:04:37 -0700 Subject: [PATCH] Add Framing subtopologies and use them within Com subtopologies (#4113) * Update ComX subtopologies to not include ComStub and update Ref * Cosmetic updates * Working FramingCcsds subtopology used in ComCcsds * Revert Ref to use ComCcsds * Move FramingSubtopology into ComCcsds build module * Working ComFprime subtopology * Cosmetic updates * formatting --- Ref/Top/RefTopologyDefs.hpp | 62 ++++++++++------- Ref/Top/instances.fpp | 2 +- Ref/Top/topology.fpp | 2 +- Ref/test/int/int_config.json | 73 ++++++++++---------- Svc/Subtopologies/CMakeLists.txt | 2 +- Svc/Subtopologies/ComCcsds/ComCcsds.fpp | 83 +++++++++++++++-------- Svc/Subtopologies/ComFprime/ComFprime.fpp | 73 +++++++++++++------- 7 files changed, 177 insertions(+), 120 deletions(-) diff --git a/Ref/Top/RefTopologyDefs.hpp b/Ref/Top/RefTopologyDefs.hpp index ba462bb2a2..aa2b525780 100644 --- a/Ref/Top/RefTopologyDefs.hpp +++ b/Ref/Top/RefTopologyDefs.hpp @@ -26,9 +26,9 @@ #include "Svc/Subtopologies/DataProducts/SubtopologyTopologyDefs.hpp" #include "Svc/Subtopologies/FileHandling/SubtopologyTopologyDefs.hpp" -//ComCcsds Enum Includes -#include "Svc/Subtopologies/ComCcsds/Ports_ComPacketQueueEnumAc.hpp" +// ComCcsds Enum Includes #include "Svc/Subtopologies/ComCcsds/Ports_ComBufferQueueEnumAc.hpp" +#include "Svc/Subtopologies/ComCcsds/Ports_ComPacketQueueEnumAc.hpp" /** * \brief required ping constants @@ -50,34 +50,46 @@ * ``` */ namespace PingEntries { - namespace Ref_blockDrv {enum { WARN = 3, FATAL = 5 };} - namespace Ref_pingRcvr {enum { WARN = 3, FATAL = 5 };} - namespace Ref_rateGroup1Comp {enum { WARN = 3, FATAL = 5 };} - namespace Ref_rateGroup2Comp {enum { WARN = 3, FATAL = 5 };} - namespace Ref_rateGroup3Comp {enum { WARN = 3, FATAL = 5 };} - namespace Ref_cmdSeq {enum { WARN = 3, FATAL = 5 };} +namespace Ref_blockDrv { +enum { WARN = 3, FATAL = 5 }; +} +namespace Ref_pingRcvr { +enum { WARN = 3, FATAL = 5 }; +} +namespace Ref_rateGroup1Comp { +enum { WARN = 3, FATAL = 5 }; +} +namespace Ref_rateGroup2Comp { +enum { WARN = 3, FATAL = 5 }; +} +namespace Ref_rateGroup3Comp { +enum { WARN = 3, FATAL = 5 }; +} +namespace Ref_cmdSeq { +enum { WARN = 3, FATAL = 5 }; +} } // namespace PingEntries // Definitions are placed within a namespace named after the deployment namespace Ref { - /** - * \brief required type definition to carry state - * - * The topology autocoder requires an object that carries state with the name `Ref::TopologyState`. Only the type - * definition is required by the autocoder and the contents of this object are otherwise opaque to the autocoder. The - * contents are entirely up to the definition of the project. This reference application specifies hostname and port - * fields, which are derived by command line inputs. - */ - struct TopologyState { - const char* hostname; //!< Hostname for TCP communication - U16 port; //!< Port for TCP communication - CdhCore::SubtopologyState cdhCore; //!< Subtopology state for CdhCore - ComCcsds::SubtopologyState comCcsds; //!< Subtopology state for ComCcsds - DataProducts::SubtopologyState dataProducts; //!< Subtopology state for DataProducts - FileHandling::SubtopologyState fileHandling; //!< Subtopology state for FileHandling - }; +/** + * \brief required type definition to carry state + * + * The topology autocoder requires an object that carries state with the name `Ref::TopologyState`. Only the type + * definition is required by the autocoder and the contents of this object are otherwise opaque to the autocoder. The + * contents are entirely up to the definition of the project. This reference application specifies hostname and port + * fields, which are derived by command line inputs. + */ +struct TopologyState { + const char* hostname; //!< Hostname for TCP communication + U16 port; //!< Port for TCP communication + CdhCore::SubtopologyState cdhCore; //!< Subtopology state for CdhCore + ComCcsds::SubtopologyState comCcsds; //!< Subtopology state for ComCcsds + DataProducts::SubtopologyState dataProducts; //!< Subtopology state for DataProducts + FileHandling::SubtopologyState fileHandling; //!< Subtopology state for FileHandling +}; - namespace PingEntries = ::PingEntries; +namespace PingEntries = ::PingEntries; } // namespace Ref #endif diff --git a/Ref/Top/instances.fpp b/Ref/Top/instances.fpp index 22632f5469..3f8bb1246e 100644 --- a/Ref/Top/instances.fpp +++ b/Ref/Top/instances.fpp @@ -99,6 +99,6 @@ module Ref { instance linuxTimer: Svc.LinuxTimer base id 0x10024000 - instance comDriver: Drv.TcpClient base id 0x10025000 + instance comDriver: Drv.TcpClient base id 0x10025000 } diff --git a/Ref/Top/topology.fpp b/Ref/Top/topology.fpp index db4c59115c..030d3e15a7 100644 --- a/Ref/Top/topology.fpp +++ b/Ref/Top/topology.fpp @@ -20,7 +20,7 @@ module Ref { import ComCcsds.Subtopology import FileHandling.Subtopology import DataProducts.Subtopology - + # ---------------------------------------------------------------------- # Instances used in the topology # ---------------------------------------------------------------------- diff --git a/Ref/test/int/int_config.json b/Ref/test/int/int_config.json index 30ad6c737a..9c45c0d61b 100644 --- a/Ref/test/int/int_config.json +++ b/Ref/test/int/int_config.json @@ -1,38 +1,37 @@ { - "Svc.ActiveRateGroup" : "Ref.rateGroup1Comp", - "Svc.CommandDispatcher" : "CdhCore.cmdDisp", - "Svc.CmdSequencer" : "Ref.cmdSeq", - "Svc.FileDownlink" : "FileHandling.fileDownlink", - "Svc.FileManager" : "FileHandling.fileManager", - "Svc.FileUplink" : "Ref.fileUplink", - "Ref.PingReceiver" : "Ref.pingRcvr", - "Svc.EventManager" : "CdhCore.events", - "Svc.TlmChan" : "Ref.tlmSend", - "Svc.PrmDb" : "FileHandling.prmDb", - "Svc.PrmDb.filename" : "/tmp/PrmDb.dat", - "Svc.DpCatalog" : "DataProducts.dpCat", - "Svc.DpManager" : "DataProducts.dpMgr", - "Svc.DpWriter" : "DataProducts.dpWriter", - "Svc.ComQueue" : "Ref.comQueue", - "Ref.TypeDemo" : "Ref.typeDemo", - "Svc.Health" : "CdhCore.health", - "Ref.SignalGen" : "Ref.SG1", - "Ref.SendBuff" : "Ref.sendBuffComp", - "Drv.TcpClient" : "Ref.comDriver", - "Svc.AssertFatalAdapter" : "Ref.fatalAdapter", - "Svc.FatalHandler" : "Ref.fatalHandler", - "Svc.BufferManager" : "Ref.commsBufferManager", - "Svc.PosixTime" : "Ref.posixTime", - "Svc.RateGroupDriver" : "Ref.rateGroupDriverComp", - "Ref.RecvBuff" : "Ref.recvBuffComp", - "Svc.Version" : "CdhCore.version", - "Svc.PassiveTextLogger" : "Ref.textLogger", - "Svc.SystemResources" : "Ref.systemResources", - "Svc.BufferManager" : "Ref.dpBufferManager", - "Svc.FrameAccumulator" : "Ref.frameAccumulator", - "Svc.FprimeDeframer" : "Ref.deframer", - "Svc.FprimeRouter" : "Ref.fprimeRouter", - "Svc.FprimeFramer" : "Ref.fprimeFramer", - "Svc.ComStub" : "Ref.comStub" -} - + "Svc.ActiveRateGroup": "Ref.rateGroup1Comp", + "Svc.CommandDispatcher": "CdhCore.cmdDisp", + "Svc.CmdSequencer": "Ref.cmdSeq", + "Svc.FileDownlink": "FileHandling.fileDownlink", + "Svc.FileManager": "FileHandling.fileManager", + "Svc.FileUplink": "Ref.fileUplink", + "Ref.PingReceiver": "Ref.pingRcvr", + "Svc.EventManager": "CdhCore.events", + "Svc.TlmChan": "Ref.tlmSend", + "Svc.PrmDb": "FileHandling.prmDb", + "Svc.PrmDb.filename": "/tmp/PrmDb.dat", + "Svc.DpCatalog": "DataProducts.dpCat", + "Svc.DpManager": "DataProducts.dpMgr", + "Svc.DpWriter": "DataProducts.dpWriter", + "Svc.ComQueue": "Ref.comQueue", + "Ref.TypeDemo": "Ref.typeDemo", + "Svc.Health": "CdhCore.health", + "Ref.SignalGen": "Ref.SG1", + "Ref.SendBuff": "Ref.sendBuffComp", + "Drv.TcpClient": "Ref.comDriver", + "Svc.AssertFatalAdapter": "Ref.fatalAdapter", + "Svc.FatalHandler": "Ref.fatalHandler", + "Svc.BufferManager": "Ref.commsBufferManager", + "Svc.PosixTime": "Ref.posixTime", + "Svc.RateGroupDriver": "Ref.rateGroupDriverComp", + "Ref.RecvBuff": "Ref.recvBuffComp", + "Svc.Version": "CdhCore.version", + "Svc.PassiveTextLogger": "Ref.textLogger", + "Svc.SystemResources": "Ref.systemResources", + "Svc.BufferManager": "Ref.dpBufferManager", + "Svc.FrameAccumulator": "Ref.frameAccumulator", + "Svc.FprimeDeframer": "Ref.deframer", + "Svc.FprimeRouter": "Ref.fprimeRouter", + "Svc.FprimeFramer": "Ref.framer", + "Svc.ComStub": "Ref.comStub" +} \ No newline at end of file diff --git a/Svc/Subtopologies/CMakeLists.txt b/Svc/Subtopologies/CMakeLists.txt index 693d5d0de3..e821318ab1 100644 --- a/Svc/Subtopologies/CMakeLists.txt +++ b/Svc/Subtopologies/CMakeLists.txt @@ -19,4 +19,4 @@ add_custom_target( Svc_Subtopologies_DataProducts Svc_Subtopologies_DataProducts_DataProductsConfig Svc_Subtopologies_ComLoggerTee -) \ No newline at end of file +) diff --git a/Svc/Subtopologies/ComCcsds/ComCcsds.fpp b/Svc/Subtopologies/ComCcsds/ComCcsds.fpp index f57d0d61dd..0c77cff1fd 100644 --- a/Svc/Subtopologies/ComCcsds/ComCcsds.fpp +++ b/Svc/Subtopologies/ComCcsds/ComCcsds.fpp @@ -90,21 +90,35 @@ module ComCcsds { """ } - instance fprimeRouter: Svc.FprimeRouter base id ComCcsdsConfig.BASE_ID + 0x03000 \ - - instance comStub: Svc.ComStub base id ComCcsdsConfig.BASE_ID + 0x04000 \ + instance fprimeRouter: Svc.FprimeRouter base id ComCcsdsConfig.BASE_ID + 0x03000 - instance tcDeframer: Svc.Ccsds.TcDeframer base id ComCcsdsConfig.BASE_ID + 0x05000 \ + instance tcDeframer: Svc.Ccsds.TcDeframer base id ComCcsdsConfig.BASE_ID + 0x04000 - instance spacePacketDeframer: Svc.Ccsds.SpacePacketDeframer base id ComCcsdsConfig.BASE_ID + 0x06000 \ + instance spacePacketDeframer: Svc.Ccsds.SpacePacketDeframer base id ComCcsdsConfig.BASE_ID + 0x05000 + # NOTE: name 'framer' is used for the framer that connects to the Com Adapter Interface for better subtopology interoperability + instance framer: Svc.Ccsds.TmFramer base id ComCcsdsConfig.BASE_ID + 0x06000 - instance tmFramer: Svc.Ccsds.TmFramer base id ComCcsdsConfig.BASE_ID + 0x07000 \ + instance spacePacketFramer: Svc.Ccsds.SpacePacketFramer base id ComCcsdsConfig.BASE_ID + 0x07000 - instance spacePacketFramer: Svc.Ccsds.SpacePacketFramer base id ComCcsdsConfig.BASE_ID + 0x08000 \ + instance apidManager: Svc.Ccsds.ApidManager base id ComCcsdsConfig.BASE_ID + 0x08000 + + instance comStub: Svc.ComStub base id ComCcsdsConfig.BASE_ID + 0x09000 + + topology FramingSubtopology { + # Usage Note: + # + # When importing this subtopology, users shall establish 5 port connections with a component implementing + # the Svc.Com (Svc/Interfaces/Com.fpp) interface. They are as follows: + # + # 1) Outputs: + # - ComCcsds.framer.dataOut -> [Svc.Com].dataIn + # - ComCcsds.frameAccumulator.dataReturnOut -> [Svc.Com].dataReturnIn + # 2) Inputs: + # - [Svc.Com].dataReturnOut -> ComCcsds.framer.dataReturnIn + # - [Svc.Com].comStatusOut -> ComCcsds.framer.comStatusIn + # - [Svc.Com].dataOut -> ComCcsds.frameAccumulator.dataIn - instance apidManager: Svc.Ccsds.ApidManager base id ComCcsdsConfig.BASE_ID + 0x09000 \ - topology Subtopology { # Active Components instance comQueue @@ -112,16 +126,13 @@ module ComCcsds { instance commsBufferManager instance frameAccumulator instance fprimeRouter - instance comStub instance tcDeframer instance spacePacketDeframer - instance tmFramer + instance framer instance spacePacketFramer instance apidManager connections Downlink { - - # ComQueue <-> SpacePacketFramer comQueue.dataOut -> spacePacketFramer.dataIn spacePacketFramer.dataReturnOut -> comQueue.dataReturnIn @@ -130,27 +141,22 @@ module ComCcsds { spacePacketFramer.bufferDeallocate -> commsBufferManager.bufferSendIn spacePacketFramer.getApidSeqCount -> apidManager.getApidSeqCountIn # SpacePacketFramer <-> TmFramer - spacePacketFramer.dataOut -> tmFramer.dataIn - tmFramer.dataReturnOut -> spacePacketFramer.dataReturnIn - # Framer <-> ComStub - tmFramer.dataOut -> comStub.dataIn - comStub.dataReturnOut -> tmFramer.dataReturnIn + spacePacketFramer.dataOut -> framer.dataIn + framer.dataReturnOut -> spacePacketFramer.dataReturnIn # ComStatus - comStub.comStatusOut -> tmFramer.comStatusIn - tmFramer.comStatusOut -> spacePacketFramer.comStatusIn - spacePacketFramer.comStatusOut -> comQueue.comStatusIn + framer.comStatusOut -> spacePacketFramer.comStatusIn + spacePacketFramer.comStatusOut -> comQueue.comStatusIn + # (Outgoing) Framer <-> ComInterface connections shall be established by the user } connections Uplink { - # ComStub <-> FrameAccumulator - comStub.dataOut -> frameAccumulator.dataIn - frameAccumulator.dataReturnOut -> comStub.dataReturnIn + # (Incoming) ComInterface <-> FrameAccumulator connections shall be established by the user # FrameAccumulator buffer allocations frameAccumulator.bufferDeallocate -> commsBufferManager.bufferSendIn frameAccumulator.bufferAllocate -> commsBufferManager.bufferGetCallee - # FrameAccumulator <-> Deframer - frameAccumulator.dataOut -> tcDeframer.dataIn - tcDeframer.dataReturnOut -> frameAccumulator.dataReturnIn + # FrameAccumulator <-> TcDeframer + frameAccumulator.dataOut -> tcDeframer.dataIn + tcDeframer.dataReturnOut -> frameAccumulator.dataReturnIn # TcDeframer <-> SpacePacketDeframer tcDeframer.dataOut -> spacePacketDeframer.dataIn spacePacketDeframer.dataReturnOut -> tcDeframer.dataReturnIn @@ -162,8 +168,25 @@ module ComCcsds { # Router buffer allocations fprimeRouter.bufferAllocate -> commsBufferManager.bufferGetCallee fprimeRouter.bufferDeallocate -> commsBufferManager.bufferSendIn - } + } # end FramingSubtopology - } # end topology -} # end ComCcsds Subtopology + # This subtopology uses FramingSubtopology with a ComStub component for Com Interface + topology Subtopology { + import FramingSubtopology + + instance comStub + + connections ComStub { + # Framer <-> ComStub (Downlink) + ComCcsds.framer.dataOut -> comStub.dataIn + comStub.dataReturnOut -> ComCcsds.framer.dataReturnIn + comStub.comStatusOut -> ComCcsds.framer.comStatusIn + + # ComStub <-> FrameAccumulator (Uplink) + comStub.dataOut -> ComCcsds.frameAccumulator.dataIn + ComCcsds.frameAccumulator.dataReturnOut -> comStub.dataReturnIn + } + } # end Subtopology + +} # end ComCcsds diff --git a/Svc/Subtopologies/ComFprime/ComFprime.fpp b/Svc/Subtopologies/ComFprime/ComFprime.fpp index aba2d483b8..4f2da4b4e2 100644 --- a/Svc/Subtopologies/ComFprime/ComFprime.fpp +++ b/Svc/Subtopologies/ComFprime/ComFprime.fpp @@ -86,15 +86,28 @@ module ComFprime { """ } - instance deframer: Svc.FprimeDeframer base id ComFprimeConfig.BASE_ID + 0x03000 \ + instance deframer: Svc.FprimeDeframer base id ComFprimeConfig.BASE_ID + 0x03000 - instance fprimeFramer: Svc.FprimeFramer base id ComFprimeConfig.BASE_ID + 0x04000 \ + instance framer: Svc.FprimeFramer base id ComFprimeConfig.BASE_ID + 0x04000 - instance fprimeRouter: Svc.FprimeRouter base id ComFprimeConfig.BASE_ID + 0x05000 \ - - instance comStub: Svc.ComStub base id ComFprimeConfig.BASE_ID + 0x06000 \ + instance fprimeRouter: Svc.FprimeRouter base id ComFprimeConfig.BASE_ID + 0x05000 + + instance comStub: Svc.ComStub base id ComFprimeConfig.BASE_ID + 0x06000 + + topology FramingSubtopology { + # Usage Note: + # + # When importing this subtopology, users shall establish 5 port connections with a component implementing + # the Svc.Com (Svc/Interfaces/Com.fpp) interface. They are as follows: + # + # 1) Outputs: + # - ComFprime.framer.dataOut -> [Svc.Com].dataIn + # - ComFprime.frameAccumulator.dataReturnOut -> [Svc.Com].dataReturnIn + # 2) Inputs: + # - [Svc.Com].dataReturnOut -> ComFprime.framer.dataReturnIn + # - [Svc.Com].comStatusOut -> ComFprime.framer.comStatusIn + # - [Svc.Com].dataOut -> ComFprime.frameAccumulator.dataIn - topology Subtopology { # Active Components instance comQueue @@ -102,31 +115,23 @@ module ComFprime { instance commsBufferManager instance frameAccumulator instance deframer - instance fprimeFramer + instance framer instance fprimeRouter - instance comStub - connections Downlink { - # Inputs to ComQueue (events, telemetry) # ComQueue <-> Framer - comQueue.dataOut -> fprimeFramer.dataIn - fprimeFramer.dataReturnOut -> comQueue.dataReturnIn + comQueue.dataOut -> framer.dataIn + framer.dataReturnOut -> comQueue.dataReturnIn # Buffer Management for Framer - fprimeFramer.bufferAllocate -> commsBufferManager.bufferGetCallee - fprimeFramer.bufferDeallocate -> commsBufferManager.bufferSendIn - # Framer <-> ComStub - fprimeFramer.dataOut -> comStub.dataIn - comStub.dataReturnOut -> fprimeFramer.dataReturnIn - # ComStatus - comStub.comStatusOut -> fprimeFramer.comStatusIn - fprimeFramer.comStatusOut -> comQueue.comStatusIn + framer.bufferAllocate -> commsBufferManager.bufferGetCallee + framer.bufferDeallocate -> commsBufferManager.bufferSendIn + # ComStatus passback + framer.comStatusOut -> comQueue.comStatusIn + # (Outgoing) Framer <-> ComInterface connections shall be established by the user } connections Uplink { - # ComStub <-> FrameAccumulator - comStub.dataOut -> frameAccumulator.dataIn - frameAccumulator.dataReturnOut -> comStub.dataReturnIn + # (Incoming) ComInterface <-> FrameAccumulator connections shall be established by the user # FrameAccumulator buffer allocations frameAccumulator.bufferDeallocate -> commsBufferManager.bufferSendIn frameAccumulator.bufferAllocate -> commsBufferManager.bufferGetCallee @@ -140,7 +145,25 @@ module ComFprime { fprimeRouter.bufferAllocate -> commsBufferManager.bufferGetCallee fprimeRouter.bufferDeallocate -> commsBufferManager.bufferSendIn } + } # end FramingSubtopology - } # end topology -} # end ComFprime Subtopology + # This subtopology uses FramingSubtopology with a ComStub component for Com Interface + topology Subtopology { + import FramingSubtopology + + instance comStub + + connections ComStub { + # Framer <-> ComStub (Downlink) + ComFprime.framer.dataOut -> comStub.dataIn + comStub.dataReturnOut -> ComFprime.framer.dataReturnIn + comStub.comStatusOut -> ComFprime.framer.comStatusIn + + # ComStub <-> FrameAccumulator (Uplink) + comStub.dataOut -> ComFprime.frameAccumulator.dataIn + ComFprime.frameAccumulator.dataReturnOut -> comStub.dataReturnIn + } + } # end Subtopology + +} # end ComFprime