go down to nanoseconds

This commit is contained in:
Robin Müller 2023-03-27 17:42:54 +02:00
parent e10768386d
commit 1a0e632d2f
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
4 changed files with 9 additions and 7 deletions

View File

@ -3,6 +3,7 @@
#include <unistd.h>
#include "fsfw/serviceinterface/ServiceInterface.h"
#include <ctime>
PapbVcInterface::PapbVcInterface(LinuxLibgpioIF* gpioComIF, gpioId_t papbBusyId,
gpioId_t papbEmptyId, std::string uioFile, int mapNum)
@ -56,7 +57,7 @@ ReturnValue_t PapbVcInterface::pollPapbBusySignal(uint32_t maxPollRetries) const
gpio::Levels papbBusyState = gpio::Levels::LOW;
ReturnValue_t result;
uint32_t busyIdx = 0;
uint32_t nextDelay = 1;
struct timespec nextDelay = {.tv_sec = 0, .tv_nsec = 10};
while (true) {
/** Check if PAPB interface is ready to receive data */
@ -75,9 +76,9 @@ ReturnValue_t PapbVcInterface::pollPapbBusySignal(uint32_t maxPollRetries) const
return PAPB_BUSY;
}
usleep(nextDelay);
if (nextDelay * 2 <= MAX_DELAY_PAPB_POLLING_US) {
nextDelay *= 2;
nanosleep(&nextDelay, const_cast<struct timespec*>(&remDelay));
if (nextDelay.tv_nsec * 2 <= MAX_DELAY_PAPB_POLLING_NS) {
nextDelay.tv_nsec *= 2;
}
}
return returnvalue::OK;

View File

@ -76,7 +76,7 @@ class PapbVcInterface : public VirtualChannelIF {
*/
static const int DATA_REG_OFFSET = 256;
static constexpr uint32_t MAX_DELAY_PAPB_POLLING_US = 4;
static constexpr long int MAX_DELAY_PAPB_POLLING_NS = 40;
LinuxLibgpioIF* gpioComIF = nullptr;
@ -87,6 +87,7 @@ class PapbVcInterface : public VirtualChannelIF {
std::string uioFile;
int mapNum = 0;
struct timespec remDelay;
volatile uint32_t* vcBaseReg = nullptr;

View File

@ -34,7 +34,7 @@ ReturnValue_t PersistentLogTmStoreTask::performOperation(uint8_t opCode) {
if (not someonesBusy) {
TaskFactory::delayTask(100);
} else if (someFileWasSwapped) {
TaskFactory::delayTask(2);
TaskFactory::delayTask(1);
}
}
}

View File

@ -19,7 +19,7 @@ ReturnValue_t PersistentSingleTmStoreTask::performOperation(uint8_t opCode) {
if (not busy) {
TaskFactory::delayTask(100);
} else if (fileHasSwapped) {
TaskFactory::delayTask(2);
TaskFactory::delayTask(1);
}
}
}