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,7 +44,9 @@ 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;
while (true) {
/** Check if PAPB interface is ready to receive data */ /** Check if PAPB interface is ready to receive data */
result = gpioComIF->readGpio(papbBusyId, papbBusyState); result = gpioComIF->readGpio(papbBusyId, papbBusyState);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {
@ -52,9 +54,14 @@ ReturnValue_t PapbVcInterface::pollPapbBusySignal() const {
<< std::endl; << std::endl;
return returnvalue::FAILED; return returnvalue::FAILED;
} }
if (papbBusyState == gpio::Levels::LOW) { if (papbBusyState == gpio::Levels::HIGH) {
return returnvalue::OK;
}
if (busyIdx == 100) {
return PAPB_BUSY; 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,9 +26,12 @@ 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 == DirectTmSinkIF::IS_BUSY) {
sif::warning << "PersistentTmStore: PAPB was too busy for dump" << std::endl;
}
if ((result == PersistentTmStore::DUMP_DONE or result == returnvalue::OK) and dumpedLen > 0) { if ((result == PersistentTmStore::DUMP_DONE or result == returnvalue::OK) and dumpedLen > 0) {
dumpContext.dumpedBytes += dumpedLen; dumpContext.dumpedBytes += dumpedLen;
dumpContext.numberOfDumpedPackets += 1; dumpContext.numberOfDumpedPackets += 1;
@ -43,7 +46,7 @@ bool TmStoreTaskBase::handleOneStore(PersistentTmStoreWithTmQueue& store,
} else if (result == returnvalue::OK) { } else if (result == returnvalue::OK) {
dumpsPerformed = true; 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;