ns delay between gpio polls solves it
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
c474d6ed1d
commit
d09b53f6df
@ -34,14 +34,18 @@ ReturnValue_t PapbVcInterface::write(const uint8_t* data, size_t size) {
|
||||
return DirectTmSinkIF::IS_BUSY;
|
||||
}
|
||||
for (size_t idx = 0; idx < size; idx++) {
|
||||
if (pollPapbBusySignal(3) == returnvalue::OK) {
|
||||
// This delay is super-important, DO NOT REMOVE!
|
||||
// Polling the GPIO
|
||||
nanosleep(&BETWEEN_POLL_DELAY, &remDelay);
|
||||
if (pollPapbBusySignal(2) == returnvalue::OK) {
|
||||
*(vcBaseReg + DATA_REG_OFFSET) = static_cast<uint32_t>(data[idx]);
|
||||
} else {
|
||||
abortPacketTransfer();
|
||||
return returnvalue::FAILED;
|
||||
}
|
||||
}
|
||||
if (pollPapbBusySignal(3) == returnvalue::OK) {
|
||||
nanosleep(&BETWEEN_POLL_DELAY, &remDelay);
|
||||
if (pollPapbBusySignal(2) == returnvalue::OK) {
|
||||
completePacketTransfer();
|
||||
} else {
|
||||
abortPacketTransfer();
|
||||
|
@ -76,8 +76,8 @@ class PapbVcInterface : public VirtualChannelIF {
|
||||
*/
|
||||
static const int DATA_REG_OFFSET = 256;
|
||||
|
||||
static constexpr long int FIRST_NON_NULL_DELAY_NS = 1000;
|
||||
static constexpr long int MAX_DELAY_PAPB_POLLING_NS = 4000;
|
||||
static constexpr long int FIRST_NON_NULL_DELAY_NS = 10;
|
||||
static constexpr long int MAX_DELAY_PAPB_POLLING_NS = 40;
|
||||
|
||||
LinuxLibgpioIF* gpioComIF = nullptr;
|
||||
|
||||
@ -89,6 +89,7 @@ class PapbVcInterface : public VirtualChannelIF {
|
||||
std::string uioFile;
|
||||
int mapNum = 0;
|
||||
mutable struct timespec nextDelay = {.tv_sec = 0, .tv_nsec = 0};
|
||||
const struct timespec BETWEEN_POLL_DELAY = {.tv_sec = 0, .tv_nsec = 5};
|
||||
mutable struct timespec remDelay;
|
||||
|
||||
volatile uint32_t* vcBaseReg = nullptr;
|
||||
@ -116,7 +117,7 @@ class PapbVcInterface : public VirtualChannelIF {
|
||||
*
|
||||
* @return returnvalue::OK when ready to receive data else PAPB_BUSY.
|
||||
*/
|
||||
ReturnValue_t pollPapbBusySignal(uint32_t maxPollRetries) const;
|
||||
inline ReturnValue_t pollPapbBusySignal(uint32_t maxPollRetries) const;
|
||||
|
||||
/**
|
||||
* @brief This function can be used for debugging to check whether there are packets in
|
||||
|
@ -43,15 +43,9 @@ ReturnValue_t PersistentLogTmStoreTask::performOperation(uint8_t opCode) {
|
||||
stateHandlingForStore(handleOneStore(stores.miscStore, miscStoreContext), miscStoreContext);
|
||||
if (not someonesBusy) {
|
||||
TaskFactory::delayTask(100);
|
||||
} else if (someFileWasSwapped) {
|
||||
TaskFactory::delayTask(20);
|
||||
} else if (vcBusyDuringDump) {
|
||||
// TODO: Might not be necessary
|
||||
TaskFactory::delayTask(20);
|
||||
} else if (byteFlowControl) {
|
||||
TaskFactory::delayTask(10);
|
||||
} else {
|
||||
// TODO: Lower this as much as possible...
|
||||
TaskFactory::delayTask(10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,30 +23,22 @@ ReturnValue_t PersistentSingleTmStoreTask::performOperation(uint8_t opCode) {
|
||||
}
|
||||
bool busy = handleOneStore(storeWithQueue, dumpContext);
|
||||
if (not busy) {
|
||||
result = TaskFactory::delayTask(100);
|
||||
TaskFactory::delayTask(100);
|
||||
delayNotBusy++;
|
||||
} else if (dumpContext.vcBusyDuringDump) {
|
||||
// TODO: Might not be necessary
|
||||
delaysVcBusyDuringDump++;
|
||||
result = TaskFactory::delayTask(10);
|
||||
} else if (dumpContext.packetWasDumped and
|
||||
dumpContext.dumpedBytes - dumpContext.bytesDumpedAtLastDelay >= 2048) {
|
||||
dumpContext.bytesDumpedAtLastDelay = dumpContext.dumpedBytes;
|
||||
result = TaskFactory::delayTask(10);
|
||||
delaysFlowControl++;
|
||||
TaskFactory::delayTask(10);
|
||||
} else {
|
||||
// TODO: Lower this as much as possible...
|
||||
result = TaskFactory::delayTask(5);
|
||||
delayHotLoop++;
|
||||
}
|
||||
if ((delaysVcBusyDuringDump + delaysFlowControl + delayNotBusy + delayHotLoop) % 2000000 == 0) {
|
||||
sif::debug << "DLY NBUSY: " << delayNotBusy << std::endl;
|
||||
sif::debug << "DLY FLCTRL: " << delaysFlowControl << std::endl;
|
||||
sif::debug << "DLY BUSYDUMP: " << delaysVcBusyDuringDump << std::endl;
|
||||
sif::debug << "DLY HOTLOOP: " << delayHotLoop << std::endl;
|
||||
}
|
||||
if (result != returnvalue::OK) {
|
||||
sif::warning << "TmStoreTask: Delay failed" << std::endl;
|
||||
}
|
||||
// if ((delaysVcBusyDuringDump + delaysFlowControl + delayNotBusy + delayHotLoop) % 2000 ==
|
||||
// 0) {
|
||||
// sif::debug << "DLY NBUSY: " << delayNotBusy << std::endl;
|
||||
// sif::debug << "DLY FLCTRL: " << delaysFlowControl << std::endl;
|
||||
// sif::debug << "DLY BUSYDUMP: " << delaysVcBusyDuringDump << std::endl;
|
||||
// sif::debug << "DLY HOTLOOP: " << delayHotLoop << std::endl;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user