Merge remote-tracking branch 'origin/develop' into mueller/improve-ss-dhb-logic

This commit is contained in:
Robin Müller 2022-10-27 16:58:30 +02:00
commit 852f27cec2
3 changed files with 22 additions and 5 deletions

View File

@ -23,7 +23,9 @@ class AcceptsTelemetryIF {
*/ */
[[nodiscard]] virtual MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel) const = 0; [[nodiscard]] virtual MessageQueueId_t getReportReceptionQueue(uint8_t virtualChannel) const = 0;
[[nodiscard]] virtual MessageQueueId_t getReportReceptionQueue() const { return getReportReceptionQueue(0); } [[nodiscard]] virtual MessageQueueId_t getReportReceptionQueue() const {
return getReportReceptionQueue(0);
}
}; };
#endif /* FSFW_TMTCSERVICES_ACCEPTSTELEMETRYIF_H_ */ #endif /* FSFW_TMTCSERVICES_ACCEPTSTELEMETRYIF_H_ */

View File

@ -332,8 +332,8 @@ ReturnValue_t UartComIF::handleCanonicalRead(UartCookie& uartCookie, UartDeviceM
return result; return result;
} }
ReturnValue_t UartComIF::handleNoncanonicalRead(UartCookie& uartCookie, UartDeviceMap::iterator& iter, ReturnValue_t UartComIF::handleNoncanonicalRead(UartCookie& uartCookie,
size_t requestLen) { UartDeviceMap::iterator& iter, size_t requestLen) {
int fd = iter->second.fileDescriptor; int fd = iter->second.fileDescriptor;
auto bufferPtr = iter->second.replyBuffer.data(); auto bufferPtr = iter->second.replyBuffer.data();
// Size check to prevent buffer overflow // Size check to prevent buffer overflow

View File

@ -1,6 +1,7 @@
#include "UioMapper.h" #include "UioMapper.h"
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <filesystem> #include <filesystem>
@ -13,7 +14,21 @@ const char UioMapper::UIO_PATH_PREFIX[] = "/sys/class/uio/";
const char UioMapper::MAP_SUBSTR[] = "/maps/map"; const char UioMapper::MAP_SUBSTR[] = "/maps/map";
const char UioMapper::SIZE_FILE_PATH[] = "/size"; const char UioMapper::SIZE_FILE_PATH[] = "/size";
UioMapper::UioMapper(std::string uioFile, int mapNum) : uioFile(uioFile), mapNum(mapNum) {} UioMapper::UioMapper(std::string uioFile, int mapNum) : mapNum(mapNum) {
struct stat buf;
lstat(uioFile.c_str(), &buf);
if (S_ISLNK(buf.st_mode)) {
char* res = realpath(uioFile.c_str(), nullptr);
if (res) {
this->uioFile = res;
} else {
sif::error << "Could not resolve real path of UIO file " << uioFile << std::endl;
}
free(res);
} else {
this->uioFile = std::move(uioFile);
}
}
UioMapper::~UioMapper() {} UioMapper::~UioMapper() {}
@ -22,7 +37,7 @@ ReturnValue_t UioMapper::getMappedAdress(uint32_t** address, Permissions permiss
int fd = open(uioFile.c_str(), O_RDWR); int fd = open(uioFile.c_str(), O_RDWR);
if (fd < 1) { if (fd < 1) {
#if FSFW_CPP_OSTREAM_ENABLED == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1
sif::error << "PtmeAxiConfig::initialize: Invalid UIO device file" << std::endl; sif::error << "UioMapper::getMappedAdress: Invalid UIO device file " << uioFile << std::endl;
#endif #endif
return returnvalue::FAILED; return returnvalue::FAILED;
} }