diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index 2b69b6b552f..f41d1c30fc7 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -68,7 +68,7 @@ CCB CComponent ccsds ccsparc -CDH +cdh CDHCORE cerrno CFDP @@ -95,6 +95,10 @@ CODEFILE COLORSTYLE colorwheel COMBUFFER +COMCCSDS +COMCCSDSSUBTOPOLOGY +COMFPRIME +COMFPRIMESUBTOPOLOGY comlogger COMMANDDISPATCHERIMPL COMMANDDISPATCHERIMPLCFG @@ -133,6 +137,8 @@ ctu culates cuz CYCLEOUT +DATAPRODUCTS +DATAPRODUCTSSUBTOPOLOGY DATAROOTDIR DDDTHH Debian @@ -213,11 +219,12 @@ ffff Ffs FILEDOWNLINK FILEDOWNLINKCFG +FILEHANDLING +FILEHANDLINGSUBTOPOLOGY FILEID FILEOPENERROR FILEWRITEERROR fio -FLDP FNDELAY FONTPATH foodoodie @@ -390,7 +397,6 @@ multitool mutexattr Mutexed mycompany -NACI nasafprime nbits ncsl @@ -451,7 +457,6 @@ PASSIVERATEGROUP PASSIVERATEGROUPIMPLTESTER patsubst pdflatex -PEB penv PERLMOD PINGENTRIES diff --git a/Ref/Main.cpp b/Ref/Main.cpp index 1b41c76a9f7..500c317ebed 100644 --- a/Ref/Main.cpp +++ b/Ref/Main.cpp @@ -82,8 +82,8 @@ int main(int argc, char* argv[]) { } // Object for communicating state to the reference topology Ref::TopologyState inputs; - inputs.hostname = hostname; - inputs.port = port_number; + inputs.comCcsds.hostname = hostname; + inputs.comCcsds.port = port_number; // Setup program shutdown via Ctrl-C signal(SIGINT, signalHandler); diff --git a/Ref/Top/RefPackets.fppi b/Ref/Top/RefPackets.fppi index 13805b7b18c..c3f5a5bc8f1 100644 --- a/Ref/Top/RefPackets.fppi +++ b/Ref/Top/RefPackets.fppi @@ -1,39 +1,44 @@ telemetry packets RefPackets { packet CDH id 1 group 1 { - CDHCore.cmdDisp.CommandsDispatched + CdhCore.cmdDisp.CommandsDispatched + + FileHandling.fileUplink.FilesReceived + FileHandling.fileUplink.PacketsReceived + FileHandling.fileDownlink.FilesSent + FileHandling.fileDownlink.PacketsSent + FileHandling.fileManager.CommandsExecuted + + ComCcsds.cmdSeq.CS_LoadCommands + ComCcsds.cmdSeq.CS_CancelCommands + ComCcsds.cmdSeq.CS_CommandsExecuted + ComCcsds.cmdSeq.CS_SequencesCompleted + ComCcsds.comQueue.comQueueDepth + ComCcsds.comQueue.buffQueueDepth + ComCcsds.commsBufferManager.TotalBuffs + ComCcsds.commsBufferManager.CurrBuffs + ComCcsds.commsBufferManager.HiBuffs + #ComCcsds.tlmSend.SendLevel + Ref.rateGroup1Comp.RgMaxTime Ref.rateGroup2Comp.RgMaxTime Ref.rateGroup3Comp.RgMaxTime - Ref.cmdSeq.CS_LoadCommands - Ref.cmdSeq.CS_CancelCommands - Ref.cmdSeq.CS_CommandsExecuted - Ref.cmdSeq.CS_SequencesCompleted - Ref.fileUplink.FilesReceived - Ref.fileUplink.PacketsReceived - Ref.commsBufferManager.TotalBuffs - Ref.commsBufferManager.CurrBuffs - Ref.commsBufferManager.HiBuffs - Ref.fileDownlink.FilesSent - Ref.fileDownlink.PacketsSent - Ref.fileManager.CommandsExecuted - Ref.comQueue.comQueueDepth - Ref.comQueue.buffQueueDepth - #CDHCore.tlmSend.SendLevel } packet CDHErrors id 2 group 1 { + CdhCore.$health.PingLateWarnings + + FileHandling.fileUplink.Warnings + FileHandling.fileDownlink.Warnings + FileHandling.fileManager.Errors + + ComCcsds.cmdSeq.CS_Errors + ComCcsds.commsBufferManager.NoBuffs + ComCcsds.commsBufferManager.EmptyBuffs + Ref.rateGroup1Comp.RgCycleSlips Ref.rateGroup2Comp.RgCycleSlips Ref.rateGroup3Comp.RgCycleSlips - Ref.cmdSeq.CS_Errors - Ref.fileUplink.Warnings - Ref.fileDownlink.Warnings - CDHCore.$health.PingLateWarnings - Ref.fileManager.Errors - Ref.commsBufferManager.NoBuffs - Ref.commsBufferManager.EmptyBuffs - Ref.fileManager.Errors } packet DriveTlm id 3 group 1 { @@ -175,94 +180,97 @@ telemetry packets RefPackets { } packet DataProducts id 21 group 3 { - Ref.dpCat.CatalogDps - Ref.dpCat.DpsSent - Ref.dpMgr.NumSuccessfulAllocations - Ref.dpMgr.NumFailedAllocations - Ref.dpMgr.NumDataProducts - Ref.dpMgr.NumBytes - Ref.dpWriter.NumBuffersReceived - Ref.dpWriter.NumBytesWritten - Ref.dpWriter.NumSuccessfulWrites - Ref.dpWriter.NumFailedWrites - Ref.dpWriter.NumErrors - Ref.dpBufferManager.TotalBuffs - Ref.dpBufferManager.CurrBuffs - Ref.dpBufferManager.HiBuffs - Ref.dpBufferManager.NoBuffs - Ref.dpBufferManager.EmptyBuffs + DataProducts.dpCat.CatalogDps + DataProducts.dpCat.DpsSent + + DataProducts.dpMgr.NumSuccessfulAllocations + DataProducts.dpMgr.NumFailedAllocations + DataProducts.dpMgr.NumDataProducts + DataProducts.dpMgr.NumBytes + + DataProducts.dpWriter.NumBuffersReceived + DataProducts.dpWriter.NumBytesWritten + DataProducts.dpWriter.NumSuccessfulWrites + DataProducts.dpWriter.NumFailedWrites + DataProducts.dpWriter.NumErrors + + DataProducts.dpBufferManager.TotalBuffs + DataProducts.dpBufferManager.CurrBuffs + DataProducts.dpBufferManager.HiBuffs + DataProducts.dpBufferManager.NoBuffs + DataProducts.dpBufferManager.EmptyBuffs } packet Version1 id 22 group 2 { - CDHCore.version.FrameworkVersion - CDHCore.version.ProjectVersion + CdhCore.version.FrameworkVersion + CdhCore.version.ProjectVersion } packet Version_Library1 id 23 group 2 { - CDHCore.version.LibraryVersion01 - CDHCore.version.LibraryVersion02 + CdhCore.version.LibraryVersion01 + CdhCore.version.LibraryVersion02 } packet Version_Library2 id 24 group 2 { - CDHCore.version.LibraryVersion03 - CDHCore.version.LibraryVersion04 + CdhCore.version.LibraryVersion03 + CdhCore.version.LibraryVersion04 } packet Version_Library3 id 25 group 2 { - CDHCore.version.LibraryVersion05 - CDHCore.version.LibraryVersion06 + CdhCore.version.LibraryVersion05 + CdhCore.version.LibraryVersion06 } packet Version_Library4 id 26 group 2 { - CDHCore.version.LibraryVersion07 - CDHCore.version.LibraryVersion08 + CdhCore.version.LibraryVersion07 + CdhCore.version.LibraryVersion08 } packet Version_Library5 id 27 group 2 { - CDHCore.version.LibraryVersion09 - CDHCore.version.LibraryVersion10 + CdhCore.version.LibraryVersion09 + CdhCore.version.LibraryVersion10 } packet Version_Custom1 id 28 group 2 { - CDHCore.version.CustomVersion01 + CdhCore.version.CustomVersion01 } packet Version_Custom2 id 29 group 2 { - CDHCore.version.CustomVersion02 + CdhCore.version.CustomVersion02 } packet Version_Custom3 id 30 group 2 { - CDHCore.version.CustomVersion03 + CdhCore.version.CustomVersion03 } packet Version_Custom4 id 31 group 2 { - CDHCore.version.CustomVersion04 + CdhCore.version.CustomVersion04 } packet Version_Custom5 id 32 group 2 { - CDHCore.version.CustomVersion05 + CdhCore.version.CustomVersion05 } packet Version_Custom6 id 33 group 2 { - CDHCore.version.CustomVersion06 + CdhCore.version.CustomVersion06 } packet Version_Custom7 id 34 group 2 { - CDHCore.version.CustomVersion07 + CdhCore.version.CustomVersion07 } packet Version_Custom8 id 35 group 2 { - CDHCore.version.CustomVersion08 + CdhCore.version.CustomVersion08 } packet Version_Custom9 id 36 group 2 { - CDHCore.version.CustomVersion09 + CdhCore.version.CustomVersion09 } packet Version_Custom10 id 37 group 2 { - CDHCore.version.CustomVersion10 + CdhCore.version.CustomVersion10 } } omit { - CDHCore.cmdDisp.CommandErrors -} \ No newline at end of file + CdhCore.cmdDisp.CommandErrors +} diff --git a/Ref/Top/RefTopology.cpp b/Ref/Top/RefTopology.cpp index 01a640ab8f4..80cecc61e63 100644 --- a/Ref/Top/RefTopology.cpp +++ b/Ref/Top/RefTopology.cpp @@ -14,8 +14,6 @@ // Necessary project-specified types #include #include -#include -#include // Used for 1Hz synthetic cycling #include @@ -26,14 +24,6 @@ using namespace Ref; // Instantiate a system logger that will handle Fw::Logger::log calls Os::Console logger; -// The reference topology uses a malloc-based allocator for components that need to allocate memory during the -// initialization phase. -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::FrameDetectors::CcsdsTcFrameDetector 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 Svc::RateGroupDriver::DividerSet rateGroupDivisorsSet{{{1, 0}, {2, 0}, {4, 0}}}; @@ -44,28 +34,6 @@ U32 rateGroup1Context[Svc::ActiveRateGroup::CONNECTION_COUNT_MAX] = {}; U32 rateGroup2Context[Svc::ActiveRateGroup::CONNECTION_COUNT_MAX] = {}; U32 rateGroup3Context[Svc::ActiveRateGroup::CONNECTION_COUNT_MAX] = {}; -Svc::ComQueue::QueueConfigurationTable configurationTable; - -// A number of constants are needed for construction of the topology. These are specified here. -enum TopologyConstants { - CMD_SEQ_BUFFER_SIZE = 5 * 1024, - FILE_DOWNLINK_TIMEOUT = 1000, - FILE_DOWNLINK_COOLDOWN = 1000, - FILE_DOWNLINK_CYCLE_TIME = 1000, - FILE_DOWNLINK_FILE_QUEUE_DEPTH = 10, - COMM_PRIORITY = 100, - // 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_STORE_COUNT = 10, - DP_BUFFER_MANAGER_ID = 300, -}; - /** * \brief configure/setup components in project-specific way * @@ -74,9 +42,6 @@ enum TopologyConstants { * desired, but is extracted here for clarity. */ void configureTopology() { - // Command sequencer needs to allocate memory to hold contents of command sequences - cmdSeq.allocateBuffer(0, mallocator, CMD_SEQ_BUFFER_SIZE); - // Rate group driver needs a divisor list rateGroupDriverComp.configure(rateGroupDivisorsSet); @@ -84,53 +49,6 @@ void configureTopology() { rateGroup1Comp.configure(rateGroup1Context, FW_NUM_ARRAY_ELEMENTS(rateGroup1Context)); rateGroup2Comp.configure(rateGroup2Context, FW_NUM_ARRAY_ELEMENTS(rateGroup2Context)); rateGroup3Comp.configure(rateGroup3Context, FW_NUM_ARRAY_ELEMENTS(rateGroup3Context)); - - // File downlink requires some project-derived properties. - fileDownlink.configure(FILE_DOWNLINK_TIMEOUT, FILE_DOWNLINK_COOLDOWN, FILE_DOWNLINK_CYCLE_TIME, - FILE_DOWNLINK_FILE_QUEUE_DEPTH); - - // Parameter database is configured with a database file name, and that file must be initially read. - prmDb.configure("PrmDb.dat"); - prmDb.readParamFile(); - - // Buffer managers need a configured set of buckets and an allocator used to allocate memory for those buckets. - 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_STORE_COUNT; - dpBufferManager.setup(DP_BUFFER_MANAGER_ID, 0, mallocator, dpBuffMgrBins); - - frameAccumulator.configure(frameDetector, 1, mallocator, 2048); - - Fw::FileNameString dpDir("./DpCat"); - Fw::FileNameString dpState("./DpCat/DpState.dat"); - - // create the DP directory if it doesn't exist - Os::FileSystem::createDirectory(dpDir.toChar()); - - dpCat.configure(&dpDir,1,dpState,0,mallocator); - dpWriter.configure(dpDir); - - // ComQueue configuration - // Events (highest-priority) - configurationTable.entries[Ref::Ports_ComPacketQueue::EVENTS].depth = 100; - configurationTable.entries[Ref::Ports_ComPacketQueue::EVENTS].priority = 0; - // Telemetry - configurationTable.entries[Ref::Ports_ComPacketQueue::TELEMETRY].depth = 500; - configurationTable.entries[Ref::Ports_ComPacketQueue::TELEMETRY].priority = 2; - // File Downlink (first entry after the ComPacket queues = NUM_CONSTANTS) - configurationTable.entries[Ref::Ports_ComPacketQueue::NUM_CONSTANTS].depth = 100; - configurationTable.entries[Ref::Ports_ComPacketQueue::NUM_CONSTANTS].priority = 1; - // Allocation identifier is 0 as the MallocAllocator discards it - comQueue.configure(configurationTable, 0, mallocator); } // Public functions for use in main program are namespaced with deployment name Ref @@ -146,21 +64,12 @@ void setupTopology(const TopologyState& state) { regCommands(); // Autocoded configuration. Function provided by autocoder. configComponents(state); - if (state.hostname != nullptr && state.port != 0) { - comDriver.configure(state.hostname, state.port); - } // Project-specific component configuration. Function provided above. May be inlined, if desired. configureTopology(); // Autocoded parameter loading. Function provided by autocoder. loadParameters(); // Autocoded task kick-off (active components). Function provided by autocoder. startTasks(state); - // Initialize socket client communication if and only if there is a valid specification - if (state.hostname != nullptr && state.port != 0) { - Os::TaskString name("ReceiveTask"); - // Uplink is configured for receive so a socket task is started - comDriver.start(name, COMM_PRIORITY, Default::STACK_SIZE); - } } void startRateGroups(Fw::TimeInterval interval) { @@ -179,14 +88,6 @@ void teardownTopology(const TopologyState& state) { // Autocoded (active component) task clean-up. Functions provided by topology autocoder. stopTasks(state); freeThreads(state); - - // Other task clean-up. - comDriver.stop(); - (void)comDriver.join(); - - // Resource deallocation - cmdSeq.deallocateBuffer(mallocator); - commsBufferManager.cleanup(); - frameAccumulator.cleanup(); + tearDownComponents(state); } } // namespace Ref diff --git a/Ref/Top/RefTopologyDefs.hpp b/Ref/Top/RefTopologyDefs.hpp index 2907f626048..2a146c15dd1 100644 --- a/Ref/Top/RefTopologyDefs.hpp +++ b/Ref/Top/RefTopologyDefs.hpp @@ -16,9 +16,24 @@ #include "Ref/Top/FppConstantsAc.hpp" #include "Svc/Health/Health.hpp" -// Subtopology PingEntries includes -#include "Svc/Subtopologies/CDHCore/PingEntries.hpp" +// Subtopology PingEntries includes +#include "Svc/Subtopologies/CdhCore/PingEntries.hpp" +#include "Svc/Subtopologies/ComCcsds/PingEntries.hpp" +#include "Svc/Subtopologies/DataProducts/PingEntries.hpp" +#include "Svc/Subtopologies/FileHandling/PingEntries.hpp" +// SubtopologyTopologyDefs includes +#include "Svc/Subtopologies/ComCcsds/SubtopologyTopologyDefs.hpp" +#include "Svc/Subtopologies/DataProducts/SubtopologyTopologyDefs.hpp" +#include "Svc/Subtopologies/FileHandling/SubtopologyTopologyDefs.hpp" + +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 PingEntries /** * \brief required ping constants * @@ -38,19 +53,6 @@ * } * ``` */ -namespace PingEntries { - namespace Ref_blockDrv {enum { WARN = 3, FATAL = 5 };} - namespace Ref_cmdSeq {enum { WARN = 3, FATAL = 5 };} - namespace Ref_fileDownlink {enum { WARN = 3, FATAL = 5 };} - namespace Ref_fileManager {enum { WARN = 3, FATAL = 5 };} - namespace Ref_fileUplink {enum { WARN = 3, FATAL = 5 };} - namespace Ref_pingRcvr {enum { WARN = 3, FATAL = 5 };} - namespace Ref_prmDb {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_dpCat {enum { WARN = 3, FATAL = 5 };} -} // namespace PingEntries // Definitions are placed within a namespace named after the deployment namespace Ref { @@ -64,8 +66,7 @@ namespace Ref { * fields, which are derived by command line inputs. */ struct TopologyState { - const char* hostname; - U16 port; + ComCcsds::SubtopologyState comCcsds; //!< Subtopology state for ComCcsds }; namespace PingEntries = ::PingEntries; diff --git a/Ref/Top/instances.fpp b/Ref/Top/instances.fpp index 8b5ceb107fe..f3f3786c537 100644 --- a/Ref/Top/instances.fpp +++ b/Ref/Top/instances.fpp @@ -33,58 +33,12 @@ module Ref { stack size Default.STACK_SIZE \ priority 118 - instance cmdSeq: Svc.CmdSequencer base id 0x0500 \ + instance pingRcvr: Ref.PingReceiver base id 0x0A00 \ queue size Default.QUEUE_SIZE \ stack size Default.STACK_SIZE \ priority 100 - instance fileDownlink: Svc.FileDownlink base id 0x0600 \ - queue size 30 \ - stack size Default.STACK_SIZE \ - priority 100 - - instance fileManager: Svc.FileManager base id 0x0700 \ - queue size 30 \ - stack size Default.STACK_SIZE \ - priority 100 - - instance fileUplink: Svc.FileUplink base id 0x0800 \ - queue size 30 \ - stack size Default.STACK_SIZE \ - priority 100 - - instance pingRcvr: Ref.PingReceiver base id 0x0900 \ - queue size Default.QUEUE_SIZE \ - stack size Default.STACK_SIZE \ - priority 100 - - instance prmDb: Svc.PrmDb base id 0x0A00 \ - queue size Default.QUEUE_SIZE \ - stack size Default.STACK_SIZE \ - priority 96 - - instance dpCat: Svc.DpCatalog base id 0x0B00 \ - queue size Default.QUEUE_SIZE \ - stack size Default.STACK_SIZE \ - priority 96 - - instance dpMgr: Svc.DpManager base id 0x0C00 \ - queue size Default.QUEUE_SIZE \ - stack size Default.STACK_SIZE \ - priority 96 - - instance dpWriter: Svc.DpWriter base id 0x0D00 \ - queue size Default.QUEUE_SIZE \ - stack size Default.STACK_SIZE \ - priority 96 - - # ComQueue has a deeper queue to be resilient to spikes in com throughput - instance comQueue: Svc.ComQueue base id 0x0E00 \ - queue size 50 \ - stack size Default.STACK_SIZE \ - priority 100 - - instance typeDemo: Ref.TypeDemo base id 0x0F00 + instance typeDemo: Ref.TypeDemo base id 0x1200 # ---------------------------------------------------------------------- # Queued component instances @@ -112,11 +66,6 @@ module Ref { # Passive component instances # ---------------------------------------------------------------------- - @ Communications driver. May be swapped with other comm drivers like UART - instance comDriver: Drv.TcpClient base id 0x4100 - - instance commsBufferManager: Svc.BufferManager base id 0x4200 - instance posixTime: Svc.PosixTime base id 0x4300 instance rateGroupDriverComp: Svc.RateGroupDriver base id 0x4400 @@ -125,25 +74,6 @@ module Ref { instance systemResources: Svc.SystemResources base id 0x4600 - instance dpBufferManager: Svc.BufferManager base id 0x4700 - - instance frameAccumulator: Svc.FrameAccumulator base id 0x4800 - - instance tcDeframer: Svc.Ccsds.TcDeframer base id 0x4900 - - instance spacePacketDeframer: Svc.Ccsds.SpacePacketDeframer base id 0x4A00 - - instance tmFramer: Svc.Ccsds.TmFramer base id 0x4B00 - - instance spacePacketFramer: Svc.Ccsds.SpacePacketFramer base id 0x4C00 - - instance fprimeRouter: Svc.FprimeRouter base id 0x4D00 - - instance apidManager: Svc.Ccsds.ApidManager base id 0x4E00 - - instance comStub: Svc.ComStub base id 0x4F00 - instance linuxTimer: Svc.LinuxTimer base id 0x5000 - } diff --git a/Ref/Top/topology.fpp b/Ref/Top/topology.fpp index 43392ff26bd..1154c5cb2e7 100644 --- a/Ref/Top/topology.fpp +++ b/Ref/Top/topology.fpp @@ -10,21 +10,17 @@ module Ref { rateGroup3 } - enum Ports_ComPacketQueue { - EVENTS, - TELEMETRY - } - enum Ports_ComBufferQueue { - FILE_DOWNLINK - } topology Ref { # ---------------------------------------------------------------------- # Subtopology imports # ---------------------------------------------------------------------- - import CDHCore.Subtopology - + import CdhCore.Subtopology + import ComCcsds.Subtopology + import FileHandling.Subtopology + import DataProducts.Subtopology + # ---------------------------------------------------------------------- # Instances used in the topology # ---------------------------------------------------------------------- @@ -35,53 +31,33 @@ module Ref { instance SG4 instance SG5 instance blockDrv - instance cmdSeq - instance comDriver - instance comStub - instance comQueue - instance tcDeframer - instance spacePacketDeframer - instance tmFramer - instance spacePacketFramer - instance fileDownlink - instance fileManager - instance fileUplink - instance commsBufferManager - instance frameAccumulator - instance apidManager instance posixTime instance pingRcvr - instance prmDb instance rateGroup1Comp instance rateGroup2Comp instance rateGroup3Comp instance rateGroupDriverComp instance recvBuffComp - instance fprimeRouter instance sendBuffComp instance typeDemo instance systemResources - instance dpCat - instance dpMgr - instance dpWriter - instance dpBufferManager instance linuxTimer # ---------------------------------------------------------------------- # Pattern graph specifiers # ---------------------------------------------------------------------- - command connections instance CDHCore.cmdDisp + command connections instance CdhCore.cmdDisp - event connections instance CDHCore.events + event connections instance CdhCore.events - telemetry connections instance CDHCore.tlmSend + telemetry connections instance CdhCore.tlmSend - health connections instance CDHCore.$health + text event connections instance CdhCore.textLogger - text event connections instance CDHCore.textLogger + health connections instance CdhCore.$health - param connections instance prmDb + param connections instance FileHandling.prmDb time connections instance posixTime @@ -95,38 +71,6 @@ module Ref { # Direct graph specifiers # ---------------------------------------------------------------------- - connections Downlink { - # Data Products - dpCat.fileOut -> fileDownlink.SendFile - fileDownlink.FileComplete -> dpCat.fileDone - # Inputs to ComQueue (events, telemetry, file) - CDHCore.events.PktSend -> comQueue.comPacketQueueIn[Ports_ComPacketQueue.EVENTS] - CDHCore.tlmSend.PktSend -> comQueue.comPacketQueueIn[Ports_ComPacketQueue.TELEMETRY] - fileDownlink.bufferSendOut -> comQueue.bufferQueueIn[Ports_ComBufferQueue.FILE_DOWNLINK] - comQueue.bufferReturnOut[Ports_ComBufferQueue.FILE_DOWNLINK] -> fileDownlink.bufferReturn - # ComQueue <-> SpacePacketFramer - comQueue.dataOut -> spacePacketFramer.dataIn - spacePacketFramer.dataReturnOut -> comQueue.dataReturnIn - # SpacePacketFramer buffer and APID management - spacePacketFramer.bufferAllocate -> commsBufferManager.bufferGetCallee - 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 - # ComStub <-> ComDriver - comStub.drvSendOut -> comDriver.$send - comDriver.sendReturnOut -> comStub.drvSendReturnIn - comDriver.ready -> comStub.drvConnected - # ComStatus - comStub.comStatusOut -> tmFramer.comStatusIn - tmFramer.comStatusOut -> spacePacketFramer.comStatusIn - spacePacketFramer.comStatusOut -> comQueue.comStatusIn - } - connections RateGroups { # Linux timer to drive cycle @@ -136,89 +80,70 @@ module Ref { rateGroupDriverComp.CycleOut[Ports_RateGroups.rateGroup1] -> rateGroup1Comp.CycleIn rateGroup1Comp.RateGroupMemberOut[0] -> SG1.schedIn rateGroup1Comp.RateGroupMemberOut[1] -> SG2.schedIn - rateGroup1Comp.RateGroupMemberOut[2] -> CDHCore.tlmSend.Run - rateGroup1Comp.RateGroupMemberOut[3] -> fileDownlink.Run + rateGroup1Comp.RateGroupMemberOut[2] -> CdhCore.tlmSend.Run + rateGroup1Comp.RateGroupMemberOut[3] -> FileHandling.fileDownlink.Run rateGroup1Comp.RateGroupMemberOut[4] -> systemResources.run - rateGroup1Comp.RateGroupMemberOut[5] -> comQueue.run + rateGroup1Comp.RateGroupMemberOut[5] -> ComCcsds.comQueue.run # Rate group 2 rateGroupDriverComp.CycleOut[Ports_RateGroups.rateGroup2] -> rateGroup2Comp.CycleIn - rateGroup2Comp.RateGroupMemberOut[0] -> cmdSeq.schedIn + rateGroup2Comp.RateGroupMemberOut[0] -> ComCcsds.cmdSeq.schedIn rateGroup2Comp.RateGroupMemberOut[1] -> sendBuffComp.SchedIn rateGroup2Comp.RateGroupMemberOut[2] -> SG3.schedIn rateGroup2Comp.RateGroupMemberOut[3] -> SG4.schedIn # Rate group 3 rateGroupDriverComp.CycleOut[Ports_RateGroups.rateGroup3] -> rateGroup3Comp.CycleIn - rateGroup3Comp.RateGroupMemberOut[0] -> CDHCore.$health.Run + rateGroup3Comp.RateGroupMemberOut[0] -> CdhCore.$health.Run rateGroup3Comp.RateGroupMemberOut[1] -> SG5.schedIn rateGroup3Comp.RateGroupMemberOut[2] -> blockDrv.Sched - rateGroup3Comp.RateGroupMemberOut[3] -> commsBufferManager.schedIn - rateGroup3Comp.RateGroupMemberOut[4] -> dpBufferManager.schedIn - rateGroup3Comp.RateGroupMemberOut[5] -> dpWriter.schedIn - rateGroup3Comp.RateGroupMemberOut[6] -> dpMgr.schedIn + rateGroup3Comp.RateGroupMemberOut[3] -> ComCcsds.commsBufferManager.schedIn + rateGroup3Comp.RateGroupMemberOut[4] -> DataProducts.dpBufferManager.schedIn + rateGroup3Comp.RateGroupMemberOut[5] -> DataProducts.dpWriter.schedIn + rateGroup3Comp.RateGroupMemberOut[6] -> DataProducts.dpMgr.schedIn } connections Ref { sendBuffComp.Data -> blockDrv.BufferIn blockDrv.BufferOut -> recvBuffComp.Data - } - connections Sequencer { - cmdSeq.comCmdOut -> CDHCore.cmdDisp.seqCmdBuff - CDHCore.cmdDisp.seqCmdStatus -> cmdSeq.cmdResponseIn - } + ### Moved this out of DataProducts Subtopology --> anything specific to deployment should live in Ref connections + # Synchronous request. Will have both request kinds for demo purposes, not typical + SG1.productGetOut -> DataProducts.dpMgr.productGetIn + # Asynchronous request + SG1.productRequestOut -> DataProducts.dpMgr.productRequestIn + DataProducts.dpMgr.productResponseOut -> SG1.productRecvIn + # Send filled DP + SG1.productSendOut -> DataProducts.dpMgr.productSendIn - connections Uplink { - # ComDriver buffer allocations - comDriver.allocate -> commsBufferManager.bufferGetCallee - comDriver.deallocate -> commsBufferManager.bufferSendIn - # ComDriver <-> ComStub - comDriver.$recv -> comStub.drvReceiveIn - comStub.drvReceiveReturnOut -> comDriver.recvReturnIn - # ComStub <-> FrameAccumulator - comStub.dataOut -> frameAccumulator.dataIn - frameAccumulator.dataReturnOut -> comStub.dataReturnIn - # FrameAccumulator buffer allocations - frameAccumulator.bufferDeallocate -> commsBufferManager.bufferSendIn - frameAccumulator.bufferAllocate -> commsBufferManager.bufferGetCallee - # FrameAccumulator <-> Deframer - frameAccumulator.dataOut -> tcDeframer.dataIn - tcDeframer.dataReturnOut -> frameAccumulator.dataReturnIn - # TcDeframer <-> SpacePacketDeframer - tcDeframer.dataOut -> spacePacketDeframer.dataIn - spacePacketDeframer.dataReturnOut -> tcDeframer.dataReturnIn - # SpacePacketDeframer APID validation - spacePacketDeframer.validateApidSeqCount -> apidManager.validateApidSeqCountIn - # SpacePacketDeframer <-> Router - spacePacketDeframer.dataOut -> fprimeRouter.dataIn - fprimeRouter.dataReturnOut -> spacePacketDeframer.dataReturnIn - # Router buffer allocations - fprimeRouter.bufferAllocate -> commsBufferManager.bufferGetCallee - fprimeRouter.bufferDeallocate -> commsBufferManager.bufferSendIn - # Router <-> CmdDispatcher/FileUplink - fprimeRouter.commandOut -> CDHCore.cmdDisp.seqCmdBuff - CDHCore.cmdDisp.seqCmdStatus -> fprimeRouter.cmdResponseIn - fprimeRouter.fileOut -> fileUplink.bufferSendIn - fileUplink.bufferSendOut -> fprimeRouter.fileBufferReturnIn } - connections DataProducts { - # DpMgr and DpWriter connections. Have explicit port indexes for demo - dpMgr.bufferGetOut[0] -> dpBufferManager.bufferGetCallee - dpMgr.productSendOut[0] -> dpWriter.bufferSendIn - dpWriter.deallocBufferSendOut -> dpBufferManager.bufferSendIn + connections ComCcsds_CdhCore{ + # events and telemetry to comQueue + CdhCore.events.PktSend -> ComCcsds.comQueue.comPacketQueueIn[ComCcsds.Ports_ComPacketQueue.EVENTS] + CdhCore.tlmSend.PktSend -> ComCcsds.comQueue.comPacketQueueIn[ComCcsds.Ports_ComPacketQueue.TELEMETRY] - # Component DP connections + # Router <-> CmdDispatcher + ComCcsds.fprimeRouter.commandOut -> CdhCore.cmdDisp.seqCmdBuff + CdhCore.cmdDisp.seqCmdStatus -> ComCcsds.fprimeRouter.cmdResponseIn + ComCcsds.cmdSeq.comCmdOut -> CdhCore.cmdDisp.seqCmdBuff + CdhCore.cmdDisp.seqCmdStatus -> ComCcsds.cmdSeq.cmdResponseIn + } - # Synchronous request. Will have both request kinds for demo purposes, not typical - SG1.productGetOut -> dpMgr.productGetIn[0] - # Asynchronous request - SG1.productRequestOut -> dpMgr.productRequestIn[0] - dpMgr.productResponseOut[0] -> SG1.productRecvIn - # Send filled DP - SG1.productSendOut -> dpMgr.productSendIn[0] + connections ComCcsds_FileHandling { + # File Downlink <-> ComQueue + FileHandling.fileDownlink.bufferSendOut -> ComCcsds.comQueue.bufferQueueIn[FileHandling.Ports_ComBufferQueue.FILE_DOWNLINK] + ComCcsds.comQueue.bufferReturnOut[FileHandling.Ports_ComBufferQueue.FILE_DOWNLINK] -> FileHandling.fileDownlink.bufferReturn + + # Router <-> FileUplink + ComCcsds.fprimeRouter.fileOut -> FileHandling.fileUplink.bufferSendIn + FileHandling.fileUplink.bufferSendOut -> ComCcsds.fprimeRouter.fileBufferReturnIn + } + connections FileHandling_DataProducts{ + # Data Products + DataProducts.dpCat.fileOut -> FileHandling.fileDownlink.SendFile + FileHandling.fileDownlink.FileComplete -> DataProducts.dpCat.fileDone } } diff --git a/Ref/test/int/ref_integration_test.py b/Ref/test/int/ref_integration_test.py index 9827a46a0d0..ebf2fc63d02 100644 --- a/Ref/test/int/ref_integration_test.py +++ b/Ref/test/int/ref_integration_test.py @@ -57,7 +57,7 @@ def set_event_filter(fprime_test_api, severity, enabled): severity = FilterSeverity[severity].name try: fprime_test_api.send_command( - "CDHCore.events.SET_EVENT_FILTER", + "CdhCore.events.SET_EVENT_FILTER", [severity, enabled], ) return True @@ -80,9 +80,9 @@ def test_send_command(fprime_test_api): Tests command send, dispatch, and receipt using send_and_assert command with a pair of NO-OP commands. """ - fprime_test_api.send_and_assert_command("CDHCore.cmdDisp.CMD_NO_OP", max_delay=0.1) + fprime_test_api.send_and_assert_command("CdhCore.cmdDisp.CMD_NO_OP", max_delay=0.1) assert fprime_test_api.get_command_test_history().size() == 1 - fprime_test_api.send_and_assert_command("CDHCore.cmdDisp.CMD_NO_OP", max_delay=0.1) + fprime_test_api.send_and_assert_command("CdhCore.cmdDisp.CMD_NO_OP", max_delay=0.1) assert fprime_test_api.get_command_test_history().size() == 2 @@ -94,11 +94,11 @@ def test_send_command_args(fprime_test_api): for count, value in enumerate(["Test String 1", "Some other string"], 1): events = [ fprime_test_api.get_event_pred( - "CDHCore.cmdDisp.NoOpStringReceived", [value] + "CdhCore.cmdDisp.NoOpStringReceived", [value] ) ] fprime_test_api.send_and_assert_command( - "CDHCore.cmdDisp.CMD_NO_OP_STRING", + "CdhCore.cmdDisp.CMD_NO_OP_STRING", [ value, ], @@ -117,15 +117,15 @@ def test_send_and_assert_no_op(fprime_test_api): length = 100 failed = 0 evr_seq = [ - "CDHCore.cmdDisp.OpCodeDispatched", - "CDHCore.cmdDisp.NoOpReceived", - "CDHCore.cmdDisp.OpCodeCompleted", + "CdhCore.cmdDisp.OpCodeDispatched", + "CdhCore.cmdDisp.NoOpReceived", + "CdhCore.cmdDisp.OpCodeCompleted", ] any_reordered = False dropped = False for i in range(0, length): results = fprime_test_api.send_and_await_event( - "CDHCore.cmdDisp.CMD_NO_OP", events=evr_seq, timeout=25 + "CdhCore.cmdDisp.CMD_NO_OP", events=evr_seq, timeout=25 ) msg = "Send and assert NO_OP Trial #{}".format(i) if not fprime_test_api.test_assert(len(results) == 3, msg, True): @@ -232,8 +232,8 @@ def test_active_logger_filter(fprime_test_api): # Drain time for dispatch events time.sleep(10) - fprime_test_api.send_and_assert_command("CDHCore.cmdDisp.CMD_NO_OP") - fprime_test_api.send_and_assert_command("CDHCore.cmdDisp.CMD_NO_OP") + fprime_test_api.send_and_assert_command("CdhCore.cmdDisp.CMD_NO_OP") + fprime_test_api.send_and_assert_command("CdhCore.cmdDisp.CMD_NO_OP") time.sleep(0.5) @@ -244,8 +244,8 @@ def test_active_logger_filter(fprime_test_api): # Drain time for dispatch events time.sleep(10) fprime_test_api.clear_histories() - fprime_test_api.send_command("CDHCore.cmdDisp.CMD_NO_OP") - fprime_test_api.send_command("CDHCore.cmdDisp.CMD_NO_OP") + fprime_test_api.send_command("CdhCore.cmdDisp.CMD_NO_OP") + fprime_test_api.send_command("CdhCore.cmdDisp.CMD_NO_OP") time.sleep(0.5) @@ -285,5 +285,5 @@ def test_seqgen(fprime_test_api): == 0 ), "Failed to run fprime-seqgen" fprime_test_api.send_and_assert_command( - "Ref.cmdSeq.CS_RUN", args=["/tmp/ref_test_int.bin", "BLOCK"], max_delay=5 + "ComCcsds.cmdSeq.CS_RUN", args=["/tmp/ref_test_int.bin", "BLOCK"], max_delay=5 ) diff --git a/Ref/test/int/test_seq.seq b/Ref/test/int/test_seq.seq index bc45caf026e..5f93c9c611b 100644 --- a/Ref/test/int/test_seq.seq +++ b/Ref/test/int/test_seq.seq @@ -1,6 +1,6 @@ ; A test sequence ; -R00:00:00 CDHCore.cmdDisp.CMD_NO_OP +R00:00:00 CdhCore.cmdDisp.CMD_NO_OP ; Let's try out some commands with arguments -R00:00:01.050 CDHCore.cmdDisp.CMD_NO_OP_STRING "Awesome string!"; +R00:00:01.050 CdhCore.cmdDisp.CMD_NO_OP_STRING "Awesome string!"; diff --git a/Svc/Subtopologies/CDHCore/CDHCoreConfig/CDHCoreConfig.fpp b/Svc/Subtopologies/CDHCore/CDHCoreConfig/CDHCoreConfig.fpp deleted file mode 100644 index c08b0c37ba3..00000000000 --- a/Svc/Subtopologies/CDHCore/CDHCoreConfig/CDHCoreConfig.fpp +++ /dev/null @@ -1,56 +0,0 @@ -module CDHCoreConfig { - #Base ID for the CDHCore Subtopology, all components are offsets from this base ID - constant BASE_ID = 0x3000 - - module QueueSizes { - constant cmdDisp = 10 - constant events = 10 - constant tlmSend = 10 - constant $health = 25 - } - - - module StackSizes { - constant cmdDisp = 64 * 1024 - constant events = 64 * 1024 - constant tlmSend = 64 * 1024 - } - - module Priorities { - constant cmdDisp = 102 - constant $health = 101 - constant events = 100 - constant tlmSend = 99 - - } -} - - -module CDHCore { - - instance tlmSend: Svc.TlmChan base id CDHCoreConfig.BASE_ID + 0x0700 \ - queue size CDHCoreConfig.QueueSizes.tlmSend \ - stack size CDHCoreConfig.StackSizes.tlmSend \ - priority CDHCoreConfig.Priorities.tlmSend \ - - # Uncomment the following block and comment the above block to use TlmPacketizer instead of TlmChan - #instance tlmSend: Svc.TlmPacketizer base id CDHCoreConfig.BASE_ID + 0x0700 \ - # queue size CDHCoreConfig.QueueSizes.tlmSend \ - # stack size CDHCoreConfig.StackSizes.tlmSend \ - # priority CDHCoreConfig.Priorities.tlmSend \ - #{ - # # NOTE: The Name Ref is specific to the Reference deployment, Ref - # # This name will need to be updated if wishing to use this in a custom deployment - # phase Fpp.ToCpp.Phases.configComponents """ - # CDHCore::tlmSend.setPacketList( - # Ref::Ref_RefPacketsTlmPackets::packetList, - # Ref::Ref_RefPacketsTlmPackets::omittedChannels, - # 1 - # ); - # """ - #} - - # Update this as a custom fatal handler if needed - instance fatalHandler: Svc.FatalHandler base id CDHCoreConfig.BASE_ID + 0x0800 - -} \ No newline at end of file diff --git a/Svc/Subtopologies/CDHCore/CDHCoreConfig/CMakeLists.txt b/Svc/Subtopologies/CDHCore/CDHCoreConfig/CMakeLists.txt deleted file mode 100644 index 8c5fe3c039a..00000000000 --- a/Svc/Subtopologies/CDHCore/CDHCoreConfig/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -register_fprime_module( - AUTOCODER_INPUTS - "${CMAKE_CURRENT_LIST_DIR}/CDHCoreConfig.fpp" - INTERFACE -) diff --git a/Svc/Subtopologies/CDHCore/CMakeLists.txt b/Svc/Subtopologies/CDHCore/CMakeLists.txt deleted file mode 100644 index d6d812a8e7b..00000000000 --- a/Svc/Subtopologies/CDHCore/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/CDHCoreConfig/") - -register_fprime_module( - AUTOCODER_INPUTS - "${CMAKE_CURRENT_LIST_DIR}/CDHCore.fpp" - HEADERS - "${CMAKE_CURRENT_LIST_DIR}/PingEntries.hpp" - INTERFACE -) diff --git a/Svc/Subtopologies/CDHCore/PingEntries.hpp b/Svc/Subtopologies/CDHCore/PingEntries.hpp deleted file mode 100644 index 94316250fea..00000000000 --- a/Svc/Subtopologies/CDHCore/PingEntries.hpp +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef CDHCORE_PINGENTRIES_HPP -#define CDHCORE_PINGENTRIES_HPP - - namespace PingEntries { - struct CDHCore_cmdDisp { enum { WARN=3, FATAL=5 }; }; - struct CDHCore_events { enum { WARN=3, FATAL=5 }; }; - struct CDHCore_tlmSend { enum { WARN=3, FATAL=5 }; }; - } - -#endif diff --git a/Svc/Subtopologies/CMakeLists.txt b/Svc/Subtopologies/CMakeLists.txt index e97b2bfb41a..08a05ef41f7 100644 --- a/Svc/Subtopologies/CMakeLists.txt +++ b/Svc/Subtopologies/CMakeLists.txt @@ -1,2 +1,5 @@ -add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/CDHCore/") - +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/CdhCore/") +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ComCcsds/") +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ComFprime/") +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/FileHandling/") +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/DataProducts/") diff --git a/Svc/Subtopologies/CdhCore/CMakeLists.txt b/Svc/Subtopologies/CdhCore/CMakeLists.txt new file mode 100644 index 00000000000..4485f2b5744 --- /dev/null +++ b/Svc/Subtopologies/CdhCore/CMakeLists.txt @@ -0,0 +1,11 @@ +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/CdhCoreConfig/") + +register_fprime_module( + AUTOCODER_INPUTS + "${CMAKE_CURRENT_LIST_DIR}/CdhCore.fpp" + HEADERS + "${CMAKE_CURRENT_LIST_DIR}/PingEntries.hpp" + INTERFACE + DEPENDS + Svc_Subtopologies_CdhCore_CdhCoreConfig +) diff --git a/Svc/Subtopologies/CDHCore/CDHCore.fpp b/Svc/Subtopologies/CdhCore/CdhCore.fpp similarity index 59% rename from Svc/Subtopologies/CDHCore/CDHCore.fpp rename to Svc/Subtopologies/CdhCore/CdhCore.fpp index a778fd72d70..9dec9db1726 100644 --- a/Svc/Subtopologies/CDHCore/CDHCore.fpp +++ b/Svc/Subtopologies/CdhCore/CdhCore.fpp @@ -1,22 +1,22 @@ -module CDHCore { +module CdhCore { # ---------------------------------------------------------------------- # Active Components # ---------------------------------------------------------------------- - instance cmdDisp: Svc.CommandDispatcher base id CDHCoreConfig.BASE_ID + 0x0100 \ - queue size CDHCoreConfig.QueueSizes.cmdDisp \ - stack size CDHCoreConfig.StackSizes.cmdDisp \ - priority CDHCoreConfig.Priorities.cmdDisp + instance cmdDisp: Svc.CommandDispatcher base id CdhCoreConfig.BASE_ID + 0x0100 \ + queue size CdhCoreConfig.QueueSizes.cmdDisp \ + stack size CdhCoreConfig.StackSizes.cmdDisp \ + priority CdhCoreConfig.Priorities.cmdDisp - instance events: Svc.ActiveLogger base id CDHCoreConfig.BASE_ID + 0x0200 \ - queue size CDHCoreConfig.QueueSizes.events \ - stack size CDHCoreConfig.StackSizes.events \ - priority CDHCoreConfig.Priorities.events + instance events: Svc.ActiveLogger base id CdhCoreConfig.BASE_ID + 0x0200 \ + queue size CdhCoreConfig.QueueSizes.events \ + stack size CdhCoreConfig.StackSizes.events \ + priority CdhCoreConfig.Priorities.events # ---------------------------------------------------------------------- # Queued Components # ---------------------------------------------------------------------- - instance $health: Svc.Health base id CDHCoreConfig.BASE_ID + 0x0300 \ - queue size CDHCoreConfig.QueueSizes.$health \ + instance $health: Svc.Health base id CdhCoreConfig.BASE_ID + 0x0300 \ + queue size CdhCoreConfig.QueueSizes.$health \ { phase Fpp.ToCpp.Phases.configConstants """ enum { @@ -25,10 +25,10 @@ module CDHCore { """ phase Fpp.ToCpp.Phases.configComponents """ // Health is supplied a set of ping entires. - CDHCore::health.setPingEntries( - ConfigObjects::CDHCore_health::pingEntries, - FW_NUM_ARRAY_ELEMENTS(ConfigObjects::CDHCore_health::pingEntries), - ConfigConstants::CDHCore_health::HEALTH_WATCHDOG_CODE + CdhCore::health.setPingEntries( + ConfigObjects::CdhCore_health::pingEntries, + FW_NUM_ARRAY_ELEMENTS(ConfigObjects::CdhCore_health::pingEntries), + ConfigConstants::CdhCore_health::HEALTH_WATCHDOG_CODE ); """ } @@ -36,17 +36,17 @@ module CDHCore { # ---------------------------------------------------------------------- # Passive Components # ---------------------------------------------------------------------- - instance version: Svc.Version base id CDHCoreConfig.BASE_ID + 0x0400 \ + instance version: Svc.Version base id CdhCoreConfig.BASE_ID + 0x0400 \ { phase Fpp.ToCpp.Phases.configComponents """ // Startup TLM and Config verbosity for Versions - CDHCore::version.config(true); + CdhCore::version.config(true); """ } - instance textLogger: Svc.PassiveTextLogger base id CDHCoreConfig.BASE_ID + 0x0500 + instance textLogger: Svc.PassiveTextLogger base id CdhCoreConfig.BASE_ID + 0x0500 - instance fatalAdapter: Svc.AssertFatalAdapter base id CDHCoreConfig.BASE_ID + 0x0600 + instance fatalAdapter: Svc.AssertFatalAdapter base id CdhCoreConfig.BASE_ID + 0x0600 topology Subtopology { #Active Components @@ -68,4 +68,4 @@ module CDHCore { } } # end topology -} # end CDHCore Subtopology \ No newline at end of file +} # end CdhCore Subtopology diff --git a/Svc/Subtopologies/CdhCore/CdhCoreConfig/CMakeLists.txt b/Svc/Subtopologies/CdhCore/CdhCoreConfig/CMakeLists.txt new file mode 100644 index 00000000000..90315c71f2e --- /dev/null +++ b/Svc/Subtopologies/CdhCore/CdhCoreConfig/CMakeLists.txt @@ -0,0 +1,7 @@ +register_fprime_config( + AUTOCODER_INPUTS + "${CMAKE_CURRENT_LIST_DIR}/CdhCoreConfig.fpp" + "${CMAKE_CURRENT_LIST_DIR}/CdhCoreFatalHandlerConfig.fpp" + "${CMAKE_CURRENT_LIST_DIR}/CdhCoreTlmConfig.fpp" + INTERFACE +) diff --git a/Svc/Subtopologies/CdhCore/CdhCoreConfig/CdhCoreConfig.fpp b/Svc/Subtopologies/CdhCore/CdhCoreConfig/CdhCoreConfig.fpp new file mode 100644 index 00000000000..43191eaffaf --- /dev/null +++ b/Svc/Subtopologies/CdhCore/CdhCoreConfig/CdhCoreConfig.fpp @@ -0,0 +1,26 @@ +module CdhCoreConfig { + #Base ID for the CdhCore Subtopology, all components are offsets from this base ID + constant BASE_ID = 0x6000 + + module QueueSizes { + constant cmdDisp = 10 + constant events = 10 + constant tlmSend = 10 + constant $health = 25 + } + + + module StackSizes { + constant cmdDisp = 64 * 1024 + constant events = 64 * 1024 + constant tlmSend = 64 * 1024 + } + + module Priorities { + constant cmdDisp = 102 + constant $health = 101 + constant events = 100 + constant tlmSend = 99 + + } +} diff --git a/Svc/Subtopologies/CdhCore/CdhCoreConfig/CdhCoreFatalHandlerConfig.fpp b/Svc/Subtopologies/CdhCore/CdhCoreConfig/CdhCoreFatalHandlerConfig.fpp new file mode 100644 index 00000000000..76a0df61625 --- /dev/null +++ b/Svc/Subtopologies/CdhCore/CdhCoreConfig/CdhCoreFatalHandlerConfig.fpp @@ -0,0 +1,6 @@ +module CdhCore { + + # Update this as a custom fatal handler if needed + instance fatalHandler: Svc.FatalHandler base id CdhCoreConfig.BASE_ID + 0x0800 + +} diff --git a/Svc/Subtopologies/CdhCore/CdhCoreConfig/CdhCoreTlmConfig.fpp b/Svc/Subtopologies/CdhCore/CdhCoreConfig/CdhCoreTlmConfig.fpp new file mode 100644 index 00000000000..30b2ba36b75 --- /dev/null +++ b/Svc/Subtopologies/CdhCore/CdhCoreConfig/CdhCoreTlmConfig.fpp @@ -0,0 +1,24 @@ +module CdhCore{ + + instance tlmSend: Svc.TlmChan base id CdhCoreConfig.BASE_ID + 0x0700 \ + queue size CdhCoreConfig.QueueSizes.tlmSend \ + stack size CdhCoreConfig.StackSizes.tlmSend \ + priority CdhCoreConfig.Priorities.tlmSend \ + + # Uncomment the following block and comment the above block to use TlmPacketizer instead of TlmChan + #instance tlmSend: Svc.TlmPacketizer base id CdhCoreConfig.BASE_ID + 0x0700 \ + # queue size CdhCoreConfig.QueueSizes.tlmSend \ + # stack size CdhCoreConfig.StackSizes.tlmSend \ + # priority CdhCoreConfig.Priorities.tlmSend \ + #{ + # # NOTE: The Name Ref is specific to the Reference deployment, Ref + # # This name will need to be updated if wishing to use this in a custom deployment + # phase Fpp.ToCpp.Phases.configComponents """ + # CdhCore::tlmSend.setPacketList( + # Ref::Ref_RefPacketsTlmPackets::packetList, + # Ref::Ref_RefPacketsTlmPackets::omittedChannels, + # 1 + # ); + # """ + #} +} diff --git a/Svc/Subtopologies/CdhCore/PingEntries.hpp b/Svc/Subtopologies/CdhCore/PingEntries.hpp new file mode 100644 index 00000000000..39756520fc0 --- /dev/null +++ b/Svc/Subtopologies/CdhCore/PingEntries.hpp @@ -0,0 +1,10 @@ +#ifndef CDHCORE_PINGENTRIES_HPP +#define CDHCORE_PINGENTRIES_HPP + + namespace PingEntries { + struct CdhCore_cmdDisp { enum { WARN=3, FATAL=5 }; }; + struct CdhCore_events { enum { WARN=3, FATAL=5 }; }; + struct CdhCore_tlmSend { enum { WARN=3, FATAL=5 }; }; + } + +#endif diff --git a/Svc/Subtopologies/ComCcsds/CMakeLists.txt b/Svc/Subtopologies/ComCcsds/CMakeLists.txt new file mode 100644 index 00000000000..e1e0e6715ce --- /dev/null +++ b/Svc/Subtopologies/ComCcsds/CMakeLists.txt @@ -0,0 +1,12 @@ +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ComCcsdsConfig/") + +register_fprime_module( + AUTOCODER_INPUTS + "${CMAKE_CURRENT_LIST_DIR}/ComCcsds.fpp" + HEADERS + "${CMAKE_CURRENT_LIST_DIR}/SubtopologyTopologyDefs.hpp" + "${CMAKE_CURRENT_LIST_DIR}/PingEntries.hpp" + DEPENDS + Svc_Subtopologies_ComCcsds_ComCcsdsConfig + INTERFACE +) diff --git a/Svc/Subtopologies/ComCcsds/ComCcsds.fpp b/Svc/Subtopologies/ComCcsds/ComCcsds.fpp new file mode 100644 index 00000000000..dab7ae12981 --- /dev/null +++ b/Svc/Subtopologies/ComCcsds/ComCcsds.fpp @@ -0,0 +1,198 @@ +module ComCcsds { + + # ComPacket Queue enum for queue types + enum Ports_ComPacketQueue { + EVENTS, + TELEMETRY, + FILE_QUEUE + } + + # ---------------------------------------------------------------------- + # Active Components + # ---------------------------------------------------------------------- + instance comQueue: Svc.ComQueue base id ComCcsdsConfig.BASE_ID + 0x0100 \ + queue size ComCcsdsConfig.QueueSizes.comQueue \ + stack size ComCcsdsConfig.StackSizes.comQueue \ + priority ComCcsdsConfig.Priorities.comQueue \ + { + phase Fpp.ToCpp.Phases.configConstants """ + enum { + EVENTS, + TELEMETRY, + FILE_QUEUE + }; + """ + phase Fpp.ToCpp.Phases.configComponents """ + Svc::ComQueue::QueueConfigurationTable configurationTable; + + // Events (highest-priority) + configurationTable.entries[ConfigConstants::ComCcsds_comQueue::EVENTS].depth = ComCcsdsConfig::QueueDepths::events; + configurationTable.entries[ConfigConstants::ComCcsds_comQueue::EVENTS].priority = ComCcsdsConfig::QueuePriorities::events; + + // Telemetry + configurationTable.entries[ConfigConstants::ComCcsds_comQueue::TELEMETRY].depth = ComCcsdsConfig::QueueDepths::tlm; + configurationTable.entries[ConfigConstants::ComCcsds_comQueue::TELEMETRY].priority = ComCcsdsConfig::QueuePriorities::tlm; + + // File Downlink Queue + configurationTable.entries[ConfigConstants::ComCcsds_comQueue::FILE_QUEUE].depth = ComCcsdsConfig::QueueDepths::file; + configurationTable.entries[ConfigConstants::ComCcsds_comQueue::FILE_QUEUE].priority = ComCcsdsConfig::QueuePriorities::file; + + // Allocation identifier is 0 as the MallocAllocator discards it + ComCcsds::comQueue.configure(configurationTable, 0, ComCcsds::Allocation::memAllocator); + """ + phase Fpp.ToCpp.Phases.tearDownComponents """ + ComCcsds::comQueue.cleanup(); + """ + } + + instance cmdSeq: Svc.CmdSequencer base id ComCcsdsConfig.BASE_ID + 0x0200 \ + queue size ComCcsdsConfig.QueueSizes.cmdSeq \ + stack size ComCcsdsConfig.StackSizes.cmdSeq \ + priority ComCcsdsConfig.Priorities.cmdSeq \ + { + phase Fpp.ToCpp.Phases.configComponents """ + ComCcsds::cmdSeq.allocateBuffer(0, ComCcsds::Allocation::memAllocator, ComCcsdsConfig::BuffMgr::cmdSeqBuffSize); + """ + + phase Fpp.ToCpp.Phases.tearDownComponents """ + ComCcsds::cmdSeq.deallocateBuffer(ComCcsds::Allocation::memAllocator); + """ + } + + # ---------------------------------------------------------------------- + # Passive Components + # ---------------------------------------------------------------------- + instance frameAccumulator: Svc.FrameAccumulator base id ComCcsdsConfig.BASE_ID + 0x0500 \ + { + + phase Fpp.ToCpp.Phases.configObjects """ + Svc::FrameDetectors::CcsdsTcFrameDetector frameDetector; + """ + phase Fpp.ToCpp.Phases.configComponents """ + ComCcsds::frameAccumulator.configure( + ConfigObjects::ComCcsds_frameAccumulator::frameDetector, + 1, + ComCcsds::Allocation::memAllocator, + ComCcsdsConfig::BuffMgr::frameAccumulatorSize + ); + """ + + phase Fpp.ToCpp.Phases.tearDownComponents """ + ComCcsds::frameAccumulator.cleanup(); + """ + } + + instance commsBufferManager: Svc.BufferManager base id ComCcsdsConfig.BASE_ID + 0x0600 \ + { + phase Fpp.ToCpp.Phases.configObjects """ + Svc::BufferManager::BufferBins bins; + """ + + phase Fpp.ToCpp.Phases.configComponents """ + memset(&ConfigObjects::ComCcsds_commsBufferManager::bins, 0, sizeof(ConfigObjects::ComCcsds_commsBufferManager::bins)); + ConfigObjects::ComCcsds_commsBufferManager::bins.bins[0].bufferSize = ComCcsdsConfig::BuffMgr::commsBuffSize; + ConfigObjects::ComCcsds_commsBufferManager::bins.bins[0].numBuffers = ComCcsdsConfig::BuffMgr::commsBuffCount; + ConfigObjects::ComCcsds_commsBufferManager::bins.bins[1].bufferSize = ComCcsdsConfig::BuffMgr::commsFileBuffSize; + ConfigObjects::ComCcsds_commsBufferManager::bins.bins[1].numBuffers = ComCcsdsConfig::BuffMgr::commsFileBuffCount; + ComCcsds::commsBufferManager.setup( + ComCcsdsConfig::BuffMgr::commsBuffMgrId, + 0, + ComCcsds::Allocation::memAllocator, + ConfigObjects::ComCcsds_commsBufferManager::bins + ); + """ + + phase Fpp.ToCpp.Phases.tearDownComponents """ + ComCcsds::commsBufferManager.cleanup(); + """ + } + + instance fprimeRouter: Svc.FprimeRouter base id ComCcsdsConfig.BASE_ID + 0x0700 \ + + instance comStub: Svc.ComStub base id ComCcsdsConfig.BASE_ID + 0x0800 \ + + instance tcDeframer: Svc.Ccsds.TcDeframer base id ComCcsdsConfig.BASE_ID + 0x0900 \ + + instance spacePacketDeframer: Svc.Ccsds.SpacePacketDeframer base id ComCcsdsConfig.BASE_ID + 0x0A00 \ + + instance tmFramer: Svc.Ccsds.TmFramer base id ComCcsdsConfig.BASE_ID + 0x0B00 \ + + instance spacePacketFramer: Svc.Ccsds.SpacePacketFramer base id ComCcsdsConfig.BASE_ID + 0x0C00 \ + + instance apidManager: Svc.Ccsds.ApidManager base id ComCcsdsConfig.BASE_ID + 0x0D00 \ + + topology Subtopology { + # Active Components + instance comQueue + instance cmdSeq + + # Passive Components + instance commsBufferManager + instance frameAccumulator + instance fprimeRouter + instance comStub + instance comDriver + instance tcDeframer + instance spacePacketDeframer + instance tmFramer + instance spacePacketFramer + instance apidManager + + connections Downlink { + + + # ComQueue <-> SpacePacketFramer + comQueue.dataOut -> spacePacketFramer.dataIn + spacePacketFramer.dataReturnOut -> comQueue.dataReturnIn + # SpacePacketFramer buffer and APID management + spacePacketFramer.bufferAllocate -> commsBufferManager.bufferGetCallee + 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 + # ComStub <-> ComDriver + comStub.drvSendOut -> comDriver.$send + comDriver.sendReturnOut -> comStub.drvSendReturnIn + comDriver.ready -> comStub.drvConnected + # ComStatus + comStub.comStatusOut -> tmFramer.comStatusIn + tmFramer.comStatusOut -> spacePacketFramer.comStatusIn + spacePacketFramer.comStatusOut -> comQueue.comStatusIn + } + + connections Uplink { + # ComDriver buffer allocations + comDriver.allocate -> commsBufferManager.bufferGetCallee + comDriver.deallocate -> commsBufferManager.bufferSendIn + # ComDriver <-> ComStub + comDriver.$recv -> comStub.drvReceiveIn + comStub.drvReceiveReturnOut -> comDriver.recvReturnIn + # ComStub <-> FrameAccumulator + comStub.dataOut -> frameAccumulator.dataIn + frameAccumulator.dataReturnOut -> comStub.dataReturnIn + # FrameAccumulator buffer allocations + frameAccumulator.bufferDeallocate -> commsBufferManager.bufferSendIn + frameAccumulator.bufferAllocate -> commsBufferManager.bufferGetCallee + # FrameAccumulator <-> Deframer + frameAccumulator.dataOut -> tcDeframer.dataIn + tcDeframer.dataReturnOut -> frameAccumulator.dataReturnIn + # TcDeframer <-> SpacePacketDeframer + tcDeframer.dataOut -> spacePacketDeframer.dataIn + spacePacketDeframer.dataReturnOut -> tcDeframer.dataReturnIn + # SpacePacketDeframer APID validation + spacePacketDeframer.validateApidSeqCount -> apidManager.validateApidSeqCountIn + # SpacePacketDeframer <-> Router + spacePacketDeframer.dataOut -> fprimeRouter.dataIn + fprimeRouter.dataReturnOut -> spacePacketDeframer.dataReturnIn + # Router buffer allocations + fprimeRouter.bufferAllocate -> commsBufferManager.bufferGetCallee + fprimeRouter.bufferDeallocate -> commsBufferManager.bufferSendIn + + } + + } # end topology +} # end ComCcsds Subtopology diff --git a/Svc/Subtopologies/ComCcsds/ComCcsdsConfig/CMakeLists.txt b/Svc/Subtopologies/ComCcsds/ComCcsdsConfig/CMakeLists.txt new file mode 100644 index 00000000000..81a1eb79a0a --- /dev/null +++ b/Svc/Subtopologies/ComCcsds/ComCcsdsConfig/CMakeLists.txt @@ -0,0 +1,11 @@ +register_fprime_config( + SOURCES + "${CMAKE_CURRENT_LIST_DIR}/ComCcsdsSubtopologyConfig.cpp" + HEADERS + "${CMAKE_CURRENT_LIST_DIR}/ComCcsdsSubtopologyConfig.hpp" + AUTOCODER_INPUTS + "${CMAKE_CURRENT_LIST_DIR}/ComCcsdsConfig.fpp" + "${CMAKE_CURRENT_LIST_DIR}/ComCcsdsComDriverConfig.fpp" + DEPENDS + Fw_Types +) diff --git a/Svc/Subtopologies/ComCcsds/ComCcsdsConfig/ComCcsdsComDriverConfig.fpp b/Svc/Subtopologies/ComCcsds/ComCcsdsConfig/ComCcsdsComDriverConfig.fpp new file mode 100644 index 00000000000..7ea2b44f4c5 --- /dev/null +++ b/Svc/Subtopologies/ComCcsds/ComCcsdsConfig/ComCcsdsComDriverConfig.fpp @@ -0,0 +1,28 @@ +module ComCcsds { + # Communications driver. May be swapped out with other comm drivers like UART in this file + # to use another driver in the Comms Subtopology + instance comDriver: Drv.TcpClient base id ComCcsdsConfig.BASE_ID + 0x0B00 \ + { + phase Fpp.ToCpp.Phases.configComponents """ + if (state.comCcsds.hostname != nullptr && state.comCcsds.port != 0) { + ComCcsds::comDriver.configure(state.comCcsds.hostname, state.comCcsds.port); + } + """ + + phase Fpp.ToCpp.Phases.startTasks """ + // Initialize socket client communication if and only if there is a valid specification + if (state.comCcsds.hostname != nullptr && state.comCcsds.port != 0) { + Os::TaskString name("ReceiveTask"); + ComCcsds::comDriver.start(name, ComCcsdsConfig::Priorities::comDriver, ComCcsdsConfig::StackSizes::comDriver); + } + """ + + phase Fpp.ToCpp.Phases.stopTasks """ + ComCcsds::comDriver.stop(); + """ + + phase Fpp.ToCpp.Phases.freeThreads """ + (void)ComCcsds::comDriver.join(); + """ + } +} diff --git a/Svc/Subtopologies/ComCcsds/ComCcsdsConfig/ComCcsdsConfig.fpp b/Svc/Subtopologies/ComCcsds/ComCcsdsConfig/ComCcsdsConfig.fpp new file mode 100644 index 00000000000..ba71e3e5de9 --- /dev/null +++ b/Svc/Subtopologies/ComCcsds/ComCcsdsConfig/ComCcsdsConfig.fpp @@ -0,0 +1,45 @@ +module ComCcsdsConfig { + #Base ID for the ComCcsds Subtopology, all components are offsets from this base ID + constant BASE_ID = 0x8000 + + module QueueSizes { + constant comQueue = 10 + constant cmdSeq = 10 + } + + module StackSizes { + constant comQueue = 64 * 1024 + constant cmdSeq = 64 * 1024 + constant comDriver = 100 + } + + module Priorities { + constant comQueue = 101 + constant cmdSeq = 100 + constant comDriver = 100 + } + + # Queue configuration constants + module QueueDepths { + constant events = 100 + constant tlm = 500 + constant file = 100 + } + + module QueuePriorities { + constant events = 0 + constant tlm = 2 + constant file = 1 + } + + # Buffer management constants + module BuffMgr { + constant cmdSeqBuffSize = 5 * 1024 + constant frameAccumulatorSize = 2048 + constant commsBuffSize = 2048 + constant commsFileBuffSize = 3000 + constant commsBuffCount = 20 + constant commsFileBuffCount = 30 + constant commsBuffMgrId = 200 + } +} diff --git a/Svc/Subtopologies/ComCcsds/ComCcsdsConfig/ComCcsdsSubtopologyConfig.cpp b/Svc/Subtopologies/ComCcsds/ComCcsdsConfig/ComCcsdsSubtopologyConfig.cpp new file mode 100644 index 00000000000..769b4dc9d6e --- /dev/null +++ b/Svc/Subtopologies/ComCcsds/ComCcsdsConfig/ComCcsdsSubtopologyConfig.cpp @@ -0,0 +1,9 @@ +#include "ComCcsdsSubtopologyConfig.hpp" + +namespace ComCcsds{ + namespace Allocation{ + //This instance can be changed to use a different allocator in the ComCcsds Subtopology + Fw::MallocAllocator mallocatorInstance; + Fw::MemAllocator& memAllocator = mallocatorInstance; + } +} diff --git a/Svc/Subtopologies/ComCcsds/ComCcsdsConfig/ComCcsdsSubtopologyConfig.hpp b/Svc/Subtopologies/ComCcsds/ComCcsdsConfig/ComCcsdsSubtopologyConfig.hpp new file mode 100644 index 00000000000..4582c13eadb --- /dev/null +++ b/Svc/Subtopologies/ComCcsds/ComCcsdsConfig/ComCcsdsSubtopologyConfig.hpp @@ -0,0 +1,12 @@ +#ifndef COMCCSDSSUBTOPOLOGY_CONFIG_HPP +#define COMCCSDSSUBTOPOLOGY_CONFIG_HPP + +#include "Fw/Types/MallocAllocator.hpp" + +namespace ComCcsds { + namespace Allocation { + extern Fw::MemAllocator& memAllocator; + } +} + +#endif diff --git a/Svc/Subtopologies/ComCcsds/PingEntries.hpp b/Svc/Subtopologies/ComCcsds/PingEntries.hpp new file mode 100644 index 00000000000..ef7f06f6940 --- /dev/null +++ b/Svc/Subtopologies/ComCcsds/PingEntries.hpp @@ -0,0 +1,9 @@ + +#ifndef COMCCSDS_PINGENTRIES_HPP +#define COMCCSDS_PINGENTRIES_HPP + + namespace PingEntries { + namespace ComCcsds_cmdSeq {enum { WARN = 3, FATAL = 5 };} + } + +#endif diff --git a/Svc/Subtopologies/ComCcsds/SubtopologyTopologyDefs.hpp b/Svc/Subtopologies/ComCcsds/SubtopologyTopologyDefs.hpp new file mode 100644 index 00000000000..8df71f76c5b --- /dev/null +++ b/Svc/Subtopologies/ComCcsds/SubtopologyTopologyDefs.hpp @@ -0,0 +1,21 @@ +#ifndef COMCCSDSSUBTOPOLOGY_DEFS_HPP +#define COMCCSDSSUBTOPOLOGY_DEFS_HPP + +#include +#include +#include +#include "Svc/Subtopologies/ComCcsds/ComCcsdsConfig/FppConstantsAc.hpp" +#include "ComCcsdsConfig/ComCcsdsSubtopologyConfig.hpp" + +namespace ComCcsds { + struct SubtopologyState { + const char* hostname; + U16 port; + }; + + struct TopologyState { + SubtopologyState comCcsds; + }; +} + +#endif diff --git a/Svc/Subtopologies/ComFprime/CMakeLists.txt b/Svc/Subtopologies/ComFprime/CMakeLists.txt new file mode 100644 index 00000000000..3065da507c7 --- /dev/null +++ b/Svc/Subtopologies/ComFprime/CMakeLists.txt @@ -0,0 +1,12 @@ +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ComFprimeConfig/") + +register_fprime_module( + AUTOCODER_INPUTS + "${CMAKE_CURRENT_LIST_DIR}/ComFprime.fpp" + HEADERS + "${CMAKE_CURRENT_LIST_DIR}/SubtopologyTopologyDefs.hpp" + "${CMAKE_CURRENT_LIST_DIR}/PingEntries.hpp" + DEPENDS + Svc_Subtopologies_ComFprime_ComFprimeConfig + INTERFACE +) diff --git a/Svc/Subtopologies/ComFprime/ComFprime.fpp b/Svc/Subtopologies/ComFprime/ComFprime.fpp new file mode 100644 index 00000000000..62b9a08c618 --- /dev/null +++ b/Svc/Subtopologies/ComFprime/ComFprime.fpp @@ -0,0 +1,164 @@ +module ComFprime { + + enum Ports_ComPacketQueue { + EVENTS, + TELEMETRY, + FILE_QUEUE + }; + + # ---------------------------------------------------------------------- + # Active Components + # ---------------------------------------------------------------------- + instance comQueue: Svc.ComQueue base id ComFprimeConfig.BASE_ID + 0x0100 \ + queue size ComFprimeConfig.QueueSizes.comQueue \ + stack size ComFprimeConfig.StackSizes.comQueue \ + priority ComFprimeConfig.Priorities.comQueue \ + { + phase Fpp.ToCpp.Phases.configConstants """ + enum{ + EVENTS, + TELEMETRY, + FILE_QUEUE + }; + """ + phase Fpp.ToCpp.Phases.configComponents """ + Svc::ComQueue::QueueConfigurationTable configurationTable; + // Events (highest-priority) + configurationTable.entries[ConfigConstants::ComFprime_comQueue::EVENTS].depth = ComFprimeConfig::QueueDepths::events; + configurationTable.entries[ConfigConstants::ComFprime_comQueue::EVENTS].priority = ComFprimeConfig::QueuePriorities::events; + // Telemetry + configurationTable.entries[ConfigConstants::ComFprime_comQueue::TELEMETRY].depth = ComFprimeConfig::QueueDepths::tlm; + configurationTable.entries[ConfigConstants::ComFprime_comQueue::TELEMETRY].priority = ComFprimeConfig::QueuePriorities::tlm; + // File Downlink Queue + configurationTable.entries[ConfigConstants::ComFprime_comQueue::FILE_QUEUE].depth = ComFprimeConfig::QueueDepths::file; + configurationTable.entries[ConfigConstants::ComFprime_comQueue::FILE_QUEUE].priority = ComFprimeConfig::QueuePriorities::file; + // Allocation identifier is 0 as the MallocAllocator discards it + ComFprime::comQueue.configure(configurationTable, 0, ComFprime::Allocation::memAllocator); + """ + } + + instance cmdSeq: Svc.CmdSequencer base id ComFprimeConfig.BASE_ID + 0x0200 \ + queue size ComFprimeConfig.QueueSizes.cmdSeq \ + stack size ComFprimeConfig.StackSizes.cmdSeq \ + priority ComFprimeConfig.Priorities.cmdSeq \ + { + phase Fpp.ToCpp.Phases.configComponents """ + ComFprime::cmdSeq.allocateBuffer(0, ComFprime::Allocation::memAllocator, ComFprimeConfig::BuffMgr::cmdSeqBuffSize); + """ + + phase Fpp.ToCpp.Phases.tearDownComponents """ + ComFprime::cmdSeq.deallocateBuffer(ComFprime::Allocation::memAllocator); + """ + } + + # ---------------------------------------------------------------------- + # Passive Components + # ---------------------------------------------------------------------- + instance frameAccumulator: Svc.FrameAccumulator base id ComFprimeConfig.BASE_ID + 0x0500 \ + { + + phase Fpp.ToCpp.Phases.configComponents """ + ComFprime::frameAccumulator.configure( + ComFprime::Detector::frameDetector, + 1, + ComFprime::Allocation::memAllocator, + ComFprimeConfig::BuffMgr::frameAccumulatorSize + ); + """ + + phase Fpp.ToCpp.Phases.tearDownComponents """ + ComFprime::frameAccumulator.cleanup(); + """ + } + + instance commsBufferManager: Svc.BufferManager base id ComFprimeConfig.BASE_ID + 0x0600 \ + { + phase Fpp.ToCpp.Phases.configComponents """ + memset(&ComFprime::BufferManagerBins::bins, 0, sizeof(ComFprime::BufferManagerBins::bins)); + ComFprime::BufferManagerBins::bins.bins[0].bufferSize = ComFprimeConfig::BuffMgr::commsBuffSize; + ComFprime::BufferManagerBins::bins.bins[0].numBuffers = ComFprimeConfig::BuffMgr::commsBuffCount; + ComFprime::BufferManagerBins::bins.bins[1].bufferSize = ComFprimeConfig::BuffMgr::commsFileBuffSize; + ComFprime::BufferManagerBins::bins.bins[1].numBuffers = ComFprimeConfig::BuffMgr::commsFileBuffCount; + ComFprime::commsBufferManager.setup( + ComFprimeConfig::BuffMgr::commsBuffMgrId, + 0, + ComFprime::Allocation::memAllocator, + ComFprime::BufferManagerBins::bins + ); + """ + + phase Fpp.ToCpp.Phases.tearDownComponents """ + ComFprime::commsBufferManager.cleanup(); + """ + } + + instance deframer: Svc.FprimeDeframer base id ComFprimeConfig.BASE_ID + 0x0700 \ + + instance fprimeFramer: Svc.FprimeFramer base id ComFprimeConfig.BASE_ID + 0x0800 \ + + instance fprimeRouter: Svc.FprimeRouter base id ComFprimeConfig.BASE_ID + 0x0900 \ + + instance comStub: Svc.ComStub base id ComFprimeConfig.BASE_ID + 0x0A00 \ + + topology Subtopology { + # Active Components + instance comQueue + instance cmdSeq + + # Passive Components + instance commsBufferManager + instance frameAccumulator + instance deframer + instance fprimeFramer + instance fprimeRouter + instance comStub + instance comDriver + + + connections Downlink { + # Inputs to ComQueue (events, telemetry) + # ComQueue <-> Framer + comQueue.dataOut -> fprimeFramer.dataIn + fprimeFramer.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 + # ComStub <-> ComDriver + comStub.drvSendOut -> comDriver.$send + comDriver.sendReturnOut -> comStub.drvSendReturnIn + comDriver.ready -> comStub.drvConnected + # ComStatus + comStub.comStatusOut -> fprimeFramer.comStatusIn + fprimeFramer.comStatusOut -> comQueue.comStatusIn + } + + connections Uplink { + # ComDriver buffer allocations + comDriver.allocate -> commsBufferManager.bufferGetCallee + comDriver.deallocate -> commsBufferManager.bufferSendIn + # ComDriver <-> ComStub + comDriver.$recv -> comStub.drvReceiveIn + comStub.drvReceiveReturnOut -> comDriver.recvReturnIn + # ComStub <-> FrameAccumulator + comStub.dataOut -> frameAccumulator.dataIn + frameAccumulator.dataReturnOut -> comStub.dataReturnIn + # FrameAccumulator buffer allocations + frameAccumulator.bufferDeallocate -> commsBufferManager.bufferSendIn + frameAccumulator.bufferAllocate -> commsBufferManager.bufferGetCallee + # FrameAccumulator <-> Deframer + frameAccumulator.dataOut -> deframer.dataIn + deframer.dataReturnOut -> frameAccumulator.dataReturnIn + # Deframer <-> Router + deframer.dataOut -> fprimeRouter.dataIn + fprimeRouter.dataReturnOut -> deframer.dataReturnIn + # Router buffer allocations + fprimeRouter.bufferAllocate -> commsBufferManager.bufferGetCallee + fprimeRouter.bufferDeallocate -> commsBufferManager.bufferSendIn + } + + + } # end topology +} # end ComFprime Subtopology diff --git a/Svc/Subtopologies/ComFprime/ComFprimeConfig/CMakeLists.txt b/Svc/Subtopologies/ComFprime/ComFprimeConfig/CMakeLists.txt new file mode 100644 index 00000000000..5661ffde58b --- /dev/null +++ b/Svc/Subtopologies/ComFprime/ComFprimeConfig/CMakeLists.txt @@ -0,0 +1,9 @@ +register_fprime_config( + SOURCES + "${CMAKE_CURRENT_LIST_DIR}/ComFprimeSubtopologyConfig.cpp" + HEADERS + "${CMAKE_CURRENT_LIST_DIR}/ComFprimeSubtopologyConfig.hpp" + AUTOCODER_INPUTS + "${CMAKE_CURRENT_LIST_DIR}/ComFprimeConfig.fpp" + "${CMAKE_CURRENT_LIST_DIR}/ComFprimeComDriverConfig.fpp" +) diff --git a/Svc/Subtopologies/ComFprime/ComFprimeConfig/ComFprimeComDriverConfig.fpp b/Svc/Subtopologies/ComFprime/ComFprimeConfig/ComFprimeComDriverConfig.fpp new file mode 100644 index 00000000000..b51721b7ff2 --- /dev/null +++ b/Svc/Subtopologies/ComFprime/ComFprimeConfig/ComFprimeComDriverConfig.fpp @@ -0,0 +1,28 @@ +module ComFprime { + # Communications driver. May be swapped out with other comm drivers like UART in this file + # to use another driver in the Comms Subtopology + instance comDriver: Drv.TcpClient base id ComFprimeConfig.BASE_ID + 0x0B00 \ + { + phase Fpp.ToCpp.Phases.configComponents """ + if (state.hostname != nullptr && state.port != 0) { + ComFprime::comDriver.configure(state.hostname, state.port); + } + """ + + phase Fpp.ToCpp.Phases.startTasks """ + // Initialize socket client communication if and only if there is a valid specification + if (state.hostname != nullptr && state.port != 0) { + Os::TaskString name("ReceiveTask"); + ComFprime::comDriver.start(name, ComFprimeConfig::Priorities::comDriver, ComFprimeConfig::StackSizes::comDriver); + } + """ + + phase Fpp.ToCpp.Phases.stopTasks """ + ComFprime::comDriver.stop(); + """ + + phase Fpp.ToCpp.Phases.freeThreads """ + (void)ComFprime::comDriver.join(); + """ + } +} diff --git a/Svc/Subtopologies/ComFprime/ComFprimeConfig/ComFprimeConfig.fpp b/Svc/Subtopologies/ComFprime/ComFprimeConfig/ComFprimeConfig.fpp new file mode 100644 index 00000000000..17e23c6fc3d --- /dev/null +++ b/Svc/Subtopologies/ComFprime/ComFprimeConfig/ComFprimeConfig.fpp @@ -0,0 +1,45 @@ +module ComFprimeConfig { + #Base ID for the ComFprime Subtopology, all components are offsets from this base ID + constant BASE_ID = 0x7000 + + module QueueSizes { + constant comQueue = 10 + constant cmdSeq = 10 + } + + module StackSizes { + constant comQueue = 64 * 1024 + constant cmdSeq = 64 * 1024 + constant comDriver = 100 + } + + module Priorities { + constant comQueue = 101 + constant cmdSeq = 100 + constant comDriver = 100 + } + + # Queue configuration constants + module QueueDepths { + constant events = 100 + constant tlm = 500 + constant file = 100 + } + + module QueuePriorities { + constant events = 0 + constant tlm = 2 + constant file = 1 + } + + # Buffer management constants + module BuffMgr { + constant cmdSeqBuffSize = 5 * 1024 + constant frameAccumulatorSize = 2048 + constant commsBuffSize = 2048 + constant commsFileBuffSize = 3000 + constant commsBuffCount = 20 + constant commsFileBuffCount = 30 + constant commsBuffMgrId = 200 + } +} diff --git a/Svc/Subtopologies/ComFprime/ComFprimeConfig/ComFprimeSubtopologyConfig.cpp b/Svc/Subtopologies/ComFprime/ComFprimeConfig/ComFprimeSubtopologyConfig.cpp new file mode 100644 index 00000000000..c3be3fa3b00 --- /dev/null +++ b/Svc/Subtopologies/ComFprime/ComFprimeConfig/ComFprimeSubtopologyConfig.cpp @@ -0,0 +1,9 @@ +#include "ComFprimeSubtopologyConfig.hpp" + +namespace ComFprime { + namespace Allocation{ + //This instance can be changed to use a different allocator in the ComFprime Subtopology + Fw::MallocAllocator mallocatorInstance; + Fw::MemAllocator& memAllocator = mallocatorInstance; + } +} diff --git a/Svc/Subtopologies/ComFprime/ComFprimeConfig/ComFprimeSubtopologyConfig.hpp b/Svc/Subtopologies/ComFprime/ComFprimeConfig/ComFprimeSubtopologyConfig.hpp new file mode 100644 index 00000000000..32f868be7ac --- /dev/null +++ b/Svc/Subtopologies/ComFprime/ComFprimeConfig/ComFprimeSubtopologyConfig.hpp @@ -0,0 +1,12 @@ +#ifndef COMFPRIMESUBTOPOLOGY_CONFIG_HPP +#define COMFPRIMESUBTOPOLOGY_CONFIG_HPP + +#include "Fw/Types/MallocAllocator.hpp" + +namespace ComFprime { + namespace Allocation { + extern Fw::MemAllocator& memAllocator; + } +} + +#endif diff --git a/Svc/Subtopologies/ComFprime/PingEntries.hpp b/Svc/Subtopologies/ComFprime/PingEntries.hpp new file mode 100644 index 00000000000..3e07c871b64 --- /dev/null +++ b/Svc/Subtopologies/ComFprime/PingEntries.hpp @@ -0,0 +1,8 @@ +#ifndef COMFPRIME_PINGENTRIES_HPP +#define COMFPRIME_PINGENTRIES_HPP + + namespace PingEntries { + namespace ComFprime_cmdSeq {enum { WARN = 3, FATAL = 5 };} + } + +#endif diff --git a/Svc/Subtopologies/ComFprime/SubtopologyTopologyDefs.hpp b/Svc/Subtopologies/ComFprime/SubtopologyTopologyDefs.hpp new file mode 100644 index 00000000000..5d0c173e8fd --- /dev/null +++ b/Svc/Subtopologies/ComFprime/SubtopologyTopologyDefs.hpp @@ -0,0 +1,20 @@ +#ifndef COMFPRIMESUBTOPOLOGY_DEFS_HPP +#define COMFPRIMESUBTOPOLOGY_DEFS_HPP + +#include +#include +#include +#include "Svc/Subtopologies/ComFprime/ComFprimeConfig/FppConstantsAc.hpp" +#include "ComFprimeConfig/ComFprimeSubtopologyConfig.hpp" + +namespace ComFprime { + struct SubtopologyState { + const char* hostname; + U16 port; + }; + + struct TopologyState { + SubtopologyState comFprime; + }; +} +#endif diff --git a/Svc/Subtopologies/DataProducts/CMakeLists.txt b/Svc/Subtopologies/DataProducts/CMakeLists.txt new file mode 100644 index 00000000000..bb381f5ccbf --- /dev/null +++ b/Svc/Subtopologies/DataProducts/CMakeLists.txt @@ -0,0 +1,12 @@ +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/DataProductsConfig/") + +register_fprime_module( + AUTOCODER_INPUTS + "${CMAKE_CURRENT_LIST_DIR}/DataProducts.fpp" + HEADERS + "${CMAKE_CURRENT_LIST_DIR}/SubtopologyTopologyDefs.hpp" + "${CMAKE_CURRENT_LIST_DIR}/PingEntries.hpp" + DEPENDS + Svc_Subtopologies_DataProducts_DataProductsConfig + INTERFACE +) diff --git a/Svc/Subtopologies/DataProducts/DataProducts.fpp b/Svc/Subtopologies/DataProducts/DataProducts.fpp new file mode 100644 index 00000000000..d4a765d6ccc --- /dev/null +++ b/Svc/Subtopologies/DataProducts/DataProducts.fpp @@ -0,0 +1,76 @@ +module DataProducts{ + + # ---------------------------------------------------------------------- + # Active Components + # ---------------------------------------------------------------------- + + instance dpCat: Svc.DpCatalog base id DataProductsConfig.BASE_ID + 0x0100 \ + queue size DataProductsConfig.QueueSizes.dpCat \ + stack size DataProductsConfig.StackSizes.dpCat \ + priority DataProductsConfig.Priorities.dpCat \ + { + phase Fpp.ToCpp.Phases.configComponents """ + Fw::FileNameString dpDir(DataProductsConfig::Paths::dpDir); + Fw::FileNameString dpState(DataProductsConfig::Paths::dpState); + Os::FileSystem::createDirectory(dpDir.toChar()); + DataProducts::dpCat.configure(&dpDir,1,dpState,0, DataProducts::Allocation::memAllocator); + """ + } + + instance dpMgr: Svc.DpManager base id DataProductsConfig.BASE_ID + 0x0200 \ + queue size DataProductsConfig.QueueSizes.dpMgr \ + stack size DataProductsConfig.StackSizes.dpMgr \ + priority DataProductsConfig.Priorities.dpMgr + + instance dpWriter: Svc.DpWriter base id DataProductsConfig.BASE_ID + 0x0300 \ + queue size DataProductsConfig.QueueSizes.dpWriter \ + stack size DataProductsConfig.StackSizes.dpWriter \ + priority DataProductsConfig.Priorities.dpWriter \ + { + phase Fpp.ToCpp.Phases.configComponents """ + DataProducts::dpWriter.configure(dpDir); + """ + } + + # ---------------------------------------------------------------------- + # Passive Components + # ---------------------------------------------------------------------- + + instance dpBufferManager: Svc.BufferManager base id DataProductsConfig.BASE_ID + 0x0400 \ + { + phase Fpp.ToCpp.Phases.configObjects """ + Svc::BufferManager::BufferBins bins; + """ + phase Fpp.ToCpp.Phases.configComponents """ + memset(&ConfigObjects::DataProducts_dpBufferManager::bins, 0, sizeof(ConfigObjects::DataProducts_dpBufferManager::bins)); + ConfigObjects::DataProducts_dpBufferManager::bins.bins[0].bufferSize = DataProductsConfig::BuffMgr::dpBufferStoreSize; + ConfigObjects::DataProducts_dpBufferManager::bins.bins[0].numBuffers = DataProductsConfig::BuffMgr::dpBufferStoreCount; + DataProducts::dpBufferManager.setup( + DataProductsConfig::BuffMgr::dpBufferManagerId, + 0, + DataProducts::Allocation::memAllocator, + ConfigObjects::DataProducts_dpBufferManager::bins + ); + """ + phase Fpp.ToCpp.Phases.tearDownComponents """ + DataProducts::dpCat.shutdown(); + DataProducts::dpBufferManager.cleanup(); + """ + } + topology Subtopology { + #Active Components + instance dpCat + instance dpMgr + instance dpWriter + + #Passive Components + instance dpBufferManager + + connections DataProducts { + # DpMgr and DpWriter connections. Have explicit port indexes for demo + dpMgr.bufferGetOut[0] -> dpBufferManager.bufferGetCallee + dpMgr.productSendOut[0] -> dpWriter.bufferSendIn + dpWriter.deallocBufferSendOut -> dpBufferManager.bufferSendIn + } + } # end topology +} # end DataProducts Subtopology diff --git a/Svc/Subtopologies/DataProducts/DataProductsConfig/CMakeLists.txt b/Svc/Subtopologies/DataProducts/DataProductsConfig/CMakeLists.txt new file mode 100644 index 00000000000..3c7fd0c2e7c --- /dev/null +++ b/Svc/Subtopologies/DataProducts/DataProductsConfig/CMakeLists.txt @@ -0,0 +1,10 @@ +register_fprime_config( + SOURCES + "${CMAKE_CURRENT_LIST_DIR}/DataProductsSubtopologyConfig.cpp" + HEADERS + "${CMAKE_CURRENT_LIST_DIR}/DataProductsSubtopologyConfig.hpp" + AUTOCODER_INPUTS + "${CMAKE_CURRENT_LIST_DIR}/DataProductsConfig.fpp" + DEPENDS + Fw_Types +) diff --git a/Svc/Subtopologies/DataProducts/DataProductsConfig/DataProductsConfig.fpp b/Svc/Subtopologies/DataProducts/DataProductsConfig/DataProductsConfig.fpp new file mode 100644 index 00000000000..f58ac2f1ba3 --- /dev/null +++ b/Svc/Subtopologies/DataProducts/DataProductsConfig/DataProductsConfig.fpp @@ -0,0 +1,39 @@ +module DataProductsConfig { + #Base ID for the DataProducts Subtopology, all components are offsets from this base ID + constant BASE_ID = 0x9000 + + module QueueSizes { + constant dpCat = 10 + constant dpMgr = 10 + constant dpWriter = 10 + constant dpBufferManager = 10 + } + + + module StackSizes { + constant dpCat = 64 * 1024 + constant dpMgr = 64 * 1024 + constant dpWriter = 64 * 1024 + constant dpBufferManager = 64 * 1024 + } + + module Priorities { + constant dpCat = 101 + constant dpMgr = 100 + constant dpWriter = 99 + constant dpBufferManager = 98 + } + + # Buffer management constants + module BuffMgr { + constant dpBufferStoreSize = 10000 + constant dpBufferStoreCount = 10 + constant dpBufferManagerId = 300 + } + + # Directory and file paths + module Paths { + constant dpDir = "./DpCat" + constant dpState = "./DpCat/DpState.dat" + } +} diff --git a/Svc/Subtopologies/DataProducts/DataProductsConfig/DataProductsSubtopologyConfig.cpp b/Svc/Subtopologies/DataProducts/DataProductsConfig/DataProductsSubtopologyConfig.cpp new file mode 100644 index 00000000000..03d69a20aae --- /dev/null +++ b/Svc/Subtopologies/DataProducts/DataProductsConfig/DataProductsSubtopologyConfig.cpp @@ -0,0 +1,9 @@ +#include "DataProductsSubtopologyConfig.hpp" + +namespace DataProducts { + namespace Allocation{ + //This instance can be changed to use a different allocator in the DataProducts Subtopology + Fw::MallocAllocator mallocatorInstance; + Fw::MemAllocator& memAllocator = mallocatorInstance; + } +} diff --git a/Svc/Subtopologies/DataProducts/DataProductsConfig/DataProductsSubtopologyConfig.hpp b/Svc/Subtopologies/DataProducts/DataProductsConfig/DataProductsSubtopologyConfig.hpp new file mode 100644 index 00000000000..0ba6db35a0f --- /dev/null +++ b/Svc/Subtopologies/DataProducts/DataProductsConfig/DataProductsSubtopologyConfig.hpp @@ -0,0 +1,12 @@ +#ifndef DATAPRODUCTSSUBTOPOLOGY_CONFIG_HPP +#define DATAPRODUCTSSUBTOPOLOGY_CONFIG_HPP + +#include "Fw/Types/MallocAllocator.hpp" + +namespace DataProducts { + namespace Allocation { + extern Fw::MemAllocator& memAllocator; + } +} + +#endif diff --git a/Svc/Subtopologies/DataProducts/PingEntries.hpp b/Svc/Subtopologies/DataProducts/PingEntries.hpp new file mode 100644 index 00000000000..78a745da8a8 --- /dev/null +++ b/Svc/Subtopologies/DataProducts/PingEntries.hpp @@ -0,0 +1,8 @@ +#ifndef DATAPRODUCTS_PINGENTRIES_HPP +#define DATAPRODUCTS_PINGENTRIES_HPP + + namespace PingEntries { + namespace DataProducts_dpCat {enum { WARN = 3, FATAL = 5 };} + } + +#endif diff --git a/Svc/Subtopologies/DataProducts/SubtopologyTopologyDefs.hpp b/Svc/Subtopologies/DataProducts/SubtopologyTopologyDefs.hpp new file mode 100644 index 00000000000..d5edee6fd86 --- /dev/null +++ b/Svc/Subtopologies/DataProducts/SubtopologyTopologyDefs.hpp @@ -0,0 +1,16 @@ +#ifndef DATAPRODUCTSSUBTOPOLOGY_DEFS_HPP +#define DATAPRODUCTSSUBTOPOLOGY_DEFS_HPP + +#include +#include +#include +#include "Svc/Subtopologies/DataProducts/DataProductsConfig/FppConstantsAc.hpp" +#include "DataProductsConfig/DataProductsSubtopologyConfig.hpp" + +namespace DataProducts { + // State for topology construction + struct TopologyState { + }; +} + +#endif diff --git a/Svc/Subtopologies/FileHandling/CMakeLists.txt b/Svc/Subtopologies/FileHandling/CMakeLists.txt new file mode 100644 index 00000000000..3e024505a4b --- /dev/null +++ b/Svc/Subtopologies/FileHandling/CMakeLists.txt @@ -0,0 +1,12 @@ +add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/FileHandlingConfig/") + +register_fprime_module( + AUTOCODER_INPUTS + "${CMAKE_CURRENT_LIST_DIR}/FileHandling.fpp" + HEADERS + "${CMAKE_CURRENT_LIST_DIR}/SubtopologyTopologyDefs.hpp" + "${CMAKE_CURRENT_LIST_DIR}/PingEntries.hpp" + INTERFACE + DEPENDS + Svc_Subtopologies_FileHandling_FileHandlingConfig +) diff --git a/Svc/Subtopologies/FileHandling/FileHandling.fpp b/Svc/Subtopologies/FileHandling/FileHandling.fpp new file mode 100644 index 00000000000..72e7d3c6391 --- /dev/null +++ b/Svc/Subtopologies/FileHandling/FileHandling.fpp @@ -0,0 +1,56 @@ +module FileHandling { + + enum Ports_ComBufferQueue { + FILE_DOWNLINK + } + + # ---------------------------------------------------------------------- + # Active Components + # ---------------------------------------------------------------------- + instance fileUplink: Svc.FileUplink base id FileHandlingConfig.BASE_ID + 0x0100 \ + queue size FileHandlingConfig.QueueSizes.fileUplink \ + stack size FileHandlingConfig.StackSizes.fileUplink \ + priority FileHandlingConfig.Priorities.fileUplink + + instance fileDownlink: Svc.FileDownlink base id FileHandlingConfig.BASE_ID + 0x0200 \ + queue size FileHandlingConfig.QueueSizes.fileDownlink \ + stack size FileHandlingConfig.StackSizes.fileDownlink \ + priority FileHandlingConfig.Priorities.fileDownlink \ + { + phase Fpp.ToCpp.Phases.configComponents """ + FileHandling::fileDownlink.configure( + FileHandlingConfig::DownlinkConfig::timeout, + FileHandlingConfig::DownlinkConfig::cooldown, + FileHandlingConfig::DownlinkConfig::cycleTime, + FileHandlingConfig::DownlinkConfig::fileQueueDepth + ); + """ + } + + instance fileManager: Svc.FileManager base id FileHandlingConfig.BASE_ID + 0x0300 \ + queue size FileHandlingConfig.QueueSizes.fileManager \ + stack size FileHandlingConfig.StackSizes.fileManager \ + priority FileHandlingConfig.Priorities.fileManager + + instance prmDb: Svc.PrmDb base id FileHandlingConfig.BASE_ID + 0x0400 \ + queue size FileHandlingConfig.QueueSizes.prmDb \ + stack size FileHandlingConfig.StackSizes.prmDb \ + priority FileHandlingConfig.Priorities.prmDb \ + { + phase Fpp.ToCpp.Phases.configComponents """ + FileHandling::prmDb.configure("PrmDb.dat"); + """ + phase Fpp.ToCpp.Phases.readParameters """ + FileHandling::prmDb.readParamFile(); + """ + } + + topology Subtopology { + #Active Components + instance fileUplink + instance fileDownlink + instance fileManager + instance prmDb + + } # end topology +} # end FileHandling Subtopology diff --git a/Svc/Subtopologies/FileHandling/FileHandlingConfig/CMakeLists.txt b/Svc/Subtopologies/FileHandling/FileHandlingConfig/CMakeLists.txt new file mode 100644 index 00000000000..c1bd7b8e64b --- /dev/null +++ b/Svc/Subtopologies/FileHandling/FileHandlingConfig/CMakeLists.txt @@ -0,0 +1,5 @@ +register_fprime_config( + AUTOCODER_INPUTS + "${CMAKE_CURRENT_LIST_DIR}/FileHandlingConfig.fpp" + INTERFACE +) diff --git a/Svc/Subtopologies/FileHandling/FileHandlingConfig/FileHandlingConfig.fpp b/Svc/Subtopologies/FileHandling/FileHandlingConfig/FileHandlingConfig.fpp new file mode 100644 index 00000000000..e2cdeb054de --- /dev/null +++ b/Svc/Subtopologies/FileHandling/FileHandlingConfig/FileHandlingConfig.fpp @@ -0,0 +1,33 @@ +module FileHandlingConfig { + #Base ID for the FileHandling Subtopology, all components are offsets from this base ID + constant BASE_ID = 0xA000 + + module QueueSizes { + constant fileUplink = 10 + constant fileDownlink = 10 + constant fileManager = 10 + constant prmDb = 10 + } + + module StackSizes { + constant fileUplink = 64 * 1024 + constant fileDownlink = 64 * 1024 + constant fileManager = 64 * 1024 + constant prmDb = 64 * 1024 + } + + module Priorities { + constant fileUplink = 101 + constant fileDownlink = 100 + constant fileManager = 99 + constant prmDb = 98 + } + + # File downlink configuration constants + module DownlinkConfig { + constant timeout = 1000 # File downlink timeout in ms + constant cooldown = 1000 # File downlink cooldown in ms + constant cycleTime = 1000 # File downlink cycle time in ms + constant fileQueueDepth = 10 # File downlink queue depth + } +} diff --git a/Svc/Subtopologies/FileHandling/PingEntries.hpp b/Svc/Subtopologies/FileHandling/PingEntries.hpp new file mode 100644 index 00000000000..8d24ec9a7c9 --- /dev/null +++ b/Svc/Subtopologies/FileHandling/PingEntries.hpp @@ -0,0 +1,11 @@ +#ifndef FILEHANDLING_PINGENTRIES_HPP +#define FILEHANDLING_PINGENTRIES_HPP + + namespace PingEntries { + namespace FileHandling_fileDownlink {enum { WARN = 3, FATAL = 5 };} + namespace FileHandling_fileManager {enum { WARN = 3, FATAL = 5 };} + namespace FileHandling_fileUplink {enum { WARN = 3, FATAL = 5 };} + namespace FileHandling_prmDb {enum { WARN = 3, FATAL = 5 };} + } + +#endif diff --git a/Svc/Subtopologies/FileHandling/SubtopologyTopologyDefs.hpp b/Svc/Subtopologies/FileHandling/SubtopologyTopologyDefs.hpp new file mode 100644 index 00000000000..adc36798018 --- /dev/null +++ b/Svc/Subtopologies/FileHandling/SubtopologyTopologyDefs.hpp @@ -0,0 +1,11 @@ +#ifndef FILEHANDLINGSUBTOPOLOGY_DEFS_HPP +#define FILEHANDLINGSUBTOPOLOGY_DEFS_HPP + +#include "Svc/Subtopologies/FileHandling/FileHandlingConfig/FppConstantsAc.hpp" +namespace FileHandling { + // State for topology construction + struct TopologyState { + }; +} + +#endif diff --git a/cmake/test/data/TestDeployment/CMakeLists.txt b/cmake/test/data/TestDeployment/CMakeLists.txt index c059d3b1af8..2b0acce62d5 100644 --- a/cmake/test/data/TestDeployment/CMakeLists.txt +++ b/cmake/test/data/TestDeployment/CMakeLists.txt @@ -31,4 +31,4 @@ add_fprime_subdirectory(./TestRelative) set(SOURCE_FILES "${CMAKE_CURRENT_LIST_DIR}/Main.cpp") set(MOD_DEPS Svc_CmdDispatcher TestLibrary_TestComponent TestLibrary2_TestComponent) -register_fprime_deployment() \ No newline at end of file +register_fprime_deployment()