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

147 lines
6.3 KiB
Fortran

module ComFprime {
enum Ports_ComPacketQueue {
EVENTS,
TELEMETRY,
};
enum Ports_ComBufferQueue {
FILE
};
# ----------------------------------------------------------------------
# Active Components
# ----------------------------------------------------------------------
instance comQueue: Svc.ComQueue base id ComFprimeConfig.BASE_ID + 0x00000 \
queue size ComFprimeConfig.QueueSizes.comQueue \
stack size ComFprimeConfig.StackSizes.comQueue \
priority ComFprimeConfig.Priorities.comQueue \
{
phase Fpp.ToCpp.Phases.configComponents """
using namespace ComFprime;
Svc::ComQueue::QueueConfigurationTable configurationTable;
// Events (highest-priority)
configurationTable.entries[Ports_ComPacketQueue::EVENTS].depth = ComFprimeConfig::QueueDepths::events;
configurationTable.entries[Ports_ComPacketQueue::EVENTS].priority = ComFprimeConfig::QueuePriorities::events;
// Telemetry
configurationTable.entries[Ports_ComPacketQueue::TELEMETRY].depth = ComFprimeConfig::QueueDepths::tlm;
configurationTable.entries[Ports_ComPacketQueue::TELEMETRY].priority = ComFprimeConfig::QueuePriorities::tlm;
// File Downlink Queue
configurationTable.entries[Ports_ComPacketQueue::NUM_CONSTANTS + Ports_ComBufferQueue::FILE].depth = ComFprimeConfig::QueueDepths::file;
configurationTable.entries[Ports_ComPacketQueue::NUM_CONSTANTS + Ports_ComBufferQueue::FILE].priority = ComFprimeConfig::QueuePriorities::file;
// Allocation identifier is 0 as the MallocAllocator discards it
ComFprime::comQueue.configure(configurationTable, 0, ComFprime::Allocation::memAllocator);
"""
phase Fpp.ToCpp.Phases.tearDownComponents """
ComFprime::comQueue.cleanup();
"""
}
# ----------------------------------------------------------------------
# Passive Components
# ----------------------------------------------------------------------
instance frameAccumulator: Svc.FrameAccumulator base id ComFprimeConfig.BASE_ID + 0x01000 \
{
phase Fpp.ToCpp.Phases.configObjects """
Svc::FrameDetectors::FprimeFrameDetector frameDetector;
"""
phase Fpp.ToCpp.Phases.configComponents """
ComFprime::frameAccumulator.configure(
ConfigObjects::ComFprime_frameAccumulator::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 + 0x02000 \
{
phase Fpp.ToCpp.Phases.configObjects """
Svc::BufferManager::BufferBins bins;
"""
phase Fpp.ToCpp.Phases.configComponents """
memset(&ConfigObjects::ComFprime_commsBufferManager::bins, 0, sizeof(ConfigObjects::ComFprime_commsBufferManager::bins));
ConfigObjects::ComFprime_commsBufferManager::bins.bins[0].bufferSize = ComFprimeConfig::BuffMgr::commsBuffSize;
ConfigObjects::ComFprime_commsBufferManager::bins.bins[0].numBuffers = ComFprimeConfig::BuffMgr::commsBuffCount;
ConfigObjects::ComFprime_commsBufferManager::bins.bins[1].bufferSize = ComFprimeConfig::BuffMgr::commsFileBuffSize;
ConfigObjects::ComFprime_commsBufferManager::bins.bins[1].numBuffers = ComFprimeConfig::BuffMgr::commsFileBuffCount;
ComFprime::commsBufferManager.setup(
ComFprimeConfig::BuffMgr::commsBuffMgrId,
0,
ComFprime::Allocation::memAllocator,
ConfigObjects::ComFprime_commsBufferManager::bins
);
"""
phase Fpp.ToCpp.Phases.tearDownComponents """
ComFprime::commsBufferManager.cleanup();
"""
}
instance deframer: Svc.FprimeDeframer base id ComFprimeConfig.BASE_ID + 0x03000 \
instance fprimeFramer: Svc.FprimeFramer base id ComFprimeConfig.BASE_ID + 0x04000 \
instance fprimeRouter: Svc.FprimeRouter base id ComFprimeConfig.BASE_ID + 0x05000 \
instance comStub: Svc.ComStub base id ComFprimeConfig.BASE_ID + 0x06000 \
topology Subtopology {
# Active Components
instance comQueue
# Passive Components
instance commsBufferManager
instance frameAccumulator
instance deframer
instance fprimeFramer
instance fprimeRouter
instance comStub
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
# ComStatus
comStub.comStatusOut -> fprimeFramer.comStatusIn
fprimeFramer.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 -> 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