found some more bugs
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good
This commit is contained in:
parent
fb324516bb
commit
00214dc378
@ -2,9 +2,10 @@
|
||||
#include <linux/ipcore/PapbVcInterface.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||
#include <ctime>
|
||||
|
||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||
|
||||
PapbVcInterface::PapbVcInterface(LinuxLibgpioIF* gpioComIF, gpioId_t papbBusyId,
|
||||
gpioId_t papbEmptyId, std::string uioFile, int mapNum)
|
||||
: gpioComIF(gpioComIF),
|
||||
@ -33,14 +34,14 @@ ReturnValue_t PapbVcInterface::write(const uint8_t* data, size_t size) {
|
||||
return DirectTmSinkIF::IS_BUSY;
|
||||
}
|
||||
for (size_t idx = 0; idx < size; idx++) {
|
||||
if (pollPapbBusySignal(5) == returnvalue::OK) {
|
||||
if (pollPapbBusySignal(3) == returnvalue::OK) {
|
||||
*(vcBaseReg + DATA_REG_OFFSET) = static_cast<uint32_t>(data[idx]);
|
||||
} else {
|
||||
abortPacketTransfer();
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
}
|
||||
if (pollPapbBusySignal(5) == returnvalue::OK) {
|
||||
if (pollPapbBusySignal(3) == returnvalue::OK) {
|
||||
completePacketTransfer();
|
||||
} else {
|
||||
abortPacketTransfer();
|
||||
|
@ -11,7 +11,6 @@ PersistentSingleTmStoreTask::PersistentSingleTmStoreTask(
|
||||
dumpContext(eventIfDumpDone) {}
|
||||
|
||||
ReturnValue_t PersistentSingleTmStoreTask::performOperation(uint8_t opCode) {
|
||||
uint32_t dummy = 0;
|
||||
while (true) {
|
||||
// Delay done by the check
|
||||
if (not cyclicStoreCheck()) {
|
||||
@ -20,25 +19,19 @@ ReturnValue_t PersistentSingleTmStoreTask::performOperation(uint8_t opCode) {
|
||||
bool busy = handleOneStore(storeWithQueue, dumpContext);
|
||||
if (not busy) {
|
||||
TaskFactory::delayTask(100);
|
||||
} else if(dumpContext.vcBusyDuringDump) {
|
||||
TaskFactory::delayTask(30);
|
||||
} else if (dumpContext.vcBusyDuringDump) {
|
||||
TaskFactory::delayTask(10);
|
||||
} else if (fileHasSwapped) {
|
||||
TaskFactory::delayTask(30);
|
||||
} else if(dumpContext.packetWasDumped and dumpContext.numberOfDumpedPackets % 5 == 0) {
|
||||
TaskFactory::delayTask(30);
|
||||
TaskFactory::delayTask(10);
|
||||
} else if (dumpContext.packetWasDumped and dumpContext.numberOfDumpedPackets % 50 == 0) {
|
||||
TaskFactory::delayTask(10);
|
||||
} else {
|
||||
// dummy++;
|
||||
// if(dummy % 2000 == 0) {
|
||||
// sif::warning << "persistent tm store is stupid" << std::endl;
|
||||
// }
|
||||
TaskFactory::delayTask(2);
|
||||
// continue;
|
||||
// TaskFactory::delayTask(5);
|
||||
}
|
||||
dummy = 0;
|
||||
//else if(dumpContext.numberOfDumpedPackets % 20 == 0) {
|
||||
// Manual load management because I don't know what the scheduler is doing..
|
||||
// Removing this delay can lead to evil side effects.
|
||||
//TaskFactory::delayTask(5);
|
||||
// else if(dumpContext.numberOfDumpedPackets % 20 == 0) {
|
||||
// Manual load management because I don't know what the scheduler is doing..
|
||||
// Removing this delay can lead to evil side effects.
|
||||
// TaskFactory::delayTask(5);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
@ -18,21 +18,21 @@ bool TmStoreTaskBase::handleOneStore(PersistentTmStoreWithTmQueue& store,
|
||||
bool tcRequestReceived = false;
|
||||
bool dumpsPerformed = false;
|
||||
fileHasSwapped = false;
|
||||
dumpContext.packetWasDumped = false;
|
||||
dumpContext.vcBusyDuringDump = false;
|
||||
|
||||
// Store TM persistently
|
||||
result = store.handleNextTm();
|
||||
if (result == returnvalue::OK) {
|
||||
tmToStoreReceived = true;
|
||||
}
|
||||
dumpContext.vcBusyDuringDump = false;
|
||||
// Dump TMs when applicable
|
||||
if (store.getState() == PersistentTmStore::State::DUMPING) {
|
||||
size_t dumpedLen = 0;
|
||||
if (not channel.isBusy()) {
|
||||
dumpContext.ptmeBusyCounter = 0;
|
||||
tmSinkBusyCd.resetTimer();
|
||||
bool fileHasSwappedLocal = false;
|
||||
result = store.dumpNextPacket(channel, dumpedLen, fileHasSwappedLocal);
|
||||
result = store.dumpNextPacket(channel, dumpedLen, fileHasSwapped);
|
||||
if (result == DirectTmSinkIF::IS_BUSY) {
|
||||
sif::warning << "Unexpected PAPB busy" << std::endl;
|
||||
}
|
||||
@ -40,10 +40,6 @@ bool TmStoreTaskBase::handleOneStore(PersistentTmStoreWithTmQueue& store,
|
||||
dumpContext.dumpedBytes += dumpedLen;
|
||||
dumpContext.numberOfDumpedPackets += 1;
|
||||
dumpContext.packetWasDumped = true;
|
||||
// Only register file swaps if more than 0 bytes were dumped.
|
||||
if(fileHasSwappedLocal) {
|
||||
fileHasSwapped = true;
|
||||
}
|
||||
}
|
||||
if (result == PersistentTmStore::DUMP_DONE) {
|
||||
uint32_t startTime;
|
||||
@ -51,6 +47,7 @@ bool TmStoreTaskBase::handleOneStore(PersistentTmStoreWithTmQueue& store,
|
||||
store.getStartAndEndTimeCurrentOrLastDump(startTime, endTime);
|
||||
triggerEvent(dumpContext.eventIfDone, dumpContext.numberOfDumpedPackets,
|
||||
dumpContext.dumpedBytes);
|
||||
dumpContext.reset();
|
||||
dumpsPerformed = true;
|
||||
} else if (result == returnvalue::OK) {
|
||||
dumpsPerformed = true;
|
||||
@ -62,14 +59,15 @@ bool TmStoreTaskBase::handleOneStore(PersistentTmStoreWithTmQueue& store,
|
||||
// If this happens, something is probably wrong.
|
||||
sif::warning << "PTME busy for longer period. Dumped length so far: "
|
||||
<< dumpContext.dumpedBytes << std::endl;
|
||||
dumpContext.ptmeBusyCounter = 0;
|
||||
triggerEvent(persTmStore::DUMP_WAS_CANCELLED, store.getObjectId());
|
||||
dumpContext.reset();
|
||||
store.cancelDump();
|
||||
channel.cancelTransfer();
|
||||
}
|
||||
}
|
||||
if (cancelDumpCd.hasTimedOut() or tmSinkBusyCd.hasTimedOut()) {
|
||||
triggerEvent(persTmStore::DUMP_WAS_CANCELLED, store.getObjectId());
|
||||
dumpDoneHandler(dumpContext);
|
||||
store.cancelDump();
|
||||
}
|
||||
} else {
|
||||
@ -109,3 +107,5 @@ bool TmStoreTaskBase::cyclicStoreCheck() {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void TmStoreTaskBase::dumpDoneHandler(DumpContext& ctx) { ctx.reset(); }
|
||||
|
@ -12,6 +12,9 @@ class TmStoreTaskBase : public SystemObject {
|
||||
void reset() {
|
||||
numberOfDumpedPackets = 0;
|
||||
dumpedBytes = 0;
|
||||
vcBusyDuringDump = false;
|
||||
packetWasDumped = false;
|
||||
ptmeBusyCounter = 0;
|
||||
}
|
||||
const Event eventIfDone;
|
||||
uint32_t numberOfDumpedPackets = 0;
|
||||
@ -45,11 +48,13 @@ class TmStoreTaskBase : public SystemObject {
|
||||
// 20 minutes are allowed as maximum dump time.
|
||||
Countdown cancelDumpCd = Countdown(60 * 20 * 1000);
|
||||
// If the TM sink is busy for 1 minute for whatever reason, cancel the dump.
|
||||
Countdown tmSinkBusyCd = Countdown(60 * 20 * 1000);//Countdown(60 * 1000 );
|
||||
Countdown tmSinkBusyCd = Countdown(60 * 20 * 1000); // Countdown(60 * 1000 );
|
||||
VirtualChannel& channel;
|
||||
bool storesInitialized = false;
|
||||
bool fileHasSwapped = false;
|
||||
SdCardMountedIF& sdcMan;
|
||||
|
||||
void dumpDoneHandler(DumpContext& ctx);
|
||||
};
|
||||
|
||||
#endif /* MISSION_TMTC_TMSTORETASKBASE_H_ */
|
||||
|
@ -2,11 +2,7 @@
|
||||
|
||||
VirtualChannel::VirtualChannel(object_id_t objectId, uint8_t vcId, const char* vcName, PtmeIF& ptme,
|
||||
const std::atomic_bool& txOn)
|
||||
: SystemObject(objectId),
|
||||
ptme(ptme),
|
||||
vcId(vcId),
|
||||
vcName(vcName),
|
||||
txOn(txOn) {}
|
||||
: SystemObject(objectId), ptme(ptme), vcId(vcId), vcName(vcName), txOn(txOn) {}
|
||||
|
||||
ReturnValue_t VirtualChannel::initialize() { return returnvalue::OK; }
|
||||
|
||||
@ -15,10 +11,10 @@ ReturnValue_t VirtualChannel::sendNextTm(const uint8_t* data, size_t size) {
|
||||
}
|
||||
|
||||
ReturnValue_t VirtualChannel::write(const uint8_t* data, size_t size) {
|
||||
//if (txOn) {
|
||||
return ptme.writeToVc(vcId, data, size);
|
||||
// if (txOn) {
|
||||
return ptme.writeToVc(vcId, data, size);
|
||||
//}
|
||||
//return returnvalue::OK;
|
||||
// return returnvalue::OK;
|
||||
}
|
||||
|
||||
uint8_t VirtualChannel::getVcid() const { return vcId; }
|
||||
@ -27,7 +23,7 @@ const char* VirtualChannel::getName() const { return vcName.c_str(); }
|
||||
|
||||
bool VirtualChannel::isBusy() const {
|
||||
// Data is discarded, so channel is not busy.
|
||||
//if (not txOn) {
|
||||
// if (not txOn) {
|
||||
// return false;
|
||||
//}
|
||||
return ptme.isBusy(vcId);
|
||||
|
Loading…
Reference in New Issue
Block a user