this is tricky
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2023-03-23 15:43:14 +01:00
parent dda8261fc3
commit 493f89e0cb
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
9 changed files with 70 additions and 44 deletions

2
fsfw

@ -1 +1 @@
Subproject commit 227524a21da755d125bcb1a5ff67bcbc452f8cf9
Subproject commit 33ac395072f0145b6e80e12deae978a5e0432f08

View File

@ -1,5 +1,6 @@
#include <fsfw_hal/linux/uio/UioMapper.h>
#include <linux/ipcore/PapbVcInterface.h>
#include <unistd.h>
#include "fsfw/serviceinterface/ServiceInterface.h"
@ -15,7 +16,13 @@ PapbVcInterface::~PapbVcInterface() {}
ReturnValue_t PapbVcInterface::initialize() {
UioMapper uioMapper(uioFile, mapNum);
return uioMapper.getMappedAdress(&vcBaseReg, UioMapper::Permissions::WRITE_ONLY);
uint32_t* baseReg;
ReturnValue_t result = uioMapper.getMappedAdress(&baseReg, UioMapper::Permissions::WRITE_ONLY);
if (result != returnvalue::OK) {
return result;
}
vcBaseReg = baseReg;
return returnvalue::OK;
}
ReturnValue_t PapbVcInterface::write(const uint8_t* data, size_t size) {
@ -24,27 +31,27 @@ ReturnValue_t PapbVcInterface::write(const uint8_t* data, size_t size) {
}
for (size_t idx = 0; idx < size; idx++) {
if (pollPapbBusySignal() == returnvalue::OK) {
*(vcBaseReg + DATA_REG_OFFSET) = static_cast<uint32_t>(*(data + idx));
*(vcBaseReg + DATA_REG_OFFSET) = static_cast<uint32_t>(data[idx]);
} else {
sif::warning << "PapbVcInterface::write: Only written " << idx << " of " << size << " data"
<< std::endl;
return returnvalue::FAILED;
abortPacketTransfer();
return DirectTmSinkIF::IS_BUSY;
}
}
if (pollPapbBusySignal() == returnvalue::OK) {
endPacketTransfer();
completePacketTransfer();
}
return returnvalue::OK;
}
void PapbVcInterface::startPacketTransfer() { *vcBaseReg = CONFIG_START; }
void PapbVcInterface::endPacketTransfer() { *vcBaseReg = CONFIG_END; }
void PapbVcInterface::completePacketTransfer() { *vcBaseReg = CONFIG_END; }
ReturnValue_t PapbVcInterface::pollPapbBusySignal() const {
gpio::Levels papbBusyState = gpio::Levels::LOW;
ReturnValue_t result = returnvalue::OK;
ReturnValue_t result;
uint32_t busyIdx = 0;
uint32_t delayCount = 0;
while (true) {
/** Check if PAPB interface is ready to receive data */
@ -57,12 +64,17 @@ ReturnValue_t PapbVcInterface::pollPapbBusySignal() const {
if (papbBusyState == gpio::Levels::HIGH) {
return returnvalue::OK;
}
if (busyIdx == 100) {
if (busyIdx == 3) {
usleep(100);
busyIdx = 0;
delayCount += 1;
continue;
}
if (delayCount == 1000) {
return PAPB_BUSY;
}
busyIdx++;
}
return returnvalue::OK;
}
@ -104,3 +116,5 @@ ReturnValue_t PapbVcInterface::sendTestFrame() {
return returnvalue::OK;
}
void PapbVcInterface::abortPacketTransfer() { *vcBaseReg = CONFIG_ABORT; }

View File

@ -51,16 +51,21 @@ class PapbVcInterface : public VirtualChannelIF {
/**
* Configuration bits:
* bit[1:0]: Size of data (1,2,3 or 4 bytes). 1 Byte <=> b00
* bit[2]: Set this bit to 1 to abort a transfered packet
* bit[2]: Set this bit to 1 to abort a transferred packet
* bit[3]: Signals to VcInterface the start of a new telemetry packet
*/
static const uint32_t CONFIG_START = 0x8;
static constexpr uint32_t CONFIG_START = 0b00001000;
/**
* Abort a transferred packet.
*/
static constexpr uint32_t CONFIG_ABORT = 0b00000100;
/**
* Writing this word to the VcInterface base address signals to the virtual channel interface
* that a complete tm packet has been transferred.
*/
static const uint32_t CONFIG_END = 0x0;
static constexpr uint32_t CONFIG_END = 0x0;
/**
* Writing to this offset within the memory space of a virtual channel will insert data for
@ -79,7 +84,7 @@ class PapbVcInterface : public VirtualChannelIF {
std::string uioFile;
int mapNum = 0;
uint32_t* vcBaseReg = nullptr;
volatile uint32_t* vcBaseReg = nullptr;
uint32_t vcOffset = 0;
@ -89,11 +94,13 @@ class PapbVcInterface : public VirtualChannelIF {
*/
void startPacketTransfer();
void abortPacketTransfer();
/**
* @brief This function sends the config byte to the virtual channel interface of the PTME
* IP Core to signal the end of a packet transfer.
*/
void endPacketTransfer();
void completePacketTransfer();
/**
* @brief This function reads the papb busy signal indicating whether the virtual channel

View File

@ -39,7 +39,6 @@ ReturnValue_t CcsdsIpCoreHandler::performOperation(uint8_t operationCode) {
}
ReturnValue_t CcsdsIpCoreHandler::initialize() {
AcceptsTelecommandsIF* tcDistributor =
ObjectManager::instance()->get<AcceptsTelecommandsIF>(tcDestination);
if (tcDistributor == nullptr) {

View File

@ -153,7 +153,7 @@ class CcsdsIpCoreHandler : public SystemObject,
PtmeConfig& ptmeConfig;
PtmeGpios ptmeGpios;
// BAT priority bit on by default to enable priority selection mode for the PTME.
uint8_t batPriorityParam = 1;
uint8_t batPriorityParam = 0;
bool updateBatPriorityOnTxOff = false;
GpioIF* gpioIF = nullptr;

View File

@ -34,8 +34,11 @@ ReturnValue_t PersistentLogTmStoreTask::performOperation(uint8_t opCode) {
if (not someonesBusy) {
TaskFactory::delayTask(40);
} else if (someFileWasSwapped and graceDelayDuringDumping.hasTimedOut()) {
TaskFactory::delayTask(2);
graceDelayDuringDumping.resetTimer();
if (someFileWasSwapped) {
TaskFactory::delayTask(1);
}
// TaskFactory::delayTask(2);
// graceDelayDuringDumping.resetTimer();
}
}
}

View File

@ -19,10 +19,13 @@ ReturnValue_t PersistentSingleTmStoreTask::performOperation(uint8_t opCode) {
if (not busy) {
TaskFactory::delayTask(40);
} else {
if (fileHasSwapped and graceDelayDuringDumping.hasTimedOut()) {
TaskFactory::delayTask(2);
graceDelayDuringDumping.resetTimer();
if (fileHasSwapped) {
TaskFactory::delayTask(1);
}
// if (fileHasSwapped and graceDelayDuringDumping.hasTimedOut()) {
// TaskFactory::delayTask(2);
// graceDelayDuringDumping.resetTimer();
// }
}
}
}

View File

@ -216,7 +216,7 @@ ReturnValue_t PersistentTmStore::loadNextDumpFile() {
sif::error << "PersistentTmStore: Could not retrieve file size: " << e.message() << std::endl;
continue;
}
//sif::debug << "Path: " << dumpParams.dirEntry.path() << std::endl;
// sif::debug << "Path: " << dumpParams.dirEntry.path() << std::endl;
// Can't even read CCSDS header.
if (dumpParams.fileSize <= 6) {

View File

@ -25,7 +25,7 @@ bool TmStoreTaskBase::handleOneStore(PersistentTmStoreWithTmQueue& store,
// Dump TMs when applicable
if (store.getState() == PersistentTmStore::State::DUMPING) {
size_t dumpedLen = 0;
// if (not channel.isBusy()) {
if (not channel.isBusy()) {
tmSinkBusyCd.resetTimer();
result = store.dumpNextPacket(channel, dumpedLen, fileHasSwapped);
if (result == DirectTmSinkIF::IS_BUSY) {
@ -45,7 +45,7 @@ bool TmStoreTaskBase::handleOneStore(PersistentTmStoreWithTmQueue& store,
} else if (result == returnvalue::OK) {
dumpsPerformed = true;
}
//}
}
if (cancelDumpCd.hasTimedOut() or tmSinkBusyCd.hasTimedOut()) {
triggerEvent(persTmStore::DUMP_WAS_CANCELLED, store.getObjectId());
store.cancelDump();