This commit is contained in:
parent
68bc7f7682
commit
c53c052876
@ -26,20 +26,20 @@ ReturnValue_t PapbVcInterface::initialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ReturnValue_t PapbVcInterface::write(const uint8_t* data, size_t size) {
|
ReturnValue_t PapbVcInterface::write(const uint8_t* data, size_t size) {
|
||||||
if (pollPapbBusySignal(0, 0) == returnvalue::OK) {
|
if (pollPapbBusySignal(0) == returnvalue::OK) {
|
||||||
startPacketTransfer();
|
startPacketTransfer();
|
||||||
} else {
|
} else {
|
||||||
return DirectTmSinkIF::IS_BUSY;
|
return DirectTmSinkIF::IS_BUSY;
|
||||||
}
|
}
|
||||||
for (size_t idx = 0; idx < size; idx++) {
|
for (size_t idx = 0; idx < size; idx++) {
|
||||||
if (pollPapbBusySignal(10, 10) == returnvalue::OK) {
|
if (pollPapbBusySignal(5) == returnvalue::OK) {
|
||||||
*(vcBaseReg + DATA_REG_OFFSET) = static_cast<uint32_t>(data[idx]);
|
*(vcBaseReg + DATA_REG_OFFSET) = static_cast<uint32_t>(data[idx]);
|
||||||
} else {
|
} else {
|
||||||
abortPacketTransfer();
|
abortPacketTransfer();
|
||||||
return returnvalue::FAILED;
|
return returnvalue::FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (pollPapbBusySignal(10, 10) == returnvalue::OK) {
|
if (pollPapbBusySignal(5) == returnvalue::OK) {
|
||||||
completePacketTransfer();
|
completePacketTransfer();
|
||||||
} else {
|
} else {
|
||||||
abortPacketTransfer();
|
abortPacketTransfer();
|
||||||
@ -52,11 +52,11 @@ void PapbVcInterface::startPacketTransfer() { *vcBaseReg = CONFIG_START; }
|
|||||||
|
|
||||||
void PapbVcInterface::completePacketTransfer() { *vcBaseReg = CONFIG_END; }
|
void PapbVcInterface::completePacketTransfer() { *vcBaseReg = CONFIG_END; }
|
||||||
|
|
||||||
ReturnValue_t PapbVcInterface::pollPapbBusySignal(uint32_t maxPollRetries,
|
ReturnValue_t PapbVcInterface::pollPapbBusySignal(uint32_t maxPollRetries) const {
|
||||||
uint32_t retryDelayUs) 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;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
/** Check if PAPB interface is ready to receive data */
|
/** Check if PAPB interface is ready to receive data */
|
||||||
@ -75,7 +75,10 @@ ReturnValue_t PapbVcInterface::pollPapbBusySignal(uint32_t maxPollRetries,
|
|||||||
return PAPB_BUSY;
|
return PAPB_BUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
usleep(retryDelayUs);
|
usleep(nextDelay);
|
||||||
|
if (nextDelay * 2 <= MAX_DELAY_PAPB_POLLING_US) {
|
||||||
|
nextDelay *= 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return returnvalue::OK;
|
return returnvalue::OK;
|
||||||
}
|
}
|
||||||
@ -100,7 +103,7 @@ void PapbVcInterface::isVcInterfaceBufferEmpty() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PapbVcInterface::isBusy() const { return pollPapbBusySignal(0, 0) == PAPB_BUSY; }
|
bool PapbVcInterface::isBusy() const { return pollPapbBusySignal(0) == PAPB_BUSY; }
|
||||||
|
|
||||||
void PapbVcInterface::cancelTransfer() { abortPacketTransfer(); }
|
void PapbVcInterface::cancelTransfer() { abortPacketTransfer(); }
|
||||||
|
|
||||||
|
@ -76,6 +76,8 @@ 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;
|
||||||
|
|
||||||
LinuxLibgpioIF* gpioComIF = nullptr;
|
LinuxLibgpioIF* gpioComIF = nullptr;
|
||||||
|
|
||||||
/** Pulled to low when virtual channel not ready to receive data */
|
/** Pulled to low when virtual channel not ready to receive data */
|
||||||
@ -111,7 +113,7 @@ class PapbVcInterface : public VirtualChannelIF {
|
|||||||
*
|
*
|
||||||
* @return returnvalue::OK when ready to receive data else PAPB_BUSY.
|
* @return returnvalue::OK when ready to receive data else PAPB_BUSY.
|
||||||
*/
|
*/
|
||||||
ReturnValue_t pollPapbBusySignal(uint32_t maxPollRetries, uint32_t retryDelayUs) const;
|
ReturnValue_t pollPapbBusySignal(uint32_t maxPollRetries) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief This function can be used for debugging to check whether there are packets in
|
* @brief This function can be used for debugging to check whether there are packets in
|
||||||
|
@ -33,12 +33,8 @@ ReturnValue_t PersistentLogTmStoreTask::performOperation(uint8_t opCode) {
|
|||||||
stateHandlingForStore(handleOneStore(stores.miscStore, miscStoreContext));
|
stateHandlingForStore(handleOneStore(stores.miscStore, miscStoreContext));
|
||||||
if (not someonesBusy) {
|
if (not someonesBusy) {
|
||||||
TaskFactory::delayTask(100);
|
TaskFactory::delayTask(100);
|
||||||
} else /* and graceDelayDuringDumping.hasTimedOut()*/ {
|
} else if (someFileWasSwapped) {
|
||||||
if (someFileWasSwapped) {
|
TaskFactory::delayTask(2);
|
||||||
TaskFactory::delayTask(20);
|
|
||||||
}
|
|
||||||
// TaskFactory::delayTask(2);
|
|
||||||
// graceDelayDuringDumping.resetTimer();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,14 +18,8 @@ ReturnValue_t PersistentSingleTmStoreTask::performOperation(uint8_t opCode) {
|
|||||||
bool busy = handleOneStore(storeWithQueue, dumpContext);
|
bool busy = handleOneStore(storeWithQueue, dumpContext);
|
||||||
if (not busy) {
|
if (not busy) {
|
||||||
TaskFactory::delayTask(100);
|
TaskFactory::delayTask(100);
|
||||||
} else {
|
} else if (fileHasSwapped) {
|
||||||
if (fileHasSwapped) {
|
TaskFactory::delayTask(2);
|
||||||
TaskFactory::delayTask(20);
|
|
||||||
}
|
|
||||||
// if (fileHasSwapped and graceDelayDuringDumping.hasTimedOut()) {
|
|
||||||
// TaskFactory::delayTask(2);
|
|
||||||
// graceDelayDuringDumping.resetTimer();
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ ReturnValue_t PersistentTmStore::loadNextDumpFile() {
|
|||||||
sif::error << "PersistentTmStore: Could not retrieve file size: " << e.message() << std::endl;
|
sif::error << "PersistentTmStore: Could not retrieve file size: " << e.message() << std::endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
sif::debug << "Path: " << dumpParams.dirEntry.path() << std::endl;
|
// sif::debug << "Path: " << dumpParams.dirEntry.path() << std::endl;
|
||||||
|
|
||||||
// File empty or can't even read CCSDS header.
|
// File empty or can't even read CCSDS header.
|
||||||
if (dumpParams.fileSize <= 6) {
|
if (dumpParams.fileSize <= 6) {
|
||||||
|
2
tmtc
2
tmtc
@ -1 +1 @@
|
|||||||
Subproject commit f6fcb2fb282d79b1e250722eba46a319603b0232
|
Subproject commit 3f3523465a141bc2a2c36cbc9cbbf6ab7b3a9d70
|
Loading…
Reference in New Issue
Block a user