some tweaks for busy handling #500

Merged
muellerr merged 28 commits from tweak_papb_busy_polling into develop 2023-03-24 14:15:01 +01:00
4 changed files with 43 additions and 27 deletions
Showing only changes of commit 159da20ef2 - Show all commits

View File

@ -44,16 +44,23 @@ void PapbVcInterface::endPacketTransfer() { *vcBaseReg = CONFIG_END; }
ReturnValue_t PapbVcInterface::pollPapbBusySignal() const { ReturnValue_t PapbVcInterface::pollPapbBusySignal() const {
gpio::Levels papbBusyState = gpio::Levels::LOW; gpio::Levels papbBusyState = gpio::Levels::LOW;
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;
uint32_t busyIdx = 0;
/** Check if PAPB interface is ready to receive data */ while (true) {
result = gpioComIF->readGpio(papbBusyId, papbBusyState); /** Check if PAPB interface is ready to receive data */
if (result != returnvalue::OK) { result = gpioComIF->readGpio(papbBusyId, papbBusyState);
sif::warning << "PapbVcInterface::pollPapbBusySignal: Failed to read papb busy signal" if (result != returnvalue::OK) {
<< std::endl; sif::warning << "PapbVcInterface::pollPapbBusySignal: Failed to read papb busy signal"
return returnvalue::FAILED; << std::endl;
} return returnvalue::FAILED;
if (papbBusyState == gpio::Levels::LOW) { }
return PAPB_BUSY; if (papbBusyState == gpio::Levels::HIGH) {
return returnvalue::OK;
}
if (busyIdx == 100) {
return PAPB_BUSY;
}
busyIdx++;
} }
return returnvalue::OK; return returnvalue::OK;

View File

@ -11,6 +11,9 @@ ReturnValue_t LiveTmTask::performOperation(uint8_t opCode) {
while (true) { while (true) {
// The funnel tasks are scheduled here directly as well. // The funnel tasks are scheduled here directly as well.
ReturnValue_t result = channel.sendNextTm(); ReturnValue_t result = channel.sendNextTm();
if (result == DirectTmSinkIF::IS_BUSY) {
sif::error << "Lost live TM, PAPB busy" << std::endl;
}
if (result == MessageQueueIF::EMPTY) { if (result == MessageQueueIF::EMPTY) {
if (tmFunnelCd.hasTimedOut()) { if (tmFunnelCd.hasTimedOut()) {
pusFunnel.performOperation(0); pusFunnel.performOperation(0);

View File

@ -26,24 +26,27 @@ bool TmStoreTaskBase::handleOneStore(PersistentTmStoreWithTmQueue& store,
if (store.getState() == PersistentTmStore::State::DUMPING) { if (store.getState() == PersistentTmStore::State::DUMPING) {
size_t dumpedLen = 0; size_t dumpedLen = 0;
bool fileHasSwapped; bool fileHasSwapped;
if (not channel.isBusy()) { // if (not channel.isBusy()) {
tmSinkBusyCd.resetTimer(); tmSinkBusyCd.resetTimer();
result = store.dumpNextPacket(channel, dumpedLen, fileHasSwapped); result = store.dumpNextPacket(channel, dumpedLen, fileHasSwapped);
if ((result == PersistentTmStore::DUMP_DONE or result == returnvalue::OK) and dumpedLen > 0) { if (result == DirectTmSinkIF::IS_BUSY) {
dumpContext.dumpedBytes += dumpedLen; sif::warning << "PersistentTmStore: PAPB was too busy for dump" << std::endl;
dumpContext.numberOfDumpedPackets += 1;
}
if (result == PersistentTmStore::DUMP_DONE) {
uint32_t startTime;
uint32_t endTime;
store.getStartAndEndTimeCurrentOrLastDump(startTime, endTime);
triggerEvent(dumpContext.eventIfDone, dumpContext.numberOfDumpedPackets,
dumpContext.dumpedBytes);
dumpsPerformed = true;
} else if (result == returnvalue::OK) {
dumpsPerformed = true;
}
} }
if ((result == PersistentTmStore::DUMP_DONE or result == returnvalue::OK) and dumpedLen > 0) {
dumpContext.dumpedBytes += dumpedLen;
dumpContext.numberOfDumpedPackets += 1;
}
if (result == PersistentTmStore::DUMP_DONE) {
uint32_t startTime;
uint32_t endTime;
store.getStartAndEndTimeCurrentOrLastDump(startTime, endTime);
triggerEvent(dumpContext.eventIfDone, dumpContext.numberOfDumpedPackets,
dumpContext.dumpedBytes);
dumpsPerformed = true;
} else if (result == returnvalue::OK) {
dumpsPerformed = true;
}
//}
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());
store.cancelDump(); store.cancelDump();

View File

@ -36,7 +36,10 @@ ReturnValue_t VirtualChannelWithQueue::sendNextTm() {
return result; return result;
} }
write(data, size); ReturnValue_t result = write(data, size);
if (result != returnvalue::OK) {
return result;
}
tmStore.deleteData(storeId); tmStore.deleteData(storeId);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
return result; return result;