go down to nanoseconds
This commit is contained in:
parent
e10768386d
commit
1a0e632d2f
@ -3,6 +3,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include "fsfw/serviceinterface/ServiceInterface.h"
|
#include "fsfw/serviceinterface/ServiceInterface.h"
|
||||||
|
#include <ctime>
|
||||||
|
|
||||||
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)
|
||||||
@ -56,7 +57,7 @@ ReturnValue_t PapbVcInterface::pollPapbBusySignal(uint32_t maxPollRetries) const
|
|||||||
gpio::Levels papbBusyState = gpio::Levels::LOW;
|
gpio::Levels papbBusyState = gpio::Levels::LOW;
|
||||||
ReturnValue_t result;
|
ReturnValue_t result;
|
||||||
uint32_t busyIdx = 0;
|
uint32_t busyIdx = 0;
|
||||||
uint32_t nextDelay = 1;
|
struct timespec nextDelay = {.tv_sec = 0, .tv_nsec = 10};
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
/** Check if PAPB interface is ready to receive data */
|
/** Check if PAPB interface is ready to receive data */
|
||||||
@ -75,9 +76,9 @@ ReturnValue_t PapbVcInterface::pollPapbBusySignal(uint32_t maxPollRetries) const
|
|||||||
return PAPB_BUSY;
|
return PAPB_BUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
usleep(nextDelay);
|
nanosleep(&nextDelay, const_cast<struct timespec*>(&remDelay));
|
||||||
if (nextDelay * 2 <= MAX_DELAY_PAPB_POLLING_US) {
|
if (nextDelay.tv_nsec * 2 <= MAX_DELAY_PAPB_POLLING_NS) {
|
||||||
nextDelay *= 2;
|
nextDelay.tv_nsec *= 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
|
@ -76,7 +76,7 @@ class PapbVcInterface : public VirtualChannelIF {
|
|||||||
*/
|
*/
|
||||||
static const int DATA_REG_OFFSET = 256;
|
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;
|
LinuxLibgpioIF* gpioComIF = nullptr;
|
||||||
|
|
||||||
@ -87,6 +87,7 @@ class PapbVcInterface : public VirtualChannelIF {
|
|||||||
|
|
||||||
std::string uioFile;
|
std::string uioFile;
|
||||||
int mapNum = 0;
|
int mapNum = 0;
|
||||||
|
struct timespec remDelay;
|
||||||
|
|
||||||
volatile uint32_t* vcBaseReg = nullptr;
|
volatile uint32_t* vcBaseReg = nullptr;
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ ReturnValue_t PersistentLogTmStoreTask::performOperation(uint8_t opCode) {
|
|||||||
if (not someonesBusy) {
|
if (not someonesBusy) {
|
||||||
TaskFactory::delayTask(100);
|
TaskFactory::delayTask(100);
|
||||||
} else if (someFileWasSwapped) {
|
} else if (someFileWasSwapped) {
|
||||||
TaskFactory::delayTask(2);
|
TaskFactory::delayTask(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ ReturnValue_t PersistentSingleTmStoreTask::performOperation(uint8_t opCode) {
|
|||||||
if (not busy) {
|
if (not busy) {
|
||||||
TaskFactory::delayTask(100);
|
TaskFactory::delayTask(100);
|
||||||
} else if (fileHasSwapped) {
|
} else if (fileHasSwapped) {
|
||||||
TaskFactory::delayTask(2);
|
TaskFactory::delayTask(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user