Moises Mata 268e168f23
Restructure core subtopologies and add Svc_Subtopologies target (#3904)
* Modify Com/Ccsds/Fprime ComDriverConfig & TopologyDefs for easier ComDriver config

* Fix BaseID collision

* Removed restrict platform, UART/TCP driver configs different files, CMake switch depending on FPRIME_HAS_SOCKETS

* Add Exclude_FROM_ALL to all subtopology cmake modules

* remove exclude from ComCcsds (needed for Ref)

* Remove exclude from all for testing

* Exclude_from_all only on comLoggerTee, comFprime (not used in Ref)

* Added Svc_Subtopologies target

* Use add_custom_target, spelling fix

* Add Configs to Svc_Subtopologies target

* Removed comDriver as instance within subtopologies, now within project topology

* Take out cmdSeq from ComSubtopologies, put in FileHandling

* Added Subtopology States for all, common pattern users can follow

* Fix Extra newline

* Moved Phased comDriver code into RefTopology.cpp

* Update metadata

check-spelling run (pull_request_target) for subtopology-config-phasing-updates

Signed-off-by: check-spelling-bot <check-spelling-bot@users.noreply.github.com>
on-behalf-of: @check-spelling <check-spelling-bot@check-spelling.dev>

* Fixed call to default stack size

* Moved cmdSeq from FileHandling subtopology to Ref Root Topology

* Fix integration test

* Remove unneeded Os includes in RefTopology.cpp

* Fix BaseIds

* Add comment for BaseIDs, comDriver configuration order fix

* Restructure of enums within Com Subtopologies

* Correct include for ComCcsds enum headers

* Using namespace syntax change

* Fix BaseIds

* Update metadata

check-spelling run (pull_request_target) for subtopology-config-phasing-updates

Signed-off-by: check-spelling-bot <check-spelling-bot@users.noreply.github.com>
on-behalf-of: @check-spelling <check-spelling-bot@check-spelling.dev>

* Remove unneeded Dependency

* Add enum at the top

* Fix RefTopology.cpp

* Update Comment

---------

Signed-off-by: check-spelling-bot <check-spelling-bot@users.noreply.github.com>
Co-authored-by: Moises Mata <moisesmata@users.noreply.github.com>
2025-07-30 10:25:29 -07:00

170 lines
7.4 KiB
Fortran

module ComCcsds {
# ComPacket Queue enum for queue types
enum Ports_ComPacketQueue {
EVENTS,
TELEMETRY
}
enum Ports_ComBufferQueue {
FILE
}
# ----------------------------------------------------------------------
# Active Components
# ----------------------------------------------------------------------
instance comQueue: Svc.ComQueue base id ComCcsdsConfig.BASE_ID + 0x00000 \
queue size ComCcsdsConfig.QueueSizes.comQueue \
stack size ComCcsdsConfig.StackSizes.comQueue \
priority ComCcsdsConfig.Priorities.comQueue \
{
phase Fpp.ToCpp.Phases.configComponents """
using namespace ComCcsds;
Svc::ComQueue::QueueConfigurationTable configurationTable;
// Events (highest-priority)
configurationTable.entries[Ports_ComPacketQueue::EVENTS].depth = ComCcsdsConfig::QueueDepths::events;
configurationTable.entries[Ports_ComPacketQueue::EVENTS].priority = ComCcsdsConfig::QueuePriorities::events;
// Telemetry
configurationTable.entries[Ports_ComPacketQueue::TELEMETRY].depth = ComCcsdsConfig::QueueDepths::tlm;
configurationTable.entries[Ports_ComPacketQueue::TELEMETRY].priority = ComCcsdsConfig::QueuePriorities::tlm;
// File Downlink Queue (buffer queue using NUM_CONSTANTS offset)
configurationTable.entries[Ports_ComPacketQueue::NUM_CONSTANTS + Ports_ComBufferQueue::FILE].depth = ComCcsdsConfig::QueueDepths::file;
configurationTable.entries[Ports_ComPacketQueue::NUM_CONSTANTS + Ports_ComBufferQueue::FILE].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();
"""
}
# ----------------------------------------------------------------------
# Passive Components
# ----------------------------------------------------------------------
instance frameAccumulator: Svc.FrameAccumulator base id ComCcsdsConfig.BASE_ID + 0x01000 \
{
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 + 0x02000 \
{
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 + 0x03000 \
instance comStub: Svc.ComStub base id ComCcsdsConfig.BASE_ID + 0x04000 \
instance tcDeframer: Svc.Ccsds.TcDeframer base id ComCcsdsConfig.BASE_ID + 0x05000 \
instance spacePacketDeframer: Svc.Ccsds.SpacePacketDeframer 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 + 0x08000 \
instance apidManager: Svc.Ccsds.ApidManager base id ComCcsdsConfig.BASE_ID + 0x09000 \
topology Subtopology {
# Active Components
instance comQueue
# Passive Components
instance commsBufferManager
instance frameAccumulator
instance fprimeRouter
instance comStub
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
# ComStatus
comStub.comStatusOut -> tmFramer.comStatusIn
tmFramer.comStatusOut -> spacePacketFramer.comStatusIn
spacePacketFramer.comStatusOut -> comQueue.comStatusIn
}
connections Uplink {
# 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