found some more bugs
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2023-03-27 21:39:37 +02:00
parent fb324516bb
commit 00214dc378
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
5 changed files with 33 additions and 38 deletions

View File

@ -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();

View File

@ -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()) {
@ -21,20 +20,14 @@ ReturnValue_t PersistentSingleTmStoreTask::performOperation(uint8_t opCode) {
if (not busy) {
TaskFactory::delayTask(100);
} else if (dumpContext.vcBusyDuringDump) {
TaskFactory::delayTask(30);
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.

View File

@ -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(); }

View File

@ -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;
@ -50,6 +53,8 @@ class TmStoreTaskBase : public SystemObject {
bool storesInitialized = false;
bool fileHasSwapped = false;
SdCardMountedIF& sdcMan;
void dumpDoneHandler(DumpContext& ctx);
};
#endif /* MISSION_TMTC_TMSTORETASKBASE_H_ */

View File

@ -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; }