From 6b48fb64d816ebbdacf2f8ff33ec47136ddeec8d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 16 Sep 2022 12:14:27 +0200 Subject: [PATCH] start integrating cfdp code --- bsp_q7s/OBSWConfig.h.in | 1 + bsp_q7s/boardtest/Q7STestTask.cpp | 6 +++--- bsp_q7s/fs/helpers.cpp | 2 +- bsp_q7s/fs/helpers.h | 3 +-- common/config/commonObjects.h | 3 ++- mission/core/GenericFactory.cpp | 34 +++++++++++++++++++++++++++---- 6 files changed, 38 insertions(+), 11 deletions(-) diff --git a/bsp_q7s/OBSWConfig.h.in b/bsp_q7s/OBSWConfig.h.in index b9c27840..fe59d8d3 100644 --- a/bsp_q7s/OBSWConfig.h.in +++ b/bsp_q7s/OBSWConfig.h.in @@ -37,6 +37,7 @@ #define OBSW_ADD_RAD_SENSORS @OBSW_ADD_RAD_SENSORS@ #define OBSW_ADD_PL_PCDU @OBSW_ADD_PL_PCDU@ #define OBSW_ADD_SYRLINKS @OBSW_ADD_SYRLINKS@ +#define OBSW_ADD_CFDP_COMPONENTS 1 #define OBSW_ENABLE_SYRLINKS_TRANSMIT_TIMEOUT 0 #define OBSW_MPSOC_JTAG_BOOT 0 diff --git a/bsp_q7s/boardtest/Q7STestTask.cpp b/bsp_q7s/boardtest/Q7STestTask.cpp index f6745348..a782ff6d 100644 --- a/bsp_q7s/boardtest/Q7STestTask.cpp +++ b/bsp_q7s/boardtest/Q7STestTask.cpp @@ -19,8 +19,8 @@ #include "OBSWConfig.h" #include "bsp_q7s/fs/SdCardManager.h" -#include "bsp_q7s/memory/scratchApi.h" #include "bsp_q7s/fs/helpers.h" +#include "bsp_q7s/memory/scratchApi.h" #include "fsfw/tasks/TaskFactory.h" #include "fsfw/timemanager/Stopwatch.h" #include "p60pdu.h" @@ -379,11 +379,11 @@ void Q7STestTask::testFileSystemHandlerDirect(FsOpCodes opCode) { if (opCode == FsOpCodes::CREATE_EMPTY_FILE_IN_TMP) { FilesystemParams params("/tmp/hello.txt"); auto res = hostFs.createFile(params); - if(res != OK) { + if (res != OK) { sif::warning << "Creating empty file in /tmp failed" << std::endl; } bool fileExists = std::filesystem::exists("/tmp/hello.txt"); - if(not fileExists) { + if (not fileExists) { sif::warning << "File was not created!" << std::endl; } hostFs.removeFile("/tmp/hello.txt"); diff --git a/bsp_q7s/fs/helpers.cpp b/bsp_q7s/fs/helpers.cpp index e233d514..f1f31eba 100644 --- a/bsp_q7s/fs/helpers.cpp +++ b/bsp_q7s/fs/helpers.cpp @@ -1,7 +1,7 @@ #include "helpers.h" std::filesystem::path fshelpers::getPrefixedPath(SdCardManager &man, - std::filesystem::path pathWihtoutPrefix) { + std::filesystem::path pathWihtoutPrefix) { auto prefix = man.getCurrentMountPrefix(); auto resPath = prefix / pathWihtoutPrefix; return resPath; diff --git a/bsp_q7s/fs/helpers.h b/bsp_q7s/fs/helpers.h index f78e5fbe..b5dc7365 100644 --- a/bsp_q7s/fs/helpers.h +++ b/bsp_q7s/fs/helpers.h @@ -7,8 +7,7 @@ namespace fshelpers { -std::filesystem::path getPrefixedPath(SdCardManager& man, - std::filesystem::path pathWihtoutPrefix); +std::filesystem::path getPrefixedPath(SdCardManager& man, std::filesystem::path pathWihtoutPrefix); } diff --git a/common/config/commonObjects.h b/common/config/commonObjects.h index e0efbce7..89e4b8d3 100644 --- a/common/config/commonObjects.h +++ b/common/config/commonObjects.h @@ -121,7 +121,8 @@ enum commonObjects : uint32_t { ACS_BOARD_ASS = 0x73000001, SUS_BOARD_ASS = 0x73000002, TCS_BOARD_ASS = 0x73000003, - RW_ASS = 0x73000004 + RW_ASS = 0x73000004, + CFDP_HANDLER = 0x73000005, }; } diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index 0c6ab421..d4e6fc9f 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -1,5 +1,6 @@ #include "GenericFactory.h" +#include #include #include #include @@ -17,6 +18,7 @@ #include #include #include +#include #include #include "OBSWConfig.h" @@ -56,17 +58,18 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { new InternalErrorReporter(objects::INTERNAL_ERROR_REPORTER); new VerificationReporter(); auto* timeStamper = new CdsShortTimeStamper(objects::TIME_STAMPER); - + StorageManagerIF* tcStore; + StorageManagerIF* tmStore; { PoolManager::LocalPoolConfig poolCfg = {{300, 16}, {300, 32}, {200, 64}, {200, 128}, {100, 1024}, {10, 2048}}; - new PoolManager(objects::TC_STORE, poolCfg); + tcStore = new PoolManager(objects::TC_STORE, poolCfg); } { PoolManager::LocalPoolConfig poolCfg = {{300, 16}, {300, 32}, {100, 64}, {100, 128}, {100, 1024}, {10, 2048}}; - new PoolManager(objects::TM_STORE, poolCfg); + tmStore = new PoolManager(objects::TM_STORE, poolCfg); } { @@ -83,7 +86,7 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { vc = config::LIVE_TM; #endif // Every TM packet goes through this funnel - new TmFunnel(objects::TM_FUNNEL, *timeStamper, 50, vc); + auto* funnel = new TmFunnel(objects::TM_FUNNEL, *timeStamper, 50, vc); // PUS service stack new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION, apid::EIVE_OBSW, @@ -129,4 +132,27 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_) { #endif /* OBSW_USE_TMTC_TCP_BRIDGE == 0 */ tmtcBridge->setMaxNumberOfPacketsStored(300); #endif /* OBSW_ADD_TCPIP_BRIDGE == 1 */ + +#if OBSW_ADD_CFDP_COMPONENTS == 1 + auto* hostFs = new HostFilesystem(); + FsfwHandlerParams params(objects::CFDP_HANDLER, *hostFs, *funnel, *tcStore, *tmStore); +// cfdp::IndicationCfg indicationCfg; +// UnsignedByteField apid(common::COMMON_CFDP_APID); +// cfdp::EntityId localId(apid); +// UnsignedByteField remoteEntityId(common::COMMON_CFDP_CLIENT_ENTITY_ID); +// cfdp::EntityId remoteId(remoteEntityId); +// cfdp::RemoteEntityCfg remoteCfg(remoteId); +// remoteCfg.defaultChecksum = cfdp::ChecksumTypes::CRC_32; +// auto* remoteCfgProvider = new cfdp::OneRemoteConfigProvider(remoteCfg); +// auto* cfdpUserHandler = new CfdpExampleUserHandler(*hostFs); +// auto* cfdpFaultHandler = new CfdpExampleFaultHandler(); +// cfdp::PacketInfoList<64> packetList; +// cfdp::LostSegmentsList<128> lostSegments; +// CfdpHandlerCfg cfg(localId, indicationCfg, *cfdpUserHandler, *cfdpFaultHandler, packetList, +// lostSegments, *remoteCfgProvider); +// auto* cfdpHandler = new CfdpHandler(params, cfg); +// CcsdsDistributorIF::DestInfo info("CFDP Destination", common::COMMON_CFDP_APID, +// cfdpHandler->getRequestQueue(), true); +// ccsdsDistrib->registerApplication(info); +#endif }