Refactor TM handling #450
@ -1,4 +1,6 @@
|
||||
#include <bsp_q7s/callbacks/q7sGpioCallbacks.h>
|
||||
#include <fsfw/storagemanager/LocalPool.h>
|
||||
#include <fsfw/storagemanager/PoolManager.h>
|
||||
#include <mission/devices/devicedefinitions/GomspaceDefinitions.h>
|
||||
|
||||
#include "OBSWConfig.h"
|
||||
|
@ -172,6 +172,7 @@ enum commonObjects : uint32_t {
|
||||
LOG_STORE_AND_TM_TASK = 0x73040001,
|
||||
HK_STORE_AND_TM_TASK = 0x73040002,
|
||||
CFDP_STORE_AND_TM_TASK = 0x73040003,
|
||||
DOWNLINK_RAM_STORE = 0x73040004,
|
||||
|
||||
// Other stuff
|
||||
THERMAL_TEMP_INSERTER = 0x90000003,
|
||||
|
@ -119,6 +119,9 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun
|
||||
{100, 256}, {50, 512}, {50, 1024}, {10, 2048}};
|
||||
*ipcStore = new PoolManager(objects::IPC_STORE, poolCfg);
|
||||
}
|
||||
PoolManager::LocalPoolConfig poolCfg = {{300, 32}, {400, 64}, {250, 128},
|
||||
{150, 512}, {150, 1024}, {150, 2048}};
|
||||
auto* ramToFileStore = new PoolManager(objects::DOWNLINK_RAM_STORE, poolCfg);
|
||||
|
||||
#if OBSW_ADD_TCPIP_SERVERS == 1
|
||||
#if OBSW_ADD_TMTC_UDP_SERVER == 1
|
||||
@ -148,18 +151,17 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun
|
||||
|
||||
PusTmFunnel::FunnelCfg cfdpFunnelCfg(objects::CFDP_TM_FUNNEL, "CfdpTmFunnel", **tmStore,
|
||||
**ipcStore, 50);
|
||||
*cfdpFunnel = new CfdpTmFunnel(cfdpFunnelCfg, config::EIVE_CFDP_APID);
|
||||
*cfdpFunnel = new CfdpTmFunnel(cfdpFunnelCfg, *ramToFileStore, config::EIVE_CFDP_APID);
|
||||
PusTmFunnel::FunnelCfg pusFunnelCfg(objects::PUS_TM_FUNNEL, "PusTmFunnel", **tmStore, **ipcStore,
|
||||
config::MAX_PUS_FUNNEL_QUEUE_DEPTH);
|
||||
// The PUS funnel routes all live TM to the live destinations and to the TM stores.
|
||||
*pusFunnel = new PusTmFunnel(pusFunnelCfg, *timeStamper, sdcMan);
|
||||
*pusFunnel = new PusTmFunnel(pusFunnelCfg, *ramToFileStore, *timeStamper, sdcMan);
|
||||
|
||||
// MISC store and PUS funnel to MISC store routing
|
||||
// TODO: Make queue depth configurable
|
||||
{
|
||||
PersistentTmStoreArgs storeArgs(objects::MISC_TM_STORE, "tm", "misc",
|
||||
|
||||
RolloverInterval::HOURLY, 2, **tmStore, sdcMan);
|
||||
RolloverInterval::HOURLY, 2, *ramToFileStore, sdcMan);
|
||||
stores.miscStore =
|
||||
new PersistentTmStoreWithTmQueue(storeArgs, "MISC STORE", config::MISC_STORE_QUEUE_SIZE);
|
||||
(*pusFunnel)
|
||||
@ -168,10 +170,9 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun
|
||||
}
|
||||
|
||||
// OK store and PUS Funnel to OK store routing
|
||||
// TODO: Make queue depth configurable
|
||||
{
|
||||
PersistentTmStoreArgs storeArgs(objects::OK_TM_STORE, "tm", "ok", RolloverInterval::MINUTELY,
|
||||
30, **tmStore, sdcMan);
|
||||
30, *ramToFileStore, sdcMan);
|
||||
stores.okStore =
|
||||
new PersistentTmStoreWithTmQueue(storeArgs, "OK STORE", config::OK_STORE_QUEUE_SIZE);
|
||||
(*pusFunnel)
|
||||
@ -180,10 +181,9 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun
|
||||
}
|
||||
|
||||
// NOT OK store and PUS funnel to NOT OK store routing
|
||||
// TODO: Make queue depth configurable
|
||||
{
|
||||
PersistentTmStoreArgs storeArgs(objects::NOT_OK_TM_STORE, "tm", "nok",
|
||||
RolloverInterval::MINUTELY, 30, **tmStore, sdcMan);
|
||||
RolloverInterval::MINUTELY, 30, *ramToFileStore, sdcMan);
|
||||
stores.notOkStore =
|
||||
new PersistentTmStoreWithTmQueue(storeArgs, "NOT OK STORE", config::NOK_STORE_QUEUE_SIZE);
|
||||
(*pusFunnel)
|
||||
@ -192,10 +192,9 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun
|
||||
}
|
||||
|
||||
// HK store and PUS funnel to HK store routing
|
||||
// TODO: Make queue depth configurable
|
||||
{
|
||||
PersistentTmStoreArgs storeArgs(objects::HK_TM_STORE, "tm", "hk", RolloverInterval::MINUTELY,
|
||||
15, **tmStore, sdcMan);
|
||||
15, *ramToFileStore, sdcMan);
|
||||
stores.hkStore =
|
||||
new PersistentTmStoreWithTmQueue(storeArgs, "HK STORE", config::HK_STORE_QUEUE_SIZE);
|
||||
(*pusFunnel)
|
||||
@ -204,10 +203,9 @@ void ObjectFactory::produceGenericObjects(HealthTableIF** healthTable_, PusTmFun
|
||||
}
|
||||
|
||||
// CFDP store and PUS funnel to CFDP store routing
|
||||
// TODO: Make queue depth configurable
|
||||
{
|
||||
PersistentTmStoreArgs storeArgs(objects::CFDP_TM_STORE, "tm", "cfdp",
|
||||
RolloverInterval::MINUTELY, 30, **tmStore, sdcMan);
|
||||
RolloverInterval::MINUTELY, 30, *ramToFileStore, sdcMan);
|
||||
stores.cfdpStore =
|
||||
new PersistentTmStoreWithTmQueue(storeArgs, "CFDP STORE", config::CFDP_STORE_QUEUE_SIZE);
|
||||
|
||||
|
@ -4,8 +4,12 @@
|
||||
#include "fsfw/tmtcpacket/ccsds/SpacePacketCreator.h"
|
||||
#include "fsfw/tmtcservices/TmTcMessage.h"
|
||||
|
||||
CfdpTmFunnel::CfdpTmFunnel(TmFunnelBase::FunnelCfg cfg, uint16_t cfdpInCcsdsApid)
|
||||
: TmFunnelBase(cfg), cfdpInCcsdsApid(cfdpInCcsdsApid) {}
|
||||
CfdpTmFunnel::CfdpTmFunnel(TmFunnelBase::FunnelCfg cfg, MessageQueueId_t fileStoreDest,
|
||||
StorageManagerIF& ramToFileStore, uint16_t cfdpInCcsdsApid)
|
||||
: TmFunnelBase(cfg),
|
||||
fileStoreDest(fileStoreDest),
|
||||
ramToFileStore(ramToFileStore),
|
||||
cfdpInCcsdsApid(cfdpInCcsdsApid) {}
|
||||
|
||||
const char* CfdpTmFunnel::getName() const { return "CFDP TM Funnel"; }
|
||||
|
||||
@ -76,5 +80,15 @@ ReturnValue_t CfdpTmFunnel::handlePacket(TmTcMessage& msg) {
|
||||
msg.setStorageId(newStoreId);
|
||||
store_address_t origStoreId = newStoreId;
|
||||
// TODO: Also route to persistent TM store
|
||||
|
||||
store_address_t storageId;
|
||||
result = ramToFileStore.addData(&storageId, newPacketData, packetLen);
|
||||
TmTcMessage fileMsg(storageId);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::error << "PusLiveDemux::handlePacket: Store too full to create data copy" << std::endl;
|
||||
} else {
|
||||
tmQueue->sendMessage(fileStoreDest, &fileMsg);
|
||||
}
|
||||
|
||||
return demultiplexLivePackets(origStoreId, newPacketData, packetLen);
|
||||
}
|
||||
|
@ -12,7 +12,8 @@
|
||||
|
||||
class CfdpTmFunnel : public TmFunnelBase {
|
||||
public:
|
||||
CfdpTmFunnel(TmFunnelBase::FunnelCfg cfg, uint16_t cfdpInCcsdsApid);
|
||||
CfdpTmFunnel(TmFunnelBase::FunnelCfg cfg, MessageQueueId_t fileStoreDest,
|
||||
StorageManagerIF& ramToFileStore, uint16_t cfdpInCcsdsApid);
|
||||
[[nodiscard]] const char* getName() const override;
|
||||
ReturnValue_t performOperation(uint8_t opCode);
|
||||
ReturnValue_t initialize() override;
|
||||
@ -20,6 +21,8 @@ class CfdpTmFunnel : public TmFunnelBase {
|
||||
private:
|
||||
ReturnValue_t handlePacket(TmTcMessage& msg);
|
||||
|
||||
MessageQueueId_t fileStoreDest;
|
||||
StorageManagerIF& ramToFileStore;
|
||||
uint16_t sourceSequenceCount = 0;
|
||||
uint16_t cfdpInCcsdsApid;
|
||||
};
|
||||
|
@ -10,9 +10,9 @@
|
||||
#include "fsfw/tmtcpacket/pus/tm/PusTmZcWriter.h"
|
||||
#include "tmtc/pusIds.h"
|
||||
|
||||
PusTmFunnel::PusTmFunnel(TmFunnelBase::FunnelCfg cfg, TimeReaderIF &timeReader,
|
||||
SdCardMountedIF &sdcMan)
|
||||
: TmFunnelBase(cfg), timeReader(timeReader), sdcMan(sdcMan) {}
|
||||
PusTmFunnel::PusTmFunnel(TmFunnelBase::FunnelCfg cfg, StorageManagerIF &ramToFileStore,
|
||||
TimeReaderIF &timeReader, SdCardMountedIF &sdcMan)
|
||||
: TmFunnelBase(cfg), ramToFileStore(ramToFileStore), timeReader(timeReader), sdcMan(sdcMan) {}
|
||||
|
||||
PusTmFunnel::~PusTmFunnel() = default;
|
||||
|
||||
@ -66,7 +66,7 @@ ReturnValue_t PusTmFunnel::handleTmPacket(TmTcMessage &message) {
|
||||
MessageQueueId_t destination;
|
||||
if (persistentTmMap.packetMatches(packet, destination)) {
|
||||
store_address_t storageId;
|
||||
result = tmStore.addData(&storageId, packetData, size);
|
||||
result = ramToFileStore.addData(&storageId, packetData, size);
|
||||
TmTcMessage msg(storageId);
|
||||
if (result != returnvalue::OK) {
|
||||
sif::error << "PusLiveDemux::handlePacket: Store too full to create data copy" << std::endl;
|
||||
|
@ -24,7 +24,8 @@
|
||||
*/
|
||||
class PusTmFunnel : public TmFunnelBase {
|
||||
public:
|
||||
PusTmFunnel(TmFunnelBase::FunnelCfg cfg, TimeReaderIF &timeReader, SdCardMountedIF &sdcMan);
|
||||
PusTmFunnel(TmFunnelBase::FunnelCfg cfg, StorageManagerIF &ramToFileStore,
|
||||
TimeReaderIF &timeReader, SdCardMountedIF &sdcMan);
|
||||
[[nodiscard]] const char *getName() const override;
|
||||
~PusTmFunnel() override;
|
||||
|
||||
@ -36,6 +37,7 @@ class PusTmFunnel : public TmFunnelBase {
|
||||
static constexpr dur_millis_t TV_UPDATE_INTERVAL_SECS = 60 * 5;
|
||||
|
||||
uint16_t sourceSequenceCount = 0;
|
||||
StorageManagerIF &ramToFileStore;
|
||||
TimeReaderIF &timeReader;
|
||||
bool storesInitialized = false;
|
||||
SdCardMountedIF &sdcMan;
|
||||
|
Loading…
Reference in New Issue
Block a user