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