From a3d245f5a030c9450c516552283d26da2c799301 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 23 Feb 2021 11:28:12 +0100 Subject: [PATCH 001/389] mutex helper print support and nullptr check --- ipc/MutexHelper.h | 49 +++++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/ipc/MutexHelper.h b/ipc/MutexHelper.h index befa69bc..5a14249c 100644 --- a/ipc/MutexHelper.h +++ b/ipc/MutexHelper.h @@ -2,33 +2,44 @@ #define FRAMEWORK_IPC_MUTEXHELPER_H_ #include "MutexFactory.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "../serviceinterface/ServiceInterface.h" class MutexHelper { public: - MutexHelper(MutexIF* mutex, MutexIF::TimeoutType timeoutType = - MutexIF::TimeoutType::BLOCKING, uint32_t timeoutMs = 0) : - internalMutex(mutex) { - ReturnValue_t status = mutex->lockMutex(timeoutType, - timeoutMs); - if(status == MutexIF::MUTEX_TIMEOUT) { + MutexHelper(MutexIF* mutex, MutexIF::TimeoutType timeoutType = + MutexIF::TimeoutType::BLOCKING, uint32_t timeoutMs = 0): + internalMutex(mutex) { + if(mutex == nullptr) { + return; + } + ReturnValue_t status = mutex->lockMutex(timeoutType, + timeoutMs); + if(status == MutexIF::MUTEX_TIMEOUT) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MutexHelper: Lock of mutex failed with timeout of " - << timeoutMs << " milliseconds!" << std::endl; + sif::error << "MutexHelper: Lock of mutex failed with timeout of " + << timeoutMs << " milliseconds!" << std::endl; +#else + sif::printError("MutexHelper: Lock of mutex failed with timeout of %lu milliseconds\n", + timeoutMs); #endif - } - else if(status != HasReturnvaluesIF::RETURN_OK){ + } + else if(status != HasReturnvaluesIF::RETURN_OK){ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MutexHelper: Lock of Mutex failed with code " - << status << std::endl; + sif::error << "MutexHelper: Lock of Mutex failed with code " + << status << std::endl; +#else + sif::printError("MutexHelper: Lock of Mutex failed with code %d\n", status); #endif - } - } + } + } - ~MutexHelper() { - internalMutex->unlockMutex(); - } + ~MutexHelper() { + if(internalMutex != nullptr) { + internalMutex->unlockMutex(); + } + } private: - MutexIF* internalMutex; + MutexIF* internalMutex; }; + #endif /* FRAMEWORK_IPC_MUTEXHELPER_H_ */ From f0178a8f73eb726e49e7f42c9be40d7663c6c429 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 23 Feb 2021 14:13:55 +0100 Subject: [PATCH 002/389] preprocessor optimization --- ipc/MutexHelper.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ipc/MutexHelper.h b/ipc/MutexHelper.h index 7f81f2f4..76eadc00 100644 --- a/ipc/MutexHelper.h +++ b/ipc/MutexHelper.h @@ -21,8 +21,8 @@ public: } ReturnValue_t status = mutex->lockMutex(timeoutType, timeoutMs); - if(status == MutexIF::MUTEX_TIMEOUT) { #if FSFW_VERBOSE_LEVEL >= 1 + if(status == MutexIF::MUTEX_TIMEOUT) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "MutexHelper: Lock of mutex failed with timeout of " << timeoutMs << " milliseconds!" << std::endl; @@ -30,7 +30,7 @@ public: sif::printError("MutexHelper: Lock of mutex failed with timeout of %lu milliseconds\n", timeoutMs); #endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ -#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + } else if(status != HasReturnvaluesIF::RETURN_OK) { #if FSFW_VERBOSE_LEVEL >= 1 @@ -39,8 +39,8 @@ public: #else sif::printError("MutexHelper: Lock of Mutex failed with code %d\n", status); #endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ -#endif /* FSFW_VERBOSE_LEVEL >= 1 */ } +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ } ~MutexHelper() { From f3cc664d4f9fdadc2f6e2ebf814dd0c924e5ae33 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 23 Feb 2021 22:07:32 +0100 Subject: [PATCH 003/389] small printout tweak --- devicehandlers/DeviceHandlerBase.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/devicehandlers/DeviceHandlerBase.cpp b/devicehandlers/DeviceHandlerBase.cpp index 35d34bf9..2471a5a4 100644 --- a/devicehandlers/DeviceHandlerBase.cpp +++ b/devicehandlers/DeviceHandlerBase.cpp @@ -1494,10 +1494,9 @@ void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType, if(errorType == sif::OutputTypes::OUT_WARNING) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "DeviceHandlerBase::" << functionName << ": Object ID " - << std::hex << std::setw(8) << std::setfill('0') - << this->getObjectId() << " | " << errorPrint << std::dec - << std::setfill(' ') << std::endl; + sif::warning << "DeviceHandlerBase::" << functionName << ": Object ID 0x" << std::hex << + std::setw(8) << std::setfill('0') << this->getObjectId() << " | " << errorPrint << + std::dec << std::setfill(' ') << std::endl; #else sif::printWarning("DeviceHandlerBase::%s: Object ID 0x%08x | %s\n", this->getObjectId(), errorPrint); From 92f249dc62cf02a5052fee4e9877bc89b2be1ab5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 24 Feb 2021 00:23:48 +0100 Subject: [PATCH 004/389] zero size handling --- globalfunctions/arrayprinter.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/globalfunctions/arrayprinter.cpp b/globalfunctions/arrayprinter.cpp index 7dc056b0..1404035f 100644 --- a/globalfunctions/arrayprinter.cpp +++ b/globalfunctions/arrayprinter.cpp @@ -5,6 +5,15 @@ void arrayprinter::print(const uint8_t *data, size_t size, OutputType type, bool printInfo, size_t maxCharPerLine) { + if(size == 0) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "Size is zero, nothing to print" << std::endl; +#else + sif::printInfo("Size is zero, nothing to print\n"); +#endif + return; + } + #if FSFW_CPP_OSTREAM_ENABLED == 1 if(printInfo) { sif::info << "Printing data with size " << size << ": " << std::endl; From 17b8d3fed05cae6e208dc3f14b6ba0d44c9ec5ef Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Sat, 6 Mar 2021 18:12:41 +0100 Subject: [PATCH 005/389] printout for trans timeout --- devicehandlers/DeviceHandlerBase.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/devicehandlers/DeviceHandlerBase.cpp b/devicehandlers/DeviceHandlerBase.cpp index 10de57bd..0649aaa0 100644 --- a/devicehandlers/DeviceHandlerBase.cpp +++ b/devicehandlers/DeviceHandlerBase.cpp @@ -308,6 +308,14 @@ void DeviceHandlerBase::doStateMachine() { uint32_t currentUptime; Clock::getUptime(¤tUptime); if (currentUptime - timeoutStart >= childTransitionDelay) { +#if FSFW_VERBOSE_LEVEL >= 1 + char printout[60]; + sprintf(printout, "Transition timeout (%lu) occured !", + static_cast(childTransitionDelay)); + /* Very common configuration error, so print it */ + printWarningOrError(sif::OutputTypes::OUT_WARNING, "doStateMachine", + RETURN_FAILED, printout); +#endif triggerEvent(MODE_TRANSITION_FAILED, childTransitionFailure, 0); setMode(transitionSourceMode, transitionSourceSubMode); break; From 778ef4ef230019ca4b155a77518156793cf5d308 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Sat, 6 Mar 2021 20:36:54 +0100 Subject: [PATCH 006/389] cleaned up a bit, no functional change --- osal/linux/PosixThread.cpp | 336 ++++++++++++++++++------------------- 1 file changed, 167 insertions(+), 169 deletions(-) diff --git a/osal/linux/PosixThread.cpp b/osal/linux/PosixThread.cpp index bd8e7258..bc5cacee 100644 --- a/osal/linux/PosixThread.cpp +++ b/osal/linux/PosixThread.cpp @@ -6,252 +6,250 @@ #include PosixThread::PosixThread(const char* name_, int priority_, size_t stackSize_): - thread(0),priority(priority_),stackSize(stackSize_) { + thread(0),priority(priority_),stackSize(stackSize_) { name[0] = '\0'; std::strncat(name, name_, PTHREAD_MAX_NAMELEN - 1); } PosixThread::~PosixThread() { - //No deletion and no free of Stack Pointer + //No deletion and no free of Stack Pointer } ReturnValue_t PosixThread::sleep(uint64_t ns) { - //TODO sleep might be better with timer instead of sleep() - timespec time; - time.tv_sec = ns/1000000000; - time.tv_nsec = ns - time.tv_sec*1e9; + //TODO sleep might be better with timer instead of sleep() + timespec time; + time.tv_sec = ns/1000000000; + time.tv_nsec = ns - time.tv_sec*1e9; - //Remaining Time is not set here - int status = nanosleep(&time,NULL); - if(status != 0){ - switch(errno){ - case EINTR: - //The nanosleep() function was interrupted by a signal. - return HasReturnvaluesIF::RETURN_FAILED; - case EINVAL: - //The rqtp argument specified a nanosecond value less than zero or - // greater than or equal to 1000 million. - return HasReturnvaluesIF::RETURN_FAILED; - default: - return HasReturnvaluesIF::RETURN_FAILED; - } + //Remaining Time is not set here + int status = nanosleep(&time,NULL); + if(status != 0){ + switch(errno){ + case EINTR: + //The nanosleep() function was interrupted by a signal. + return HasReturnvaluesIF::RETURN_FAILED; + case EINVAL: + //The rqtp argument specified a nanosecond value less than zero or + // greater than or equal to 1000 million. + return HasReturnvaluesIF::RETURN_FAILED; + default: + return HasReturnvaluesIF::RETURN_FAILED; + } - } - return HasReturnvaluesIF::RETURN_OK; + } + return HasReturnvaluesIF::RETURN_OK; } void PosixThread::suspend() { - //Wait for SIGUSR1 - int caughtSig = 0; - sigset_t waitSignal; - sigemptyset(&waitSignal); - sigaddset(&waitSignal, SIGUSR1); - sigwait(&waitSignal, &caughtSig); - if (caughtSig != SIGUSR1) { + //Wait for SIGUSR1 + int caughtSig = 0; + sigset_t waitSignal; + sigemptyset(&waitSignal); + sigaddset(&waitSignal, SIGUSR1); + sigwait(&waitSignal, &caughtSig); + if (caughtSig != SIGUSR1) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "FixedTimeslotTask: Unknown Signal received: " << - caughtSig << std::endl; + sif::error << "FixedTimeslotTask: Unknown Signal received: " << + caughtSig << std::endl; #endif - } + } } void PosixThread::resume(){ - /* Signal the thread to start. Makes sense to call kill to start or? ;) - * - * According to Posix raise(signal) will call pthread_kill(pthread_self(), sig), - * but as the call must be done from the thread itsself this is not possible here - */ - pthread_kill(thread,SIGUSR1); + /* Signal the thread to start. Makes sense to call kill to start or? ;) + According to POSIX raise(signal) will call pthread_kill(pthread_self(), sig), + but as the call must be done from the thread itself this is not possible here */ + pthread_kill(thread,SIGUSR1); } bool PosixThread::delayUntil(uint64_t* const prevoiusWakeTime_ms, - const uint64_t delayTime_ms) { - uint64_t nextTimeToWake_ms; - bool shouldDelay = false; - //Get current Time - const uint64_t currentTime_ms = getCurrentMonotonicTimeMs(); - /* Generate the tick time at which the task wants to wake. */ - nextTimeToWake_ms = (*prevoiusWakeTime_ms) + delayTime_ms; + const uint64_t delayTime_ms) { + uint64_t nextTimeToWake_ms; + bool shouldDelay = false; + /* Get current Time */ + const uint64_t currentTime_ms = getCurrentMonotonicTimeMs(); + /* Generate the tick time at which the task wants to wake. */ + nextTimeToWake_ms = (*prevoiusWakeTime_ms) + delayTime_ms; - if (currentTime_ms < *prevoiusWakeTime_ms) { - /* The tick count has overflowed since this function was - lasted called. In this case the only time we should ever - actually delay is if the wake time has also overflowed, - and the wake time is greater than the tick time. When this + if (currentTime_ms < *prevoiusWakeTime_ms) { + /* The tick count has overflowed since this function was + lasted called. In this case the only time we should ever + actually delay is if the wake time has also overflowed, + and the wake time is greater than the tick time. When this is the case it is as if neither time had overflowed. */ - if ((nextTimeToWake_ms < *prevoiusWakeTime_ms) - && (nextTimeToWake_ms > currentTime_ms)) { - shouldDelay = true; - } - } else { - /* The tick time has not overflowed. In this case we will + if ((nextTimeToWake_ms < *prevoiusWakeTime_ms) + && (nextTimeToWake_ms > currentTime_ms)) { + shouldDelay = true; + } + } else { + /* The tick time has not overflowed. In this case we will delay if either the wake time has overflowed, and/or the tick time is less than the wake time. */ - if ((nextTimeToWake_ms < *prevoiusWakeTime_ms) - || (nextTimeToWake_ms > currentTime_ms)) { - shouldDelay = true; - } - } + if ((nextTimeToWake_ms < *prevoiusWakeTime_ms) + || (nextTimeToWake_ms > currentTime_ms)) { + shouldDelay = true; + } + } - /* Update the wake time ready for the next call. */ + /* Update the wake time ready for the next call. */ - (*prevoiusWakeTime_ms) = nextTimeToWake_ms; + (*prevoiusWakeTime_ms) = nextTimeToWake_ms; - if (shouldDelay) { - uint64_t sleepTime = nextTimeToWake_ms - currentTime_ms; - PosixThread::sleep(sleepTime * 1000000ull); - return true; - } - //We are shifting the time in case the deadline was missed like rtems - (*prevoiusWakeTime_ms) = currentTime_ms; - return false; + if (shouldDelay) { + uint64_t sleepTime = nextTimeToWake_ms - currentTime_ms; + PosixThread::sleep(sleepTime * 1000000ull); + return true; + } + /* We are shifting the time in case the deadline was missed like RTEMS */ + (*prevoiusWakeTime_ms) = currentTime_ms; + return false; } uint64_t PosixThread::getCurrentMonotonicTimeMs(){ - timespec timeNow; - clock_gettime(CLOCK_MONOTONIC_RAW, &timeNow); - uint64_t currentTime_ms = (uint64_t) timeNow.tv_sec * 1000 - + timeNow.tv_nsec / 1000000; + timespec timeNow; + clock_gettime(CLOCK_MONOTONIC_RAW, &timeNow); + uint64_t currentTime_ms = (uint64_t) timeNow.tv_sec * 1000 + + timeNow.tv_nsec / 1000000; - return currentTime_ms; + return currentTime_ms; } void PosixThread::createTask(void* (*fnc_)(void*), void* arg_) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - //sif::debug << "PosixThread::createTask" << std::endl; + //sif::debug << "PosixThread::createTask" << std::endl; #endif - /* - * The attr argument points to a pthread_attr_t structure whose contents - are used at thread creation time to determine attributes for the new - thread; this structure is initialized using pthread_attr_init(3) and - related functions. If attr is NULL, then the thread is created with - default attributes. - */ - pthread_attr_t attributes; - int status = pthread_attr_init(&attributes); - if(status != 0){ + /* + * The attr argument points to a pthread_attr_t structure whose contents + * are used at thread creation time to determine attributes for the new + * thread; this structure is initialized using pthread_attr_init(3) and + * related functions. If attr is NULL, then the thread is created with + * default attributes. + */ + pthread_attr_t attributes; + int status = pthread_attr_init(&attributes); + if(status != 0){ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "Posix Thread attribute init failed with: " << - strerror(status) << std::endl; + sif::error << "Posix Thread attribute init failed with: " << + strerror(status) << std::endl; #endif - } - void* stackPointer; - status = posix_memalign(&stackPointer, sysconf(_SC_PAGESIZE), stackSize); - if(status != 0){ + } + void* stackPointer; + status = posix_memalign(&stackPointer, sysconf(_SC_PAGESIZE), stackSize); + if(status != 0){ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "PosixThread::createTask: Stack init failed with: " << - strerror(status) << std::endl; + sif::error << "PosixThread::createTask: Stack init failed with: " << + strerror(status) << std::endl; #endif - if(errno == ENOMEM) { - size_t stackMb = stackSize/10e6; + if(errno == ENOMEM) { + size_t stackMb = stackSize/10e6; #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "PosixThread::createTask: Insufficient memory for" - " the requested " << stackMb << " MB" << std::endl; + sif::error << "PosixThread::createTask: Insufficient memory for" + " the requested " << stackMb << " MB" << std::endl; #else - sif::printError("PosixThread::createTask: Insufficient memory for " - "the requested %lu MB\n", static_cast(stackMb)); + sif::printError("PosixThread::createTask: Insufficient memory for " + "the requested %lu MB\n", static_cast(stackMb)); #endif - } - else if(errno == EINVAL) { + } + else if(errno == EINVAL) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "PosixThread::createTask: Wrong alignment argument!" - << std::endl; + sif::error << "PosixThread::createTask: Wrong alignment argument!" + << std::endl; #else - sif::printError("PosixThread::createTask: " - "Wrong alignment argument!\n"); + sif::printError("PosixThread::createTask: " + "Wrong alignment argument!\n"); #endif - } - return; - } + } + return; + } - status = pthread_attr_setstack(&attributes, stackPointer, stackSize); - if(status != 0){ + status = pthread_attr_setstack(&attributes, stackPointer, stackSize); + if(status != 0){ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "PosixThread::createTask: pthread_attr_setstack " - " failed with: " << strerror(status) << std::endl; - sif::error << "Make sure the specified stack size is valid and is " - "larger than the minimum allowed stack size." << std::endl; + sif::error << "PosixThread::createTask: pthread_attr_setstack " + " failed with: " << strerror(status) << std::endl; + sif::error << "Make sure the specified stack size is valid and is " + "larger than the minimum allowed stack size." << std::endl; #endif - } + } - status = pthread_attr_setinheritsched(&attributes, PTHREAD_EXPLICIT_SCHED); - if(status != 0){ + status = pthread_attr_setinheritsched(&attributes, PTHREAD_EXPLICIT_SCHED); + if(status != 0){ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "Posix Thread attribute setinheritsched failed with: " << - strerror(status) << std::endl; + sif::error << "Posix Thread attribute setinheritsched failed with: " << + strerror(status) << std::endl; #endif - } + } - // TODO FIFO -> This needs root privileges for the process - status = pthread_attr_setschedpolicy(&attributes,SCHED_FIFO); - if(status != 0){ + // TODO FIFO -> This needs root privileges for the process + status = pthread_attr_setschedpolicy(&attributes,SCHED_FIFO); + if(status != 0){ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "Posix Thread attribute schedule policy failed with: " << - strerror(status) << std::endl; + sif::error << "Posix Thread attribute schedule policy failed with: " << + strerror(status) << std::endl; #endif - } + } - sched_param scheduleParams; - scheduleParams.__sched_priority = priority; - status = pthread_attr_setschedparam(&attributes, &scheduleParams); - if(status != 0){ + sched_param scheduleParams; + scheduleParams.__sched_priority = priority; + status = pthread_attr_setschedparam(&attributes, &scheduleParams); + if(status != 0){ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "Posix Thread attribute schedule params failed with: " << - strerror(status) << std::endl; + sif::error << "Posix Thread attribute schedule params failed with: " << + strerror(status) << std::endl; #endif - } + } - //Set Signal Mask for suspend until startTask is called - sigset_t waitSignal; - sigemptyset(&waitSignal); - sigaddset(&waitSignal, SIGUSR1); - status = pthread_sigmask(SIG_BLOCK, &waitSignal, NULL); - if(status != 0){ + //Set Signal Mask for suspend until startTask is called + sigset_t waitSignal; + sigemptyset(&waitSignal); + sigaddset(&waitSignal, SIGUSR1); + status = pthread_sigmask(SIG_BLOCK, &waitSignal, NULL); + if(status != 0){ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "Posix Thread sigmask failed failed with: " << - strerror(status) << " errno: " << strerror(errno) << std::endl; + sif::error << "Posix Thread sigmask failed failed with: " << + strerror(status) << " errno: " << strerror(errno) << std::endl; #endif - } + } - status = pthread_create(&thread,&attributes,fnc_,arg_); - if(status != 0){ + status = pthread_create(&thread,&attributes,fnc_,arg_); + if(status != 0){ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "Posix Thread create failed with: " << - strerror(status) << std::endl; + sif::error << "Posix Thread create failed with: " << + strerror(status) << std::endl; #endif - } + } - status = pthread_setname_np(thread,name); - if(status != 0){ + status = pthread_setname_np(thread,name); + if(status != 0){ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "PosixThread::createTask: setname failed with: " << - strerror(status) << std::endl; + sif::error << "PosixThread::createTask: setname failed with: " << + strerror(status) << std::endl; #endif - if(status == ERANGE) { + if(status == ERANGE) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "PosixThread::createTask: Task name length longer" - " than 16 chars. Truncating.." << std::endl; + sif::error << "PosixThread::createTask: Task name length longer" + " than 16 chars. Truncating.." << std::endl; #endif - name[15] = '\0'; - status = pthread_setname_np(thread,name); - if(status != 0){ + name[15] = '\0'; + status = pthread_setname_np(thread,name); + if(status != 0){ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "PosixThread::createTask: Setting name" - " did not work.." << std::endl; + sif::error << "PosixThread::createTask: Setting name" + " did not work.." << std::endl; #endif - } - } - } + } + } + } - status = pthread_attr_destroy(&attributes); - if(status!=0){ + status = pthread_attr_destroy(&attributes); + if(status!=0){ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "Posix Thread attribute destroy failed with: " << - strerror(status) << std::endl; + sif::error << "Posix Thread attribute destroy failed with: " << + strerror(status) << std::endl; #endif - } + } } From 83d0db824289b28dbad81cce0c80276c4fc839c8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 20 Mar 2021 15:53:43 +0100 Subject: [PATCH 007/389] fixed udp bridge --- osal/linux/TmTcUnixUdpBridge.cpp | 10 ---------- osal/linux/TmTcUnixUdpBridge.h | 4 ---- 2 files changed, 14 deletions(-) diff --git a/osal/linux/TmTcUnixUdpBridge.cpp b/osal/linux/TmTcUnixUdpBridge.cpp index fa7913ea..767c3cfe 100644 --- a/osal/linux/TmTcUnixUdpBridge.cpp +++ b/osal/linux/TmTcUnixUdpBridge.cpp @@ -103,11 +103,6 @@ ReturnValue_t TmTcUnixUdpBridge::sendTm(const uint8_t *data, size_t dataLen) { /* The target address can be set by different threads so this lock ensures thread-safety */ MutexGuard lock(mutex, timeoutType, mutexTimeoutMs); - if(ipAddrAnySet){ - clientAddress.sin_addr.s_addr = htons(INADDR_ANY); - clientAddressLen = sizeof(clientAddress); - } - #if FSFW_CPP_OSTREAM_ENABLED == 1 && FSFW_UDP_SEND_WIRETAPPING_ENABLED == 1 char ipAddress [15]; sif::debug << "IP Address Sender: "<< @@ -160,8 +155,3 @@ void TmTcUnixUdpBridge::setMutexProperties(MutexIF::TimeoutType timeoutType, this->timeoutType = timeoutType; this->mutexTimeoutMs = timeoutMs; } - -void TmTcUnixUdpBridge::setClientAddressToAny(bool ipAddrAnySet){ - this->ipAddrAnySet = ipAddrAnySet; -} - diff --git a/osal/linux/TmTcUnixUdpBridge.h b/osal/linux/TmTcUnixUdpBridge.h index 3ab2118c..c39c43f7 100644 --- a/osal/linux/TmTcUnixUdpBridge.h +++ b/osal/linux/TmTcUnixUdpBridge.h @@ -30,8 +30,6 @@ public: void checkAndSetClientAddress(sockaddr_in& clientAddress); - void setClientAddressToAny(bool ipAddrAnySet); - protected: virtual ReturnValue_t sendTm(const uint8_t * data, size_t dataLen) override; @@ -42,8 +40,6 @@ private: struct sockaddr_in clientAddress; socklen_t clientAddressLen = 0; - bool ipAddrAnySet = false; - //! Access to the client address is mutex protected as it is set by another task. MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING; dur_millis_t mutexTimeoutMs = 20; From d1a256cbf66223fe47dcb1c7b8c825b6fcfa943c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 31 Mar 2021 19:53:58 +0200 Subject: [PATCH 008/389] added missing include --- osal/linux/tcpipHelpers.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/osal/linux/tcpipHelpers.cpp b/osal/linux/tcpipHelpers.cpp index 4c1b9a78..3e8f6009 100644 --- a/osal/linux/tcpipHelpers.cpp +++ b/osal/linux/tcpipHelpers.cpp @@ -1,5 +1,6 @@ #include "../common/tcpipHelpers.h" +#include "../../serviceinterface/ServiceInterface.h" #include "../../tasks/TaskFactory.h" #include From dea2205908f29cbb700ad85c2614da71b6efccfc Mon Sep 17 00:00:00 2001 From: IRS Cleanroom Laptop Date: Thu, 1 Apr 2021 15:20:53 +0200 Subject: [PATCH 009/389] improved output --- devicehandlers/DeviceHandlerBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devicehandlers/DeviceHandlerBase.cpp b/devicehandlers/DeviceHandlerBase.cpp index 0649aaa0..e46bd5de 100644 --- a/devicehandlers/DeviceHandlerBase.cpp +++ b/devicehandlers/DeviceHandlerBase.cpp @@ -1516,7 +1516,7 @@ void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType, } else if(errorType == sif::OutputTypes::OUT_ERROR) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "DeviceHandlerBase::" << functionName << ": Object ID " + sif::error << "DeviceHandlerBase::" << functionName << ": Object ID 0x" << std::hex << std::setw(8) << std::setfill('0') << this->getObjectId() << " | " << errorPrint << std::dec << std::setfill(' ') << std::endl; From 0e76333d3315f2278397935d220c20f64b6e838a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 7 Apr 2021 12:03:28 +0200 Subject: [PATCH 010/389] minor improvements for PUS distributor --- tcdistribution/PUSDistributor.cpp | 121 +++++++++++++++++------------- 1 file changed, 68 insertions(+), 53 deletions(-) diff --git a/tcdistribution/PUSDistributor.cpp b/tcdistribution/PUSDistributor.cpp index 00fd9029..0a95c5ef 100644 --- a/tcdistribution/PUSDistributor.cpp +++ b/tcdistribution/PUSDistributor.cpp @@ -1,22 +1,24 @@ #include "CCSDSDistributorIF.h" #include "PUSDistributor.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "../serviceinterface/ServiceInterface.h" #include "../tmtcpacket/pus/TcPacketStored.h" #include "../tmtcservices/PusVerificationReport.h" +#define PUS_DISTRIBUTOR_DEBUGGING 1 + PUSDistributor::PUSDistributor(uint16_t setApid, object_id_t setObjectId, - object_id_t setPacketSource) : - TcDistributor(setObjectId), checker(setApid), verifyChannel(), - tcStatus(RETURN_FAILED), packetSource(setPacketSource) {} + object_id_t setPacketSource) : + TcDistributor(setObjectId), checker(setApid), verifyChannel(), + tcStatus(RETURN_FAILED), packetSource(setPacketSource) {} PUSDistributor::~PUSDistributor() {} PUSDistributor::TcMqMapIter PUSDistributor::selectDestination() { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - // sif:: debug << "PUSDistributor::handlePacket received: " - // << this->current_packet_id.store_index << ", " - // << this->current_packet_id.packet_index << std::endl; +#if FSFW_CPP_OSTREAM_ENABLED == 1 && PUS_DISTRIBUTOR_DEBUGGING == 1 + store_address_t storeId = this->currentMessage.getStorageId()); + sif:: debug << "PUSDistributor::handlePacket received: " << storeId.poolIndex << ", " << + storeId.packetIndex << std::endl; #endif TcMqMapIter queueMapIt = this->queueMap.end(); if(this->currentPacket == nullptr) { @@ -25,15 +27,17 @@ PUSDistributor::TcMqMapIter PUSDistributor::selectDestination() { this->currentPacket->setStoreAddress(this->currentMessage.getStorageId()); if (currentPacket->getWholeData() != nullptr) { tcStatus = checker.checkPacket(currentPacket); -#ifdef DEBUG if(tcStatus != HasReturnvaluesIF::RETURN_OK) { +#if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << "PUSDistributor::handlePacket: Packet format " - << "invalid, code "<< static_cast(tcStatus) - << std::endl; + sif::debug << "PUSDistributor::handlePacket: Packet format invalid, code " << + static_cast(tcStatus) << std::endl; +#else + sif::printDebug("PUSDistributor::handlePacket: Packet format invalid, code %d\n", + static_cast(tcStatus)); +#endif #endif } -#endif uint32_t queue_id = currentPacket->getService(); queueMapIt = this->queueMap.find(queue_id); } @@ -43,11 +47,12 @@ PUSDistributor::TcMqMapIter PUSDistributor::selectDestination() { if (queueMapIt == this->queueMap.end()) { tcStatus = DESTINATION_NOT_FOUND; -#ifdef DEBUG +#if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << "PUSDistributor::handlePacket: Destination not found, " - << "code "<< static_cast(tcStatus) << std::endl; -#endif + sif::debug << "PUSDistributor::handlePacket: Destination not found" << std::endl; +#else + sif::printDebug("PUSDistributor::handlePacket: Destination not found\n"); +#endif /* !FSFW_CPP_OSTREAM_ENABLED == 1 */ #endif } @@ -62,46 +67,54 @@ PUSDistributor::TcMqMapIter PUSDistributor::selectDestination() { ReturnValue_t PUSDistributor::registerService(AcceptsTelecommandsIF* service) { - uint16_t serviceId = service->getIdentifier(); + uint16_t serviceId = service->getIdentifier(); +#if PUS_DISTRIBUTOR_DEBUGGING == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 - // sif::info << "Service ID: " << (int)serviceId << std::endl; + sif::info << "Service ID: " << static_cast(serviceId) << std::endl; +#else + sif::printInfo("Service ID: %d\n", static_cast(serviceId)); #endif - MessageQueueId_t queue = service->getRequestQueue(); - auto returnPair = queueMap.emplace(serviceId, queue); - if (not returnPair.second) { +#endif + MessageQueueId_t queue = service->getRequestQueue(); + auto returnPair = queueMap.emplace(serviceId, queue); + if (not returnPair.second) { +#if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "PUSDistributor::registerService: Service ID already" - " exists in map." << std::endl; + sif::error << "PUSDistributor::registerService: Service ID already" + " exists in map" << std::endl; +#else + sif::printError("PUSDistributor::registerService: Service ID already exists in map\n"); #endif - return SERVICE_ID_ALREADY_EXISTS; - } - return HasReturnvaluesIF::RETURN_OK; +#endif + return SERVICE_ID_ALREADY_EXISTS; + } + return HasReturnvaluesIF::RETURN_OK; } MessageQueueId_t PUSDistributor::getRequestQueue() { - return tcQueue->getId(); + return tcQueue->getId(); } ReturnValue_t PUSDistributor::callbackAfterSending(ReturnValue_t queueStatus) { - if (queueStatus != RETURN_OK) { - tcStatus = queueStatus; - } - if (tcStatus != RETURN_OK) { - this->verifyChannel.sendFailureReport(tc_verification::ACCEPTANCE_FAILURE, - currentPacket, tcStatus); - // A failed packet is deleted immediately after reporting, - // otherwise it will block memory. - currentPacket->deletePacket(); - return RETURN_FAILED; - } else { - this->verifyChannel.sendSuccessReport(tc_verification::ACCEPTANCE_SUCCESS, - currentPacket); - return RETURN_OK; - } + if (queueStatus != RETURN_OK) { + tcStatus = queueStatus; + } + if (tcStatus != RETURN_OK) { + this->verifyChannel.sendFailureReport(tc_verification::ACCEPTANCE_FAILURE, + currentPacket, tcStatus); + // A failed packet is deleted immediately after reporting, + // otherwise it will block memory. + currentPacket->deletePacket(); + return RETURN_FAILED; + } else { + this->verifyChannel.sendSuccessReport(tc_verification::ACCEPTANCE_SUCCESS, + currentPacket); + return RETURN_OK; + } } uint16_t PUSDistributor::getIdentifier() { - return checker.getApid(); + return checker.getApid(); } ReturnValue_t PUSDistributor::initialize() { @@ -111,15 +124,17 @@ ReturnValue_t PUSDistributor::initialize() { return ObjectManagerIF::CHILD_INIT_FAILED; } - CCSDSDistributorIF* ccsdsDistributor = - objectManager->get(packetSource); - if (ccsdsDistributor == nullptr) { + CCSDSDistributorIF* ccsdsDistributor = + objectManager->get(packetSource); + if (ccsdsDistributor == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "PUSDistributor::initialize: Packet source invalid." - << " Make sure it exists and implements CCSDSDistributorIF!" - << std::endl; + sif::error << "PUSDistributor::initialize: Packet source invalid" << std::endl; + sif::error << " Make sure it exists and implements CCSDSDistributorIF!" << std::endl; +#else + sif::printError("PUSDistributor::initialize: Packet source invalid\n"); + sif::printError("Make sure it exists and implements CCSDSDistributorIF\n"); #endif - return RETURN_FAILED; - } - return ccsdsDistributor->registerApplication(this); + return RETURN_FAILED; + } + return ccsdsDistributor->registerApplication(this); } From 7322a7d0f53e0ae72b69cac1a4abffbe74543365 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 7 Apr 2021 12:09:06 +0200 Subject: [PATCH 011/389] improvements for ccsds distributor --- tcdistribution/CCSDSDistributor.cpp | 31 ++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/tcdistribution/CCSDSDistributor.cpp b/tcdistribution/CCSDSDistributor.cpp index b795854f..f3864066 100644 --- a/tcdistribution/CCSDSDistributor.cpp +++ b/tcdistribution/CCSDSDistributor.cpp @@ -1,8 +1,10 @@ #include "CCSDSDistributor.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "../serviceinterface/ServiceInterface.h" #include "../tmtcpacket/SpacePacketBase.h" +#define CCSDS_DISTRIBUTOR_DEBUGGING 1 + CCSDSDistributor::CCSDSDistributor(uint16_t setDefaultApid, object_id_t setObjectId): TcDistributor(setObjectId), defaultApid( setDefaultApid ) { @@ -11,26 +13,36 @@ CCSDSDistributor::CCSDSDistributor(uint16_t setDefaultApid, CCSDSDistributor::~CCSDSDistributor() {} TcDistributor::TcMqMapIter CCSDSDistributor::selectDestination() { +#if CCSDS_DISTRIBUTOR_DEBUGGING == 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 -// sif::debug << "CCSDSDistributor::selectDestination received: " << -// this->currentMessage.getStorageId().pool_index << ", " << -// this->currentMessage.getStorageId().packet_index << std::endl; + sif::debug << "CCSDSDistributor::selectDestination received: " << + this->currentMessage.getStorageId().poolIndex << ", " << + this->currentMessage.getStorageId().packetIndex << std::endl; +#else + sif::printDebug("CCSDSDistributor::selectDestination received: %d, %d\n", + currentMessage.getStorageId().poolIndex, currentMessage.getStorageId().packetIndex); +#endif #endif const uint8_t* packet = nullptr; size_t size = 0; ReturnValue_t result = this->tcStore->getData(currentMessage.getStorageId(), &packet, &size ); if(result != HasReturnvaluesIF::RETURN_OK) { +#if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "CCSDSDistributor::selectDestination: Getting data from" " store failed!" << std::endl; +#else + sif::printError("CCSDSDistributor::selectDestination: Getting data from" + " store failed!\n"); +#endif #endif } SpacePacketBase currentPacket(packet); -#if FSFW_CPP_OSTREAM_ENABLED == 1 -// sif:: info << "CCSDSDistributor::selectDestination has packet with APID " -// << std::hex << currentPacket.getAPID() << std::dec << std::endl; +#if FSFW_CPP_OSTREAM_ENABLED == 1 && CCSDS_DISTRIBUTOR_DEBUGGING == 1 + sif::info << "CCSDSDistributor::selectDestination has packet with APID " << std::hex << + currentPacket.getAPID() << std::dec << std::endl; #endif TcMqMapIter position = this->queueMap.find(currentPacket.getAPID()); if ( position != this->queueMap.end() ) { @@ -76,9 +88,14 @@ ReturnValue_t CCSDSDistributor::initialize() { ReturnValue_t status = this->TcDistributor::initialize(); this->tcStore = objectManager->get( objects::TC_STORE ); if (this->tcStore == nullptr) { +#if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "CCSDSDistributor::initialize: Could not initialize" " TC store!" << std::endl; +#else + sif::printError("CCSDSDistributor::initialize: Could not initialize" + " TC store!\n"); +#endif #endif status = RETURN_FAILED; } From 3ff54844153aa81cbb0c5c6b5546be4bd4a30904 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 7 Apr 2021 13:44:03 +0200 Subject: [PATCH 012/389] disabled debugging mode --- tcdistribution/CCSDSDistributor.cpp | 2 +- tcdistribution/PUSDistributor.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tcdistribution/CCSDSDistributor.cpp b/tcdistribution/CCSDSDistributor.cpp index f3864066..62cbfbf2 100644 --- a/tcdistribution/CCSDSDistributor.cpp +++ b/tcdistribution/CCSDSDistributor.cpp @@ -3,7 +3,7 @@ #include "../serviceinterface/ServiceInterface.h" #include "../tmtcpacket/SpacePacketBase.h" -#define CCSDS_DISTRIBUTOR_DEBUGGING 1 +#define CCSDS_DISTRIBUTOR_DEBUGGING 0 CCSDSDistributor::CCSDSDistributor(uint16_t setDefaultApid, object_id_t setObjectId): diff --git a/tcdistribution/PUSDistributor.cpp b/tcdistribution/PUSDistributor.cpp index 0a95c5ef..abdd1f8d 100644 --- a/tcdistribution/PUSDistributor.cpp +++ b/tcdistribution/PUSDistributor.cpp @@ -5,7 +5,7 @@ #include "../tmtcpacket/pus/TcPacketStored.h" #include "../tmtcservices/PusVerificationReport.h" -#define PUS_DISTRIBUTOR_DEBUGGING 1 +#define PUS_DISTRIBUTOR_DEBUGGING 0 PUSDistributor::PUSDistributor(uint16_t setApid, object_id_t setObjectId, object_id_t setPacketSource) : From 43ddb445737575a8847e895aea279a57f4e0a6a1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 7 Apr 2021 22:12:01 +0200 Subject: [PATCH 013/389] fixed temperature sensor object --- thermal/TemperatureSensor.h | 54 +++++++++++++++++++------------------ 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/thermal/TemperatureSensor.h b/thermal/TemperatureSensor.h index 2b1fb1f0..ceb8a861 100644 --- a/thermal/TemperatureSensor.h +++ b/thermal/TemperatureSensor.h @@ -1,11 +1,14 @@ #ifndef TEMPERATURESENSOR_H_ #define TEMPERATURESENSOR_H_ -#include "../thermal/AbstractTemperatureSensor.h" -#include "../datapoolglob/GlobalDataSet.h" -#include "../datapoolglob/GlobalPoolVariable.h" +#include "tcsDefinitions.h" +#include "AbstractTemperatureSensor.h" + +#include "../datapoollocal/LocalPoolDataSetBase.h" +#include "../datapoollocal/LocalPoolVariable.h" #include "../monitoring/LimitMonitor.h" + /** * @brief This building block handles non-linear value conversion and * range checks for analog temperature sensors. @@ -57,27 +60,26 @@ public: /** * Instantiate Temperature Sensor Object. - * @param setObjectid objectId of the sensor object - * @param inputValue Input value which is converted to a temperature - * @param poolVariable Pool Variable to store the temperature value - * @param vectorIndex Vector Index for the sensor monitor - * @param parameters Calculation parameters, temperature limits, gradient limit - * @param datapoolId Datapool ID of the output temperature - * @param outputSet Output dataset for the output temperature to fetch it with read() + * @param setObjectid objectId of the sensor object + * @param inputValue Pointer to input value which is converted to a temperature + * @param variableGpid Global Pool ID of the output value + * @param inputVariable Input variable handle + * @param vectorIndex Vector Index for the sensor monitor + * @param parameters Calculation parameters, temperature limits, gradient limit + * @param outputSet Output dataset for the output temperature to fetch it with read() * @param thermalModule respective thermal module, if it has one */ TemperatureSensor(object_id_t setObjectid, - inputType *inputValue, PoolVariableIF *poolVariable, - uint8_t vectorIndex, uint32_t datapoolId, Parameters parameters = {0, 0, 0, 0, 0, 0}, - GlobDataSet *outputSet = NULL, ThermalModuleIF *thermalModule = NULL) : + inputType *inputValue, gp_id_t variableGpid, PoolVariableIF* inputVariable, + uint8_t vectorIndex, Parameters parameters = {0, 0, 0, 0, 0, 0}, + LocalPoolDataSetBase *outputSet = NULL, ThermalModuleIF *thermalModule = NULL) : AbstractTemperatureSensor(setObjectid, thermalModule), parameters(parameters), - inputValue(inputValue), poolVariable(poolVariable), - outputTemperature(datapoolId, outputSet, PoolVariableIF::VAR_WRITE), - sensorMonitor(setObjectid, DOMAIN_ID_SENSOR, - GlobalDataPool::poolIdAndPositionToPid(poolVariable->getDataPoolId(), vectorIndex), + inputValue(inputValue), poolVariable(inputVariable), + outputTemperature(variableGpid, outputSet, PoolVariableIF::VAR_WRITE), + sensorMonitor(setObjectid, DOMAIN_ID_SENSOR, poolVariable, DEFAULT_CONFIRMATION_COUNT, parameters.lowerLimit, parameters.upperLimit, TEMP_SENSOR_LOW, TEMP_SENSOR_HIGH), - oldTemperature(20), uptimeOfOldTemperature( { INVALID_TEMPERATURE, 0 }) { + oldTemperature(20), uptimeOfOldTemperature({ thermal::INVALID_TEMPERATURE, 0 }) { } @@ -98,7 +100,7 @@ protected: private: void setInvalid() { - outputTemperature = INVALID_TEMPERATURE; + outputTemperature = thermal::INVALID_TEMPERATURE; outputTemperature.setValid(false); uptimeOfOldTemperature.tv_sec = INVALID_UPTIME; sensorMonitor.setToInvalid(); @@ -108,11 +110,11 @@ protected: UsedParameters parameters; - inputType * inputValue; + inputType* inputValue; - PoolVariableIF *poolVariable; + PoolVariableIF* poolVariable; - gp_float_t outputTemperature; + lp_var_t outputTemperature; LimitMonitor sensorMonitor; @@ -120,8 +122,8 @@ protected: timeval uptimeOfOldTemperature; void doChildOperation() { - if (!poolVariable->isValid() - || !healthHelper.healthTable->isHealthy(getObjectId())) { + if ((not poolVariable->isValid()) or + (not healthHelper.healthTable->isHealthy(getObjectId()))) { setInvalid(); return; } @@ -152,13 +154,13 @@ protected: } } - //Check is done against raw limits. SHOULDDO: Why? Using �C would be more easy to handle. + //Check is done against raw limits. SHOULDDO: Why? Using C would be more easy to handle. sensorMonitor.doCheck(outputTemperature.value); if (sensorMonitor.isOutOfLimits()) { uptimeOfOldTemperature.tv_sec = INVALID_UPTIME; outputTemperature.setValid(PoolVariableIF::INVALID); - outputTemperature = INVALID_TEMPERATURE; + outputTemperature = thermal::INVALID_TEMPERATURE; } else { oldTemperature = outputTemperature; uptimeOfOldTemperature = uptime; From 80aab5f461fa0f462aff4743c95413299642ce06 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 8 Apr 2021 15:25:22 +0200 Subject: [PATCH 014/389] super evil bug --- osal/linux/MessageQueue.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osal/linux/MessageQueue.cpp b/osal/linux/MessageQueue.cpp index 60d15dee..b40ff29b 100644 --- a/osal/linux/MessageQueue.cpp +++ b/osal/linux/MessageQueue.cpp @@ -190,13 +190,14 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) { return HasReturnvaluesIF::RETURN_FAILED; } return HasReturnvaluesIF::RETURN_OK; - }else if(status==0){ + } + else if(status==0) { //Success but no message received return MessageQueueIF::EMPTY; } else { //No message was received. Keep lastPartner anyway, I might send //something later. But still, delete packet content. - memset(message->getData(), 0, message->getMaximumMessageSize()); + memset(message->getBuffer(), 0, message->getMaximumMessageSize()); switch(errno){ case EAGAIN: //O_NONBLOCK or MQ_NONBLOCK was set and there are no messages From 9ee1bd15c4f82e10edc8aba250686ed70f1699ae Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 8 Apr 2021 15:38:36 +0200 Subject: [PATCH 015/389] now fixed properly --- ipc/MessageQueueMessage.cpp | 4 ++++ ipc/MessageQueueMessage.h | 1 + ipc/MessageQueueMessageIF.h | 1 + osal/linux/MessageQueue.cpp | 7 ++++--- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ipc/MessageQueueMessage.cpp b/ipc/MessageQueueMessage.cpp index e97778c3..1958af54 100644 --- a/ipc/MessageQueueMessage.cpp +++ b/ipc/MessageQueueMessage.cpp @@ -86,3 +86,7 @@ size_t MessageQueueMessage::getMaximumMessageSize() const { return this->MAX_MESSAGE_SIZE; } +size_t MessageQueueMessage::getMaximumDataSize() const { + return this->MAX_DATA_SIZE; +} + diff --git a/ipc/MessageQueueMessage.h b/ipc/MessageQueueMessage.h index 5234f64f..111056ca 100644 --- a/ipc/MessageQueueMessage.h +++ b/ipc/MessageQueueMessage.h @@ -139,6 +139,7 @@ public: virtual void setMessageSize(size_t messageSize) override; virtual size_t getMinimumMessageSize() const override; virtual size_t getMaximumMessageSize() const override; + virtual size_t getMaximumDataSize() const override; /** * @brief This is a debug method that prints the content. diff --git a/ipc/MessageQueueMessageIF.h b/ipc/MessageQueueMessageIF.h index 33e01e7d..893c30b5 100644 --- a/ipc/MessageQueueMessageIF.h +++ b/ipc/MessageQueueMessageIF.h @@ -72,6 +72,7 @@ public: virtual void setMessageSize(size_t messageSize) = 0; virtual size_t getMinimumMessageSize() const = 0; virtual size_t getMaximumMessageSize() const = 0; + virtual size_t getMaximumDataSize() const = 0; }; diff --git a/osal/linux/MessageQueue.cpp b/osal/linux/MessageQueue.cpp index b40ff29b..8004c045 100644 --- a/osal/linux/MessageQueue.cpp +++ b/osal/linux/MessageQueue.cpp @@ -191,13 +191,14 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) { } return HasReturnvaluesIF::RETURN_OK; } - else if(status==0) { + else if (status==0) { //Success but no message received return MessageQueueIF::EMPTY; - } else { + } + else { //No message was received. Keep lastPartner anyway, I might send //something later. But still, delete packet content. - memset(message->getBuffer(), 0, message->getMaximumMessageSize()); + memset(message->getData(), 0, message->getMaximumDataSize()); switch(errno){ case EAGAIN: //O_NONBLOCK or MQ_NONBLOCK was set and there are no messages From e799e45198c19793d99a530e0d496f89d08107b3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 8 Apr 2021 16:20:24 +0200 Subject: [PATCH 016/389] bugfix for RTEMS --- osal/rtems/MessageQueue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osal/rtems/MessageQueue.cpp b/osal/rtems/MessageQueue.cpp index bfaf3569..717b80dd 100644 --- a/osal/rtems/MessageQueue.cpp +++ b/osal/rtems/MessageQueue.cpp @@ -61,7 +61,7 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) { } else { //No message was received. Keep lastPartner anyway, I might send something later. //But still, delete packet content. - memset(message->getData(), 0, message->getMaximumMessageSize()); + memset(message->getData(), 0, message->getMaximumDataSize()); } return convertReturnCode(status); } From 38d929c2a8df4451129bad3b464f3119fffe96ab Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 8 Apr 2021 18:48:44 +0200 Subject: [PATCH 017/389] coverity fixes --- osal/common/TcpTmTcServer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/osal/common/TcpTmTcServer.cpp b/osal/common/TcpTmTcServer.cpp index 296afad8..2bfd4876 100644 --- a/osal/common/TcpTmTcServer.cpp +++ b/osal/common/TcpTmTcServer.cpp @@ -70,6 +70,7 @@ ReturnValue_t TcpTmTcServer::initialize() { #endif freeaddrinfo(addrResult); handleError(Protocol::TCP, ErrorSources::BIND_CALL); + return HasReturnvaluesIF::RETURN_FAILED; } freeaddrinfo(addrResult); From f988271be4dbae63963755871451dc95d3085efd Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 8 Apr 2021 18:53:22 +0200 Subject: [PATCH 018/389] coverity fixes --- container/SharedRingBuffer.cpp | 3 +++ container/SharedRingBuffer.h | 23 +++++++++++++---------- osal/common/TcpTmTcServer.cpp | 6 ++++-- osal/common/UdpTmTcBridge.cpp | 1 + 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/container/SharedRingBuffer.cpp b/container/SharedRingBuffer.cpp index 5e20bb6f..fe36341d 100644 --- a/container/SharedRingBuffer.cpp +++ b/container/SharedRingBuffer.cpp @@ -17,6 +17,9 @@ SharedRingBuffer::SharedRingBuffer(object_id_t objectId, uint8_t *buffer, mutex = MutexFactory::instance()->createMutex(); } +SharedRingBuffer::~SharedRingBuffer() { + MutexFactory::instance()->deleteMutex(mutex); +} void SharedRingBuffer::setToUseReceiveSizeFIFO(size_t fifoDepth) { this->fifoDepth = fifoDepth; diff --git a/container/SharedRingBuffer.h b/container/SharedRingBuffer.h index 66a119ab..9d6ea56c 100644 --- a/container/SharedRingBuffer.h +++ b/container/SharedRingBuffer.h @@ -26,6 +26,18 @@ public: */ SharedRingBuffer(object_id_t objectId, const size_t size, bool overwriteOld, size_t maxExcessBytes); + /** + * This constructor takes an external buffer with the specified size. + * @param buffer + * @param size + * @param overwriteOld + * If the ring buffer is overflowing at a write operartion, the oldest data + * will be overwritten. + */ + SharedRingBuffer(object_id_t objectId, uint8_t* buffer, const size_t size, + bool overwriteOld, size_t maxExcessBytes); + + virtual~ SharedRingBuffer(); /** * @brief This function can be used to add an optional FIFO to the class @@ -37,16 +49,7 @@ public: */ void setToUseReceiveSizeFIFO(size_t fifoDepth); - /** - * This constructor takes an external buffer with the specified size. - * @param buffer - * @param size - * @param overwriteOld - * If the ring buffer is overflowing at a write operartion, the oldest data - * will be overwritten. - */ - SharedRingBuffer(object_id_t objectId, uint8_t* buffer, const size_t size, - bool overwriteOld, size_t maxExcessBytes); + /** * Unless a read-only constant value is read, all operations on the diff --git a/osal/common/TcpTmTcServer.cpp b/osal/common/TcpTmTcServer.cpp index 2bfd4876..08a62ffb 100644 --- a/osal/common/TcpTmTcServer.cpp +++ b/osal/common/TcpTmTcServer.cpp @@ -85,8 +85,8 @@ TcpTmTcServer::~TcpTmTcServer() { ReturnValue_t TcpTmTcServer::performOperation(uint8_t opCode) { using namespace tcpip; /* If a connection is accepted, the corresponding socket will be assigned to the new socket */ - socket_t clientSocket; - sockaddr clientSockAddr; + socket_t clientSocket = 0; + sockaddr clientSockAddr = {}; socklen_t connectorSockAddrLen = 0; int retval = 0; @@ -102,6 +102,7 @@ ReturnValue_t TcpTmTcServer::performOperation(uint8_t opCode) { if(clientSocket == INVALID_SOCKET) { handleError(Protocol::TCP, ErrorSources::ACCEPT_CALL, 500); + closeSocket(clientSocket); continue; }; @@ -123,6 +124,7 @@ ReturnValue_t TcpTmTcServer::performOperation(uint8_t opCode) { /* Done, shut down connection */ retval = shutdown(clientSocket, SHUT_SEND); + closeSocket(clientSocket); } return HasReturnvaluesIF::RETURN_OK; } diff --git a/osal/common/UdpTmTcBridge.cpp b/osal/common/UdpTmTcBridge.cpp index 7f3dc929..798be6f5 100644 --- a/osal/common/UdpTmTcBridge.cpp +++ b/osal/common/UdpTmTcBridge.cpp @@ -103,6 +103,7 @@ ReturnValue_t UdpTmTcBridge::initialize() { #endif freeaddrinfo(addrResult); tcpip::handleError(tcpip::Protocol::UDP, tcpip::ErrorSources::BIND_CALL); + return HasReturnvaluesIF::RETURN_FAILED; } freeaddrinfo(addrResult); return HasReturnvaluesIF::RETURN_OK; From 00d9a4f3ed44b1bc929271f93f126105aa866616 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 8 Apr 2021 18:57:24 +0200 Subject: [PATCH 019/389] more coverity fixes --- osal/host/FixedTimeslotTask.cpp | 1 - osal/host/PeriodicTask.cpp | 1 - osal/host/QueueMapManager.cpp | 4 ++++ osal/host/QueueMapManager.h | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/osal/host/FixedTimeslotTask.cpp b/osal/host/FixedTimeslotTask.cpp index 3b169b5a..ee149922 100644 --- a/osal/host/FixedTimeslotTask.cpp +++ b/osal/host/FixedTimeslotTask.cpp @@ -38,7 +38,6 @@ FixedTimeslotTask::~FixedTimeslotTask(void) { if(mainThread.joinable()) { mainThread.join(); } - delete this; } void FixedTimeslotTask::taskEntryPoint(void* argument) { diff --git a/osal/host/PeriodicTask.cpp b/osal/host/PeriodicTask.cpp index d7abf9d0..631264b7 100644 --- a/osal/host/PeriodicTask.cpp +++ b/osal/host/PeriodicTask.cpp @@ -38,7 +38,6 @@ PeriodicTask::~PeriodicTask(void) { if(mainThread.joinable()) { mainThread.join(); } - delete this; } void PeriodicTask::taskEntryPoint(void* argument) { diff --git a/osal/host/QueueMapManager.cpp b/osal/host/QueueMapManager.cpp index b50d62dc..c9100fe9 100644 --- a/osal/host/QueueMapManager.cpp +++ b/osal/host/QueueMapManager.cpp @@ -10,6 +10,10 @@ QueueMapManager::QueueMapManager() { mapLock = MutexFactory::instance()->createMutex(); } +QueueMapManager::~QueueMapManager() { + MutexFactory::instance()->deleteMutex(mapLock); +} + QueueMapManager* QueueMapManager::instance() { if (mqManagerInstance == nullptr){ mqManagerInstance = new QueueMapManager(); diff --git a/osal/host/QueueMapManager.h b/osal/host/QueueMapManager.h index 3610ca63..90c39c2f 100644 --- a/osal/host/QueueMapManager.h +++ b/osal/host/QueueMapManager.h @@ -36,6 +36,8 @@ public: private: //! External instantiation is forbidden. QueueMapManager(); + ~QueueMapManager(); + uint32_t queueCounter = 0; MutexIF* mapLock; QueueMap queueMap; From bddd8720b2898d785f6647d9d383ff65c3d2c4e0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 8 Apr 2021 18:59:48 +0200 Subject: [PATCH 020/389] another coverity fix --- osal/host/FixedTimeslotTask.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osal/host/FixedTimeslotTask.cpp b/osal/host/FixedTimeslotTask.cpp index ee149922..016b1404 100644 --- a/osal/host/FixedTimeslotTask.cpp +++ b/osal/host/FixedTimeslotTask.cpp @@ -118,8 +118,11 @@ ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId, } #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "Component " << std::hex << componentId << - " not found, not adding it to pst" << std::endl; + sif::error << "Component " << std::hex << "0x" << componentId << "not found, " + "not adding it to PST.." << std::dec << std::endl; +#else + sif::printError("Component 0x%08x not found, not adding it to PST..\n", + static_cast(componentId)); #endif return HasReturnvaluesIF::RETURN_FAILED; } From efb7c8760a864e45e5686ce450fb8f7b06dc7500 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 8 Apr 2021 19:01:06 +0200 Subject: [PATCH 021/389] coverity action helper fix --- action/ActionHelper.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/action/ActionHelper.cpp b/action/ActionHelper.cpp index 4b64a40c..b2374ed6 100644 --- a/action/ActionHelper.cpp +++ b/action/ActionHelper.cpp @@ -147,11 +147,6 @@ ReturnValue_t ActionHelper::reportData(MessageQueueId_t reportTo, return result; } - if (result != HasReturnvaluesIF::RETURN_OK) { - ipcStore->deleteData(storeAddress); - return result; - } - /* We don't need to report the objectId, as we receive REQUESTED data before the completion success message. True aperiodic replies need to be reported with another dedicated message. */ ActionMessage::setDataReply(&reply, replyId, storeAddress); From b30a3aaa382c136df69329e16bae1dfac5f82aa1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 8 Apr 2021 19:07:03 +0200 Subject: [PATCH 022/389] coverity fix --- osal/host/MessageQueue.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/osal/host/MessageQueue.cpp b/osal/host/MessageQueue.cpp index 18272a68..359ce8ec 100644 --- a/osal/host/MessageQueue.cpp +++ b/osal/host/MessageQueue.cpp @@ -106,6 +106,9 @@ bool MessageQueue::isDefaultDestinationSet() const { ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo, MessageQueueMessageIF* message, MessageQueueId_t sentFrom, bool ignoreFault) { + if(message == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } message->setSender(sentFrom); if(message->getMessageSize() > message->getMaximumMessageSize()) { // Actually, this should never happen or an error will be emitted @@ -128,12 +131,12 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo, return HasReturnvaluesIF::RETURN_FAILED; } if(targetQueue->messageQueue.size() < targetQueue->messageDepth) { - MutexGuard mutexLock(targetQueue->queueLock, - MutexIF::TimeoutType::WAITING, 20); - // not ideal, works for now though. - MessageQueueMessage* mqmMessage = - dynamic_cast(message); - if(message != nullptr) { + MutexGuard mutexLock(targetQueue->queueLock, MutexIF::TimeoutType::WAITING, 20); + // TODO: Would be nice to support other message types, but this would require + // create the message on the heap from an upper layer and simply storing + // MessageQueueMessageIF pointers in the queue. + MessageQueueMessage* mqmMessage = dynamic_cast(message); + if(mqmMessage != nullptr) { targetQueue->messageQueue.push(*mqmMessage); } else { From 8f4ab6d7edd963166e9f4f0845ff85c9882aeb5a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 8 Apr 2021 19:07:51 +0200 Subject: [PATCH 023/389] coverity: initialize member --- serialize/SerializeElement.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serialize/SerializeElement.h b/serialize/SerializeElement.h index 47080292..d41098d8 100644 --- a/serialize/SerializeElement.h +++ b/serialize/SerializeElement.h @@ -57,7 +57,7 @@ public: return &entry; } - T entry; + T entry = 0; }; #endif /* FSFW_SERIALIZE_SERIALIZEELEMENT_H_ */ From dd367bf083422f24f0a2e9aea4ea8b9f213499ce Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 8 Apr 2021 19:09:00 +0200 Subject: [PATCH 024/389] coverity: initialize entry --- serialize/SerializeElement.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/serialize/SerializeElement.h b/serialize/SerializeElement.h index d41098d8..ba34393d 100644 --- a/serialize/SerializeElement.h +++ b/serialize/SerializeElement.h @@ -25,7 +25,7 @@ public: } SerializeElement() : - LinkedElement(this) { + LinkedElement(this), entry(0) { } ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize, @@ -57,7 +57,7 @@ public: return &entry; } - T entry = 0; + T entry; }; #endif /* FSFW_SERIALIZE_SERIALIZEELEMENT_H_ */ From e6a1a7cc2d5d5f17f02c70e8bb677d75cde5712e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 8 Apr 2021 19:10:49 +0200 Subject: [PATCH 025/389] coverity fix for event message --- events/EventMessage.cpp | 2 +- events/EventMessage.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/events/EventMessage.cpp b/events/EventMessage.cpp index bbc41e10..548b4f0f 100644 --- a/events/EventMessage.cpp +++ b/events/EventMessage.cpp @@ -109,6 +109,6 @@ bool EventMessage::isClearedEventMessage() { return getEvent() == INVALID_EVENT; } -size_t EventMessage::getMinimumMessageSize() { +size_t EventMessage::getMinimumMessageSize() const { return EVENT_MESSAGE_SIZE; } diff --git a/events/EventMessage.h b/events/EventMessage.h index 4d003bd7..f2f5ffb5 100644 --- a/events/EventMessage.h +++ b/events/EventMessage.h @@ -45,7 +45,7 @@ public: protected: static const Event INVALID_EVENT = 0; - virtual size_t getMinimumMessageSize(); + virtual size_t getMinimumMessageSize() const override; }; From 905d525aa27069e9948861879a5e104a35e40a4b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 8 Apr 2021 19:12:21 +0200 Subject: [PATCH 026/389] small fix DHB --- devicehandlers/DeviceHandlerBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devicehandlers/DeviceHandlerBase.cpp b/devicehandlers/DeviceHandlerBase.cpp index 15eac11f..4a0b3582 100644 --- a/devicehandlers/DeviceHandlerBase.cpp +++ b/devicehandlers/DeviceHandlerBase.cpp @@ -1483,7 +1483,7 @@ void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType, if(errorCode == ObjectManagerIF::CHILD_INIT_FAILED) { errorPrint = "Initialization error"; } - if(errorCode == HasReturnvaluesIF::RETURN_FAILED) { + else if(errorCode == HasReturnvaluesIF::RETURN_FAILED) { if(errorType == sif::OutputTypes::OUT_WARNING) { errorPrint = "Generic Warning"; } From 2b84ab018c03774e6a8caff9bb87e9844498ec71 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 8 Apr 2021 20:53:54 +0200 Subject: [PATCH 027/389] implemented mq properly --- osal/host/MessageQueue.cpp | 24 ++++++------------------ osal/host/MessageQueue.h | 2 +- 2 files changed, 7 insertions(+), 19 deletions(-) diff --git a/osal/host/MessageQueue.cpp b/osal/host/MessageQueue.cpp index 359ce8ec..41c55a3d 100644 --- a/osal/host/MessageQueue.cpp +++ b/osal/host/MessageQueue.cpp @@ -64,9 +64,8 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) { return MessageQueueIF::EMPTY; } MutexGuard mutexLock(queueLock, MutexIF::TimeoutType::WAITING, 20); - MessageQueueMessage* currentMessage = &messageQueue.front(); - std::copy(currentMessage->getBuffer(), - currentMessage->getBuffer() + messageSize, message->getBuffer()); + std::copy(messageQueue.front().data(), messageQueue.front().data() + messageSize, + message->getBuffer()); messageQueue.pop(); // The last partner is the first uint32_t field in the message this->lastPartner = message->getSender(); @@ -80,7 +79,7 @@ MessageQueueId_t MessageQueue::getLastPartner() const { ReturnValue_t MessageQueue::flush(uint32_t* count) { *count = messageQueue.size(); // Clears the queue. - messageQueue = std::queue(); + messageQueue = std::queue>(); return HasReturnvaluesIF::RETURN_OK; } @@ -132,20 +131,9 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo, } if(targetQueue->messageQueue.size() < targetQueue->messageDepth) { MutexGuard mutexLock(targetQueue->queueLock, MutexIF::TimeoutType::WAITING, 20); - // TODO: Would be nice to support other message types, but this would require - // create the message on the heap from an upper layer and simply storing - // MessageQueueMessageIF pointers in the queue. - MessageQueueMessage* mqmMessage = dynamic_cast(message); - if(mqmMessage != nullptr) { - targetQueue->messageQueue.push(*mqmMessage); - } - else { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::sendMessageFromMessageQueue: Message" - "is not MessageQueueMessage!" << std::endl; -#endif - } - + targetQueue->messageQueue.push(std::vector(message->getMaximumMessageSize())); + memcpy(targetQueue->messageQueue.back().data(), message->getBuffer(), + message->getMaximumMessageSize()); } else { return MessageQueueIF::FULL; diff --git a/osal/host/MessageQueue.h b/osal/host/MessageQueue.h index 97a9e491..e965123d 100644 --- a/osal/host/MessageQueue.h +++ b/osal/host/MessageQueue.h @@ -212,7 +212,7 @@ protected: //static ReturnValue_t handleSendResult(BaseType_t result, bool ignoreFault); private: - std::queue messageQueue; + std::queue> messageQueue; /** * @brief The class stores the queue id it got assigned. * If initialization fails, the queue id is set to zero. From c1f4ae08fb4e1c76592735b1dd0741fda14a772d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 8 Apr 2021 22:28:44 +0200 Subject: [PATCH 028/389] typo fix --- ipc/MessageQueueIF.h | 2 +- osal/FreeRTOS/MessageQueue.cpp | 2 +- osal/linux/MessageQueue.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ipc/MessageQueueIF.h b/ipc/MessageQueueIF.h index 1c06521c..74ccb29a 100644 --- a/ipc/MessageQueueIF.h +++ b/ipc/MessageQueueIF.h @@ -27,7 +27,7 @@ public: //! Returned if a reply method was called without partner static const ReturnValue_t NO_REPLY_PARTNER = MAKE_RETURN_CODE(3); //! Returned if the target destination is invalid. - static constexpr ReturnValue_t DESTINVATION_INVALID = MAKE_RETURN_CODE(4); + static constexpr ReturnValue_t DESTINATION_INVALID = MAKE_RETURN_CODE(4); virtual ~MessageQueueIF() {} /** diff --git a/osal/FreeRTOS/MessageQueue.cpp b/osal/FreeRTOS/MessageQueue.cpp index c0c82cf1..3a0f654e 100644 --- a/osal/FreeRTOS/MessageQueue.cpp +++ b/osal/FreeRTOS/MessageQueue.cpp @@ -135,7 +135,7 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo, QueueHandle_t destination = nullptr; if(sendTo == MessageQueueIF::NO_QUEUE or sendTo == 0x00) { - return MessageQueueIF::DESTINVATION_INVALID; + return MessageQueueIF::DESTINATION_INVALID; } else { destination = reinterpret_cast(sendTo); diff --git a/osal/linux/MessageQueue.cpp b/osal/linux/MessageQueue.cpp index 8004c045..12774a58 100644 --- a/osal/linux/MessageQueue.cpp +++ b/osal/linux/MessageQueue.cpp @@ -373,7 +373,7 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo, <<"mq_send to: " << sendTo << " sent from " << sentFrom << std::endl; #endif - return DESTINVATION_INVALID; + return DESTINATION_INVALID; } case EINTR: //The call was interrupted by a signal. From d92a20a669d5918422833aaf09b9934a59d8d789 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 8 Apr 2021 22:49:36 +0200 Subject: [PATCH 029/389] coverity --- datapool/HkSwitchHelper.cpp | 2 +- globalfunctions/arrayprinter.cpp | 4 ++-- osal/FreeRTOS/Clock.cpp | 2 +- pus/Service5EventReporting.cpp | 4 +++- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/datapool/HkSwitchHelper.cpp b/datapool/HkSwitchHelper.cpp index 1a2a25eb..21e37f59 100644 --- a/datapool/HkSwitchHelper.cpp +++ b/datapool/HkSwitchHelper.cpp @@ -7,7 +7,7 @@ HkSwitchHelper::HkSwitchHelper(EventReportingProxyIF* eventProxy) : } HkSwitchHelper::~HkSwitchHelper() { - // TODO Auto-generated destructor stub + QueueFactory::instance()->deleteMessageQueue(actionQueue); } ReturnValue_t HkSwitchHelper::initialize() { diff --git a/globalfunctions/arrayprinter.cpp b/globalfunctions/arrayprinter.cpp index 20a64f5b..0423360b 100644 --- a/globalfunctions/arrayprinter.cpp +++ b/globalfunctions/arrayprinter.cpp @@ -51,7 +51,7 @@ void arrayprinter::printHex(const uint8_t *data, size_t size, #else // General format: 0x01, 0x02, 0x03 so it is number of chars times 6 // plus line break plus small safety margin. - char printBuffer[(size + 1) * 7 + 1]; + char printBuffer[(size + 1) * 7 + 1] = {}; size_t currentPos = 0; for(size_t i = 0; i < size; i++) { // To avoid buffer overflows. @@ -94,7 +94,7 @@ void arrayprinter::printDec(const uint8_t *data, size_t size, #else // General format: 32, 243, -12 so it is number of chars times 5 // plus line break plus small safety margin. - char printBuffer[(size + 1) * 5 + 1]; + char printBuffer[(size + 1) * 5 + 1] = {}; size_t currentPos = 0; for(size_t i = 0; i < size; i++) { // To avoid buffer overflows. diff --git a/osal/FreeRTOS/Clock.cpp b/osal/FreeRTOS/Clock.cpp index 806edcc7..c15971fe 100644 --- a/osal/FreeRTOS/Clock.cpp +++ b/osal/FreeRTOS/Clock.cpp @@ -111,7 +111,7 @@ ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) { ReturnValue_t Clock::convertTimeOfDayToTimeval(const TimeOfDay_t* from, timeval* to) { - struct tm time_tm; + struct tm time_tm = {}; time_tm.tm_year = from->year - 1900; time_tm.tm_mon = from->month - 1; diff --git a/pus/Service5EventReporting.cpp b/pus/Service5EventReporting.cpp index 29eb7f20..965a27ad 100644 --- a/pus/Service5EventReporting.cpp +++ b/pus/Service5EventReporting.cpp @@ -15,7 +15,9 @@ Service5EventReporting::Service5EventReporting(object_id_t objectId, eventQueue = QueueFactory::instance()->createMessageQueue(messageQueueDepth); } -Service5EventReporting::~Service5EventReporting(){} +Service5EventReporting::~Service5EventReporting() { + QueueFactory::instance()->deleteMessageQueue(eventQueue); +} ReturnValue_t Service5EventReporting::performService() { EventMessage message; From 40cc3c383bca725d162638fa9885ec3f4d83f8fb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 9 Apr 2021 00:45:04 +0200 Subject: [PATCH 030/389] this should work --- serialize/SerializeElement.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/serialize/SerializeElement.h b/serialize/SerializeElement.h index ba34393d..db66f9cc 100644 --- a/serialize/SerializeElement.h +++ b/serialize/SerializeElement.h @@ -25,7 +25,7 @@ public: } SerializeElement() : - LinkedElement(this), entry(0) { + LinkedElement(this), entry() { } ReturnValue_t serialize(uint8_t **buffer, size_t *size, size_t maxSize, From d3c3a9147a875f34a4fe95358b5e41cecfa4093f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 9 Apr 2021 08:29:56 +0200 Subject: [PATCH 031/389] bumped version number --- FSFWVersion.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/FSFWVersion.h b/FSFWVersion.h index 11a60891..df2d49a5 100644 --- a/FSFWVersion.h +++ b/FSFWVersion.h @@ -3,9 +3,9 @@ const char* const FSFW_VERSION_NAME = "ASTP"; -#define FSFW_VERSION 0 -#define FSFW_SUBVERSION 0 -#define FSFW_REVISION 1 +#define FSFW_VERSION 1 +#define FSFW_SUBVERSION 0 +#define FSFW_REVISION 0 From b8c7a6570915df561df260ec6e83b03521b9114e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 9 Apr 2021 08:59:32 +0200 Subject: [PATCH 032/389] coverity fix --- datapoollocal/LocalDataPoolManager.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/datapoollocal/LocalDataPoolManager.cpp b/datapoollocal/LocalDataPoolManager.cpp index 94ee9c26..dbe68ff1 100644 --- a/datapoollocal/LocalDataPoolManager.cpp +++ b/datapoollocal/LocalDataPoolManager.cpp @@ -909,27 +909,29 @@ void LocalDataPoolManager::printWarningOrError(sif::OutputTypes outputType, errorPrint = "Unknown error"; } } + object_id_t objectId = 0xffffffff; + if(owner != nullptr) { + objectId = owner->getObjectId(); + } if(outputType == sif::OutputTypes::OUT_WARNING) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "LocalDataPoolManager::" << functionName - << ": Object ID 0x" << std::setw(8) << std::setfill('0') - << std::hex << owner->getObjectId() << " | " << errorPrint - << std::dec << std::setfill(' ') << std::endl; + sif::warning << "LocalDataPoolManager::" << functionName << ": Object ID 0x" << + std::setw(8) << std::setfill('0') << std::hex << objectId << " | " << errorPrint << + std::dec << std::setfill(' ') << std::endl; #else sif::printWarning("LocalDataPoolManager::%s: Object ID 0x%08x | %s\n", - functionName, owner->getObjectId(), errorPrint); + functionName, objectId, errorPrint); #endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ } else if(outputType == sif::OutputTypes::OUT_ERROR) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "LocalDataPoolManager::" << functionName - << ": Object ID 0x" << std::setw(8) << std::setfill('0') - << std::hex << owner->getObjectId() << " | " << errorPrint - << std::dec << std::setfill(' ') << std::endl; + sif::error << "LocalDataPoolManager::" << functionName << ": Object ID 0x" << + std::setw(8) << std::setfill('0') << std::hex << objectId << " | " << errorPrint << + std::dec << std::setfill(' ') << std::endl; #else sif::printError("LocalDataPoolManager::%s: Object ID 0x%08x | %s\n", - functionName, owner->getObjectId(), errorPrint); + functionName, objectId, errorPrint); #endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ } #endif /* #if FSFW_VERBOSE_LEVEL >= 1 */ From d9a0a4f2ea75f62035287c3e75f2272b995d77b5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 9 Apr 2021 09:14:42 +0200 Subject: [PATCH 033/389] coverity --- pus/Service1TelecommandVerification.cpp | 4 +++- tmtcservices/TmTcBridge.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pus/Service1TelecommandVerification.cpp b/pus/Service1TelecommandVerification.cpp index 9e86c752..7ce75478 100644 --- a/pus/Service1TelecommandVerification.cpp +++ b/pus/Service1TelecommandVerification.cpp @@ -15,7 +15,9 @@ Service1TelecommandVerification::Service1TelecommandVerification( tmQueue = QueueFactory::instance()->createMessageQueue(messageQueueDepth); } -Service1TelecommandVerification::~Service1TelecommandVerification() {} +Service1TelecommandVerification::~Service1TelecommandVerification() { + QueueFactory::instance()->deleteMessageQueue(tmQueue); +} MessageQueueId_t Service1TelecommandVerification::getVerificationQueue(){ return tmQueue->getId(); diff --git a/tmtcservices/TmTcBridge.cpp b/tmtcservices/TmTcBridge.cpp index f99b9051..dcffac41 100644 --- a/tmtcservices/TmTcBridge.cpp +++ b/tmtcservices/TmTcBridge.cpp @@ -16,7 +16,9 @@ TmTcBridge::TmTcBridge(object_id_t objectId, object_id_t tcDestination, createMessageQueue(TMTC_RECEPTION_QUEUE_DEPTH); } -TmTcBridge::~TmTcBridge() {} +TmTcBridge::~TmTcBridge() { + QueueFactory::instance()->deleteMessageQueue(tmTcReceptionQueue); +} ReturnValue_t TmTcBridge::setNumberOfSentPacketsPerCycle( uint8_t sentPacketsPerCycle) { From e0d39b1feb04aafdb3fbe9e57a2f84ed9923300a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 9 Apr 2021 09:17:11 +0200 Subject: [PATCH 034/389] coverity --- pus/Service8FunctionManagement.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pus/Service8FunctionManagement.cpp b/pus/Service8FunctionManagement.cpp index a2202abc..54187a82 100644 --- a/pus/Service8FunctionManagement.cpp +++ b/pus/Service8FunctionManagement.cpp @@ -53,12 +53,14 @@ ReturnValue_t Service8FunctionManagement::checkInterfaceAndAcquireMessageQueue( ReturnValue_t Service8FunctionManagement::prepareCommand( CommandMessage* message, uint8_t subservice, const uint8_t* tcData, size_t tcDataLen, uint32_t* state, object_id_t objectId) { - return prepareDirectCommand(dynamic_cast(message), - tcData, tcDataLen); + return prepareDirectCommand(message, tcData, tcDataLen); } ReturnValue_t Service8FunctionManagement::prepareDirectCommand( CommandMessage *message, const uint8_t *tcData, size_t tcDataLen) { + if(message == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } if(tcDataLen < sizeof(object_id_t) + sizeof(ActionId_t)) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::debug << "Service8FunctionManagement::prepareDirectCommand:" From 6db0725aa4293cfafdf9cdea87d701a3892cd2eb Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Fri, 9 Apr 2021 15:39:48 +0200 Subject: [PATCH 035/389] coverity fix --- health/HealthTable.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/health/HealthTable.cpp b/health/HealthTable.cpp index 5d720b19..8b19d8e3 100644 --- a/health/HealthTable.cpp +++ b/health/HealthTable.cpp @@ -68,8 +68,18 @@ void HealthTable::printAll(uint8_t* pointer, size_t maxSize) { MutexGuard(mutex, timeoutType, mutexTimeoutMs); size_t size = 0; uint16_t count = healthMap.size(); - SerializeAdapter::serialize(&count, + ReturnValue_t result = SerializeAdapter::serialize(&count, &pointer, &size, maxSize, SerializeIF::Endianness::BIG); + if(result != HasReturnvaluesIF::RETURN_OK) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "HealthTable::printAll: Serialization of health table failed" << std::endl; +#else + sif::printWarning("HealthTable::printAll: Serialization of health table failed\n"); +#endif +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + return; + } for (const auto& health: healthMap) { SerializeAdapter::serialize(&health.first, &pointer, &size, maxSize, SerializeIF::Endianness::BIG); From 316310e99301790d9674d69e3c17e9ff782a34e9 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Fri, 9 Apr 2021 15:49:33 +0200 Subject: [PATCH 036/389] coverity --- devicehandlers/DeviceHandlerBase.cpp | 2 +- pus/CService200ModeCommanding.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/devicehandlers/DeviceHandlerBase.cpp b/devicehandlers/DeviceHandlerBase.cpp index 4a0b3582..8c8919ce 100644 --- a/devicehandlers/DeviceHandlerBase.cpp +++ b/devicehandlers/DeviceHandlerBase.cpp @@ -1515,7 +1515,7 @@ void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType, << std::setfill(' ') << std::endl; #else sif::printError("DeviceHandlerBase::%s: Object ID 0x%08x | %s\n", - this->getObjectId(), errorPrint); + functionName, this->getObjectId(), errorPrint); #endif } diff --git a/pus/CService200ModeCommanding.cpp b/pus/CService200ModeCommanding.cpp index c4e99359..70caadd1 100644 --- a/pus/CService200ModeCommanding.cpp +++ b/pus/CService200ModeCommanding.cpp @@ -61,8 +61,7 @@ ReturnValue_t CService200ModeCommanding::prepareCommand( return result; } - ModeMessage::setModeMessage(dynamic_cast(message), - ModeMessage::CMD_MODE_COMMAND, modeCommandPacket.getMode(), + ModeMessage::setModeMessage(message, ModeMessage::CMD_MODE_COMMAND, modeCommandPacket.getMode(), modeCommandPacket.getSubmode()); return result; } From 2e417c787d8fa38f9ff0bc9a73b44f900f796c75 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Fri, 9 Apr 2021 16:14:14 +0200 Subject: [PATCH 037/389] coverity --- devicehandlers/DeviceHandlerBase.cpp | 5 ++++- pus/Service20ParameterManagement.cpp | 5 ++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/devicehandlers/DeviceHandlerBase.cpp b/devicehandlers/DeviceHandlerBase.cpp index 8c8919ce..531a0642 100644 --- a/devicehandlers/DeviceHandlerBase.cpp +++ b/devicehandlers/DeviceHandlerBase.cpp @@ -1495,6 +1495,9 @@ void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType, errorPrint = "Unknown error"; } } + if(functionName == nullptr) { + functionName = "unknown function"; + } if(errorType == sif::OutputTypes::OUT_WARNING) { #if FSFW_CPP_OSTREAM_ENABLED == 1 @@ -1504,7 +1507,7 @@ void DeviceHandlerBase::printWarningOrError(sif::OutputTypes errorType, << std::setfill(' ') << std::endl; #else sif::printWarning("DeviceHandlerBase::%s: Object ID 0x%08x | %s\n", - this->getObjectId(), errorPrint); + functionName, this->getObjectId(), errorPrint); #endif } else if(errorType == sif::OutputTypes::OUT_ERROR) { diff --git a/pus/Service20ParameterManagement.cpp b/pus/Service20ParameterManagement.cpp index bc3a9119..90e96650 100644 --- a/pus/Service20ParameterManagement.cpp +++ b/pus/Service20ParameterManagement.cpp @@ -75,9 +75,8 @@ ReturnValue_t Service20ParameterManagement::checkInterfaceAndAcquireMessageQueue #else sif::printError("Service20ParameterManagement::checkInterfaceAndAcquire" "MessageQueue: Can't access object\n"); - sif::printError("Object ID: 0x%08x\n", objectId); - sif::printError("Make sure it implements " - "ReceivesParameterMessagesIF!\n"); + sif::printError("Object ID: 0x%08x\n", *objectId); + sif::printError("Make sure it implements ReceivesParameterMessagesIF!\n"); #endif return CommandingServiceBase::INVALID_OBJECT; From 83e7dbb1f0ab91fa7068e628d66d70633afd5238 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Fri, 9 Apr 2021 16:17:21 +0200 Subject: [PATCH 038/389] Coveritx fixes --- pus/servicepackets/Service8Packets.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pus/servicepackets/Service8Packets.h b/pus/servicepackets/Service8Packets.h index b026edf5..a27cf8bb 100644 --- a/pus/servicepackets/Service8Packets.h +++ b/pus/servicepackets/Service8Packets.h @@ -43,8 +43,8 @@ public: private: DirectCommand(const DirectCommand &command); - object_id_t objectId; - ActionId_t actionId; + object_id_t objectId = 0; + ActionId_t actionId = 0; uint32_t parametersSize; //!< [EXPORT] : [IGNORE] const uint8_t * parameterBuffer; //!< [EXPORT] : [MAXSIZE] 65535 Bytes From f1ffa88e07718e14581e71e9e53f74f471a54946 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 10 Apr 2021 14:29:00 +0200 Subject: [PATCH 039/389] small bugfix --- osal/host/FixedTimeslotTask.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osal/host/FixedTimeslotTask.cpp b/osal/host/FixedTimeslotTask.cpp index 016b1404..89daa278 100644 --- a/osal/host/FixedTimeslotTask.cpp +++ b/osal/host/FixedTimeslotTask.cpp @@ -3,7 +3,7 @@ #include "../../ipc/MutexFactory.h" #include "../../osal/host/Mutex.h" #include "../../osal/host/FixedTimeslotTask.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "../../serviceinterface/ServiceInterface.h" #include "../../tasks/ExecutableObjectIF.h" #include From 5144cbd789f2fe30cf02891d29301204dcdf7818 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 11 Apr 2021 02:26:11 +0200 Subject: [PATCH 040/389] additional inc path now in IF --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ff060d7b..8ba6a187 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -184,6 +184,7 @@ endif() target_include_directories(${LIB_FSFW_NAME} INTERFACE ${CMAKE_SOURCE_DIR} ${FSFW_CONFIG_PATH_ABSOLUTE} + ${FSFW_ADD_INC_PATHS_ABS} ) # Includes path required to compile FSFW itself as well From fbe860c6a51247104a84fdc9f94064810ca2e2f8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 11 Apr 2021 14:54:02 +0200 Subject: [PATCH 041/389] refactored addr print, using AI_PASSIVE now --- osal/common/UdpTcPollingTask.cpp | 9 +++++--- osal/common/UdpTmTcBridge.cpp | 21 ++++++++++--------- osal/common/tcpipCommon.cpp | 35 ++++++++++++++++++++++++++++++++ osal/common/tcpipCommon.h | 11 ++++++++-- 4 files changed, 61 insertions(+), 15 deletions(-) diff --git a/osal/common/UdpTcPollingTask.cpp b/osal/common/UdpTcPollingTask.cpp index 759cee05..47f67b29 100644 --- a/osal/common/UdpTcPollingTask.cpp +++ b/osal/common/UdpTcPollingTask.cpp @@ -15,7 +15,7 @@ #endif //! Debugging preprocessor define. -#define FSFW_UDP_RCV_WIRETAPPING_ENABLED 0 +#define FSFW_UDP_RECV_WIRETAPPING_ENABLED 0 UdpTcPollingTask::UdpTcPollingTask(object_id_t objectId, object_id_t tmtcUnixUdpBridge, size_t maxRecvSize, @@ -66,10 +66,13 @@ ReturnValue_t UdpTcPollingTask::performOperation(uint8_t opCode) { tcpip::handleError(tcpip::Protocol::UDP, tcpip::ErrorSources::RECVFROM_CALL, 1000); continue; } -#if FSFW_CPP_OSTREAM_ENABLED == 1 && FSFW_UDP_RCV_WIRETAPPING_ENABLED == 1 +#if FSFW_UDP_RECV_WIRETAPPING_ENABLED == 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 sif::debug << "UdpTcPollingTask::performOperation: " << bytesReceived << " bytes received" << std::endl; +#else #endif +#endif /* FSFW_UDP_RCV_WIRETAPPING_ENABLED == 1 */ ReturnValue_t result = handleSuccessfullTcRead(bytesReceived); if(result != HasReturnvaluesIF::RETURN_FAILED) { @@ -84,7 +87,7 @@ ReturnValue_t UdpTcPollingTask::performOperation(uint8_t opCode) { ReturnValue_t UdpTcPollingTask::handleSuccessfullTcRead(size_t bytesRead) { store_address_t storeId; -#if FSFW_UDP_RCV_WIRETAPPING_ENABLED == 1 +#if FSFW_UDP_RECV_WIRETAPPING_ENABLED == 1 arrayprinter::print(receptionBuffer.data(), bytesRead); #endif diff --git a/osal/common/UdpTmTcBridge.cpp b/osal/common/UdpTmTcBridge.cpp index 798be6f5..ba23f521 100644 --- a/osal/common/UdpTmTcBridge.cpp +++ b/osal/common/UdpTmTcBridge.cpp @@ -70,6 +70,7 @@ ReturnValue_t UdpTmTcBridge::initialize() { hints.ai_family = AF_INET; hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = IPPROTO_UDP; + hints.ai_flags = AI_PASSIVE; /* Set up UDP socket: https://en.wikipedia.org/wiki/Getaddrinfo @@ -95,6 +96,10 @@ ReturnValue_t UdpTmTcBridge::initialize() { return HasReturnvaluesIF::RETURN_FAILED; } +#if FSFW_UDP_SEND_WIRETAPPING_ENABLED == 1 + tcpip::printAddress(addrResult->ai_addr); +#endif + retval = bind(serverSocket, addrResult->ai_addr, static_cast(addrResult->ai_addrlen)); if(retval != 0) { #if FSFW_CPP_OSTREAM_ENABLED == 1 @@ -121,10 +126,8 @@ ReturnValue_t UdpTmTcBridge::sendTm(const uint8_t *data, size_t dataLen) { /* The target address can be set by different threads so this lock ensures thread-safety */ MutexGuard lock(mutex, timeoutType, mutexTimeoutMs); -#if FSFW_CPP_OSTREAM_ENABLED == 1 && FSFW_UDP_SEND_WIRETAPPING_ENABLED == 1 - char ipAddress [15]; - sif::debug << "IP Address Sender: "<< inet_ntop(AF_INET, - &clientAddress.sin_addr.s_addr, ipAddress, 15) << std::endl; +#if FSFW_UDP_SEND_WIRETAPPING_ENABLED == 1 + tcpip::printAddress(&clientAddress); #endif int bytesSent = sendto( @@ -152,13 +155,11 @@ void UdpTmTcBridge::checkAndSetClientAddress(sockaddr& newAddress) { /* The target address can be set by different threads so this lock ensures thread-safety */ MutexGuard lock(mutex, timeoutType, mutexTimeoutMs); -#if FSFW_CPP_OSTREAM_ENABLED == 1 && FSFW_UDP_SEND_WIRETAPPING_ENABLED == 1 - char ipAddress [15]; - sif::debug << "IP Address Sender: "<< inet_ntop(AF_INET, - &newAddress.sin_addr.s_addr, ipAddress, 15) << std::endl; - sif::debug << "IP Address Old: " << inet_ntop(AF_INET, - &clientAddress.sin_addr.s_addr, ipAddress, 15) << std::endl; +#if FSFW_UDP_SEND_WIRETAPPING_ENABLED == 1 + tcpip::printAddress(&newAddress); + tcpip::printAddress(&clientAddress); #endif + registerCommConnect(); /* Set new IP address to reply to */ diff --git a/osal/common/tcpipCommon.cpp b/osal/common/tcpipCommon.cpp index 9a5e4647..ab4eda29 100644 --- a/osal/common/tcpipCommon.cpp +++ b/osal/common/tcpipCommon.cpp @@ -1,4 +1,5 @@ #include "tcpipCommon.h" +#include void tcpip::determineErrorStrings(Protocol protocol, ErrorSources errorSrc, std::string &protStr, std::string &srcString) { @@ -34,3 +35,37 @@ void tcpip::determineErrorStrings(Protocol protocol, ErrorSources errorSrc, std: srcString = "unknown call"; } } + +void tcpip::printAddress(struct sockaddr* addr) { + char ipAddress[INET6_ADDRSTRLEN] = {}; + const char* stringPtr = NULL; + switch(addr->sa_family) { + case AF_INET: { + struct sockaddr_in *addrIn = reinterpret_cast(addr); + stringPtr = inet_ntop(AF_INET, &(addrIn->sin_addr), ipAddress, INET_ADDRSTRLEN); + break; + } + case AF_INET6: { + struct sockaddr_in6 *addrIn = reinterpret_cast(addr); + stringPtr = inet_ntop(AF_INET6, &(addrIn->sin6_addr), ipAddress, INET6_ADDRSTRLEN); + break; + } + } +#if FSFW_CPP_OSTREAM_ENABLED == 1 + if(stringPtr == NULL) { + sif::debug << "Could not convert IP address to text representation, error code " + << errno << std::endl; + } + else { + sif::debug << "IP Address Sender: " << ipAddress << std::endl; + } +#else + if(stringPtr == NULL) { + sif::printDebug("Could not convert IP address to text representation, error code %d\n", + errno); + } + else { + sif::printDebug("IP Address Sender: %s\n", ipAddress); + } +#endif +} diff --git a/osal/common/tcpipCommon.h b/osal/common/tcpipCommon.h index dc5ada52..22b914dc 100644 --- a/osal/common/tcpipCommon.h +++ b/osal/common/tcpipCommon.h @@ -4,6 +4,13 @@ #include "../../timemanager/clockDefinitions.h" #include +#ifdef _WIN32 +#include +#else +#include +#include +#endif + namespace tcpip { const char* const DEFAULT_SERVER_PORT = "7301"; @@ -28,8 +35,8 @@ enum class ErrorSources { void determineErrorStrings(Protocol protocol, ErrorSources errorSrc, std::string& protStr, std::string& srcString); +void printAddress(struct sockaddr* addr); + } - - #endif /* FSFW_OSAL_COMMON_TCPIPCOMMON_H_ */ From 924ea420a9f72d188000dc73bfe2500635e2ddad Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 11 Apr 2021 14:58:53 +0200 Subject: [PATCH 042/389] missing include for windows --- osal/common/tcpipCommon.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osal/common/tcpipCommon.cpp b/osal/common/tcpipCommon.cpp index ab4eda29..551e2a42 100644 --- a/osal/common/tcpipCommon.cpp +++ b/osal/common/tcpipCommon.cpp @@ -1,6 +1,10 @@ #include "tcpipCommon.h" #include +#ifdef _WIN32 +#include +#endif + void tcpip::determineErrorStrings(Protocol protocol, ErrorSources errorSrc, std::string &protStr, std::string &srcString) { if(protocol == Protocol::TCP) { From 6e6fb62b3cb66561b76fc86b320e05d5559c2be9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 11 Apr 2021 18:36:24 +0200 Subject: [PATCH 043/389] last coverity fixes --- devicehandlers/HealthDevice.cpp | 4 ++-- health/HealthTable.cpp | 2 +- timemanager/TimeMessage.cpp | 2 +- timemanager/TimeMessage.h | 2 +- tmtcservices/TmTcMessage.cpp | 2 +- tmtcservices/TmTcMessage.h | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/devicehandlers/HealthDevice.cpp b/devicehandlers/HealthDevice.cpp index 418ed257..e23dd5b6 100644 --- a/devicehandlers/HealthDevice.cpp +++ b/devicehandlers/HealthDevice.cpp @@ -16,9 +16,9 @@ ReturnValue_t HealthDevice::performOperation(uint8_t opCode) { CommandMessage command; ReturnValue_t result = commandQueue->receiveMessage(&command); if (result == HasReturnvaluesIF::RETURN_OK) { - healthHelper.handleHealthCommand(&command); + result = healthHelper.handleHealthCommand(&command); } - return HasReturnvaluesIF::RETURN_OK; + return result; } ReturnValue_t HealthDevice::initialize() { diff --git a/health/HealthTable.cpp b/health/HealthTable.cpp index 8b19d8e3..5717fe9f 100644 --- a/health/HealthTable.cpp +++ b/health/HealthTable.cpp @@ -96,7 +96,7 @@ ReturnValue_t HealthTable::iterate(HealthEntry *value, bool reset) { mapIterator = healthMap.begin(); } if (mapIterator == healthMap.end()) { - result = HasReturnvaluesIF::RETURN_FAILED; + return HasReturnvaluesIF::RETURN_FAILED; } *value = *mapIterator; mapIterator++; diff --git a/timemanager/TimeMessage.cpp b/timemanager/TimeMessage.cpp index a1042efe..66aea0f4 100644 --- a/timemanager/TimeMessage.cpp +++ b/timemanager/TimeMessage.cpp @@ -25,6 +25,6 @@ uint32_t TimeMessage::getCounterValue() { return temp; } -size_t TimeMessage::getMinimumMessageSize() { +size_t TimeMessage::getMinimumMessageSize() const { return this->MAX_SIZE; } diff --git a/timemanager/TimeMessage.h b/timemanager/TimeMessage.h index f5ac3e14..00778fb7 100644 --- a/timemanager/TimeMessage.h +++ b/timemanager/TimeMessage.h @@ -11,7 +11,7 @@ protected: * @brief This call always returns the same fixed size of the message. * @return Returns HEADER_SIZE + \c sizeof(timeval) + sizeof(uint32_t). */ - size_t getMinimumMessageSize(); + size_t getMinimumMessageSize() const override; public: /** diff --git a/tmtcservices/TmTcMessage.cpp b/tmtcservices/TmTcMessage.cpp index ae028315..c0f32aaa 100644 --- a/tmtcservices/TmTcMessage.cpp +++ b/tmtcservices/TmTcMessage.cpp @@ -21,7 +21,7 @@ TmTcMessage::TmTcMessage(store_address_t storeId) { this->setStorageId(storeId); } -size_t TmTcMessage::getMinimumMessageSize() { +size_t TmTcMessage::getMinimumMessageSize() const { return this->HEADER_SIZE + sizeof(store_address_t); } diff --git a/tmtcservices/TmTcMessage.h b/tmtcservices/TmTcMessage.h index 41fe198a..7d2a7bdb 100644 --- a/tmtcservices/TmTcMessage.h +++ b/tmtcservices/TmTcMessage.h @@ -18,7 +18,7 @@ protected: * @brief This call always returns the same fixed size of the message. * @return Returns HEADER_SIZE + @c sizeof(store_address_t). */ - size_t getMinimumMessageSize(); + size_t getMinimumMessageSize() const override; public: /** * @brief In the default constructor, only the message_size is set. From 438049bb803eb1ecb770bdd8ad941538ec7f179a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 11 Apr 2021 18:50:48 +0200 Subject: [PATCH 044/389] another coverity fix --- thermal/Heater.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/thermal/Heater.cpp b/thermal/Heater.cpp index 782ce296..d148c871 100644 --- a/thermal/Heater.cpp +++ b/thermal/Heater.cpp @@ -286,7 +286,10 @@ void Heater::handleQueue() { if (result == HasReturnvaluesIF::RETURN_OK) { return; } - parameterHelper.handleParameterMessage(&command); + result = parameterHelper.handleParameterMessage(&command); + if (result == HasReturnvaluesIF::RETURN_OK) { + return; + } } } From 5d93cf12f771506d75a99df015f4d892d84765c5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 11 Apr 2021 18:55:10 +0200 Subject: [PATCH 045/389] another coverity fix --- health/HealthTable.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/health/HealthTable.cpp b/health/HealthTable.cpp index 5717fe9f..3fed1deb 100644 --- a/health/HealthTable.cpp +++ b/health/HealthTable.cpp @@ -81,11 +81,17 @@ void HealthTable::printAll(uint8_t* pointer, size_t maxSize) { return; } for (const auto& health: healthMap) { - SerializeAdapter::serialize(&health.first, + result = SerializeAdapter::serialize(&health.first, &pointer, &size, maxSize, SerializeIF::Endianness::BIG); + if(result != HasReturnvaluesIF::RETURN_OK) { + return; + } uint8_t healthValue = health.second; - SerializeAdapter::serialize(&healthValue, &pointer, &size, + result = SerializeAdapter::serialize(&healthValue, &pointer, &size, maxSize, SerializeIF::Endianness::BIG); + if(result != HasReturnvaluesIF::RETURN_OK) { + return; + } } } From d7d52439d76a114bebaa3a67e4a59385eac91540 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 12 Apr 2021 20:40:41 +0200 Subject: [PATCH 046/389] added new option --- defaultcfg/fsfwconfig/FSFWConfig.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/defaultcfg/fsfwconfig/FSFWConfig.h b/defaultcfg/fsfwconfig/FSFWConfig.h index ed86e6e1..9a07b4ea 100644 --- a/defaultcfg/fsfwconfig/FSFWConfig.h +++ b/defaultcfg/fsfwconfig/FSFWConfig.h @@ -17,6 +17,8 @@ #define FSFW_DISABLE_PRINTOUT 0 #endif +#define FSFW_USE_PUS_C_TELEMETRY 1 + //! Can be used to disable the ANSI color sequences for C stdio. #define FSFW_COLORED_OUTPUT 1 From 9a5f717169069f23330b47ed73c62cfd8139e96e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 12 Apr 2021 21:17:53 +0200 Subject: [PATCH 047/389] refactoring to allow PUS c implementation --- tmtcpacket/pus/CMakeLists.txt | 2 + tmtcpacket/pus/TmPacketBase.cpp | 106 +++----------- tmtcpacket/pus/TmPacketBase.h | 234 +++++++++++------------------- tmtcpacket/pus/TmPacketIF.h | 8 + tmtcpacket/pus/TmPacketPusA.cpp | 121 +++++++++++++++ tmtcpacket/pus/TmPacketPusA.h | 137 +++++++++++++++++ tmtcpacket/pus/TmPacketPusC.cpp | 2 + tmtcpacket/pus/TmPacketPusC.h | 8 + tmtcpacket/pus/TmPacketStored.cpp | 10 +- tmtcpacket/pus/TmPacketStored.h | 4 +- 10 files changed, 398 insertions(+), 234 deletions(-) create mode 100644 tmtcpacket/pus/TmPacketIF.h create mode 100644 tmtcpacket/pus/TmPacketPusA.cpp create mode 100644 tmtcpacket/pus/TmPacketPusA.h create mode 100644 tmtcpacket/pus/TmPacketPusC.cpp create mode 100644 tmtcpacket/pus/TmPacketPusC.h diff --git a/tmtcpacket/pus/CMakeLists.txt b/tmtcpacket/pus/CMakeLists.txt index fcfc82d2..1fdd9dd8 100644 --- a/tmtcpacket/pus/CMakeLists.txt +++ b/tmtcpacket/pus/CMakeLists.txt @@ -5,4 +5,6 @@ target_sources(${LIB_FSFW_NAME} TmPacketBase.cpp TmPacketMinimal.cpp TmPacketStored.cpp + TmPacketPusA.cpp + TmPacketPusC.cpp ) diff --git a/tmtcpacket/pus/TmPacketBase.cpp b/tmtcpacket/pus/TmPacketBase.cpp index c8e4b430..10f37b00 100644 --- a/tmtcpacket/pus/TmPacketBase.cpp +++ b/tmtcpacket/pus/TmPacketBase.cpp @@ -11,111 +11,53 @@ TimeStamperIF* TmPacketBase::timeStamper = nullptr; object_id_t TmPacketBase::timeStamperId = 0; -TmPacketBase::TmPacketBase(uint8_t* setData) : - SpacePacketBase(setData) { - tmData = reinterpret_cast(setData); +TmPacketBase::TmPacketBase(uint8_t* setData): + SpacePacketBase(setData) { } TmPacketBase::~TmPacketBase() { - //Nothing to do. + //Nothing to do. } -uint8_t TmPacketBase::getService() { - return tmData->data_field.service_type; -} - -uint8_t TmPacketBase::getSubService() { - return tmData->data_field.service_subtype; -} - -uint8_t* TmPacketBase::getSourceData() { - return &tmData->data; -} uint16_t TmPacketBase::getSourceDataSize() { - return getPacketDataLength() - sizeof(tmData->data_field) - - CRC_SIZE + 1; + return getPacketDataLength() - getDataFieldSize() - CRC_SIZE + 1; } uint16_t TmPacketBase::getErrorControl() { - uint32_t size = getSourceDataSize() + CRC_SIZE; - uint8_t* p_to_buffer = &tmData->data; - return (p_to_buffer[size - 2] << 8) + p_to_buffer[size - 1]; + uint32_t size = getSourceDataSize() + CRC_SIZE; + uint8_t* p_to_buffer = getSourceData(); + return (p_to_buffer[size - 2] << 8) + p_to_buffer[size - 1]; } void TmPacketBase::setErrorControl() { - uint32_t full_size = getFullSize(); - uint16_t crc = CRC::crc16ccitt(getWholeData(), full_size - CRC_SIZE); - uint32_t size = getSourceDataSize(); - getSourceData()[size] = (crc & 0XFF00) >> 8; // CRCH - getSourceData()[size + 1] = (crc) & 0X00FF; // CRCL + uint32_t full_size = getFullSize(); + uint16_t crc = CRC::crc16ccitt(getWholeData(), full_size - CRC_SIZE); + uint32_t size = getSourceDataSize(); + getSourceData()[size] = (crc & 0XFF00) >> 8; // CRCH + getSourceData()[size + 1] = (crc) & 0X00FF; // CRCL } -void TmPacketBase::setData(const uint8_t* p_Data) { - SpacePacketBase::setData(p_Data); - tmData = (TmPacketPointer*) p_Data; -} + void TmPacketBase::print() { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << "TmPacketBase::print: " << std::endl; + sif::debug << "TmPacketBase::print: " << std::endl; #endif - arrayprinter::print(getWholeData(), getFullSize()); + arrayprinter::print(getWholeData(), getFullSize()); } bool TmPacketBase::checkAndSetStamper() { - if (timeStamper == NULL) { - timeStamper = objectManager->get(timeStamperId); - if (timeStamper == NULL) { + if (timeStamper == NULL) { + timeStamper = objectManager->get(timeStamperId); + if (timeStamper == NULL) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "TmPacketBase::checkAndSetStamper: Stamper not found!" - << std::endl; + sif::error << "TmPacketBase::checkAndSetStamper: Stamper not found!" + << std::endl; #endif - return false; - } - } - return true; + return false; + } + } + return true; } -ReturnValue_t TmPacketBase::getPacketTime(timeval* timestamp) const { - size_t tempSize = 0; - return CCSDSTime::convertFromCcsds(timestamp, tmData->data_field.time, - &tempSize, sizeof(tmData->data_field.time)); -} - -uint8_t* TmPacketBase::getPacketTimeRaw() const{ - return tmData->data_field.time; - -} - -void TmPacketBase::initializeTmPacket(uint16_t apid, uint8_t service, - uint8_t subservice, uint8_t packetSubcounter) { - //Set primary header: - initSpacePacketHeader(false, true, apid); - //Set data Field Header: - //First, set to zero. - memset(&tmData->data_field, 0, sizeof(tmData->data_field)); - - // NOTE: In PUS-C, the PUS Version is 2 and specified for the first 4 bits. - // The other 4 bits of the first byte are the spacecraft time reference - // status. To change to PUS-C, set 0b00100000. - // Set CCSDS_secondary header flag to 0, version number to 001 and ack - // to 0000 - tmData->data_field.version_type_ack = 0b00010000; - tmData->data_field.service_type = service; - tmData->data_field.service_subtype = subservice; - tmData->data_field.subcounter = packetSubcounter; - //Timestamp packet - if (checkAndSetStamper()) { - timeStamper->addTimeStamp(tmData->data_field.time, - sizeof(tmData->data_field.time)); - } -} - -void TmPacketBase::setSourceDataSize(uint16_t size) { - setPacketDataLength(size + sizeof(PUSTmDataFieldHeader) + CRC_SIZE - 1); -} - -size_t TmPacketBase::getTimestampSize() const { - return sizeof(tmData->data_field.time); -} diff --git a/tmtcpacket/pus/TmPacketBase.h b/tmtcpacket/pus/TmPacketBase.h index 6efc0165..72cdbb69 100644 --- a/tmtcpacket/pus/TmPacketBase.h +++ b/tmtcpacket/pus/TmPacketBase.h @@ -10,32 +10,6 @@ namespace Factory{ void setStaticFrameworkObjectIds(); } -/** - * This struct defines a byte-wise structured PUS TM Data Field Header. - * Any optional fields in the header must be added or removed here. - * Currently, no Destination field is present, but an eigth-byte representation - * for a time tag. - * @ingroup tmtcpackets - */ -struct PUSTmDataFieldHeader { - uint8_t version_type_ack; - uint8_t service_type; - uint8_t service_subtype; - uint8_t subcounter; -// uint8_t destination; - uint8_t time[TimeStamperIF::MISSION_TIMESTAMP_SIZE]; -}; - -/** - * This struct defines the data structure of a PUS Telecommand Packet when - * accessed via a pointer. - * @ingroup tmtcpackets - */ -struct TmPacketPointer { - CCSDSPrimaryHeader primary; - PUSTmDataFieldHeader data_field; - uint8_t data; -}; /** * This class is the basic data handler for any ECSS PUS Telemetry packet. @@ -49,61 +23,84 @@ struct TmPacketPointer { * @ingroup tmtcpackets */ class TmPacketBase : public SpacePacketBase { - friend void (Factory::setStaticFrameworkObjectIds)(); + friend void (Factory::setStaticFrameworkObjectIds)(); public: - /** - * This constant defines the minimum size of a valid PUS Telemetry Packet. - */ - static const uint32_t TM_PACKET_MIN_SIZE = (sizeof(CCSDSPrimaryHeader) + - sizeof(PUSTmDataFieldHeader) + 2); - //! Maximum size of a TM Packet in this mission. - //! TODO: Make this dependant on a config variable. - static const uint32_t MISSION_TM_PACKET_MAX_SIZE = 2048; - //! First byte of secondary header for PUS-A packets. - //! TODO: Maybe also support PUS-C via config? - static const uint8_t VERSION_NUMBER_BYTE_PUS_A = 0b00010000; - /** - * This is the default constructor. - * It sets its internal data pointer to the address passed and also - * forwards the data pointer to the parent SpacePacketBase class. - * @param set_address The position where the packet data lies. - */ - TmPacketBase( uint8_t* setData ); - /** - * This is the empty default destructor. - */ - virtual ~TmPacketBase(); + //! Maximum size of a TM Packet in this mission. + //! TODO: Make this dependant on a config variable. + static const uint32_t MISSION_TM_PACKET_MAX_SIZE = 2048; + //! First byte of secondary header for PUS-A packets. + //! TODO: Maybe also support PUS-C via config? + static const uint8_t VERSION_NUMBER_BYTE_PUS_A = 0b00010000; - /** - * This is a getter for the packet's PUS Service ID, which is the second - * byte of the Data Field Header. - * @return The packet's PUS Service ID. - */ - uint8_t getService(); - /** - * This is a getter for the packet's PUS Service Subtype, which is the - * third byte of the Data Field Header. - * @return The packet's PUS Service Subtype. - */ - uint8_t getSubService(); - /** - * This is a getter for a pointer to the packet's Source data. - * - * These are the bytes that follow after the Data Field Header. They form - * the packet's source data. - * @return A pointer to the PUS Source Data. - */ - uint8_t* getSourceData(); - /** - * This method calculates the size of the PUS Source data field. - * - * It takes the information stored in the CCSDS Packet Data Length field - * and subtracts the Data Field Header size and the CRC size. - * @return The size of the PUS Source Data (without Error Control field) - */ - uint16_t getSourceDataSize(); + /** + * This is the default constructor. + * It sets its internal data pointer to the address passed and also + * forwards the data pointer to the parent SpacePacketBase class. + * @param set_address The position where the packet data lies. + */ + TmPacketBase( uint8_t* setData ); + /** + * This is the empty default destructor. + */ + virtual ~TmPacketBase(); + /** + * This is a getter for the packet's PUS Service ID, which is the second + * byte of the Data Field Header. + * @return The packet's PUS Service ID. + */ + virtual uint8_t getService() = 0; + /** + * This is a getter for the packet's PUS Service Subtype, which is the + * third byte of the Data Field Header. + * @return The packet's PUS Service Subtype. + */ + virtual uint8_t getSubService() = 0; + /** + * This is a getter for a pointer to the packet's Source data. + * + * These are the bytes that follow after the Data Field Header. They form + * the packet's source data. + * @return A pointer to the PUS Source Data. + */ + virtual uint8_t* getSourceData() = 0; + /** + * This method calculates the size of the PUS Source data field. + * + * It takes the information stored in the CCSDS Packet Data Length field + * and subtracts the Data Field Header size and the CRC size. + * @return The size of the PUS Source Data (without Error Control field) + */ + virtual uint16_t getSourceDataSize() = 0; + + /** + * Get size of data field which can differ based on implementation + * @return + */ + virtual uint16_t getDataFieldSize() = 0; + + virtual size_t getPacketMinimumSize() const = 0; + + /** + * Interprets the "time"-field in the secondary header and returns it in + * timeval format. + * @return Converted timestamp of packet. + */ + virtual ReturnValue_t getPacketTime(timeval* timestamp) const = 0; + /** + * Returns a raw pointer to the beginning of the time field. + * @return Raw pointer to time field. + */ + virtual uint8_t* getPacketTimeRaw() const = 0; + + virtual size_t getTimestampSize() const = 0; + + /** + * This is a debugging helper method that prints the whole packet content + * to the screen. + */ + void print(); /** * With this method, the Error Control Field is updated to match the * current content of the packet. This method is not protected because @@ -111,79 +108,24 @@ public: * like the sequence count. */ void setErrorControl(); - - /** - * This getter returns the Error Control Field of the packet. - * - * The field is placed after any possible Source Data. If no - * Source Data is present there's still an Error Control field. It is - * supposed to be a 16bit-CRC. - * @return The PUS Error Control - */ - uint16_t getErrorControl(); - - /** - * This is a debugging helper method that prints the whole packet content - * to the screen. - */ - void print(); - /** - * Interprets the "time"-field in the secondary header and returns it in - * timeval format. - * @return Converted timestamp of packet. - */ - ReturnValue_t getPacketTime(timeval* timestamp) const; - /** - * Returns a raw pointer to the beginning of the time field. - * @return Raw pointer to time field. - */ - uint8_t* getPacketTimeRaw() const; - - size_t getTimestampSize() const; + /** + * This getter returns the Error Control Field of the packet. + * + * The field is placed after any possible Source Data. If no + * Source Data is present there's still an Error Control field. It is + * supposed to be a 16bit-CRC. + * @return The PUS Error Control + */ + uint16_t getErrorControl(); protected: - /** - * A pointer to a structure which defines the data structure of - * the packet's data. - * - * To be hardware-safe, all elements are of byte size. - */ - TmPacketPointer* tmData; - /** - * The timeStamper is responsible for adding a timestamp to the packet. - * It is initialized lazy. - */ - static TimeStamperIF* timeStamper; - //! The ID to use when looking for a time stamper. - static object_id_t timeStamperId; - /** - * Initializes the Tm Packet header. - * Does set the timestamp (to now), but not the error control field. - * @param apid APID used. - * @param service PUS Service - * @param subservice PUS Subservice - * @param packetSubcounter Additional subcounter used. + * The timeStamper is responsible for adding a timestamp to the packet. + * It is initialized lazy. */ - void initializeTmPacket(uint16_t apid, uint8_t service, uint8_t subservice, - uint8_t packetSubcounter); - - /** - * With this method, the packet data pointer can be redirected to another - * location. - * - * This call overwrites the parent's setData method to set both its - * @c tc_data pointer and the parent's @c data pointer. - * - * @param p_data A pointer to another PUS Telemetry Packet. - */ - void setData( const uint8_t* pData ); - - /** - * In case data was filled manually (almost never the case). - * @param size Size of source data (without CRC and data filed header!). - */ - void setSourceDataSize(uint16_t size); + static TimeStamperIF* timeStamper; + //! The ID to use when looking for a time stamper. + static object_id_t timeStamperId; /** * Checks if a time stamper is available and tries to set it if not. diff --git a/tmtcpacket/pus/TmPacketIF.h b/tmtcpacket/pus/TmPacketIF.h new file mode 100644 index 00000000..bd66523b --- /dev/null +++ b/tmtcpacket/pus/TmPacketIF.h @@ -0,0 +1,8 @@ +#ifndef FSFW_TMTCPACKET_PUS_TMPACKETIF_H_ +#define FSFW_TMTCPACKET_PUS_TMPACKETIF_H_ + + + + + +#endif /* FSFW_TMTCPACKET_PUS_TMPACKETIF_H_ */ diff --git a/tmtcpacket/pus/TmPacketPusA.cpp b/tmtcpacket/pus/TmPacketPusA.cpp new file mode 100644 index 00000000..630aac0f --- /dev/null +++ b/tmtcpacket/pus/TmPacketPusA.cpp @@ -0,0 +1,121 @@ +#include "TmPacketPusA.h" +#include "TmPacketBase.h" + +#include "../../globalfunctions/CRC.h" +#include "../../globalfunctions/arrayprinter.h" +#include "../../objectmanager/ObjectManagerIF.h" +#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "../../timemanager/CCSDSTime.h" + +#include + + +TmPacketPusA::TmPacketPusA(uint8_t* setData) : TmPacketBase(setData) { + tmData = reinterpret_cast(setData); +} + +TmPacketPusA::~TmPacketPusA() { + //Nothing to do. +} + +uint8_t TmPacketPusA::getService() { + return tmData->data_field.service_type; +} + +uint8_t TmPacketPusA::getSubService() { + return tmData->data_field.service_subtype; +} + +uint8_t* TmPacketPusA::getSourceData() { + return &tmData->data; +} + +uint16_t TmPacketPusA::getSourceDataSize() { + return getPacketDataLength() - sizeof(tmData->data_field) + - CRC_SIZE + 1; +} + +//uint16_t TmPacketPusA::getErrorControl() { +// uint32_t size = getSourceDataSize() + CRC_SIZE; +// uint8_t* p_to_buffer = &tmData->data; +// return (p_to_buffer[size - 2] << 8) + p_to_buffer[size - 1]; +//} +// +//void TmPacketPusA::setErrorControl() { +// uint32_t full_size = getFullSize(); +// uint16_t crc = CRC::crc16ccitt(getWholeData(), full_size - CRC_SIZE); +// uint32_t size = getSourceDataSize(); +// getSourceData()[size] = (crc & 0XFF00) >> 8; // CRCH +// getSourceData()[size + 1] = (crc) & 0X00FF; // CRCL +//} + +void TmPacketPusA::setData(const uint8_t* p_Data) { + SpacePacketBase::setData(p_Data); + tmData = (TmPacketPointer*) p_Data; +} + + +size_t TmPacketPusA::getPacketMinimumSize() const { + return TM_PACKET_MIN_SIZE; +} + +uint16_t TmPacketPusA::getDataFieldSize() { + return sizeof(PUSTmDataFieldHeader); +} + +bool TmPacketPusA::checkAndSetStamper() { + if (timeStamper == NULL) { + timeStamper = objectManager->get(timeStamperId); + if (timeStamper == NULL) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "TmPacketPusA::checkAndSetStamper: Stamper not found!" + << std::endl; +#endif + return false; + } + } + return true; +} + +ReturnValue_t TmPacketPusA::getPacketTime(timeval* timestamp) const { + size_t tempSize = 0; + return CCSDSTime::convertFromCcsds(timestamp, tmData->data_field.time, + &tempSize, sizeof(tmData->data_field.time)); +} + +uint8_t* TmPacketPusA::getPacketTimeRaw() const{ + return tmData->data_field.time; + +} + +void TmPacketPusA::initializeTmPacket(uint16_t apid, uint8_t service, + uint8_t subservice, uint8_t packetSubcounter) { + //Set primary header: + initSpacePacketHeader(false, true, apid); + //Set data Field Header: + //First, set to zero. + memset(&tmData->data_field, 0, sizeof(tmData->data_field)); + + // NOTE: In PUS-C, the PUS Version is 2 and specified for the first 4 bits. + // The other 4 bits of the first byte are the spacecraft time reference + // status. To change to PUS-C, set 0b00100000. + // Set CCSDS_secondary header flag to 0, version number to 001 and ack + // to 0000 + tmData->data_field.version_type_ack = 0b00010000; + tmData->data_field.service_type = service; + tmData->data_field.service_subtype = subservice; + tmData->data_field.subcounter = packetSubcounter; + //Timestamp packet + if (checkAndSetStamper()) { + timeStamper->addTimeStamp(tmData->data_field.time, + sizeof(tmData->data_field.time)); + } +} + +void TmPacketPusA::setSourceDataSize(uint16_t size) { + setPacketDataLength(size + sizeof(PUSTmDataFieldHeader) + CRC_SIZE - 1); +} + +size_t TmPacketPusA::getTimestampSize() const { + return sizeof(tmData->data_field.time); +} diff --git a/tmtcpacket/pus/TmPacketPusA.h b/tmtcpacket/pus/TmPacketPusA.h new file mode 100644 index 00000000..4db634c2 --- /dev/null +++ b/tmtcpacket/pus/TmPacketPusA.h @@ -0,0 +1,137 @@ +#ifndef FSFW_TMTCPACKET_PUS_TMPACKETPUSA_H_ +#define FSFW_TMTCPACKET_PUS_TMPACKETPUSA_H_ + +#include "TmPacketBase.h" +#include "../SpacePacketBase.h" +#include "../../timemanager/TimeStamperIF.h" +#include "../../timemanager/Clock.h" +#include "../../objectmanager/SystemObjectIF.h" + +namespace Factory{ +void setStaticFrameworkObjectIds(); +} + +/** + * This struct defines a byte-wise structured PUS TM Data Field Header. + * Any optional fields in the header must be added or removed here. + * Currently, no Destination field is present, but an eigth-byte representation + * for a time tag. + * @ingroup tmtcpackets + */ +struct PUSTmDataFieldHeader { + uint8_t version_type_ack; + uint8_t service_type; + uint8_t service_subtype; + uint8_t subcounter; +// uint8_t destination; + uint8_t time[TimeStamperIF::MISSION_TIMESTAMP_SIZE]; +}; + +/** + * This struct defines the data structure of a PUS Telecommand Packet when + * accessed via a pointer. + * @ingroup tmtcpackets + */ +struct TmPacketPointer { + CCSDSPrimaryHeader primary; + PUSTmDataFieldHeader data_field; + uint8_t data; +}; + +/** + * PUS A packet implementation + * @ingroup tmtcpackets + */ +class TmPacketPusA: public TmPacketBase { + friend void (Factory::setStaticFrameworkObjectIds)(); +public: + /** + * This constant defines the minimum size of a valid PUS Telemetry Packet. + */ + static const uint32_t TM_PACKET_MIN_SIZE = (sizeof(CCSDSPrimaryHeader) + + sizeof(PUSTmDataFieldHeader) + 2); + //! Maximum size of a TM Packet in this mission. + //! TODO: Make this dependant on a config variable. + static const uint32_t MISSION_TM_PACKET_MAX_SIZE = 2048; + //! First byte of secondary header for PUS-A packets. + //! TODO: Maybe also support PUS-C via config? + static const uint8_t VERSION_NUMBER_BYTE_PUS_A = 0b00010000; + + /** + * This is the default constructor. + * It sets its internal data pointer to the address passed and also + * forwards the data pointer to the parent SpacePacketBase class. + * @param set_address The position where the packet data lies. + */ + TmPacketPusA( uint8_t* setData ); + /** + * This is the empty default destructor. + */ + virtual ~TmPacketPusA(); + + /* TmPacketBase implementations */ + uint8_t getService() override; + uint8_t getSubService() override; + uint8_t* getSourceData() override; + uint16_t getSourceDataSize() override; + uint16_t getDataFieldSize() override; + /** + * Interprets the "time"-field in the secondary header and returns it in + * timeval format. + * @return Converted timestamp of packet. + */ + ReturnValue_t getPacketTime(timeval* timestamp) const override; + /** + * Returns a raw pointer to the beginning of the time field. + * @return Raw pointer to time field. + */ + uint8_t* getPacketTimeRaw() const override; + + size_t getTimestampSize() const override; + size_t getPacketMinimumSize() const override; + +protected: + /** + * A pointer to a structure which defines the data structure of + * the packet's data. + * + * To be hardware-safe, all elements are of byte size. + */ + TmPacketPointer* tmData; + + /** + * Initializes the Tm Packet header. + * Does set the timestamp (to now), but not the error control field. + * @param apid APID used. + * @param service PUS Service + * @param subservice PUS Subservice + * @param packetSubcounter Additional subcounter used. + */ + void initializeTmPacket(uint16_t apid, uint8_t service, uint8_t subservice, + uint8_t packetSubcounter); + + /** + * With this method, the packet data pointer can be redirected to another + * location. + * + * This call overwrites the parent's setData method to set both its + * @c tc_data pointer and the parent's @c data pointer. + * + * @param p_data A pointer to another PUS Telemetry Packet. + */ + void setData( const uint8_t* pData ); + + /** + * In case data was filled manually (almost never the case). + * @param size Size of source data (without CRC and data filed header!). + */ + void setSourceDataSize(uint16_t size); + + /** + * Checks if a time stamper is available and tries to set it if not. + * @return Returns false if setting failed. + */ + bool checkAndSetStamper(); +}; + +#endif /* FSFW_TMTCPACKET_PUS_TMPACKETPUSA_H_ */ diff --git a/tmtcpacket/pus/TmPacketPusC.cpp b/tmtcpacket/pus/TmPacketPusC.cpp new file mode 100644 index 00000000..99f50825 --- /dev/null +++ b/tmtcpacket/pus/TmPacketPusC.cpp @@ -0,0 +1,2 @@ +#include "TmPacketPusC.h" + diff --git a/tmtcpacket/pus/TmPacketPusC.h b/tmtcpacket/pus/TmPacketPusC.h new file mode 100644 index 00000000..fec435c4 --- /dev/null +++ b/tmtcpacket/pus/TmPacketPusC.h @@ -0,0 +1,8 @@ +#ifndef FSFW_TMTCPACKET_PUS_TMPACKETPUSC_H_ +#define FSFW_TMTCPACKET_PUS_TMPACKETPUSC_H_ + + + + + +#endif /* FSFW_TMTCPACKET_PUS_TMPACKETPUSC_H_ */ diff --git a/tmtcpacket/pus/TmPacketStored.cpp b/tmtcpacket/pus/TmPacketStored.cpp index 0fd2a4a0..d69e2419 100644 --- a/tmtcpacket/pus/TmPacketStored.cpp +++ b/tmtcpacket/pus/TmPacketStored.cpp @@ -10,21 +10,21 @@ StorageManagerIF *TmPacketStored::store = nullptr; InternalErrorReporterIF *TmPacketStored::internalErrorReporter = nullptr; TmPacketStored::TmPacketStored(store_address_t setAddress) : - TmPacketBase(nullptr), storeAddress(setAddress) { + TmPacketPusA(nullptr), storeAddress(setAddress) { setStoreAddress(storeAddress); } TmPacketStored::TmPacketStored(uint16_t apid, uint8_t service, uint8_t subservice, uint8_t packetSubcounter, const uint8_t *data, uint32_t size, const uint8_t *headerData, uint32_t headerSize) : - TmPacketBase(NULL) { + TmPacketPusA(nullptr) { storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; if (not checkAndSetStore()) { return; } uint8_t *pData = nullptr; ReturnValue_t returnValue = store->getFreeElement(&storeAddress, - (TmPacketBase::TM_PACKET_MIN_SIZE + size + headerSize), &pData); + (getPacketMinimumSize() + size + headerSize), &pData); if (returnValue != store->RETURN_OK) { checkAndReportLostTm(); @@ -41,7 +41,7 @@ TmPacketStored::TmPacketStored(uint16_t apid, uint8_t service, TmPacketStored::TmPacketStored(uint16_t apid, uint8_t service, uint8_t subservice, uint8_t packetSubcounter, SerializeIF *content, SerializeIF *header) : - TmPacketBase(NULL) { + TmPacketPusA(nullptr) { storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; if (not checkAndSetStore()) { return; @@ -55,7 +55,7 @@ TmPacketStored::TmPacketStored(uint16_t apid, uint8_t service, } uint8_t *p_data = NULL; ReturnValue_t returnValue = store->getFreeElement(&storeAddress, - (TmPacketBase::TM_PACKET_MIN_SIZE + sourceDataSize), &p_data); + (getPacketMinimumSize() + sourceDataSize), &p_data); if (returnValue != store->RETURN_OK) { checkAndReportLostTm(); } diff --git a/tmtcpacket/pus/TmPacketStored.h b/tmtcpacket/pus/TmPacketStored.h index b231407d..1cc8e6ba 100644 --- a/tmtcpacket/pus/TmPacketStored.h +++ b/tmtcpacket/pus/TmPacketStored.h @@ -2,7 +2,9 @@ #define FSFW_TMTCPACKET_PUS_TMPACKETSTORED_H_ #include "TmPacketBase.h" +#include +#include "../../tmtcpacket/pus/TmPacketPusA.h" #include "../../serialize/SerializeIF.h" #include "../../storagemanager/StorageManagerIF.h" #include "../../internalError/InternalErrorReporterIF.h" @@ -18,7 +20,7 @@ * packets in a store with the help of a storeAddress. * @ingroup tmtcpackets */ -class TmPacketStored : public TmPacketBase { +class TmPacketStored : public TmPacketPusA { public: /** * This is a default constructor which does not set the data pointer. From ae1dab1fce187d18d4a37cf416dcbc0cbfcfb491 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 12 Apr 2021 21:53:08 +0200 Subject: [PATCH 048/389] sth broke --- pus/Service17Test.cpp | 4 +- pus/Service1TelecommandVerification.cpp | 4 +- pus/Service5EventReporting.cpp | 2 +- tmtcpacket/pus/CMakeLists.txt | 1 + tmtcpacket/pus/TmPacketBase.h | 2 +- tmtcpacket/pus/TmPacketPusA.cpp | 22 +---- tmtcpacket/pus/TmPacketPusA.h | 11 ++- tmtcpacket/pus/TmPacketStored.cpp | 96 ++++---------------- tmtcpacket/pus/TmPacketStored.h | 50 +++------- tmtcpacket/pus/TmPacketStoredBase.cpp | 94 +++++++++++++++++++ tmtcpacket/pus/TmPacketStoredBase.h | 89 ++++++++++++++++++ tmtcservices/CommandingServiceBase.cpp | 6 +- unittest/user/unittest/core/CatchFactory.cpp | 2 +- 13 files changed, 233 insertions(+), 150 deletions(-) create mode 100644 tmtcpacket/pus/TmPacketStoredBase.cpp create mode 100644 tmtcpacket/pus/TmPacketStoredBase.h diff --git a/pus/Service17Test.cpp b/pus/Service17Test.cpp index 85a32e1e..28370171 100644 --- a/pus/Service17Test.cpp +++ b/pus/Service17Test.cpp @@ -17,14 +17,14 @@ Service17Test::~Service17Test() { ReturnValue_t Service17Test::handleRequest(uint8_t subservice) { switch(subservice) { case Subservice::CONNECTION_TEST: { - TmPacketStored connectionPacket(apid, serviceId, + TmPacketStoredPusA connectionPacket(apid, serviceId, Subservice::CONNECTION_TEST_REPORT, packetSubCounter++); connectionPacket.sendPacket(requestQueue->getDefaultDestination(), requestQueue->getId()); return HasReturnvaluesIF::RETURN_OK; } case Subservice::EVENT_TRIGGER_TEST: { - TmPacketStored connectionPacket(apid, serviceId, + TmPacketStoredPusA connectionPacket(apid, serviceId, Subservice::CONNECTION_TEST_REPORT, packetSubCounter++); connectionPacket.sendPacket(requestQueue->getDefaultDestination(), requestQueue->getId()); diff --git a/pus/Service1TelecommandVerification.cpp b/pus/Service1TelecommandVerification.cpp index 7ce75478..5e9d0e42 100644 --- a/pus/Service1TelecommandVerification.cpp +++ b/pus/Service1TelecommandVerification.cpp @@ -68,7 +68,7 @@ ReturnValue_t Service1TelecommandVerification::generateFailureReport( message->getTcSequenceControl(), message->getStep(), message->getErrorCode(), message->getParameter1(), message->getParameter2()); - TmPacketStored tmPacket(apid, serviceId, message->getReportId(), + TmPacketStoredPusA tmPacket(apid, serviceId, message->getReportId(), packetSubCounter++, &report); ReturnValue_t result = tmPacket.sendPacket(tmQueue->getDefaultDestination(), tmQueue->getId()); @@ -79,7 +79,7 @@ ReturnValue_t Service1TelecommandVerification::generateSuccessReport( PusVerificationMessage *message) { SuccessReport report(message->getReportId(),message->getTcPacketId(), message->getTcSequenceControl(),message->getStep()); - TmPacketStored tmPacket(apid, serviceId, message->getReportId(), + TmPacketStoredPusA tmPacket(apid, serviceId, message->getReportId(), packetSubCounter++, &report); ReturnValue_t result = tmPacket.sendPacket(tmQueue->getDefaultDestination(), tmQueue->getId()); diff --git a/pus/Service5EventReporting.cpp b/pus/Service5EventReporting.cpp index 965a27ad..8632f8d7 100644 --- a/pus/Service5EventReporting.cpp +++ b/pus/Service5EventReporting.cpp @@ -52,7 +52,7 @@ ReturnValue_t Service5EventReporting::generateEventReport( { EventReport report(message.getEventId(),message.getReporter(), message.getParameter1(),message.getParameter2()); - TmPacketStored tmPacket(PusServiceBase::apid, PusServiceBase::serviceId, + TmPacketStoredPusA tmPacket(PusServiceBase::apid, PusServiceBase::serviceId, message.getSeverity(), packetSubCounter++, &report); ReturnValue_t result = tmPacket.sendPacket( requestQueue->getDefaultDestination(),requestQueue->getId()); diff --git a/tmtcpacket/pus/CMakeLists.txt b/tmtcpacket/pus/CMakeLists.txt index 1fdd9dd8..a2ce20e2 100644 --- a/tmtcpacket/pus/CMakeLists.txt +++ b/tmtcpacket/pus/CMakeLists.txt @@ -7,4 +7,5 @@ target_sources(${LIB_FSFW_NAME} TmPacketStored.cpp TmPacketPusA.cpp TmPacketPusC.cpp + TmPacketStoredBase.cpp ) diff --git a/tmtcpacket/pus/TmPacketBase.h b/tmtcpacket/pus/TmPacketBase.h index 72cdbb69..09a6ca54 100644 --- a/tmtcpacket/pus/TmPacketBase.h +++ b/tmtcpacket/pus/TmPacketBase.h @@ -31,7 +31,7 @@ public: static const uint32_t MISSION_TM_PACKET_MAX_SIZE = 2048; //! First byte of secondary header for PUS-A packets. //! TODO: Maybe also support PUS-C via config? - static const uint8_t VERSION_NUMBER_BYTE_PUS_A = 0b00010000; + static const uint8_t VERSION_NUMBER_BYTE = 0b00010000; /** * This is the default constructor. diff --git a/tmtcpacket/pus/TmPacketPusA.cpp b/tmtcpacket/pus/TmPacketPusA.cpp index 630aac0f..841f7e40 100644 --- a/tmtcpacket/pus/TmPacketPusA.cpp +++ b/tmtcpacket/pus/TmPacketPusA.cpp @@ -11,7 +11,7 @@ TmPacketPusA::TmPacketPusA(uint8_t* setData) : TmPacketBase(setData) { - tmData = reinterpret_cast(setData); + tmData = reinterpret_cast(setData); } TmPacketPusA::~TmPacketPusA() { @@ -35,23 +35,9 @@ uint16_t TmPacketPusA::getSourceDataSize() { - CRC_SIZE + 1; } -//uint16_t TmPacketPusA::getErrorControl() { -// uint32_t size = getSourceDataSize() + CRC_SIZE; -// uint8_t* p_to_buffer = &tmData->data; -// return (p_to_buffer[size - 2] << 8) + p_to_buffer[size - 1]; -//} -// -//void TmPacketPusA::setErrorControl() { -// uint32_t full_size = getFullSize(); -// uint16_t crc = CRC::crc16ccitt(getWholeData(), full_size - CRC_SIZE); -// uint32_t size = getSourceDataSize(); -// getSourceData()[size] = (crc & 0XFF00) >> 8; // CRCH -// getSourceData()[size + 1] = (crc) & 0X00FF; // CRCL -//} - void TmPacketPusA::setData(const uint8_t* p_Data) { SpacePacketBase::setData(p_Data); - tmData = (TmPacketPointer*) p_Data; + tmData = (TmPacketPointerPusA*) p_Data; } @@ -60,7 +46,7 @@ size_t TmPacketPusA::getPacketMinimumSize() const { } uint16_t TmPacketPusA::getDataFieldSize() { - return sizeof(PUSTmDataFieldHeader); + return sizeof(PUSTmDataFieldHeaderPusA); } bool TmPacketPusA::checkAndSetStamper() { @@ -113,7 +99,7 @@ void TmPacketPusA::initializeTmPacket(uint16_t apid, uint8_t service, } void TmPacketPusA::setSourceDataSize(uint16_t size) { - setPacketDataLength(size + sizeof(PUSTmDataFieldHeader) + CRC_SIZE - 1); + setPacketDataLength(size + sizeof(PUSTmDataFieldHeaderPusA) + CRC_SIZE - 1); } size_t TmPacketPusA::getTimestampSize() const { diff --git a/tmtcpacket/pus/TmPacketPusA.h b/tmtcpacket/pus/TmPacketPusA.h index 4db634c2..21bdfd95 100644 --- a/tmtcpacket/pus/TmPacketPusA.h +++ b/tmtcpacket/pus/TmPacketPusA.h @@ -18,7 +18,7 @@ void setStaticFrameworkObjectIds(); * for a time tag. * @ingroup tmtcpackets */ -struct PUSTmDataFieldHeader { +struct PUSTmDataFieldHeaderPusA { uint8_t version_type_ack; uint8_t service_type; uint8_t service_subtype; @@ -32,9 +32,9 @@ struct PUSTmDataFieldHeader { * accessed via a pointer. * @ingroup tmtcpackets */ -struct TmPacketPointer { +struct TmPacketPointerPusA { CCSDSPrimaryHeader primary; - PUSTmDataFieldHeader data_field; + PUSTmDataFieldHeaderPusA data_field; uint8_t data; }; @@ -49,7 +49,7 @@ public: * This constant defines the minimum size of a valid PUS Telemetry Packet. */ static const uint32_t TM_PACKET_MIN_SIZE = (sizeof(CCSDSPrimaryHeader) + - sizeof(PUSTmDataFieldHeader) + 2); + sizeof(PUSTmDataFieldHeaderPusA) + 2); //! Maximum size of a TM Packet in this mission. //! TODO: Make this dependant on a config variable. static const uint32_t MISSION_TM_PACKET_MAX_SIZE = 2048; @@ -75,6 +75,7 @@ public: uint8_t* getSourceData() override; uint16_t getSourceDataSize() override; uint16_t getDataFieldSize() override; + /** * Interprets the "time"-field in the secondary header and returns it in * timeval format. @@ -97,7 +98,7 @@ protected: * * To be hardware-safe, all elements are of byte size. */ - TmPacketPointer* tmData; + TmPacketPointerPusA* tmData; /** * Initializes the Tm Packet header. diff --git a/tmtcpacket/pus/TmPacketStored.cpp b/tmtcpacket/pus/TmPacketStored.cpp index d69e2419..4a33c504 100644 --- a/tmtcpacket/pus/TmPacketStored.cpp +++ b/tmtcpacket/pus/TmPacketStored.cpp @@ -6,20 +6,19 @@ #include -StorageManagerIF *TmPacketStored::store = nullptr; -InternalErrorReporterIF *TmPacketStored::internalErrorReporter = nullptr; +StorageManagerIF *TmPacketStoredPusA::store = nullptr; +InternalErrorReporterIF *TmPacketStoredPusA::internalErrorReporter = nullptr; -TmPacketStored::TmPacketStored(store_address_t setAddress) : - TmPacketPusA(nullptr), storeAddress(setAddress) { - setStoreAddress(storeAddress); +TmPacketStoredPusA::TmPacketStoredPusA(store_address_t setAddress) : + TmPacketStoredBase(setAddress), TmPacketPusA(nullptr){ } -TmPacketStored::TmPacketStored(uint16_t apid, uint8_t service, +TmPacketStoredPusA::TmPacketStoredPusA(uint16_t apid, uint8_t service, uint8_t subservice, uint8_t packetSubcounter, const uint8_t *data, uint32_t size, const uint8_t *headerData, uint32_t headerSize) : TmPacketPusA(nullptr) { storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; - if (not checkAndSetStore()) { + if (not TmPacketStoredBase::checkAndSetStore()) { return; } uint8_t *pData = nullptr; @@ -27,7 +26,7 @@ TmPacketStored::TmPacketStored(uint16_t apid, uint8_t service, (getPacketMinimumSize() + size + headerSize), &pData); if (returnValue != store->RETURN_OK) { - checkAndReportLostTm(); + TmPacketStoredBase::checkAndReportLostTm(); return; } setData(pData); @@ -35,15 +34,15 @@ TmPacketStored::TmPacketStored(uint16_t apid, uint8_t service, memcpy(getSourceData(), headerData, headerSize); memcpy(getSourceData() + headerSize, data, size); setPacketDataLength( - size + headerSize + sizeof(PUSTmDataFieldHeader) + CRC_SIZE - 1); + size + headerSize + sizeof(PUSTmDataFieldHeaderPusA) + CRC_SIZE - 1); } -TmPacketStored::TmPacketStored(uint16_t apid, uint8_t service, +TmPacketStoredPusA::TmPacketStoredPusA(uint16_t apid, uint8_t service, uint8_t subservice, uint8_t packetSubcounter, SerializeIF *content, SerializeIF *header) : TmPacketPusA(nullptr) { storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; - if (not checkAndSetStore()) { + if (not TmPacketStoredBase::checkAndSetStore()) { return; } size_t sourceDataSize = 0; @@ -57,7 +56,7 @@ TmPacketStored::TmPacketStored(uint16_t apid, uint8_t service, ReturnValue_t returnValue = store->getFreeElement(&storeAddress, (getPacketMinimumSize() + sourceDataSize), &p_data); if (returnValue != store->RETURN_OK) { - checkAndReportLostTm(); + TmPacketStoredBase::checkAndReportLostTm(); } setData(p_data); initializeTmPacket(apid, service, subservice, packetSubcounter); @@ -72,76 +71,13 @@ TmPacketStored::TmPacketStored(uint16_t apid, uint8_t service, SerializeIF::Endianness::BIG); } setPacketDataLength( - sourceDataSize + sizeof(PUSTmDataFieldHeader) + CRC_SIZE - 1); + sourceDataSize + sizeof(PUSTmDataFieldHeaderPusA) + CRC_SIZE - 1); } -store_address_t TmPacketStored::getStoreAddress() { - return storeAddress; +uint8_t* TmPacketStoredPusA::getAllTmData() { + return getWholeData(); } -void TmPacketStored::deletePacket() { - store->deleteData(storeAddress); - storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; - setData(nullptr); -} - -void TmPacketStored::setStoreAddress(store_address_t setAddress) { - storeAddress = setAddress; - const uint8_t* tempData = nullptr; - size_t tempSize; - if (not checkAndSetStore()) { - return; - } - ReturnValue_t status = store->getData(storeAddress, &tempData, &tempSize); - if (status == StorageManagerIF::RETURN_OK) { - setData(tempData); - } else { - setData(nullptr); - storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; - } -} - -bool TmPacketStored::checkAndSetStore() { - if (store == nullptr) { - store = objectManager->get(objects::TM_STORE); - if (store == nullptr) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "TmPacketStored::TmPacketStored: TM Store not found!" - << std::endl; -#endif - return false; - } - } - return true; -} - -ReturnValue_t TmPacketStored::sendPacket(MessageQueueId_t destination, - MessageQueueId_t sentFrom, bool doErrorReporting) { - if (getWholeData() == nullptr) { - //SHOULDDO: More decent code. - return HasReturnvaluesIF::RETURN_FAILED; - } - TmTcMessage tmMessage(getStoreAddress()); - ReturnValue_t result = MessageQueueSenderIF::sendMessage(destination, - &tmMessage, sentFrom); - if (result != HasReturnvaluesIF::RETURN_OK) { - deletePacket(); - if (doErrorReporting) { - checkAndReportLostTm(); - } - return result; - } - //SHOULDDO: In many cases, some counter is incremented for successfully sent packets. The check is often not done, but just incremented. - return HasReturnvaluesIF::RETURN_OK; - -} - -void TmPacketStored::checkAndReportLostTm() { - if (internalErrorReporter == nullptr) { - internalErrorReporter = objectManager->get( - objects::INTERNAL_ERROR_REPORTER); - } - if (internalErrorReporter != nullptr) { - internalErrorReporter->lostTm(); - } +void TmPacketStoredPusA::setDataPointer(const uint8_t *newPointer) { + setData(newPointer); } diff --git a/tmtcpacket/pus/TmPacketStored.h b/tmtcpacket/pus/TmPacketStored.h index 1cc8e6ba..17b81e9f 100644 --- a/tmtcpacket/pus/TmPacketStored.h +++ b/tmtcpacket/pus/TmPacketStored.h @@ -1,7 +1,8 @@ -#ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTORED_H_ -#define FSFW_TMTCPACKET_PUS_TMPACKETSTORED_H_ +#ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTORED_PUSA_H_ +#define FSFW_TMTCPACKET_PUS_TMPACKETSTORED_PUSA_H_ #include "TmPacketBase.h" +#include "TmPacketStoredBase.h" #include #include "../../tmtcpacket/pus/TmPacketPusA.h" @@ -20,13 +21,15 @@ * packets in a store with the help of a storeAddress. * @ingroup tmtcpackets */ -class TmPacketStored : public TmPacketPusA { +class TmPacketStoredPusA : + public TmPacketStoredBase, + public TmPacketPusA { public: /** * This is a default constructor which does not set the data pointer. * However, it does try to set the packet store. */ - TmPacketStored( store_address_t setAddress ); + TmPacketStoredPusA( store_address_t setAddress ); /** * With this constructor, new space is allocated in the packet store and * a new PUS Telemetry Packet is created there. @@ -47,7 +50,7 @@ public: * will be copied in front of data * @param headerSize The size of the headerDataF */ - TmPacketStored( uint16_t apid, uint8_t service, uint8_t subservice, + TmPacketStoredPusA( uint16_t apid, uint8_t service, uint8_t subservice, uint8_t packet_counter = 0, const uint8_t* data = nullptr, uint32_t size = 0, const uint8_t* headerData = nullptr, uint32_t headerSize = 0); @@ -55,30 +58,13 @@ public: * Another ctor to directly pass structured content and header data to the * packet to avoid additional buffers. */ - TmPacketStored( uint16_t apid, uint8_t service, uint8_t subservice, + TmPacketStoredPusA( uint16_t apid, uint8_t service, uint8_t subservice, uint8_t packet_counter, SerializeIF* content, SerializeIF* header = nullptr); - /** - * This is a getter for the current store address of the packet. - * @return The current store address. The (raw) value is - * @c StorageManagerIF::INVALID_ADDRESS if - * the packet is not linked. - */ - store_address_t getStoreAddress(); - /** - * With this call, the packet is deleted. - * It removes itself from the store and sets its data pointer to NULL. - */ - void deletePacket(); - /** - * With this call, a packet can be linked to another store. This is useful - * if the packet is a class member and used for more than one packet. - * @param setAddress The new packet id to link to. - */ - void setStoreAddress( store_address_t setAddress ); - ReturnValue_t sendPacket( MessageQueueId_t destination, - MessageQueueId_t sentFrom, bool doErrorReporting = true ); + uint8_t* getAllTmData() override; + void setDataPointer(const uint8_t* newPointer) override; + private: /** * This is a pointer to the store all instances of the class use. @@ -94,17 +80,7 @@ private: * The address where the packet data of the object instance is stored. */ store_address_t storeAddress; - /** - * A helper method to check if a store is assigned to the class. - * If not, the method tries to retrieve the store from the global - * ObjectManager. - * @return @li @c true if the store is linked or could be created. - * @li @c false otherwise. - */ - bool checkAndSetStore(); - - void checkAndReportLostTm(); }; -#endif /* FSFW_TMTCPACKET_PUS_TMPACKETSTORED_H_ */ +#endif /* FSFW_TMTCPACKET_PUS_TMPACKETSTORED_PUSA_H_ */ diff --git a/tmtcpacket/pus/TmPacketStoredBase.cpp b/tmtcpacket/pus/TmPacketStoredBase.cpp new file mode 100644 index 00000000..3ab31a80 --- /dev/null +++ b/tmtcpacket/pus/TmPacketStoredBase.cpp @@ -0,0 +1,94 @@ +#include "TmPacketStoredBase.h" + +#include "../../objectmanager/ObjectManagerIF.h" +#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "../../tmtcservices/TmTcMessage.h" + +#include + +StorageManagerIF *TmPacketStoredBase::store = nullptr; +InternalErrorReporterIF *TmPacketStoredBase::internalErrorReporter = nullptr; + +TmPacketStoredBase::TmPacketStoredBase(store_address_t setAddress): storeAddress(setAddress) { + setStoreAddress(storeAddress); +} + +TmPacketStoredBase::TmPacketStoredBase() { +} + + +TmPacketStoredBase::~TmPacketStoredBase() { +} + +store_address_t TmPacketStoredBase::getStoreAddress() { + return storeAddress; +} + +void TmPacketStoredBase::deletePacket() { + store->deleteData(storeAddress); + storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; + setDataPointer(nullptr); +} + +void TmPacketStoredBase::setStoreAddress(store_address_t setAddress) { + storeAddress = setAddress; + const uint8_t* tempData = nullptr; + size_t tempSize; + if (not checkAndSetStore()) { + return; + } + ReturnValue_t status = store->getData(storeAddress, &tempData, &tempSize); + if (status == StorageManagerIF::RETURN_OK) { + setDataPointer(tempData); + } else { + setDataPointer(nullptr); + storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; + } +} + +bool TmPacketStoredBase::checkAndSetStore() { + if (store == nullptr) { + store = objectManager->get(objects::TM_STORE); + if (store == nullptr) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "TmPacketStored::TmPacketStored: TM Store not found!" + << std::endl; +#endif + return false; + } + } + return true; +} + +ReturnValue_t TmPacketStoredBase::sendPacket(MessageQueueId_t destination, + MessageQueueId_t sentFrom, bool doErrorReporting) { + if (getAllTmData() == nullptr) { + //SHOULDDO: More decent code. + return HasReturnvaluesIF::RETURN_FAILED; + } + TmTcMessage tmMessage(getStoreAddress()); + ReturnValue_t result = MessageQueueSenderIF::sendMessage(destination, + &tmMessage, sentFrom); + if (result != HasReturnvaluesIF::RETURN_OK) { + deletePacket(); + if (doErrorReporting) { + checkAndReportLostTm(); + } + return result; + } + //SHOULDDO: In many cases, some counter is incremented for successfully sent packets. The check is often not done, but just incremented. + return HasReturnvaluesIF::RETURN_OK; + +} + +void TmPacketStoredBase::checkAndReportLostTm() { + if (internalErrorReporter == nullptr) { + internalErrorReporter = objectManager->get( + objects::INTERNAL_ERROR_REPORTER); + } + if (internalErrorReporter != nullptr) { + internalErrorReporter->lostTm(); + } +} + + diff --git a/tmtcpacket/pus/TmPacketStoredBase.h b/tmtcpacket/pus/TmPacketStoredBase.h new file mode 100644 index 00000000..58a231a5 --- /dev/null +++ b/tmtcpacket/pus/TmPacketStoredBase.h @@ -0,0 +1,89 @@ +#ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTOREDBASE_H_ +#define FSFW_TMTCPACKET_PUS_TMPACKETSTOREDBASE_H_ + +#include "TmPacketBase.h" +#include "TmPacketStoredBase.h" +#include + +#include "../../tmtcpacket/pus/TmPacketPusA.h" +#include "../../serialize/SerializeIF.h" +#include "../../storagemanager/StorageManagerIF.h" +#include "../../internalError/InternalErrorReporterIF.h" +#include "../../ipc/MessageQueueSenderIF.h" + +/** + * This class generates a ECSS PUS Telemetry packet within a given + * intermediate storage. + * As most packets are passed between tasks with the help of a storage + * anyway, it seems logical to create a Packet-In-Storage access class + * which saves the user almost all storage handling operation. + * Packets can both be newly created with the class and be "linked" to + * packets in a store with the help of a storeAddress. + * @ingroup tmtcpackets + */ +class TmPacketStoredBase { +public: + /** + * This is a default constructor which does not set the data pointer. + * However, it does try to set the packet store. + */ + TmPacketStoredBase( store_address_t setAddress ); + TmPacketStoredBase(); + + virtual ~TmPacketStoredBase(); + + virtual uint8_t* getAllTmData() = 0; + virtual void setDataPointer(const uint8_t* newPointer) = 0; + + /** + * This is a getter for the current store address of the packet. + * @return The current store address. The (raw) value is + * @c StorageManagerIF::INVALID_ADDRESS if + * the packet is not linked. + */ + store_address_t getStoreAddress(); + /** + * With this call, the packet is deleted. + * It removes itself from the store and sets its data pointer to NULL. + */ + void deletePacket(); + /** + * With this call, a packet can be linked to another store. This is useful + * if the packet is a class member and used for more than one packet. + * @param setAddress The new packet id to link to. + */ + void setStoreAddress( store_address_t setAddress ); + + ReturnValue_t sendPacket( MessageQueueId_t destination, + MessageQueueId_t sentFrom, bool doErrorReporting = true ); + +protected: + /** + * This is a pointer to the store all instances of the class use. + * If the store is not yet set (i.e. @c store is NULL), every constructor + * call tries to set it and throws an error message in case of failures. + * The default store is objects::TM_STORE. + */ + static StorageManagerIF* store; + + static InternalErrorReporterIF *internalErrorReporter; + + /** + * The address where the packet data of the object instance is stored. + */ + store_address_t storeAddress; + /** + * A helper method to check if a store is assigned to the class. + * If not, the method tries to retrieve the store from the global + * ObjectManager. + * @return @li @c true if the store is linked or could be created. + * @li @c false otherwise. + */ + bool checkAndSetStore(); + + void checkAndReportLostTm(); +}; + + +#endif /* FSFW_TMTCPACKET_PUS_TMPACKETSTOREDBASE_H_ */ + diff --git a/tmtcservices/CommandingServiceBase.cpp b/tmtcservices/CommandingServiceBase.cpp index 8b6f7a09..bbcdcc80 100644 --- a/tmtcservices/CommandingServiceBase.cpp +++ b/tmtcservices/CommandingServiceBase.cpp @@ -293,7 +293,7 @@ void CommandingServiceBase::handleRequestQueue() { ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, const uint8_t* data, size_t dataLen, const uint8_t* headerData, size_t headerSize) { - TmPacketStored tmPacketStored(this->apid, this->service, subservice, + TmPacketStoredPusA tmPacketStored(this->apid, this->service, subservice, this->tmPacketCounter, data, dataLen, headerData, headerSize); ReturnValue_t result = tmPacketStored.sendPacket( requestQueue->getDefaultDestination(), requestQueue->getId()); @@ -311,7 +311,7 @@ ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, size_t size = 0; SerializeAdapter::serialize(&objectId, &pBuffer, &size, sizeof(object_id_t), SerializeIF::Endianness::BIG); - TmPacketStored tmPacketStored(this->apid, this->service, subservice, + TmPacketStoredPusA tmPacketStored(this->apid, this->service, subservice, this->tmPacketCounter, data, dataLen, buffer, size); ReturnValue_t result = tmPacketStored.sendPacket( requestQueue->getDefaultDestination(), requestQueue->getId()); @@ -324,7 +324,7 @@ ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, SerializeIF* content, SerializeIF* header) { - TmPacketStored tmPacketStored(this->apid, this->service, subservice, + TmPacketStoredPusA tmPacketStored(this->apid, this->service, subservice, this->tmPacketCounter, content, header); ReturnValue_t result = tmPacketStored.sendPacket( requestQueue->getDefaultDestination(), requestQueue->getId()); diff --git a/unittest/user/unittest/core/CatchFactory.cpp b/unittest/user/unittest/core/CatchFactory.cpp index eabaa21d..2c4eaf24 100644 --- a/unittest/user/unittest/core/CatchFactory.cpp +++ b/unittest/user/unittest/core/CatchFactory.cpp @@ -74,7 +74,7 @@ void Factory::setStaticFrameworkObjectIds() { DeviceHandlerFailureIsolation::powerConfirmationId = objects::NO_OBJECT; - TmPacketStored::timeStamperId = objects::NO_OBJECT; + TmPacketStoredPusA::timeStamperId = objects::NO_OBJECT; } From 4faa5b0685fc894b643979d54bdf5d8736257e75 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 12 Apr 2021 22:02:16 +0200 Subject: [PATCH 049/389] fixes --- tmtcpacket/pus/TmPacketStored.cpp | 5 +---- tmtcpacket/pus/TmPacketStored.h | 9 --------- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/tmtcpacket/pus/TmPacketStored.cpp b/tmtcpacket/pus/TmPacketStored.cpp index 4a33c504..b09f505d 100644 --- a/tmtcpacket/pus/TmPacketStored.cpp +++ b/tmtcpacket/pus/TmPacketStored.cpp @@ -6,9 +6,6 @@ #include -StorageManagerIF *TmPacketStoredPusA::store = nullptr; -InternalErrorReporterIF *TmPacketStoredPusA::internalErrorReporter = nullptr; - TmPacketStoredPusA::TmPacketStoredPusA(store_address_t setAddress) : TmPacketStoredBase(setAddress), TmPacketPusA(nullptr){ } @@ -42,7 +39,7 @@ TmPacketStoredPusA::TmPacketStoredPusA(uint16_t apid, uint8_t service, SerializeIF *header) : TmPacketPusA(nullptr) { storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; - if (not TmPacketStoredBase::checkAndSetStore()) { + if (not TmPacketStoredBase::checkAndSetStore()) { return; } size_t sourceDataSize = 0; diff --git a/tmtcpacket/pus/TmPacketStored.h b/tmtcpacket/pus/TmPacketStored.h index 17b81e9f..f1722f4e 100644 --- a/tmtcpacket/pus/TmPacketStored.h +++ b/tmtcpacket/pus/TmPacketStored.h @@ -66,15 +66,6 @@ public: void setDataPointer(const uint8_t* newPointer) override; private: - /** - * This is a pointer to the store all instances of the class use. - * If the store is not yet set (i.e. @c store is NULL), every constructor - * call tries to set it and throws an error message in case of failures. - * The default store is objects::TM_STORE. - */ - static StorageManagerIF* store; - - static InternalErrorReporterIF *internalErrorReporter; /** * The address where the packet data of the object instance is stored. From 07f121631609209a828b6f1df5bdc602bec72b68 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 12 Apr 2021 22:12:18 +0200 Subject: [PATCH 050/389] error found --- tmtcpacket/pus/TmPacketStored.h | 6 ------ tmtcpacket/pus/TmPacketStoredBase.h | 6 +++--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/tmtcpacket/pus/TmPacketStored.h b/tmtcpacket/pus/TmPacketStored.h index f1722f4e..aeeba275 100644 --- a/tmtcpacket/pus/TmPacketStored.h +++ b/tmtcpacket/pus/TmPacketStored.h @@ -65,12 +65,6 @@ public: uint8_t* getAllTmData() override; void setDataPointer(const uint8_t* newPointer) override; -private: - - /** - * The address where the packet data of the object instance is stored. - */ - store_address_t storeAddress; }; diff --git a/tmtcpacket/pus/TmPacketStoredBase.h b/tmtcpacket/pus/TmPacketStoredBase.h index 58a231a5..dd7e31eb 100644 --- a/tmtcpacket/pus/TmPacketStoredBase.h +++ b/tmtcpacket/pus/TmPacketStoredBase.h @@ -52,10 +52,10 @@ public: * if the packet is a class member and used for more than one packet. * @param setAddress The new packet id to link to. */ - void setStoreAddress( store_address_t setAddress ); + void setStoreAddress(store_address_t setAddress); - ReturnValue_t sendPacket( MessageQueueId_t destination, - MessageQueueId_t sentFrom, bool doErrorReporting = true ); + ReturnValue_t sendPacket(MessageQueueId_t destination, MessageQueueId_t sentFrom, + bool doErrorReporting = true); protected: /** From 9a2fbefc9ff5c9fbdd64fa4dbe7eaef293704b05 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 12 Apr 2021 22:24:11 +0200 Subject: [PATCH 051/389] refactoring continued --- pus/Service17Test.cpp | 2 +- pus/Service1TelecommandVerification.cpp | 2 +- pus/Service5EventReporting.cpp | 2 +- tmtcpacket/pus/CMakeLists.txt | 2 +- tmtcpacket/pus/TmPacketBase.cpp | 8 +- tmtcpacket/pus/TmPacketStored.h | 73 ++----------------- ...acketStored.cpp => TmPacketStoredPusA.cpp} | 2 +- tmtcpacket/pus/TmPacketStoredPusA.h | 71 ++++++++++++++++++ tmtcservices/CommandingServiceBase.cpp | 2 +- 9 files changed, 89 insertions(+), 75 deletions(-) rename tmtcpacket/pus/{TmPacketStored.cpp => TmPacketStoredPusA.cpp} (98%) create mode 100644 tmtcpacket/pus/TmPacketStoredPusA.h diff --git a/pus/Service17Test.cpp b/pus/Service17Test.cpp index 28370171..cdd8817c 100644 --- a/pus/Service17Test.cpp +++ b/pus/Service17Test.cpp @@ -2,7 +2,7 @@ #include "../serviceinterface/ServiceInterfaceStream.h" #include "../objectmanager/SystemObject.h" -#include "../tmtcpacket/pus/TmPacketStored.h" +#include "../tmtcpacket/pus/TmPacketStoredPusA.h" Service17Test::Service17Test(object_id_t objectId, diff --git a/pus/Service1TelecommandVerification.cpp b/pus/Service1TelecommandVerification.cpp index 5e9d0e42..358d1faa 100644 --- a/pus/Service1TelecommandVerification.cpp +++ b/pus/Service1TelecommandVerification.cpp @@ -3,7 +3,7 @@ #include "../ipc/QueueFactory.h" #include "../tmtcservices/PusVerificationReport.h" -#include "../tmtcpacket/pus/TmPacketStored.h" +#include "../tmtcpacket/pus/TmPacketStoredPusA.h" #include "../serviceinterface/ServiceInterfaceStream.h" #include "../tmtcservices/AcceptsTelemetryIF.h" diff --git a/pus/Service5EventReporting.cpp b/pus/Service5EventReporting.cpp index 8632f8d7..f6281fe9 100644 --- a/pus/Service5EventReporting.cpp +++ b/pus/Service5EventReporting.cpp @@ -4,7 +4,7 @@ #include "../serviceinterface/ServiceInterfaceStream.h" #include "../events/EventManagerIF.h" #include "../ipc/QueueFactory.h" -#include "../tmtcpacket/pus/TmPacketStored.h" +#include "../tmtcpacket/pus/TmPacketStoredPusA.h" Service5EventReporting::Service5EventReporting(object_id_t objectId, diff --git a/tmtcpacket/pus/CMakeLists.txt b/tmtcpacket/pus/CMakeLists.txt index a2ce20e2..747ed070 100644 --- a/tmtcpacket/pus/CMakeLists.txt +++ b/tmtcpacket/pus/CMakeLists.txt @@ -4,7 +4,7 @@ target_sources(${LIB_FSFW_NAME} TcPacketStored.cpp TmPacketBase.cpp TmPacketMinimal.cpp - TmPacketStored.cpp + TmPacketStoredPusA.cpp TmPacketPusA.cpp TmPacketPusC.cpp TmPacketStoredBase.cpp diff --git a/tmtcpacket/pus/TmPacketBase.cpp b/tmtcpacket/pus/TmPacketBase.cpp index 10f37b00..2dfef258 100644 --- a/tmtcpacket/pus/TmPacketBase.cpp +++ b/tmtcpacket/pus/TmPacketBase.cpp @@ -3,13 +3,13 @@ #include "../../globalfunctions/CRC.h" #include "../../globalfunctions/arrayprinter.h" #include "../../objectmanager/ObjectManagerIF.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "../../serviceinterface/ServiceInterface.h" #include "../../timemanager/CCSDSTime.h" #include TimeStamperIF* TmPacketBase::timeStamper = nullptr; -object_id_t TmPacketBase::timeStamperId = 0; +object_id_t TmPacketBase::timeStamperId = objects::NO_OBJECT; TmPacketBase::TmPacketBase(uint8_t* setData): SpacePacketBase(setData) { @@ -52,8 +52,10 @@ bool TmPacketBase::checkAndSetStamper() { timeStamper = objectManager->get(timeStamperId); if (timeStamper == NULL) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "TmPacketBase::checkAndSetStamper: Stamper not found!" + sif::Warning << "TmPacketBase::checkAndSetStamper: Stamper not found!" << std::endl; +#else + sif::printWarning("TmPacketBase::checkAndSetStamper: Stamper not found!\n"); #endif return false; } diff --git a/tmtcpacket/pus/TmPacketStored.h b/tmtcpacket/pus/TmPacketStored.h index aeeba275..53ef3f4d 100644 --- a/tmtcpacket/pus/TmPacketStored.h +++ b/tmtcpacket/pus/TmPacketStored.h @@ -1,71 +1,12 @@ -#ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTORED_PUSA_H_ -#define FSFW_TMTCPACKET_PUS_TMPACKETSTORED_PUSA_H_ +#ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTORED_H_ +#define FSFW_TMTCPACKET_PUS_TMPACKETSTORED_H_ -#include "TmPacketBase.h" -#include "TmPacketStoredBase.h" #include -#include "../../tmtcpacket/pus/TmPacketPusA.h" -#include "../../serialize/SerializeIF.h" -#include "../../storagemanager/StorageManagerIF.h" -#include "../../internalError/InternalErrorReporterIF.h" -#include "../../ipc/MessageQueueSenderIF.h" - -/** - * This class generates a ECSS PUS Telemetry packet within a given - * intermediate storage. - * As most packets are passed between tasks with the help of a storage - * anyway, it seems logical to create a Packet-In-Storage access class - * which saves the user almost all storage handling operation. - * Packets can both be newly created with the class and be "linked" to - * packets in a store with the help of a storeAddress. - * @ingroup tmtcpackets - */ -class TmPacketStoredPusA : - public TmPacketStoredBase, - public TmPacketPusA { -public: - /** - * This is a default constructor which does not set the data pointer. - * However, it does try to set the packet store. - */ - TmPacketStoredPusA( store_address_t setAddress ); - /** - * With this constructor, new space is allocated in the packet store and - * a new PUS Telemetry Packet is created there. - * Packet Application Data passed in data is copied into the packet. - * The Application data is passed in two parts, first a header, then a - * data field. This allows building a Telemetry Packet from two separate - * data sources. - * @param apid Sets the packet's APID field. - * @param service Sets the packet's Service ID field. - * This specifies the source service. - * @param subservice Sets the packet's Service Subtype field. - * This specifies the source sub-service. - * @param packet_counter Sets the Packet counter field of this packet - * @param data The payload data to be copied to the - * Application Data Field - * @param size The amount of data to be copied. - * @param headerData The header Data of the Application field, - * will be copied in front of data - * @param headerSize The size of the headerDataF - */ - TmPacketStoredPusA( uint16_t apid, uint8_t service, uint8_t subservice, - uint8_t packet_counter = 0, const uint8_t* data = nullptr, - uint32_t size = 0, const uint8_t* headerData = nullptr, - uint32_t headerSize = 0); - /** - * Another ctor to directly pass structured content and header data to the - * packet to avoid additional buffers. - */ - TmPacketStoredPusA( uint16_t apid, uint8_t service, uint8_t subservice, - uint8_t packet_counter, SerializeIF* content, - SerializeIF* header = nullptr); - - uint8_t* getAllTmData() override; - void setDataPointer(const uint8_t* newPointer) override; - -}; +#if FSFW_USE_PUS_C_TELEMETRY == 1 +#else +#include "TmPacketStoredPusA.h" +#endif -#endif /* FSFW_TMTCPACKET_PUS_TMPACKETSTORED_PUSA_H_ */ +#endif /* FSFW_TMTCPACKET_PUS_TMPACKETSTORED_H_ */ diff --git a/tmtcpacket/pus/TmPacketStored.cpp b/tmtcpacket/pus/TmPacketStoredPusA.cpp similarity index 98% rename from tmtcpacket/pus/TmPacketStored.cpp rename to tmtcpacket/pus/TmPacketStoredPusA.cpp index b09f505d..4931f8d9 100644 --- a/tmtcpacket/pus/TmPacketStored.cpp +++ b/tmtcpacket/pus/TmPacketStoredPusA.cpp @@ -1,4 +1,4 @@ -#include "TmPacketStored.h" +#include "TmPacketStoredPusA.h" #include "../../objectmanager/ObjectManagerIF.h" #include "../../serviceinterface/ServiceInterfaceStream.h" diff --git a/tmtcpacket/pus/TmPacketStoredPusA.h b/tmtcpacket/pus/TmPacketStoredPusA.h new file mode 100644 index 00000000..aeeba275 --- /dev/null +++ b/tmtcpacket/pus/TmPacketStoredPusA.h @@ -0,0 +1,71 @@ +#ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTORED_PUSA_H_ +#define FSFW_TMTCPACKET_PUS_TMPACKETSTORED_PUSA_H_ + +#include "TmPacketBase.h" +#include "TmPacketStoredBase.h" +#include + +#include "../../tmtcpacket/pus/TmPacketPusA.h" +#include "../../serialize/SerializeIF.h" +#include "../../storagemanager/StorageManagerIF.h" +#include "../../internalError/InternalErrorReporterIF.h" +#include "../../ipc/MessageQueueSenderIF.h" + +/** + * This class generates a ECSS PUS Telemetry packet within a given + * intermediate storage. + * As most packets are passed between tasks with the help of a storage + * anyway, it seems logical to create a Packet-In-Storage access class + * which saves the user almost all storage handling operation. + * Packets can both be newly created with the class and be "linked" to + * packets in a store with the help of a storeAddress. + * @ingroup tmtcpackets + */ +class TmPacketStoredPusA : + public TmPacketStoredBase, + public TmPacketPusA { +public: + /** + * This is a default constructor which does not set the data pointer. + * However, it does try to set the packet store. + */ + TmPacketStoredPusA( store_address_t setAddress ); + /** + * With this constructor, new space is allocated in the packet store and + * a new PUS Telemetry Packet is created there. + * Packet Application Data passed in data is copied into the packet. + * The Application data is passed in two parts, first a header, then a + * data field. This allows building a Telemetry Packet from two separate + * data sources. + * @param apid Sets the packet's APID field. + * @param service Sets the packet's Service ID field. + * This specifies the source service. + * @param subservice Sets the packet's Service Subtype field. + * This specifies the source sub-service. + * @param packet_counter Sets the Packet counter field of this packet + * @param data The payload data to be copied to the + * Application Data Field + * @param size The amount of data to be copied. + * @param headerData The header Data of the Application field, + * will be copied in front of data + * @param headerSize The size of the headerDataF + */ + TmPacketStoredPusA( uint16_t apid, uint8_t service, uint8_t subservice, + uint8_t packet_counter = 0, const uint8_t* data = nullptr, + uint32_t size = 0, const uint8_t* headerData = nullptr, + uint32_t headerSize = 0); + /** + * Another ctor to directly pass structured content and header data to the + * packet to avoid additional buffers. + */ + TmPacketStoredPusA( uint16_t apid, uint8_t service, uint8_t subservice, + uint8_t packet_counter, SerializeIF* content, + SerializeIF* header = nullptr); + + uint8_t* getAllTmData() override; + void setDataPointer(const uint8_t* newPointer) override; + +}; + + +#endif /* FSFW_TMTCPACKET_PUS_TMPACKETSTORED_PUSA_H_ */ diff --git a/tmtcservices/CommandingServiceBase.cpp b/tmtcservices/CommandingServiceBase.cpp index bbcdcc80..147c8796 100644 --- a/tmtcservices/CommandingServiceBase.cpp +++ b/tmtcservices/CommandingServiceBase.cpp @@ -6,7 +6,7 @@ #include "../objectmanager/ObjectManagerIF.h" #include "../ipc/QueueFactory.h" #include "../tmtcpacket/pus/TcPacketStored.h" -#include "../tmtcpacket/pus/TmPacketStored.h" +#include "../tmtcpacket/pus/TmPacketStoredPusA.h" #include "../serviceinterface/ServiceInterface.h" object_id_t CommandingServiceBase::defaultPacketSource = objects::NO_OBJECT; From f906605097465daa0f3d300de5bfa7ade1a11384 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 12 Apr 2021 23:55:33 +0200 Subject: [PATCH 052/389] addes pus packet c implementation --- timemanager/TimeStamperIF.h | 5 +- tmtcpacket/pus/TmPacketBase.cpp | 9 +- tmtcpacket/pus/TmPacketBase.h | 5 +- tmtcpacket/pus/TmPacketPusA.cpp | 24 +---- tmtcpacket/pus/TmPacketPusA.h | 11 +-- tmtcpacket/pus/TmPacketPusC.cpp | 86 +++++++++++++++++ tmtcpacket/pus/TmPacketPusC.h | 127 ++++++++++++++++++++++++++ tmtcpacket/pus/TmPacketStoredPusC.cpp | 2 + tmtcpacket/pus/TmPacketStoredPusC.h | 8 ++ 9 files changed, 237 insertions(+), 40 deletions(-) create mode 100644 tmtcpacket/pus/TmPacketStoredPusC.cpp create mode 100644 tmtcpacket/pus/TmPacketStoredPusC.h diff --git a/timemanager/TimeStamperIF.h b/timemanager/TimeStamperIF.h index 57b7f014..1c4ada60 100644 --- a/timemanager/TimeStamperIF.h +++ b/timemanager/TimeStamperIF.h @@ -1,6 +1,7 @@ #ifndef FSFW_TIMEMANAGER_TIMESTAMPERIF_H_ #define FSFW_TIMEMANAGER_TIMESTAMPERIF_H_ +#include #include "../returnvalues/HasReturnvaluesIF.h" /** @@ -16,8 +17,8 @@ public: //! This is a mission-specific constant and determines the total //! size reserved for timestamps. - //! TODO: Default define in FSFWConfig ? - static const uint8_t MISSION_TIMESTAMP_SIZE = 8; + static const uint8_t MISSION_TIMESTAMP_SIZE = fsfwconfig::FSFW_MISSION_TIMESTAMP_SIZE; + virtual ReturnValue_t addTimeStamp(uint8_t* buffer, const uint8_t maxSize) = 0; virtual ~TimeStamperIF() {} diff --git a/tmtcpacket/pus/TmPacketBase.cpp b/tmtcpacket/pus/TmPacketBase.cpp index 2dfef258..25193c92 100644 --- a/tmtcpacket/pus/TmPacketBase.cpp +++ b/tmtcpacket/pus/TmPacketBase.cpp @@ -38,7 +38,11 @@ void TmPacketBase::setErrorControl() { getSourceData()[size + 1] = (crc) & 0X00FF; // CRCL } - +ReturnValue_t TmPacketBase::getPacketTime(timeval* timestamp) const { + size_t tempSize = 0; + return CCSDSTime::convertFromCcsds(timestamp, getPacketTimeRaw(), + &tempSize, getTimestampSize()); +} void TmPacketBase::print() { #if FSFW_CPP_OSTREAM_ENABLED == 1 @@ -52,8 +56,7 @@ bool TmPacketBase::checkAndSetStamper() { timeStamper = objectManager->get(timeStamperId); if (timeStamper == NULL) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::Warning << "TmPacketBase::checkAndSetStamper: Stamper not found!" - << std::endl; + sif::warning << "TmPacketBase::checkAndSetStamper: Stamper not found!" << std::endl; #else sif::printWarning("TmPacketBase::checkAndSetStamper: Stamper not found!\n"); #endif diff --git a/tmtcpacket/pus/TmPacketBase.h b/tmtcpacket/pus/TmPacketBase.h index 09a6ca54..6925e99b 100644 --- a/tmtcpacket/pus/TmPacketBase.h +++ b/tmtcpacket/pus/TmPacketBase.h @@ -29,8 +29,7 @@ public: //! Maximum size of a TM Packet in this mission. //! TODO: Make this dependant on a config variable. static const uint32_t MISSION_TM_PACKET_MAX_SIZE = 2048; - //! First byte of secondary header for PUS-A packets. - //! TODO: Maybe also support PUS-C via config? + //! First four bits of first byte of secondary header static const uint8_t VERSION_NUMBER_BYTE = 0b00010000; /** @@ -87,7 +86,7 @@ public: * timeval format. * @return Converted timestamp of packet. */ - virtual ReturnValue_t getPacketTime(timeval* timestamp) const = 0; + virtual ReturnValue_t getPacketTime(timeval* timestamp) const; /** * Returns a raw pointer to the beginning of the time field. * @return Raw pointer to time field. diff --git a/tmtcpacket/pus/TmPacketPusA.cpp b/tmtcpacket/pus/TmPacketPusA.cpp index 841f7e40..d96f6aa7 100644 --- a/tmtcpacket/pus/TmPacketPusA.cpp +++ b/tmtcpacket/pus/TmPacketPusA.cpp @@ -49,27 +49,7 @@ uint16_t TmPacketPusA::getDataFieldSize() { return sizeof(PUSTmDataFieldHeaderPusA); } -bool TmPacketPusA::checkAndSetStamper() { - if (timeStamper == NULL) { - timeStamper = objectManager->get(timeStamperId); - if (timeStamper == NULL) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "TmPacketPusA::checkAndSetStamper: Stamper not found!" - << std::endl; -#endif - return false; - } - } - return true; -} - -ReturnValue_t TmPacketPusA::getPacketTime(timeval* timestamp) const { - size_t tempSize = 0; - return CCSDSTime::convertFromCcsds(timestamp, tmData->data_field.time, - &tempSize, sizeof(tmData->data_field.time)); -} - -uint8_t* TmPacketPusA::getPacketTimeRaw() const{ +uint8_t* TmPacketPusA::getPacketTimeRaw() const { return tmData->data_field.time; } @@ -92,7 +72,7 @@ void TmPacketPusA::initializeTmPacket(uint16_t apid, uint8_t service, tmData->data_field.service_subtype = subservice; tmData->data_field.subcounter = packetSubcounter; //Timestamp packet - if (checkAndSetStamper()) { + if (TmPacketBase::checkAndSetStamper()) { timeStamper->addTimeStamp(tmData->data_field.time, sizeof(tmData->data_field.time)); } diff --git a/tmtcpacket/pus/TmPacketPusA.h b/tmtcpacket/pus/TmPacketPusA.h index 21bdfd95..dd9a5d09 100644 --- a/tmtcpacket/pus/TmPacketPusA.h +++ b/tmtcpacket/pus/TmPacketPusA.h @@ -53,9 +53,6 @@ public: //! Maximum size of a TM Packet in this mission. //! TODO: Make this dependant on a config variable. static const uint32_t MISSION_TM_PACKET_MAX_SIZE = 2048; - //! First byte of secondary header for PUS-A packets. - //! TODO: Maybe also support PUS-C via config? - static const uint8_t VERSION_NUMBER_BYTE_PUS_A = 0b00010000; /** * This is the default constructor. @@ -76,19 +73,13 @@ public: uint16_t getSourceDataSize() override; uint16_t getDataFieldSize() override; - /** - * Interprets the "time"-field in the secondary header and returns it in - * timeval format. - * @return Converted timestamp of packet. - */ - ReturnValue_t getPacketTime(timeval* timestamp) const override; /** * Returns a raw pointer to the beginning of the time field. * @return Raw pointer to time field. */ uint8_t* getPacketTimeRaw() const override; - size_t getTimestampSize() const override; + size_t getPacketMinimumSize() const override; protected: diff --git a/tmtcpacket/pus/TmPacketPusC.cpp b/tmtcpacket/pus/TmPacketPusC.cpp index 99f50825..e6aa50dd 100644 --- a/tmtcpacket/pus/TmPacketPusC.cpp +++ b/tmtcpacket/pus/TmPacketPusC.cpp @@ -1,2 +1,88 @@ #include "TmPacketPusC.h" +#include "TmPacketBase.h" +#include "../../globalfunctions/CRC.h" +#include "../../globalfunctions/arrayprinter.h" +#include "../../objectmanager/ObjectManagerIF.h" +#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "../../timemanager/CCSDSTime.h" + +#include + + +TmPacketPusC::TmPacketPusC(uint8_t* setData) : TmPacketBase(setData) { + tmData = reinterpret_cast(setData); +} + +TmPacketPusC::~TmPacketPusC() { + //Nothing to do. +} + +uint8_t TmPacketPusC::getService() { + return tmData->dataField.serviceType; +} + +uint8_t TmPacketPusC::getSubService() { + return tmData->dataField.serviceSubtype; +} + +uint8_t* TmPacketPusC::getSourceData() { + return &tmData->data; +} + +uint16_t TmPacketPusC::getSourceDataSize() { + return getPacketDataLength() - sizeof(tmData->dataField) - CRC_SIZE + 1; +} + +void TmPacketPusC::setData(const uint8_t* p_Data) { + SpacePacketBase::setData(p_Data); + tmData = (TmPacketPointerPusC*) p_Data; +} + + +size_t TmPacketPusC::getPacketMinimumSize() const { + return TM_PACKET_MIN_SIZE; +} + +uint16_t TmPacketPusC::getDataFieldSize() { + return sizeof(PUSTmDataFieldHeaderPusC); +} + +uint8_t* TmPacketPusC::getPacketTimeRaw() const{ + return tmData->dataField.time; + +} + +void TmPacketPusC::initializeTmPacket(uint16_t apid, uint8_t service, + uint8_t subservice, uint16_t packetSubcounter, uint16_t destinationId = 0, + uint8_t timeRefField = 0) { + //Set primary header: + initSpacePacketHeader(false, true, apid); + //Set data Field Header: + //First, set to zero. + memset(&tmData->dataField, 0, sizeof(tmData->dataField)); + + // NOTE: In PUS-C, the PUS Version is 2 and specified for the first 4 bits. + // The other 4 bits of the first byte are the spacecraft time reference + // status. To change to PUS-C, set 0b00100000. + // Set CCSDS_secondary header flag to 0, version number to 001 and ack + // to 0000 + tmData->dataField.versionTimeReferenceField = VERSION_NUMBER_BYTE | timeRefField; + tmData->dataField.serviceType = service; + tmData->dataField.serviceSubtype = subservice; + tmData->dataField.subcounter = packetSubcounter; + tmData->dataField.destinationId = destinationId; + //Timestamp packet + if (checkAndSetStamper()) { + timeStamper->addTimeStamp(tmData->dataField.time, + sizeof(tmData->dataField.time)); + } +} + +void TmPacketPusC::setSourceDataSize(uint16_t size) { + setPacketDataLength(size + sizeof(PUSTmDataFieldHeaderPusC) + CRC_SIZE - 1); +} + +size_t TmPacketPusC::getTimestampSize() const { + return sizeof(tmData->dataField.time); +} diff --git a/tmtcpacket/pus/TmPacketPusC.h b/tmtcpacket/pus/TmPacketPusC.h index fec435c4..975d134f 100644 --- a/tmtcpacket/pus/TmPacketPusC.h +++ b/tmtcpacket/pus/TmPacketPusC.h @@ -1,8 +1,135 @@ #ifndef FSFW_TMTCPACKET_PUS_TMPACKETPUSC_H_ #define FSFW_TMTCPACKET_PUS_TMPACKETPUSC_H_ +#include "TmPacketBase.h" +#include "../SpacePacketBase.h" +#include "../../timemanager/TimeStamperIF.h" +#include "../../timemanager/Clock.h" +#include "../../objectmanager/SystemObjectIF.h" +namespace Factory{ +void setStaticFrameworkObjectIds(); +} +/** + * This struct defines a byte-wise structured PUS TM Data Field Header. + * Any optional fields in the header must be added or removed here. + * Currently, no Destination field is present, but an eigth-byte representation + * for a time tag. + * @ingroup tmtcpackets + */ +struct PUSTmDataFieldHeaderPusC { + uint8_t versionTimeReferenceField; + uint8_t serviceType; + uint8_t serviceSubtype; + uint16_t subcounter; + uint16_t destinationId; + uint8_t time[TimeStamperIF::MISSION_TIMESTAMP_SIZE]; +}; +/** + * This struct defines the data structure of a PUS Telecommand Packet when + * accessed via a pointer. + * @ingroup tmtcpackets + */ +struct TmPacketPointerPusC { + CCSDSPrimaryHeader primary; + PUSTmDataFieldHeaderPusC dataField; + uint8_t data; +}; + +/** + * PUS A packet implementation + * @ingroup tmtcpackets + */ +class TmPacketPusC: public TmPacketBase { + friend void (Factory::setStaticFrameworkObjectIds)(); +public: + /** + * This constant defines the minimum size of a valid PUS Telemetry Packet. + */ + static const uint32_t TM_PACKET_MIN_SIZE = (sizeof(CCSDSPrimaryHeader) + + sizeof(PUSTmDataFieldHeaderPusC) + 2); + //! Maximum size of a TM Packet in this mission. + //! TODO: Make this dependant on a config variable. + static const uint32_t MISSION_TM_PACKET_MAX_SIZE = 2048; + + /** + * This is the default constructor. + * It sets its internal data pointer to the address passed and also + * forwards the data pointer to the parent SpacePacketBase class. + * @param set_address The position where the packet data lies. + */ + TmPacketPusC( uint8_t* setData ); + /** + * This is the empty default destructor. + */ + virtual ~TmPacketPusC(); + + /* TmPacketBase implementations */ + uint8_t getService() override; + uint8_t getSubService() override; + uint8_t* getSourceData() override; + uint16_t getSourceDataSize() override; + uint16_t getDataFieldSize() override; + + /** + * Interprets the "time"-field in the secondary header and returns it in + * timeval format. + * @return Converted timestamp of packet. + */ + ReturnValue_t getPacketTime(timeval* timestamp) const override; + /** + * Returns a raw pointer to the beginning of the time field. + * @return Raw pointer to time field. + */ + uint8_t* getPacketTimeRaw() const override; + + size_t getTimestampSize() const override; + size_t getPacketMinimumSize() const override; + +protected: + /** + * A pointer to a structure which defines the data structure of + * the packet's data. + * + * To be hardware-safe, all elements are of byte size. + */ + TmPacketPointerPusC* tmData; + + /** + * Initializes the Tm Packet header. + * Does set the timestamp (to now), but not the error control field. + * @param apid APID used. + * @param service PUS Service + * @param subservice PUS Subservice + * @param packetSubcounter Additional subcounter used. + */ + void initializeTmPacket(uint16_t apid, uint8_t service, uint8_t subservice, + uint16_t packetSubcounter, uint16_t destinationId, uint8_t timeRefField); + + /** + * With this method, the packet data pointer can be redirected to another + * location. + * + * This call overwrites the parent's setData method to set both its + * @c tc_data pointer and the parent's @c data pointer. + * + * @param p_data A pointer to another PUS Telemetry Packet. + */ + void setData( const uint8_t* pData ); + + /** + * In case data was filled manually (almost never the case). + * @param size Size of source data (without CRC and data filed header!). + */ + void setSourceDataSize(uint16_t size); + + /** + * Checks if a time stamper is available and tries to set it if not. + * @return Returns false if setting failed. + */ + bool checkAndSetStamper(); +}; #endif /* FSFW_TMTCPACKET_PUS_TMPACKETPUSC_H_ */ diff --git a/tmtcpacket/pus/TmPacketStoredPusC.cpp b/tmtcpacket/pus/TmPacketStoredPusC.cpp new file mode 100644 index 00000000..bb27b80f --- /dev/null +++ b/tmtcpacket/pus/TmPacketStoredPusC.cpp @@ -0,0 +1,2 @@ +#include "TmPacketStoredPusC.h" + diff --git a/tmtcpacket/pus/TmPacketStoredPusC.h b/tmtcpacket/pus/TmPacketStoredPusC.h new file mode 100644 index 00000000..53b39414 --- /dev/null +++ b/tmtcpacket/pus/TmPacketStoredPusC.h @@ -0,0 +1,8 @@ +#ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTOREDPUSC_H_ +#define FSFW_TMTCPACKET_PUS_TMPACKETSTOREDPUSC_H_ + + + + + +#endif /* FSFW_TMTCPACKET_PUS_TMPACKETSTOREDPUSC_H_ */ From ed186b04dfdfb41f5574fac1d01fddd3a9162511 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 13 Apr 2021 00:19:09 +0200 Subject: [PATCH 053/389] finalized PUS C TM support --- pus/Service17Test.cpp | 15 +++- pus/Service1TelecommandVerification.cpp | 12 ++- pus/Service5EventReporting.cpp | 7 +- tmtcpacket/pus/CMakeLists.txt | 1 + tmtcpacket/pus/TmPacketPusC.cpp | 8 +- tmtcpacket/pus/TmPacketPusC.h | 15 +--- tmtcpacket/pus/TmPacketStored.h | 1 + tmtcpacket/pus/TmPacketStoredPusA.cpp | 3 +- tmtcpacket/pus/TmPacketStoredPusA.h | 10 +-- tmtcpacket/pus/TmPacketStoredPusC.cpp | 78 ++++++++++++++++++++ tmtcpacket/pus/TmPacketStoredPusC.h | 57 ++++++++++++++ tmtcservices/CommandingServiceBase.cpp | 18 ++++- unittest/user/unittest/core/CatchFactory.cpp | 4 +- 13 files changed, 196 insertions(+), 33 deletions(-) diff --git a/pus/Service17Test.cpp b/pus/Service17Test.cpp index cdd8817c..daed987a 100644 --- a/pus/Service17Test.cpp +++ b/pus/Service17Test.cpp @@ -1,8 +1,9 @@ #include "Service17Test.h" +#include -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "../serviceinterface/ServiceInterface.h" #include "../objectmanager/SystemObject.h" -#include "../tmtcpacket/pus/TmPacketStoredPusA.h" +#include "../tmtcpacket/pus/TmPacketStored.h" Service17Test::Service17Test(object_id_t objectId, @@ -17,15 +18,25 @@ Service17Test::~Service17Test() { ReturnValue_t Service17Test::handleRequest(uint8_t subservice) { switch(subservice) { case Subservice::CONNECTION_TEST: { +#if FSFW_USE_PUS_C_TELEMETRY == 0 TmPacketStoredPusA connectionPacket(apid, serviceId, Subservice::CONNECTION_TEST_REPORT, packetSubCounter++); +#else + TmPacketStoredPusC connectionPacket(apid, serviceId, + Subservice::CONNECTION_TEST_REPORT, packetSubCounter++); +#endif connectionPacket.sendPacket(requestQueue->getDefaultDestination(), requestQueue->getId()); return HasReturnvaluesIF::RETURN_OK; } case Subservice::EVENT_TRIGGER_TEST: { +#if FSFW_USE_PUS_C_TELEMETRY == 0 TmPacketStoredPusA connectionPacket(apid, serviceId, Subservice::CONNECTION_TEST_REPORT, packetSubCounter++); +#else + TmPacketStoredPusC connectionPacket(apid, serviceId, + Subservice::CONNECTION_TEST_REPORT, packetSubCounter++); +#endif connectionPacket.sendPacket(requestQueue->getDefaultDestination(), requestQueue->getId()); triggerEvent(TEST, 1234, 5678); diff --git a/pus/Service1TelecommandVerification.cpp b/pus/Service1TelecommandVerification.cpp index 358d1faa..7ef08de7 100644 --- a/pus/Service1TelecommandVerification.cpp +++ b/pus/Service1TelecommandVerification.cpp @@ -3,7 +3,7 @@ #include "../ipc/QueueFactory.h" #include "../tmtcservices/PusVerificationReport.h" -#include "../tmtcpacket/pus/TmPacketStoredPusA.h" +#include "../tmtcpacket/pus/TmPacketStored.h" #include "../serviceinterface/ServiceInterfaceStream.h" #include "../tmtcservices/AcceptsTelemetryIF.h" @@ -68,8 +68,13 @@ ReturnValue_t Service1TelecommandVerification::generateFailureReport( message->getTcSequenceControl(), message->getStep(), message->getErrorCode(), message->getParameter1(), message->getParameter2()); +#if FSFW_USE_PUS_C_TELEMETRY == 0 TmPacketStoredPusA tmPacket(apid, serviceId, message->getReportId(), packetSubCounter++, &report); +#else + TmPacketStoredPusC tmPacket(apid, serviceId, message->getReportId(), + packetSubCounter++, &report); +#endif ReturnValue_t result = tmPacket.sendPacket(tmQueue->getDefaultDestination(), tmQueue->getId()); return result; @@ -79,8 +84,13 @@ ReturnValue_t Service1TelecommandVerification::generateSuccessReport( PusVerificationMessage *message) { SuccessReport report(message->getReportId(),message->getTcPacketId(), message->getTcSequenceControl(),message->getStep()); +#if FSFW_USE_PUS_C_TELEMETRY == 0 TmPacketStoredPusA tmPacket(apid, serviceId, message->getReportId(), packetSubCounter++, &report); +#else + TmPacketStoredPusC tmPacket(apid, serviceId, message->getReportId(), + packetSubCounter++, &report); +#endif ReturnValue_t result = tmPacket.sendPacket(tmQueue->getDefaultDestination(), tmQueue->getId()); return result; diff --git a/pus/Service5EventReporting.cpp b/pus/Service5EventReporting.cpp index f6281fe9..62eefcb3 100644 --- a/pus/Service5EventReporting.cpp +++ b/pus/Service5EventReporting.cpp @@ -4,7 +4,7 @@ #include "../serviceinterface/ServiceInterfaceStream.h" #include "../events/EventManagerIF.h" #include "../ipc/QueueFactory.h" -#include "../tmtcpacket/pus/TmPacketStoredPusA.h" +#include "../tmtcpacket/pus/TmPacketStored.h" Service5EventReporting::Service5EventReporting(object_id_t objectId, @@ -52,8 +52,13 @@ ReturnValue_t Service5EventReporting::generateEventReport( { EventReport report(message.getEventId(),message.getReporter(), message.getParameter1(),message.getParameter2()); +#if FSFW_USE_PUS_C_TELEMETRY == 0 TmPacketStoredPusA tmPacket(PusServiceBase::apid, PusServiceBase::serviceId, message.getSeverity(), packetSubCounter++, &report); +#else + TmPacketStoredPusC tmPacket(PusServiceBase::apid, PusServiceBase::serviceId, + message.getSeverity(), packetSubCounter++, &report); +#endif ReturnValue_t result = tmPacket.sendPacket( requestQueue->getDefaultDestination(),requestQueue->getId()); if(result != HasReturnvaluesIF::RETURN_OK) { diff --git a/tmtcpacket/pus/CMakeLists.txt b/tmtcpacket/pus/CMakeLists.txt index 747ed070..cd4f49f1 100644 --- a/tmtcpacket/pus/CMakeLists.txt +++ b/tmtcpacket/pus/CMakeLists.txt @@ -5,6 +5,7 @@ target_sources(${LIB_FSFW_NAME} TmPacketBase.cpp TmPacketMinimal.cpp TmPacketStoredPusA.cpp + TmPacketStoredPusC.cpp TmPacketPusA.cpp TmPacketPusC.cpp TmPacketStoredBase.cpp diff --git a/tmtcpacket/pus/TmPacketPusC.cpp b/tmtcpacket/pus/TmPacketPusC.cpp index e6aa50dd..a6b4c428 100644 --- a/tmtcpacket/pus/TmPacketPusC.cpp +++ b/tmtcpacket/pus/TmPacketPusC.cpp @@ -54,8 +54,8 @@ uint8_t* TmPacketPusC::getPacketTimeRaw() const{ } void TmPacketPusC::initializeTmPacket(uint16_t apid, uint8_t service, - uint8_t subservice, uint16_t packetSubcounter, uint16_t destinationId = 0, - uint8_t timeRefField = 0) { + uint8_t subservice, uint16_t packetSubcounter, uint16_t destinationId, + uint8_t timeRefField) { //Set primary header: initSpacePacketHeader(false, true, apid); //Set data Field Header: @@ -67,13 +67,15 @@ void TmPacketPusC::initializeTmPacket(uint16_t apid, uint8_t service, // status. To change to PUS-C, set 0b00100000. // Set CCSDS_secondary header flag to 0, version number to 001 and ack // to 0000 + /* Only account for last 4 bytes */ + timeRefField &= 0b1111; tmData->dataField.versionTimeReferenceField = VERSION_NUMBER_BYTE | timeRefField; tmData->dataField.serviceType = service; tmData->dataField.serviceSubtype = subservice; tmData->dataField.subcounter = packetSubcounter; tmData->dataField.destinationId = destinationId; //Timestamp packet - if (checkAndSetStamper()) { + if (TmPacketBase::checkAndSetStamper()) { timeStamper->addTimeStamp(tmData->dataField.time, sizeof(tmData->dataField.time)); } diff --git a/tmtcpacket/pus/TmPacketPusC.h b/tmtcpacket/pus/TmPacketPusC.h index 975d134f..d072d5b9 100644 --- a/tmtcpacket/pus/TmPacketPusC.h +++ b/tmtcpacket/pus/TmPacketPusC.h @@ -73,19 +73,13 @@ public: uint16_t getSourceDataSize() override; uint16_t getDataFieldSize() override; - /** - * Interprets the "time"-field in the secondary header and returns it in - * timeval format. - * @return Converted timestamp of packet. - */ - ReturnValue_t getPacketTime(timeval* timestamp) const override; /** * Returns a raw pointer to the beginning of the time field. * @return Raw pointer to time field. */ uint8_t* getPacketTimeRaw() const override; - size_t getTimestampSize() const override; + size_t getPacketMinimumSize() const override; protected: @@ -106,7 +100,7 @@ protected: * @param packetSubcounter Additional subcounter used. */ void initializeTmPacket(uint16_t apid, uint8_t service, uint8_t subservice, - uint16_t packetSubcounter, uint16_t destinationId, uint8_t timeRefField); + uint16_t packetSubcounter, uint16_t destinationId = 0, uint8_t timeRefField = 0); /** * With this method, the packet data pointer can be redirected to another @@ -125,11 +119,6 @@ protected: */ void setSourceDataSize(uint16_t size); - /** - * Checks if a time stamper is available and tries to set it if not. - * @return Returns false if setting failed. - */ - bool checkAndSetStamper(); }; #endif /* FSFW_TMTCPACKET_PUS_TMPACKETPUSC_H_ */ diff --git a/tmtcpacket/pus/TmPacketStored.h b/tmtcpacket/pus/TmPacketStored.h index 53ef3f4d..fadda561 100644 --- a/tmtcpacket/pus/TmPacketStored.h +++ b/tmtcpacket/pus/TmPacketStored.h @@ -4,6 +4,7 @@ #include #if FSFW_USE_PUS_C_TELEMETRY == 1 +#include "TmPacketStoredPusC.h" #else #include "TmPacketStoredPusA.h" #endif diff --git a/tmtcpacket/pus/TmPacketStoredPusA.cpp b/tmtcpacket/pus/TmPacketStoredPusA.cpp index 4931f8d9..68102b62 100644 --- a/tmtcpacket/pus/TmPacketStoredPusA.cpp +++ b/tmtcpacket/pus/TmPacketStoredPusA.cpp @@ -1,7 +1,6 @@ #include "TmPacketStoredPusA.h" -#include "../../objectmanager/ObjectManagerIF.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "../../serviceinterface/ServiceInterface.h" #include "../../tmtcservices/TmTcMessage.h" #include diff --git a/tmtcpacket/pus/TmPacketStoredPusA.h b/tmtcpacket/pus/TmPacketStoredPusA.h index aeeba275..0cfcf0b8 100644 --- a/tmtcpacket/pus/TmPacketStoredPusA.h +++ b/tmtcpacket/pus/TmPacketStoredPusA.h @@ -1,18 +1,12 @@ #ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTORED_PUSA_H_ #define FSFW_TMTCPACKET_PUS_TMPACKETSTORED_PUSA_H_ -#include "TmPacketBase.h" #include "TmPacketStoredBase.h" +#include "TmPacketPusA.h" #include -#include "../../tmtcpacket/pus/TmPacketPusA.h" -#include "../../serialize/SerializeIF.h" -#include "../../storagemanager/StorageManagerIF.h" -#include "../../internalError/InternalErrorReporterIF.h" -#include "../../ipc/MessageQueueSenderIF.h" - /** - * This class generates a ECSS PUS Telemetry packet within a given + * This class generates a ECSS PUS A Telemetry packet within a given * intermediate storage. * As most packets are passed between tasks with the help of a storage * anyway, it seems logical to create a Packet-In-Storage access class diff --git a/tmtcpacket/pus/TmPacketStoredPusC.cpp b/tmtcpacket/pus/TmPacketStoredPusC.cpp index bb27b80f..f006412e 100644 --- a/tmtcpacket/pus/TmPacketStoredPusC.cpp +++ b/tmtcpacket/pus/TmPacketStoredPusC.cpp @@ -1,2 +1,80 @@ #include "TmPacketStoredPusC.h" +#include "../../serviceinterface/ServiceInterface.h" +#include "../../tmtcservices/TmTcMessage.h" + +#include + +TmPacketStoredPusC::TmPacketStoredPusC(store_address_t setAddress) : + TmPacketStoredBase(setAddress), TmPacketPusC(nullptr){ +} + +TmPacketStoredPusC::TmPacketStoredPusC(uint16_t apid, uint8_t service, + uint8_t subservice, uint16_t packetSubcounter, const uint8_t *data, + uint32_t size, const uint8_t *headerData, uint32_t headerSize, uint16_t destinationId, + uint8_t timeRefField) : + TmPacketPusC(nullptr) { + storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; + if (not TmPacketStoredBase::checkAndSetStore()) { + return; + } + uint8_t *pData = nullptr; + ReturnValue_t returnValue = store->getFreeElement(&storeAddress, + (getPacketMinimumSize() + size + headerSize), &pData); + + if (returnValue != store->RETURN_OK) { + TmPacketStoredBase::checkAndReportLostTm(); + return; + } + setData(pData); + initializeTmPacket(apid, service, subservice, packetSubcounter, destinationId, timeRefField); + memcpy(getSourceData(), headerData, headerSize); + memcpy(getSourceData() + headerSize, data, size); + setPacketDataLength( + size + headerSize + sizeof(PUSTmDataFieldHeaderPusC) + CRC_SIZE - 1); +} + +TmPacketStoredPusC::TmPacketStoredPusC(uint16_t apid, uint8_t service, + uint8_t subservice, uint16_t packetSubcounter, SerializeIF *content, + SerializeIF *header, uint16_t destinationId, uint8_t timeRefField) : + TmPacketPusC(nullptr) { + storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; + if (not TmPacketStoredBase::checkAndSetStore()) { + return; + } + size_t sourceDataSize = 0; + if (content != NULL) { + sourceDataSize += content->getSerializedSize(); + } + if (header != NULL) { + sourceDataSize += header->getSerializedSize(); + } + uint8_t *p_data = NULL; + ReturnValue_t returnValue = store->getFreeElement(&storeAddress, + (getPacketMinimumSize() + sourceDataSize), &p_data); + if (returnValue != store->RETURN_OK) { + TmPacketStoredBase::checkAndReportLostTm(); + } + setData(p_data); + initializeTmPacket(apid, service, subservice, packetSubcounter); + uint8_t *putDataHere = getSourceData(); + size_t size = 0; + if (header != NULL) { + header->serialize(&putDataHere, &size, sourceDataSize, + SerializeIF::Endianness::BIG); + } + if (content != NULL) { + content->serialize(&putDataHere, &size, sourceDataSize, + SerializeIF::Endianness::BIG); + } + setPacketDataLength( + sourceDataSize + sizeof(PUSTmDataFieldHeaderPusC) + CRC_SIZE - 1); +} + +uint8_t* TmPacketStoredPusC::getAllTmData() { + return getWholeData(); +} + +void TmPacketStoredPusC::setDataPointer(const uint8_t *newPointer) { + setData(newPointer); +} diff --git a/tmtcpacket/pus/TmPacketStoredPusC.h b/tmtcpacket/pus/TmPacketStoredPusC.h index 53b39414..83478a94 100644 --- a/tmtcpacket/pus/TmPacketStoredPusC.h +++ b/tmtcpacket/pus/TmPacketStoredPusC.h @@ -1,7 +1,64 @@ #ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTOREDPUSC_H_ #define FSFW_TMTCPACKET_PUS_TMPACKETSTOREDPUSC_H_ +#include +#include +/** + * This class generates a ECSS PUS A Telemetry packet within a given + * intermediate storage. + * As most packets are passed between tasks with the help of a storage + * anyway, it seems logical to create a Packet-In-Storage access class + * which saves the user almost all storage handling operation. + * Packets can both be newly created with the class and be "linked" to + * packets in a store with the help of a storeAddress. + * @ingroup tmtcpackets + */ +class TmPacketStoredPusC: + public TmPacketStoredBase, + public TmPacketPusC { +public: + /** + * This is a default constructor which does not set the data pointer. + * However, it does try to set the packet store. + */ + TmPacketStoredPusC( store_address_t setAddress ); + /** + * With this constructor, new space is allocated in the packet store and + * a new PUS Telemetry Packet is created there. + * Packet Application Data passed in data is copied into the packet. + * The Application data is passed in two parts, first a header, then a + * data field. This allows building a Telemetry Packet from two separate + * data sources. + * @param apid Sets the packet's APID field. + * @param service Sets the packet's Service ID field. + * This specifies the source service. + * @param subservice Sets the packet's Service Subtype field. + * This specifies the source sub-service. + * @param packet_counter Sets the Packet counter field of this packet + * @param data The payload data to be copied to the + * Application Data Field + * @param size The amount of data to be copied. + * @param headerData The header Data of the Application field, + * will be copied in front of data + * @param headerSize The size of the headerDataF + */ + TmPacketStoredPusC( uint16_t apid, uint8_t service, uint8_t subservice, + uint16_t packetCounter = 0, const uint8_t* data = nullptr, + uint32_t size = 0, const uint8_t* headerData = nullptr, + uint32_t headerSize = 0, uint16_t destinationId = 0, uint8_t timeRefField = 0); + /** + * Another ctor to directly pass structured content and header data to the + * packet to avoid additional buffers. + */ + TmPacketStoredPusC( uint16_t apid, uint8_t service, uint8_t subservice, + uint16_t packetCounter, SerializeIF* content, + SerializeIF* header = nullptr, uint16_t destinationId = 0, uint8_t timeRefField = 0); + + uint8_t* getAllTmData() override; + void setDataPointer(const uint8_t* newPointer) override; + +}; diff --git a/tmtcservices/CommandingServiceBase.cpp b/tmtcservices/CommandingServiceBase.cpp index 147c8796..fbd29468 100644 --- a/tmtcservices/CommandingServiceBase.cpp +++ b/tmtcservices/CommandingServiceBase.cpp @@ -1,12 +1,13 @@ #include "AcceptsTelemetryIF.h" #include "CommandingServiceBase.h" #include "TmTcMessage.h" +#include #include "../tcdistribution/PUSDistributorIF.h" #include "../objectmanager/ObjectManagerIF.h" #include "../ipc/QueueFactory.h" #include "../tmtcpacket/pus/TcPacketStored.h" -#include "../tmtcpacket/pus/TmPacketStoredPusA.h" +#include "../tmtcpacket/pus/TmPacketStored.h" #include "../serviceinterface/ServiceInterface.h" object_id_t CommandingServiceBase::defaultPacketSource = objects::NO_OBJECT; @@ -293,8 +294,13 @@ void CommandingServiceBase::handleRequestQueue() { ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, const uint8_t* data, size_t dataLen, const uint8_t* headerData, size_t headerSize) { +#if FSFW_USE_PUS_C_TELEMETRY == 0 TmPacketStoredPusA tmPacketStored(this->apid, this->service, subservice, this->tmPacketCounter, data, dataLen, headerData, headerSize); +#else + TmPacketStoredPusC tmPacketStored(this->apid, this->service, subservice, + this->tmPacketCounter, data, dataLen, headerData, headerSize); +#endif ReturnValue_t result = tmPacketStored.sendPacket( requestQueue->getDefaultDestination(), requestQueue->getId()); if (result == HasReturnvaluesIF::RETURN_OK) { @@ -311,8 +317,13 @@ ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, size_t size = 0; SerializeAdapter::serialize(&objectId, &pBuffer, &size, sizeof(object_id_t), SerializeIF::Endianness::BIG); +#if FSFW_USE_PUS_C_TELEMETRY == 0 TmPacketStoredPusA tmPacketStored(this->apid, this->service, subservice, this->tmPacketCounter, data, dataLen, buffer, size); +#else + TmPacketStoredPusC tmPacketStored(this->apid, this->service, subservice, + this->tmPacketCounter, data, dataLen, buffer, size); +#endif ReturnValue_t result = tmPacketStored.sendPacket( requestQueue->getDefaultDestination(), requestQueue->getId()); if (result == HasReturnvaluesIF::RETURN_OK) { @@ -324,8 +335,13 @@ ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, SerializeIF* content, SerializeIF* header) { +#if FSFW_USE_PUS_C_TELEMETRY == 0 TmPacketStoredPusA tmPacketStored(this->apid, this->service, subservice, this->tmPacketCounter, content, header); +#else + TmPacketStoredPusC tmPacketStored(this->apid, this->service, subservice, + this->tmPacketCounter, content, header); +#endif ReturnValue_t result = tmPacketStored.sendPacket( requestQueue->getDefaultDestination(), requestQueue->getId()); if (result == HasReturnvaluesIF::RETURN_OK) { diff --git a/unittest/user/unittest/core/CatchFactory.cpp b/unittest/user/unittest/core/CatchFactory.cpp index 2c4eaf24..9afb4fdd 100644 --- a/unittest/user/unittest/core/CatchFactory.cpp +++ b/unittest/user/unittest/core/CatchFactory.cpp @@ -1,6 +1,6 @@ +#include "CatchFactory.h" #include #include -#include "CatchFactory.h" #include #include @@ -74,7 +74,7 @@ void Factory::setStaticFrameworkObjectIds() { DeviceHandlerFailureIsolation::powerConfirmationId = objects::NO_OBJECT; - TmPacketStoredPusA::timeStamperId = objects::NO_OBJECT; + TmPacketBase::timeStamperId = objects::NO_OBJECT; } From fc7e401ddc86b744e6e2bdb42291f67ca8302073 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 13 Apr 2021 01:24:26 +0200 Subject: [PATCH 054/389] pus c working --- defaultcfg/fsfwconfig/FSFWConfig.h | 2 +- tmtcpacket/pus/TmPacketPusC.cpp | 6 ++++-- tmtcpacket/pus/TmPacketPusC.h | 6 ++++-- tmtcpacket/pus/TmPacketStoredPusC.cpp | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/defaultcfg/fsfwconfig/FSFWConfig.h b/defaultcfg/fsfwconfig/FSFWConfig.h index 9a07b4ea..23129402 100644 --- a/defaultcfg/fsfwconfig/FSFWConfig.h +++ b/defaultcfg/fsfwconfig/FSFWConfig.h @@ -45,7 +45,7 @@ namespace fsfwconfig { //! Default timestamp size. The default timestamp will be an eight byte CDC //! short timestamp. -static constexpr uint8_t FSFW_MISSION_TIMESTAMP_SIZE = 8; +static constexpr uint8_t FSFW_MISSION_TIMESTAMP_SIZE = 7; //! Configure the allocated pool sizes for the event manager. static constexpr size_t FSFW_EVENTMGMR_MATCHTREE_NODES = 240; diff --git a/tmtcpacket/pus/TmPacketPusC.cpp b/tmtcpacket/pus/TmPacketPusC.cpp index a6b4c428..12f0d3f8 100644 --- a/tmtcpacket/pus/TmPacketPusC.cpp +++ b/tmtcpacket/pus/TmPacketPusC.cpp @@ -72,8 +72,10 @@ void TmPacketPusC::initializeTmPacket(uint16_t apid, uint8_t service, tmData->dataField.versionTimeReferenceField = VERSION_NUMBER_BYTE | timeRefField; tmData->dataField.serviceType = service; tmData->dataField.serviceSubtype = subservice; - tmData->dataField.subcounter = packetSubcounter; - tmData->dataField.destinationId = destinationId; + tmData->dataField.subcounterMsb = packetSubcounter << 8 & 0xff; + tmData->dataField.subcounterLsb = packetSubcounter & 0xff; + tmData->dataField.destinationIdMsb = destinationId << 8 & 0xff; + tmData->dataField.destinationIdLsb = destinationId & 0xff; //Timestamp packet if (TmPacketBase::checkAndSetStamper()) { timeStamper->addTimeStamp(tmData->dataField.time, diff --git a/tmtcpacket/pus/TmPacketPusC.h b/tmtcpacket/pus/TmPacketPusC.h index d072d5b9..fdc27548 100644 --- a/tmtcpacket/pus/TmPacketPusC.h +++ b/tmtcpacket/pus/TmPacketPusC.h @@ -22,8 +22,10 @@ struct PUSTmDataFieldHeaderPusC { uint8_t versionTimeReferenceField; uint8_t serviceType; uint8_t serviceSubtype; - uint16_t subcounter; - uint16_t destinationId; + uint8_t subcounterMsb; + uint8_t subcounterLsb; + uint8_t destinationIdMsb; + uint8_t destinationIdLsb; uint8_t time[TimeStamperIF::MISSION_TIMESTAMP_SIZE]; }; diff --git a/tmtcpacket/pus/TmPacketStoredPusC.cpp b/tmtcpacket/pus/TmPacketStoredPusC.cpp index f006412e..7f774411 100644 --- a/tmtcpacket/pus/TmPacketStoredPusC.cpp +++ b/tmtcpacket/pus/TmPacketStoredPusC.cpp @@ -56,7 +56,7 @@ TmPacketStoredPusC::TmPacketStoredPusC(uint16_t apid, uint8_t service, TmPacketStoredBase::checkAndReportLostTm(); } setData(p_data); - initializeTmPacket(apid, service, subservice, packetSubcounter); + initializeTmPacket(apid, service, subservice, packetSubcounter, destinationId, timeRefField); uint8_t *putDataHere = getSourceData(); size_t size = 0; if (header != NULL) { From cf8a9996a75c41af890e3d51599814f75aa1fe40 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 13 Apr 2021 10:42:49 +0200 Subject: [PATCH 055/389] added new test stub --- unittest/tests/tmtcpacket/CMakeLists.txt | 3 +++ unittest/tests/tmtcpacket/PusTmTest.cpp | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 unittest/tests/tmtcpacket/CMakeLists.txt create mode 100644 unittest/tests/tmtcpacket/PusTmTest.cpp diff --git a/unittest/tests/tmtcpacket/CMakeLists.txt b/unittest/tests/tmtcpacket/CMakeLists.txt new file mode 100644 index 00000000..a1a4c1b6 --- /dev/null +++ b/unittest/tests/tmtcpacket/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${TARGET_NAME} PRIVATE + PusTmTest.cpp +) diff --git a/unittest/tests/tmtcpacket/PusTmTest.cpp b/unittest/tests/tmtcpacket/PusTmTest.cpp new file mode 100644 index 00000000..b28b04f6 --- /dev/null +++ b/unittest/tests/tmtcpacket/PusTmTest.cpp @@ -0,0 +1,3 @@ + + + From 62e409a9f22092fdd650a1fa776d3b33a18694c2 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 15 Apr 2021 10:07:39 +0200 Subject: [PATCH 056/389] doc fix --- tmtcpacket/pus/TmPacketPusC.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tmtcpacket/pus/TmPacketPusC.cpp b/tmtcpacket/pus/TmPacketPusC.cpp index 12f0d3f8..ca2bccdb 100644 --- a/tmtcpacket/pus/TmPacketPusC.cpp +++ b/tmtcpacket/pus/TmPacketPusC.cpp @@ -62,12 +62,7 @@ void TmPacketPusC::initializeTmPacket(uint16_t apid, uint8_t service, //First, set to zero. memset(&tmData->dataField, 0, sizeof(tmData->dataField)); - // NOTE: In PUS-C, the PUS Version is 2 and specified for the first 4 bits. - // The other 4 bits of the first byte are the spacecraft time reference - // status. To change to PUS-C, set 0b00100000. - // Set CCSDS_secondary header flag to 0, version number to 001 and ack - // to 0000 - /* Only account for last 4 bytes */ + /* Only account for last 4 bytes for time reference field */ timeRefField &= 0b1111; tmData->dataField.versionTimeReferenceField = VERSION_NUMBER_BYTE | timeRefField; tmData->dataField.serviceType = service; From 770356f8b68f2d897852b811d1ed61e0f57e6f69 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 19 Apr 2021 14:38:56 +0200 Subject: [PATCH 057/389] fix for warning print --- osal/linux/tcpipHelpers.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osal/linux/tcpipHelpers.cpp b/osal/linux/tcpipHelpers.cpp index 3e8f6009..d7c644ec 100644 --- a/osal/linux/tcpipHelpers.cpp +++ b/osal/linux/tcpipHelpers.cpp @@ -99,8 +99,8 @@ void tcpip::handleError(Protocol protocol, ErrorSources errorSrc, dur_millis_t s sif::warning << "tcpip::handleError: " << protocolString << " | " << errorSrcString << " | " << infoString << std::endl; #else - sif::printWarning("tcpip::handleError: %s | %s | %s\n", protocolString, - errorSrcString, infoString); + sif::printWarning("tcpip::handleError: %s | %s | %s\n", protocolString.c_str(), + errorSrcString.c_str(), infoString.c_str()); #endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ if(sleepDuration > 0) { From a66fc5339606495fd5222a2bbcf6160647289bf8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 20 Apr 2021 15:31:03 +0200 Subject: [PATCH 058/389] config define moved, better warning --- defaultcfg/fsfwconfig/FSFWConfig.h | 13 +++++++------ osal/linux/PosixThread.cpp | 10 +++++++++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/defaultcfg/fsfwconfig/FSFWConfig.h b/defaultcfg/fsfwconfig/FSFWConfig.h index e1e0ec64..fe18a2f4 100644 --- a/defaultcfg/fsfwconfig/FSFWConfig.h +++ b/defaultcfg/fsfwconfig/FSFWConfig.h @@ -40,6 +40,13 @@ //! Specify whether a special mode store is used for Subsystem components. #define FSFW_USE_MODESTORE 0 +//! Defines if the real time scheduler for linux should be used. +//! If set to 0, this will also disable priority settings for linux +//! as most systems will not allow to set nice values without privileges +//! For embedded linux system set this to 1. +//! If set to 1 the binary needs "cap_sys_nice=eip" privileges to run +#define FSFW_USE_REALTIME_FOR_LINUX 1 + namespace fsfwconfig { //! Default timestamp size. The default timestamp will be an eight byte CDC //! short timestamp. @@ -58,12 +65,6 @@ static constexpr uint8_t FSFW_CSB_FIFO_DEPTH = 6; static constexpr size_t FSFW_PRINT_BUFFER_SIZE = 124; -//! Defines if the real time scheduler for linux should be used. -//! If set to 0, this will also disable priority settings for linux -//! as most systems will not allow to set nice values without privileges -//! For embedded linux system set this to 1. -//! If set to 1 the binary needs "cap_sys_nice=eip" privileges to run -#define FSFW_USE_REALTIME_FOR_LINUX 1 } #endif /* CONFIG_FSFWCONFIG_H_ */ diff --git a/osal/linux/PosixThread.cpp b/osal/linux/PosixThread.cpp index f1cff992..72adfb14 100644 --- a/osal/linux/PosixThread.cpp +++ b/osal/linux/PosixThread.cpp @@ -223,8 +223,16 @@ void PosixThread::createTask(void* (*fnc_)(void*), void* arg_) { status = pthread_create(&thread,&attributes,fnc_,arg_); if(status != 0){ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "Posix Thread create failed with: " << + sif::error << "PosixThread::createTask: Failed with: " << strerror(status) << std::endl; + sif::error << "For FSFW_USE_REALTIME_FOR_LINUX == 1 make sure to call " << + "\"all sudo setcap 'cap_sys_nice=eip'\" on the application or set " + "/etc/security/limit.conf" << std::endl; +#else + sif::printError("PosixThread::createTask: Create failed with: %s\n", strerror(status)); + sif::printError("For FSFW_USE_REALTIME_FOR_LINUX == 1 make sure to call " + "\"all sudo setcap 'cap_sys_nice=eip'\" on the application or set " + "/etc/security/limit.conf\n"); #endif } From cc8c3aef3d3047c4a6692f24513459043a3c9cfd Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 20 Apr 2021 16:18:39 +0200 Subject: [PATCH 059/389] removed unused interface --- tmtcpacket/pus/TmPacketIF.h | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 tmtcpacket/pus/TmPacketIF.h diff --git a/tmtcpacket/pus/TmPacketIF.h b/tmtcpacket/pus/TmPacketIF.h deleted file mode 100644 index bd66523b..00000000 --- a/tmtcpacket/pus/TmPacketIF.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef FSFW_TMTCPACKET_PUS_TMPACKETIF_H_ -#define FSFW_TMTCPACKET_PUS_TMPACKETIF_H_ - - - - - -#endif /* FSFW_TMTCPACKET_PUS_TMPACKETIF_H_ */ From 3f91803422a97a448a23da550a05cae1564f900b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 20 Apr 2021 18:35:11 +0200 Subject: [PATCH 060/389] fixes from code review --- defaultcfg/fsfwconfig/FSFWConfig.h | 4 ++-- tmtcpacket/pus/TmPacketStoredPusC.h | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/defaultcfg/fsfwconfig/FSFWConfig.h b/defaultcfg/fsfwconfig/FSFWConfig.h index 2e5a7aae..1abdab4c 100644 --- a/defaultcfg/fsfwconfig/FSFWConfig.h +++ b/defaultcfg/fsfwconfig/FSFWConfig.h @@ -50,8 +50,8 @@ #define FSFW_USE_REALTIME_FOR_LINUX 1 namespace fsfwconfig { -//! Default timestamp size. The default timestamp will be an eight byte CDC -//! short timestamp. + +//! Default timestamp size. The default timestamp will be an seven byte CDC short timestamp. static constexpr uint8_t FSFW_MISSION_TIMESTAMP_SIZE = 7; //! Configure the allocated pool sizes for the event manager. diff --git a/tmtcpacket/pus/TmPacketStoredPusC.h b/tmtcpacket/pus/TmPacketStoredPusC.h index 83478a94..883dc0ff 100644 --- a/tmtcpacket/pus/TmPacketStoredPusC.h +++ b/tmtcpacket/pus/TmPacketStoredPusC.h @@ -5,7 +5,7 @@ #include /** - * This class generates a ECSS PUS A Telemetry packet within a given + * This class generates a ECSS PUS C Telemetry packet within a given * intermediate storage. * As most packets are passed between tasks with the help of a storage * anyway, it seems logical to create a Packet-In-Storage access class @@ -42,6 +42,9 @@ public: * @param headerData The header Data of the Application field, * will be copied in front of data * @param headerSize The size of the headerDataF + * @param destinationId Destination ID containing the application process ID as specified + * by PUS C + * @param timeRefField 4 bit time reference field as specified by PUS C */ TmPacketStoredPusC( uint16_t apid, uint8_t service, uint8_t subservice, uint16_t packetCounter = 0, const uint8_t* data = nullptr, From 3356ccc9d4bbbe336249b2fb4763adcaea0acd52 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 22 Apr 2021 17:45:46 +0200 Subject: [PATCH 061/389] tested new comment export string for retvals --- ipc/MessageQueueIF.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ipc/MessageQueueIF.h b/ipc/MessageQueueIF.h index 74ccb29a..217174f6 100644 --- a/ipc/MessageQueueIF.h +++ b/ipc/MessageQueueIF.h @@ -22,11 +22,11 @@ public: static const uint8_t INTERFACE_ID = CLASS_ID::MESSAGE_QUEUE_IF; //! No new messages on the queue static const ReturnValue_t EMPTY = MAKE_RETURN_CODE(1); - //! No space left for more messages + //! [EXPORT] : [COMMENT] No space left for more messages static const ReturnValue_t FULL = MAKE_RETURN_CODE(2); - //! Returned if a reply method was called without partner + //! [EXPORT] : [COMMENT] Returned if a reply method was called without partner static const ReturnValue_t NO_REPLY_PARTNER = MAKE_RETURN_CODE(3); - //! Returned if the target destination is invalid. + //! [EXPORT] : [COMMENT] Returned if the target destination is invalid. static constexpr ReturnValue_t DESTINATION_INVALID = MAKE_RETURN_CODE(4); virtual ~MessageQueueIF() {} From 7f1cbaef23d2c508e0bf88b190cb57eefd361e3e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 22 Apr 2021 18:09:23 +0200 Subject: [PATCH 062/389] updated default cmakelists --- defaultcfg/fsfwconfig/CMakeLists.txt | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/defaultcfg/fsfwconfig/CMakeLists.txt b/defaultcfg/fsfwconfig/CMakeLists.txt index cbd4ecde..178fc273 100644 --- a/defaultcfg/fsfwconfig/CMakeLists.txt +++ b/defaultcfg/fsfwconfig/CMakeLists.txt @@ -1,15 +1,23 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - ipc/missionMessageTypes.cpp - objects/FsfwFactory.cpp - pollingsequence/PollingSequenceFactory.cpp -) - -# Should be added to include path target_include_directories(${TARGET_NAME} PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} ) -if(NOT FSFW_CONFIG_PATH) - set(FSFW_CONFIG_PATH ${CMAKE_CURRENT_SOURCE_DIR}) +target_sources(${TARGET_NAME} PRIVATE + ipc/missionMessageTypes.cpp + pollingsequence/PollingSequenceFactory.cpp + objects/FsfwFactory.cpp +) + +# If a special translation file for object IDs exists, compile it. +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp") + target_sources(${TARGET_NAME} PRIVATE + objects/translateObjects.cpp + ) endif() +# If a special translation file for events exists, compile it. +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp") + target_sources(${TARGET_NAME} PRIVATE + events/translateEvents.cpp + ) +endif() From 18a9729c75875f8bee674f03dd93a5eeeb657a66 Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" Date: Sat, 24 Apr 2021 13:52:06 +0200 Subject: [PATCH 063/389] added multiple reply support --- devicehandlers/DeviceHandlerBase.cpp | 19 ++++++++++++------- devicehandlers/DeviceHandlerBase.h | 18 ++++++++++++++++-- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/devicehandlers/DeviceHandlerBase.cpp b/devicehandlers/DeviceHandlerBase.cpp index 0649aaa0..472b81f0 100644 --- a/devicehandlers/DeviceHandlerBase.cpp +++ b/devicehandlers/DeviceHandlerBase.cpp @@ -456,6 +456,15 @@ ReturnValue_t DeviceHandlerBase::insertInCommandMap(DeviceCommandId_t deviceComm } } +size_t DeviceHandlerBase::getNextReplyLength(DeviceCommandId_t commandId){ + DeviceReplyIter iter = deviceReplyMap.find(commandId); + if(iter != deviceReplyMap.end()) { + return iter->second.replyLen; + }else{ + return 0; + } +} + ReturnValue_t DeviceHandlerBase::updateReplyMapEntry(DeviceCommandId_t deviceReply, uint16_t delayCycles, uint16_t maxDelayCycles, bool periodic) { auto replyIter = deviceReplyMap.find(deviceReply); @@ -646,16 +655,12 @@ void DeviceHandlerBase::doGetWrite() { void DeviceHandlerBase::doSendRead() { ReturnValue_t result; - size_t requestLen = 0; + size_t replyLen = 0; if(cookieInfo.pendingCommand != deviceCommandMap.end()) { - DeviceReplyIter iter = deviceReplyMap.find( - cookieInfo.pendingCommand->first); - if(iter != deviceReplyMap.end()) { - requestLen = iter->second.replyLen; - } + replyLen = getNextReplyLength(cookieInfo.pendingCommand->first); } - result = communicationInterface->requestReceiveMessage(comCookie, requestLen); + result = communicationInterface->requestReceiveMessage(comCookie, replyLen); if (result == RETURN_OK) { cookieInfo.state = COOKIE_READ_SENT; diff --git a/devicehandlers/DeviceHandlerBase.h b/devicehandlers/DeviceHandlerBase.h index d61b0407..496c08ff 100644 --- a/devicehandlers/DeviceHandlerBase.h +++ b/devicehandlers/DeviceHandlerBase.h @@ -471,13 +471,27 @@ protected: ReturnValue_t insertInReplyMap(DeviceCommandId_t deviceCommand, uint16_t maxDelayCycles, LocalPoolDataSetBase* dataSet = nullptr, size_t replyLen = 0, bool periodic = false); + /** - * @brief A simple command to add a command to the commandList. + * @brief A simple command to add a command to the commandList. * @param deviceCommand The command to add * @return - @c RETURN_OK when the command was successfully inserted, * - @c RETURN_FAILED else. */ ReturnValue_t insertInCommandMap(DeviceCommandId_t deviceCommand); + + /** + * @brief This function returns the reply length of the next reply to read. + * + * @param deviceCommand The command which triggered the device reply. + * + * @details The default implementation assumes only one reply is triggered by the command. In + * case the command triggers multiple replies (e.g. one acknowledgment, one data, + * and one execution status reply), this function can be overwritten to get the + * reply length of the next reply to read. + */ + virtual size_t getNextReplyLength(DeviceCommandId_t deviceCommand); + /** * @brief This is a helper method to facilitate updating entries * in the reply map. @@ -953,7 +967,7 @@ protected: * - NO_REPLY_EXPECTED if there was no reply found. This is not an * error case as many commands do not expect a reply. */ - virtual ReturnValue_t enableReplyInReplyMap(DeviceCommandMap::iterator cmd, + virtual ReturnValue_t enableReplyInReplyMap(DeviceCommandMap::iterator command, uint8_t expectedReplies = 1, bool useAlternateId = false, DeviceCommandId_t alternateReplyID = 0); From 56d43f5b49c0a737e4604238dfe8ce0988ed4b04 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 24 Apr 2021 22:46:12 +0200 Subject: [PATCH 064/389] better output --- objectmanager/ObjectManager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/objectmanager/ObjectManager.cpp b/objectmanager/ObjectManager.cpp index 3c2be532..674fedc1 100644 --- a/objectmanager/ObjectManager.cpp +++ b/objectmanager/ObjectManager.cpp @@ -108,9 +108,9 @@ void ObjectManager::initialize() { result = it.second->checkObjectConnections(); if ( result != RETURN_OK ) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "ObjectManager::ObjectManager: Object " << std::hex << - (int) it.first << " connection check failed with code 0x" - << result << std::dec << std::endl; + sif::error << "ObjectManager::ObjectManager: Object 0x" << std::hex << + (int) it.first << " connection check failed with code 0x" << result << + std::dec << std::endl; #endif errorCount++; } From ff33a1274daf1af83832501036f2adbb807ba690 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 24 Apr 2021 23:54:13 +0200 Subject: [PATCH 065/389] deleted old bridge --- osal/linux/TmTcUnixUdpBridge.cpp | 157 ------------------------------- osal/linux/TmTcUnixUdpBridge.h | 49 ---------- 2 files changed, 206 deletions(-) delete mode 100644 osal/linux/TmTcUnixUdpBridge.cpp delete mode 100644 osal/linux/TmTcUnixUdpBridge.h diff --git a/osal/linux/TmTcUnixUdpBridge.cpp b/osal/linux/TmTcUnixUdpBridge.cpp deleted file mode 100644 index 62ac41c0..00000000 --- a/osal/linux/TmTcUnixUdpBridge.cpp +++ /dev/null @@ -1,157 +0,0 @@ -#include "TmTcUnixUdpBridge.h" -#include "../common/tcpipHelpers.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../ipc/MutexGuard.h" - -#include -#include -#include - -#include - -//! Debugging preprocessor define. -#define FSFW_UDP_SEND_WIRETAPPING_ENABLED 0 - -const std::string TmTcUnixUdpBridge::DEFAULT_UDP_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT; - -TmTcUnixUdpBridge::TmTcUnixUdpBridge(object_id_t objectId, object_id_t tcDestination, - object_id_t tmStoreId, object_id_t tcStoreId, std::string udpServerPort): - TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) { - if(udpServerPort == "") { - this->udpServerPort = DEFAULT_UDP_SERVER_PORT; - } - else { - this->udpServerPort = udpServerPort; - } - - mutex = MutexFactory::instance()->createMutex(); - communicationLinkUp = false; -} - -ReturnValue_t TmTcUnixUdpBridge::initialize() { - using namespace tcpip; - - ReturnValue_t result = TmTcBridge::initialize(); - if(result != HasReturnvaluesIF::RETURN_OK) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "TmTcUnixUdpBridge::initialize: TmTcBridge initialization failed!" - << std::endl; -#endif - return result; - } - - struct addrinfo *addrResult = nullptr; - struct addrinfo hints; - - std::memset(&hints, 0, sizeof(hints)); - hints.ai_family = AF_INET; - hints.ai_socktype = SOCK_DGRAM; - hints.ai_protocol = IPPROTO_UDP; - hints.ai_flags = AI_PASSIVE; - - /* Set up UDP socket: - https://man7.org/linux/man-pages/man3/getaddrinfo.3.html - Passing nullptr as the first parameter and specifying AI_PASSIVE in hints will cause - getaddrinfo to assign the address 0.0.0.0 (any address) */ - int retval = getaddrinfo(nullptr, udpServerPort.c_str(), &hints, &addrResult); - if (retval != 0) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "TmTcWinUdpBridge::TmTcWinUdpBridge: Retrieving address info failed!" << - std::endl; -#endif - return HasReturnvaluesIF::RETURN_FAILED; - } - - /* Set up UDP socket: https://man7.org/linux/man-pages/man7/ip.7.html */ - serverSocket = socket(addrResult->ai_family, addrResult->ai_socktype, addrResult->ai_protocol); - if(serverSocket < 0) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "TmTcUnixUdpBridge::TmTcUnixUdpBridge: Could not open UDP socket!" << - std::endl; -#else - sif::printError("TmTcUnixUdpBridge::TmTcUnixUdpBridge: Could not open UDP socket!\n"); -#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ - freeaddrinfo(addrResult); - handleError(Protocol::UDP, ErrorSources::SOCKET_CALL); - return HasReturnvaluesIF::RETURN_FAILED; - } - - retval = bind(serverSocket, addrResult->ai_addr, static_cast(addrResult->ai_addrlen)); - if(retval != 0) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "TmTcWinUdpBridge::TmTcWinUdpBridge: Could not bind " - "local port (" << udpServerPort << ") to server socket!" << std::endl; -#endif - freeaddrinfo(addrResult); - handleError(Protocol::UDP, ErrorSources::BIND_CALL); - return HasReturnvaluesIF::RETURN_FAILED; - } - - return HasReturnvaluesIF::RETURN_OK; -} - -TmTcUnixUdpBridge::~TmTcUnixUdpBridge() { - if(mutex != nullptr) { - MutexFactory::instance()->deleteMutex(mutex); - } - close(serverSocket); -} - -ReturnValue_t TmTcUnixUdpBridge::sendTm(const uint8_t *data, size_t dataLen) { - int flags = 0; - - /* The target address can be set by different threads so this lock ensures thread-safety */ - MutexGuard lock(mutex, timeoutType, mutexTimeoutMs); - -#if FSFW_CPP_OSTREAM_ENABLED == 1 && FSFW_UDP_SEND_WIRETAPPING_ENABLED == 1 - char ipAddress [15]; - sif::debug << "IP Address Sender: "<< - inet_ntop(AF_INET,&clientAddress.sin_addr.s_addr, ipAddress, 15) << std::endl; -#endif - - ssize_t bytesSent = sendto( - serverSocket, - data, - dataLen, - flags, - reinterpret_cast(&clientAddress), - clientAddressLen - ); - if(bytesSent < 0) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "TmTcUnixUdpBridge::sendTm: Send operation failed." << std::endl; -#endif - tcpip::handleError(tcpip::Protocol::UDP, tcpip::ErrorSources::SENDTO_CALL); - } - -#if FSFW_CPP_OSTREAM_ENABLED == 1 && FSFW_UDP_SEND_WIRETAPPING_ENABLED == 1 - sif::debug << "TmTcUnixUdpBridge::sendTm: " << bytesSent << " bytes were" - " sent." << std::endl; -#endif - - return HasReturnvaluesIF::RETURN_OK; -} - -void TmTcUnixUdpBridge::checkAndSetClientAddress(sockaddr_in& newAddress) { - /* The target address can be set by different threads so this lock ensures thread-safety */ - MutexGuard lock(mutex, timeoutType, mutexTimeoutMs); - -#if FSFW_CPP_OSTREAM_ENABLED == 1 && FSFW_UDP_RCV_WIRETAPPING_ENABLED == 1 - char ipAddress [15]; - sif::debug << "IP Address Sender: "<< inet_ntop(AF_INET, - &newAddress.sin_addr.s_addr, ipAddress, 15) << std::endl; - sif::debug << "IP Address Old: " << inet_ntop(AF_INET, - &clientAddress.sin_addr.s_addr, ipAddress, 15) << std::endl; -#endif - registerCommConnect(); - - /* Set new IP address to reply to. */ - clientAddress = newAddress; - clientAddressLen = sizeof(clientAddress); -} - -void TmTcUnixUdpBridge::setMutexProperties(MutexIF::TimeoutType timeoutType, - dur_millis_t timeoutMs) { - this->timeoutType = timeoutType; - this->mutexTimeoutMs = timeoutMs; -} diff --git a/osal/linux/TmTcUnixUdpBridge.h b/osal/linux/TmTcUnixUdpBridge.h deleted file mode 100644 index fd932714..00000000 --- a/osal/linux/TmTcUnixUdpBridge.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef FRAMEWORK_OSAL_LINUX_TMTCUNIXUDPBRIDGE_H_ -#define FRAMEWORK_OSAL_LINUX_TMTCUNIXUDPBRIDGE_H_ - -#include "../../tmtcservices/AcceptsTelecommandsIF.h" -#include "../../tmtcservices/TmTcBridge.h" -#include -#include -#include - -class TmTcUnixUdpBridge: - public TmTcBridge { - friend class UdpTcPollingTask; -public: - - /* The ports chosen here should not be used by any other process. - List of used ports on Linux: /etc/services */ - static const std::string DEFAULT_UDP_SERVER_PORT; - - TmTcUnixUdpBridge(object_id_t objectId, object_id_t tcDestination, - object_id_t tmStoreId, object_id_t tcStoreId, - std::string serverPort = ""); - virtual~ TmTcUnixUdpBridge(); - - /** - * Set properties of internal mutex. - */ - void setMutexProperties(MutexIF::TimeoutType timeoutType, dur_millis_t timeoutMs); - - ReturnValue_t initialize() override; - - void checkAndSetClientAddress(sockaddr_in& clientAddress); - -protected: - virtual ReturnValue_t sendTm(const uint8_t * data, size_t dataLen) override; - -private: - int serverSocket = 0; - std::string udpServerPort; - - struct sockaddr_in clientAddress; - socklen_t clientAddressLen = 0; - - //! Access to the client address is mutex protected as it is set by another task. - MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING; - dur_millis_t mutexTimeoutMs = 20; - MutexIF* mutex; -}; - -#endif /* FRAMEWORK_OSAL_LINUX_TMTCUNIXUDPBRIDGE_H_ */ From 413ff0d1b9f0a0ed172ff1b427aab8f3f8d40a16 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 26 Apr 2021 14:17:57 +0200 Subject: [PATCH 066/389] parameter wrapper bugfix --- parameters/ParameterHelper.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/parameters/ParameterHelper.cpp b/parameters/ParameterHelper.cpp index 24d0b2b1..e80c2c47 100644 --- a/parameters/ParameterHelper.cpp +++ b/parameters/ParameterHelper.cpp @@ -65,6 +65,9 @@ ReturnValue_t ParameterHelper::handleParameterMessage(CommandMessage *message) { ParameterWrapper ownerWrapper; result = owner->getParameter(domain, uniqueIdentifier, &ownerWrapper, &streamWrapper, linearIndex); + if(result != HasReturnvaluesIF::RETURN_OK) { + return result; + } result = ownerWrapper.copyFrom(&streamWrapper, linearIndex); if (result != HasReturnvaluesIF::RETURN_OK) { From 097244bf8b429d1b107343a3dbd77fa537a9c86d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 29 Apr 2021 19:51:38 +0200 Subject: [PATCH 067/389] use timestamp size from FSFWConfig.h --- timemanager/TimeStamperIF.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/timemanager/TimeStamperIF.h b/timemanager/TimeStamperIF.h index 57b7f014..534cc734 100644 --- a/timemanager/TimeStamperIF.h +++ b/timemanager/TimeStamperIF.h @@ -2,6 +2,7 @@ #define FSFW_TIMEMANAGER_TIMESTAMPERIF_H_ #include "../returnvalues/HasReturnvaluesIF.h" +#include /** * A class implementing this IF provides facilities to add a time stamp to the @@ -16,8 +17,7 @@ public: //! This is a mission-specific constant and determines the total //! size reserved for timestamps. - //! TODO: Default define in FSFWConfig ? - static const uint8_t MISSION_TIMESTAMP_SIZE = 8; + static const uint8_t MISSION_TIMESTAMP_SIZE = fsfwconfig::FSFW_MISSION_TIMESTAMP_SIZE; virtual ReturnValue_t addTimeStamp(uint8_t* buffer, const uint8_t maxSize) = 0; virtual ~TimeStamperIF() {} From f3530d3c7ede036e02a65963fcf36da4e5dc024a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 30 Apr 2021 23:59:45 +0200 Subject: [PATCH 068/389] small format change for event to test --- datalinklayer/DataLinkLayer.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/datalinklayer/DataLinkLayer.h b/datalinklayer/DataLinkLayer.h index 17a57d61..27e69006 100644 --- a/datalinklayer/DataLinkLayer.h +++ b/datalinklayer/DataLinkLayer.h @@ -19,7 +19,8 @@ class VirtualChannelReception; class DataLinkLayer : public CCSDSReturnValuesIF { public: static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SYSTEM_1; - static const Event RF_AVAILABLE = MAKE_EVENT(0, severity::INFO); //!< A RF available signal was detected. P1: raw RFA state, P2: 0 + //! [EXPORT] : [COMMENT] A RF available signal was detected. P1: raw RFA state, P2: 0 + static const Event RF_AVAILABLE = MAKE_EVENT(0, severity::INFO); static const Event RF_LOST = MAKE_EVENT(1, severity::INFO); //!< A previously found RF available signal was lost. P1: raw RFA state, P2: 0 static const Event BIT_LOCK = MAKE_EVENT(2, severity::INFO); //!< A Bit Lock signal. Was detected. P1: raw BLO state, P2: 0 static const Event BIT_LOCK_LOST = MAKE_EVENT(3, severity::INFO); //!< A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0 From 126def219b30b1ca97c8fbc03825ed139e2a56ec Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 5 May 2021 12:59:42 +0200 Subject: [PATCH 069/389] continued tmtc server and bridge --- osal/common/CMakeLists.txt | 1 + osal/common/TcpTmTcBridge.cpp | 57 ++++++++++++ osal/common/TcpTmTcBridge.h | 54 +++++++++++ osal/common/TcpTmTcServer.cpp | 152 +++++++++++++++++++++++-------- osal/common/TcpTmTcServer.h | 26 +++++- osal/common/UdpTcPollingTask.cpp | 4 +- osal/common/UdpTcPollingTask.h | 8 +- osal/common/UdpTmTcBridge.cpp | 21 ++--- osal/common/UdpTmTcBridge.h | 6 +- osal/common/tcpipCommon.cpp | 3 + osal/common/tcpipCommon.h | 3 +- 11 files changed, 270 insertions(+), 65 deletions(-) create mode 100644 osal/common/TcpTmTcBridge.cpp create mode 100644 osal/common/TcpTmTcBridge.h diff --git a/osal/common/CMakeLists.txt b/osal/common/CMakeLists.txt index af76484d..b7c8c033 100644 --- a/osal/common/CMakeLists.txt +++ b/osal/common/CMakeLists.txt @@ -5,6 +5,7 @@ if(DEFINED WIN32 OR DEFINED UNIX) UdpTcPollingTask.cpp UdpTmTcBridge.cpp TcpTmTcServer.cpp + TcpTmTcBridge.cpp ) endif() diff --git a/osal/common/TcpTmTcBridge.cpp b/osal/common/TcpTmTcBridge.cpp new file mode 100644 index 00000000..a88b68e9 --- /dev/null +++ b/osal/common/TcpTmTcBridge.cpp @@ -0,0 +1,57 @@ +#include "TcpTmTcBridge.h" +#include "tcpipHelpers.h" + +#include +#include +#include + +#ifdef _WIN32 + +#include + +#elif defined(__unix__) + +#include +#include + +#endif + +const std::string TcpTmTcBridge::DEFAULT_UDP_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT; + +TcpTmTcBridge::TcpTmTcBridge(object_id_t objectId, object_id_t tcDestination, + object_id_t tmStoreId, object_id_t tcStoreId): + TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) { + mutex = MutexFactory::instance()->createMutex(); + communicationLinkUp = false; +} + +ReturnValue_t TcpTmTcBridge::initialize() { + ReturnValue_t result = TmTcBridge::initialize(); + if(result != HasReturnvaluesIF::RETURN_OK) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "TmTcUdpBridge::initialize: TmTcBridge initialization failed!" + << std::endl; +#endif + return result; + } + + return HasReturnvaluesIF::RETURN_OK; +} + +TcpTmTcBridge::~TcpTmTcBridge() { + if(mutex != nullptr) { + MutexFactory::instance()->deleteMutex(mutex); + } +} + +ReturnValue_t TcpTmTcBridge::sendTm(const uint8_t *data, size_t dataLen) { + + return HasReturnvaluesIF::RETURN_OK; +} + + +void TcpTmTcBridge::setMutexProperties(MutexIF::TimeoutType timeoutType, + dur_millis_t timeoutMs) { + this->timeoutType = timeoutType; + this->mutexTimeoutMs = timeoutMs; +} diff --git a/osal/common/TcpTmTcBridge.h b/osal/common/TcpTmTcBridge.h new file mode 100644 index 00000000..db45fca8 --- /dev/null +++ b/osal/common/TcpTmTcBridge.h @@ -0,0 +1,54 @@ +#ifndef FSFW_OSAL_COMMON_TCPTMTCBRIDGE_H_ +#define FSFW_OSAL_COMMON_TCPTMTCBRIDGE_H_ + +#include "TcpIpBase.h" +#include "../../tmtcservices/TmTcBridge.h" + +#ifdef _WIN32 + +#include + +#elif defined(__unix__) + +#include + +#endif + +#include + +/** + * @brief This class should be used with the UdpTcPollingTask to implement a UDP server + * for receiving and sending PUS TMTC. + */ +class TcpTmTcBridge: + public TmTcBridge { + //friend class UdpTcPollingTask; +public: + /* The ports chosen here should not be used by any other process. */ + static const std::string DEFAULT_UDP_SERVER_PORT; + + TcpTmTcBridge(object_id_t objectId, object_id_t tcDestination, + object_id_t tmStoreId = objects::TM_STORE, + object_id_t tcStoreId = objects::TC_STORE); + virtual~ TcpTmTcBridge(); + + /** + * Set properties of internal mutex. + */ + void setMutexProperties(MutexIF::TimeoutType timeoutType, dur_millis_t timeoutMs); + + ReturnValue_t initialize() override; + +protected: + virtual ReturnValue_t sendTm(const uint8_t * data, size_t dataLen) override; + +private: + + //! Access to the client address is mutex protected as it is set by another task. + MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING; + dur_millis_t mutexTimeoutMs = 20; + MutexIF* mutex; +}; + +#endif /* FSFW_OSAL_COMMON_TCPTMTCBRIDGE_H_ */ + diff --git a/osal/common/TcpTmTcServer.cpp b/osal/common/TcpTmTcServer.cpp index 08a62ffb..8717783e 100644 --- a/osal/common/TcpTmTcServer.cpp +++ b/osal/common/TcpTmTcServer.cpp @@ -1,6 +1,12 @@ #include "TcpTmTcServer.h" +#include "TcpTmTcBridge.h" #include "tcpipHelpers.h" + +#include "../../container/SharedRingBuffer.h" +#include "../../ipc/MessageQueueSenderIF.h" +#include "../../objectmanager/ObjectManagerIF.h" #include "../../serviceinterface/ServiceInterface.h" +#include "../../tmtcservices/TmTcMessage.h" #ifdef _WIN32 #include @@ -12,12 +18,17 @@ #endif -const std::string TcpTmTcServer::DEFAULT_TCP_SERVER_PORT = "7301"; -const std::string TcpTmTcServer::DEFAULT_TCP_CLIENT_PORT = "7302"; +#ifndef FSFW_TCP_RECV_WIRETAPPING_ENABLED +#define FSFW_TCP_RECV_WIRETAPPING_ENABLED 0 +#endif -TcpTmTcServer::TcpTmTcServer(object_id_t objectId, object_id_t tmtcUnixUdpBridge, +const std::string TcpTmTcServer::DEFAULT_TCP_SERVER_PORT = "7301"; + +TcpTmTcServer::TcpTmTcServer(object_id_t objectId, object_id_t tmtcTcpBridge, + /*SharedRingBuffer* tcpRingBuffer, */ size_t receptionBufferSize, std::string customTcpServerPort): - SystemObject(objectId), tcpPort(customTcpServerPort) { + SystemObject(objectId), tmtcBridgeId(tmtcTcpBridge), tcpPort(customTcpServerPort), + receptionBuffer(receptionBufferSize) /*, tcpRingBuffer(tcpRingBuffer) */ { if(tcpPort == "") { tcpPort = DEFAULT_TCP_SERVER_PORT; } @@ -26,11 +37,34 @@ TcpTmTcServer::TcpTmTcServer(object_id_t objectId, object_id_t tmtcUnixUdpBridge ReturnValue_t TcpTmTcServer::initialize() { using namespace tcpip; + /* + if(tcpRingBuffer == nullptr) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "TcpTmTcServer::initialize: Invalid ring buffer!" << std::endl; +#else + sif::printError("TcpTmTcServer::initialize: Invalid ring buffer!\n"); +#endif + return ObjectManagerIF::CHILD_INIT_FAILED; + } + */ + ReturnValue_t result = TcpIpBase::initialize(); if(result != HasReturnvaluesIF::RETURN_OK) { return result; } + tcStore = objectManager->get(objects::TC_STORE); + if (tcStore == nullptr) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "TcpTmTcServer::initialize: TC store uninitialized!" << std::endl; +#else + sif::printError("TcpTmTcServer::initialize: TC store uninitialized!\n"); +#endif + return ObjectManagerIF::CHILD_INIT_FAILED; + } + + tmtcBridge = objectManager->get(tmtcBridgeId); + int retval = 0; struct addrinfo *addrResult = nullptr; struct addrinfo hints = {}; @@ -42,10 +76,6 @@ ReturnValue_t TcpTmTcServer::initialize() { retval = getaddrinfo(nullptr, tcpPort.c_str(), &hints, &addrResult); if (retval != 0) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "TcWinTcpServer::TcpTmTcServer: Retrieving address info failed!" << - std::endl; -#endif handleError(Protocol::TCP, ErrorSources::GETADDRINFO_CALL); return HasReturnvaluesIF::RETURN_FAILED; } @@ -54,9 +84,6 @@ ReturnValue_t TcpTmTcServer::initialize() { listenerTcpSocket = socket(addrResult->ai_family, addrResult->ai_socktype, addrResult->ai_protocol); if(listenerTcpSocket == INVALID_SOCKET) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "TcWinTcpServer::TcWinTcpServer: Socket creation failed!" << std::endl; -#endif freeaddrinfo(addrResult); handleError(Protocol::TCP, ErrorSources::SOCKET_CALL); return HasReturnvaluesIF::RETURN_FAILED; @@ -64,10 +91,6 @@ ReturnValue_t TcpTmTcServer::initialize() { retval = bind(listenerTcpSocket, addrResult->ai_addr, static_cast(addrResult->ai_addrlen)); if(retval == SOCKET_ERROR) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "TcWinTcpServer::TcpTmTcServer: Binding socket failed!" << - std::endl; -#endif freeaddrinfo(addrResult); handleError(Protocol::TCP, ErrorSources::BIND_CALL); return HasReturnvaluesIF::RETURN_FAILED; @@ -85,7 +108,7 @@ TcpTmTcServer::~TcpTmTcServer() { ReturnValue_t TcpTmTcServer::performOperation(uint8_t opCode) { using namespace tcpip; /* If a connection is accepted, the corresponding socket will be assigned to the new socket */ - socket_t clientSocket = 0; + socket_t connSocket = 0; sockaddr clientSockAddr = {}; socklen_t connectorSockAddrLen = 0; int retval = 0; @@ -98,35 +121,92 @@ ReturnValue_t TcpTmTcServer::performOperation(uint8_t opCode) { continue; } - clientSocket = accept(listenerTcpSocket, &clientSockAddr, &connectorSockAddrLen); + connSocket = accept(listenerTcpSocket, &clientSockAddr, &connectorSockAddrLen); - if(clientSocket == INVALID_SOCKET) { + if(connSocket == INVALID_SOCKET) { handleError(Protocol::TCP, ErrorSources::ACCEPT_CALL, 500); - closeSocket(clientSocket); + closeSocket(connSocket); continue; }; - retval = recv(clientSocket, reinterpret_cast(receptionBuffer.data()), - receptionBuffer.size(), 0); - if(retval > 0) { -#if FSFW_TCP_RCV_WIRETAPPING_ENABLED == 1 - sif::info << "TcpTmTcServer::performOperation: Received " << retval << " bytes." - std::endl; -#endif - handleError(Protocol::TCP, ErrorSources::RECV_CALL, 500); - } - else if(retval == 0) { - - } - else { - - } + handleServerOperation(connSocket); /* Done, shut down connection */ - retval = shutdown(clientSocket, SHUT_SEND); - closeSocket(clientSocket); + retval = shutdown(connSocket, SHUT_SEND); + if(retval != 0) { + handleError(Protocol::TCP, ErrorSources::SHUTDOWN_CALL); + } + closeSocket(connSocket); } return HasReturnvaluesIF::RETURN_OK; } +ReturnValue_t TcpTmTcServer::initializeAfterTaskCreation() { + /* Initialize the destination after task creation. This ensures + that the destination has already been set in the TMTC bridge. */ + targetTcDestination = tmtcBridge->getRequestQueue(); +// +// if(tcpRingBuffer != nullptr) { +// auto fifoCheck = tcpRingBuffer->getReceiveSizesFIFO(); +// if (fifoCheck == nullptr) { +//#if FSFW_CPP_OSTREAM_ENABLED == 1 +// sif::error << "TcpTmTcServer::initializeAfterTaskCreation: " +// "TCP ring buffer does not have a FIFO!" << std::endl; +//#else +// sif::printError("TcpTmTcServer::initialize: TCP ring buffer does not have a FIFO!\n"); +//#endif /* FSFW_CPP_OSTREAM_ENABLED == 0 */ +// } +// } + + return HasReturnvaluesIF::RETURN_OK; +} + +void TcpTmTcServer::handleServerOperation(socket_t connSocket) { + int retval = 0; + do { + retval = recv(connSocket, + reinterpret_cast(receptionBuffer.data()), + receptionBuffer.capacity(), + tcpFlags); + if (retval > 0) { + handleTcReception(retval); + } + else if(retval == 0) { + /* Client has finished sending telecommands, send telemetry now */ + } + else { + /* Should not happen */ + } + } while(retval > 0); +} + +ReturnValue_t TcpTmTcServer::handleTcReception(size_t bytesRecvd) { +#if FSFW_TCP_RECV_WIRETAPPING_ENABLED == 1 + arrayprinter::print(receptionBuffer.data(), bytesRead); +#endif + store_address_t storeId; + ReturnValue_t result = tcStore->addData(&storeId, receptionBuffer.data(), bytesRecvd); + if (result != HasReturnvaluesIF::RETURN_OK) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning<< "TcpTmTcServer::handleServerOperation: Data storage failed." << std::endl; + sif::warning << "Packet size: " << bytesRecvd << std::endl; +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + } + + TmTcMessage message(storeId); + + result = MessageQueueSenderIF::sendMessage(targetTcDestination, &message); + if (result != HasReturnvaluesIF::RETURN_OK) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "UdpTcPollingTask::handleSuccessfullTcRead: " + " Sending message to queue failed" << std::endl; +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + tcStore->deleteData(storeId); + } + return result; +} diff --git a/osal/common/TcpTmTcServer.h b/osal/common/TcpTmTcServer.h index 4dcc77a2..6db6621d 100644 --- a/osal/common/TcpTmTcServer.h +++ b/osal/common/TcpTmTcServer.h @@ -2,7 +2,11 @@ #define FSFW_OSAL_WINDOWS_TCWINTCPSERVER_H_ #include "TcpIpBase.h" +#include "../../ipc/messageQueueDefinitions.h" +#include "../../ipc/MessageQueueIF.h" +#include "../../objectmanager/frameworkObjects.h" #include "../../objectmanager/SystemObject.h" +#include "../../storagemanager/StorageManagerIF.h" #include "../../tasks/ExecutableObjectIF.h" #ifdef __unix__ @@ -12,8 +16,9 @@ #include #include -//! Debugging preprocessor define. -#define FSFW_TCP_RCV_WIRETAPPING_ENABLED 0 +class TcpTmTcBridge; +//class SharedRingBuffer; + /** * @brief Windows TCP server used to receive telecommands on a Windows Host @@ -28,26 +33,39 @@ public: /* The ports chosen here should not be used by any other process. */ static const std::string DEFAULT_TCP_SERVER_PORT; static const std::string DEFAULT_TCP_CLIENT_PORT; + static constexpr size_t ETHERNET_MTU_SIZE = 1500; - TcpTmTcServer(object_id_t objectId, object_id_t tmtcUnixUdpBridge, + TcpTmTcServer(object_id_t objectId, object_id_t tmtcTcpBridge /*, SharedRingBuffer* tcpRingBuffer*/, + size_t receptionBufferSize = ETHERNET_MTU_SIZE, std::string customTcpServerPort = ""); virtual~ TcpTmTcServer(); ReturnValue_t initialize() override; ReturnValue_t performOperation(uint8_t opCode) override; + ReturnValue_t initializeAfterTaskCreation() override; + +protected: + StorageManagerIF* tcStore = nullptr; private: + //! TMTC bridge is cached. + object_id_t tmtcBridgeId = objects::NO_OBJECT; + TcpTmTcBridge* tmtcBridge = nullptr; std::string tcpPort; + int tcpFlags = 0; socket_t listenerTcpSocket = 0; struct sockaddr tcpAddress; + MessageQueueId_t targetTcDestination = MessageQueueIF::NO_QUEUE; int tcpAddrLen = sizeof(tcpAddress); int currentBacklog = 3; std::vector receptionBuffer; + //SharedRingBuffer* tcpRingBuffer; int tcpSockOpt = 0; - + void handleServerOperation(socket_t connSocket); + ReturnValue_t handleTcReception(size_t bytesRecvd); }; #endif /* FSFW_OSAL_WINDOWS_TCWINTCPSERVER_H_ */ diff --git a/osal/common/UdpTcPollingTask.cpp b/osal/common/UdpTcPollingTask.cpp index 47f67b29..d79e2447 100644 --- a/osal/common/UdpTcPollingTask.cpp +++ b/osal/common/UdpTcPollingTask.cpp @@ -18,9 +18,9 @@ #define FSFW_UDP_RECV_WIRETAPPING_ENABLED 0 UdpTcPollingTask::UdpTcPollingTask(object_id_t objectId, - object_id_t tmtcUnixUdpBridge, size_t maxRecvSize, + object_id_t tmtcUdpBridge, size_t maxRecvSize, double timeoutSeconds): SystemObject(objectId), - tmtcBridgeId(tmtcUnixUdpBridge) { + tmtcBridgeId(tmtcUdpBridge) { if(frameSize > 0) { this->frameSize = frameSize; } diff --git a/osal/common/UdpTcPollingTask.h b/osal/common/UdpTcPollingTask.h index 052eced5..cfe74b34 100644 --- a/osal/common/UdpTcPollingTask.h +++ b/osal/common/UdpTcPollingTask.h @@ -1,5 +1,5 @@ -#ifndef FSFW_OSAL_WINDOWS_TCSOCKETPOLLINGTASK_H_ -#define FSFW_OSAL_WINDOWS_TCSOCKETPOLLINGTASK_H_ +#ifndef FSFW_OSAL_COMMON_UDPTCPOLLINGTASK_H_ +#define FSFW_OSAL_COMMON_UDPTCPOLLINGTASK_H_ #include "UdpTmTcBridge.h" #include "../../objectmanager/SystemObject.h" @@ -22,7 +22,7 @@ public: //! 0.5 default milliseconds timeout for now. static constexpr timeval DEFAULT_TIMEOUT = {0, 500}; - UdpTcPollingTask(object_id_t objectId, object_id_t tmtcUnixUdpBridge, + UdpTcPollingTask(object_id_t objectId, object_id_t tmtcUdpBridge, size_t maxRecvSize = 0, double timeoutSeconds = -1); virtual~ UdpTcPollingTask(); @@ -57,4 +57,4 @@ private: ReturnValue_t handleSuccessfullTcRead(size_t bytesRead); }; -#endif /* FRAMEWORK_OSAL_LINUX_TCSOCKETPOLLINGTASK_H_ */ +#endif /* FSFW_OSAL_COMMON_UDPTCPOLLINGTASK_H_ */ diff --git a/osal/common/UdpTmTcBridge.cpp b/osal/common/UdpTmTcBridge.cpp index ba23f521..ccbb194e 100644 --- a/osal/common/UdpTmTcBridge.cpp +++ b/osal/common/UdpTmTcBridge.cpp @@ -16,7 +16,9 @@ #endif //! Debugging preprocessor define. +#ifndef FSFW_UDP_SEND_WIRETAPPING_ENABLED #define FSFW_UDP_SEND_WIRETAPPING_ENABLED 0 +#endif const std::string UdpTmTcBridge::DEFAULT_UDP_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT; @@ -38,7 +40,7 @@ ReturnValue_t UdpTmTcBridge::initialize() { ReturnValue_t result = TmTcBridge::initialize(); if(result != HasReturnvaluesIF::RETURN_OK) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "TmTcUdpBridge::initialize: TmTcBridge initialization failed!" + sif::error << "UdpTmTcBridge::initialize: TmTcBridge initialization failed!" << std::endl; #endif return result; @@ -54,10 +56,10 @@ ReturnValue_t UdpTmTcBridge::initialize() { /* Tell the user that we could not find a usable */ /* Winsock DLL. */ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "TmTcUdpBridge::TmTcUdpBridge: WSAStartup failed with error: " << + sif::error << "UdpTmTcBridge::UdpTmTcBridge: WSAStartup failed with error: " << err << std::endl; #else - sif::printError("TmTcUdpBridge::TmTcUdpBridge: WSAStartup failed with error: %d\n", + sif::printError("UdpTmTcBridge::UdpTmTcBridge: WSAStartup failed with error: %d\n", err); #endif return HasReturnvaluesIF::RETURN_FAILED; @@ -78,19 +80,12 @@ ReturnValue_t UdpTmTcBridge::initialize() { getaddrinfo to assign the address 0.0.0.0 (any address) */ int retval = getaddrinfo(nullptr, udpServerPort.c_str(), &hints, &addrResult); if (retval != 0) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "TmTcUdpBridge::TmTcUdpBridge: Retrieving address info failed!" << - std::endl; -#endif + tcpip::handleError(tcpip::Protocol::UDP, tcpip::ErrorSources::GETADDRINFO_CALL); return HasReturnvaluesIF::RETURN_FAILED; } serverSocket = socket(addrResult->ai_family, addrResult->ai_socktype, addrResult->ai_protocol); if(serverSocket == INVALID_SOCKET) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "TmTcUdpBridge::TmTcUdpBridge: Could not open UDP socket!" << - std::endl; -#endif freeaddrinfo(addrResult); tcpip::handleError(tcpip::Protocol::UDP, tcpip::ErrorSources::SOCKET_CALL); return HasReturnvaluesIF::RETURN_FAILED; @@ -102,10 +97,6 @@ ReturnValue_t UdpTmTcBridge::initialize() { retval = bind(serverSocket, addrResult->ai_addr, static_cast(addrResult->ai_addrlen)); if(retval != 0) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "TmTcUdpBridge::TmTcUdpBridge: Could not bind " - "local port (" << udpServerPort << ") to server socket!" << std::endl; -#endif freeaddrinfo(addrResult); tcpip::handleError(tcpip::Protocol::UDP, tcpip::ErrorSources::BIND_CALL); return HasReturnvaluesIF::RETURN_FAILED; diff --git a/osal/common/UdpTmTcBridge.h b/osal/common/UdpTmTcBridge.h index 8b8d1949..290f5eb0 100644 --- a/osal/common/UdpTmTcBridge.h +++ b/osal/common/UdpTmTcBridge.h @@ -1,5 +1,5 @@ -#ifndef FSFW_OSAL_WINDOWS_TMTCWINUDPBRIDGE_H_ -#define FSFW_OSAL_WINDOWS_TMTCWINUDPBRIDGE_H_ +#ifndef FSFW_OSAL_COMMON_TMTCUDPBRIDGE_H_ +#define FSFW_OSAL_COMMON_TMTCUDPBRIDGE_H_ #include "TcpIpBase.h" #include "../../tmtcservices/TmTcBridge.h" @@ -56,5 +56,5 @@ private: MutexIF* mutex; }; -#endif /* FSFW_OSAL_HOST_TMTCWINUDPBRIDGE_H_ */ +#endif /* FSFW_OSAL_COMMON_TMTCUDPBRIDGE_H_ */ diff --git a/osal/common/tcpipCommon.cpp b/osal/common/tcpipCommon.cpp index 551e2a42..d4a3e8e6 100644 --- a/osal/common/tcpipCommon.cpp +++ b/osal/common/tcpipCommon.cpp @@ -35,6 +35,9 @@ void tcpip::determineErrorStrings(Protocol protocol, ErrorSources errorSrc, std: else if(errorSrc == ErrorSources::GETADDRINFO_CALL) { srcString = "getaddrinfo call"; } + else if(errorSrc == ErrorSources::SHUTDOWN_CALL) { + srcString = "shutdown call"; + } else { srcString = "unknown call"; } diff --git a/osal/common/tcpipCommon.h b/osal/common/tcpipCommon.h index 22b914dc..eb1bd910 100644 --- a/osal/common/tcpipCommon.h +++ b/osal/common/tcpipCommon.h @@ -29,7 +29,8 @@ enum class ErrorSources { RECVFROM_CALL, LISTEN_CALL, ACCEPT_CALL, - SENDTO_CALL + SENDTO_CALL, + SHUTDOWN_CALL }; void determineErrorStrings(Protocol protocol, ErrorSources errorSrc, std::string& protStr, From c1d30aad13753591b57db9e549333a596b606947 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 5 May 2021 15:59:41 +0200 Subject: [PATCH 070/389] TCP server implementation finished A lot of smaller tweaks and smaller refactoring done in UDP TMTC bridge as well --- osal/common/TcpTmTcBridge.cpp | 26 ++++++++-- osal/common/TcpTmTcBridge.h | 25 ++++++++-- osal/common/TcpTmTcServer.cpp | 86 ++++++++++++++++++++-------------- osal/common/TcpTmTcServer.h | 44 ++++++++++++----- osal/common/UdpTcPollingTask.h | 7 +-- osal/common/UdpTmTcBridge.cpp | 2 +- osal/common/UdpTmTcBridge.h | 10 +++- osal/common/tcpipCommon.cpp | 6 +++ osal/common/tcpipCommon.h | 1 + tmtcservices/TmTcBridge.cpp | 7 ++- tmtcservices/TmTcBridge.h | 3 +- 11 files changed, 152 insertions(+), 65 deletions(-) diff --git a/osal/common/TcpTmTcBridge.cpp b/osal/common/TcpTmTcBridge.cpp index a88b68e9..24fab9a9 100644 --- a/osal/common/TcpTmTcBridge.cpp +++ b/osal/common/TcpTmTcBridge.cpp @@ -22,15 +22,18 @@ TcpTmTcBridge::TcpTmTcBridge(object_id_t objectId, object_id_t tcDestination, object_id_t tmStoreId, object_id_t tcStoreId): TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) { mutex = MutexFactory::instance()->createMutex(); - communicationLinkUp = false; + // Connection is always up, TM is requested by connecting to server and receiving packets + registerCommConnect(); } ReturnValue_t TcpTmTcBridge::initialize() { ReturnValue_t result = TmTcBridge::initialize(); if(result != HasReturnvaluesIF::RETURN_OK) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "TmTcUdpBridge::initialize: TmTcBridge initialization failed!" + sif::error << "TcpTmTcBridge::initialize: TmTcBridge initialization failed!" << std::endl; +#else + sif::printError("TcpTmTcBridge::initialize: TmTcBridge initialization failed!\n"); #endif return result; } @@ -44,8 +47,25 @@ TcpTmTcBridge::~TcpTmTcBridge() { } } -ReturnValue_t TcpTmTcBridge::sendTm(const uint8_t *data, size_t dataLen) { +ReturnValue_t TcpTmTcBridge::handleTm() { + // Simply store the telemetry in the FIFO, the server will use it to access the TM + MutexGuard guard(mutex, timeoutType, mutexTimeoutMs); + TmTcMessage message; + ReturnValue_t status = HasReturnvaluesIF::RETURN_OK; + for (ReturnValue_t result = tmTcReceptionQueue->receiveMessage(&message); + result == HasReturnvaluesIF::RETURN_OK; + result = tmTcReceptionQueue->receiveMessage(&message)) + { + status = storeDownlinkData(&message); + if(status != HasReturnvaluesIF::RETURN_OK) { + break; + } + } + return HasReturnvaluesIF::RETURN_OK; +} +ReturnValue_t TcpTmTcBridge::sendTm(const uint8_t *data, size_t dataLen) { + // Not used. The Server uses the FIFO to access and send the telemetry. return HasReturnvaluesIF::RETURN_OK; } diff --git a/osal/common/TcpTmTcBridge.h b/osal/common/TcpTmTcBridge.h index db45fca8..6cfacb9f 100644 --- a/osal/common/TcpTmTcBridge.h +++ b/osal/common/TcpTmTcBridge.h @@ -17,16 +17,30 @@ #include /** - * @brief This class should be used with the UdpTcPollingTask to implement a UDP server - * for receiving and sending PUS TMTC. + * @brief This class should be used with the TcpTmTcServer to implement a TCP server + * for receiving and sending PUS telemetry and telecommands (TMTC) + * @details + * This bridge tasks takes care of filling a FIFO which generated telemetry. The TcpTmTcServer + * will take care of sending the telemetry stored in the FIFO if a client connects to the + * server. This bridge will also be the default destination for telecommands, but the telecommands + * will be relayed to a specified tcDestination directly. */ class TcpTmTcBridge: public TmTcBridge { - //friend class UdpTcPollingTask; + friend class TcpTmTcServer; public: /* The ports chosen here should not be used by any other process. */ static const std::string DEFAULT_UDP_SERVER_PORT; + /** + * Constructor + * @param objectId Object ID of the TcpTmTcBridge. + * @param tcDestination Destination for received TC packets. Any received telecommands will + * be sent there directly. The destination object needs to implement + * AcceptsTelecommandsIF. + * @param tmStoreId TM store object ID. It is recommended to the default object ID + * @param tcStoreId TC store object ID. It is recommended to the default object ID + */ TcpTmTcBridge(object_id_t objectId, object_id_t tcDestination, object_id_t tmStoreId = objects::TM_STORE, object_id_t tcStoreId = objects::TC_STORE); @@ -39,12 +53,15 @@ public: ReturnValue_t initialize() override; + protected: + ReturnValue_t handleTm() override; virtual ReturnValue_t sendTm(const uint8_t * data, size_t dataLen) override; private: - //! Access to the client address is mutex protected as it is set by another task. + //! Access to the FIFO needs to be mutex protected because it is used by the bridge and + //! the server. MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING; dur_millis_t mutexTimeoutMs = 20; MutexIF* mutex; diff --git a/osal/common/TcpTmTcServer.cpp b/osal/common/TcpTmTcServer.cpp index 8717783e..25403e8b 100644 --- a/osal/common/TcpTmTcServer.cpp +++ b/osal/common/TcpTmTcServer.cpp @@ -4,6 +4,7 @@ #include "../../container/SharedRingBuffer.h" #include "../../ipc/MessageQueueSenderIF.h" +#include "../../ipc/MutexGuard.h" #include "../../objectmanager/ObjectManagerIF.h" #include "../../serviceinterface/ServiceInterface.h" #include "../../tmtcservices/TmTcMessage.h" @@ -25,10 +26,9 @@ const std::string TcpTmTcServer::DEFAULT_TCP_SERVER_PORT = "7301"; TcpTmTcServer::TcpTmTcServer(object_id_t objectId, object_id_t tmtcTcpBridge, - /*SharedRingBuffer* tcpRingBuffer, */ size_t receptionBufferSize, - std::string customTcpServerPort): - SystemObject(objectId), tmtcBridgeId(tmtcTcpBridge), tcpPort(customTcpServerPort), - receptionBuffer(receptionBufferSize) /*, tcpRingBuffer(tcpRingBuffer) */ { + size_t receptionBufferSize, std::string customTcpServerPort): + SystemObject(objectId), tmtcBridgeId(tmtcTcpBridge), + tcpPort(customTcpServerPort), receptionBuffer(receptionBufferSize) { if(tcpPort == "") { tcpPort = DEFAULT_TCP_SERVER_PORT; } @@ -37,17 +37,6 @@ TcpTmTcServer::TcpTmTcServer(object_id_t objectId, object_id_t tmtcTcpBridge, ReturnValue_t TcpTmTcServer::initialize() { using namespace tcpip; - /* - if(tcpRingBuffer == nullptr) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "TcpTmTcServer::initialize: Invalid ring buffer!" << std::endl; -#else - sif::printError("TcpTmTcServer::initialize: Invalid ring buffer!\n"); -#endif - return ObjectManagerIF::CHILD_INIT_FAILED; - } - */ - ReturnValue_t result = TcpIpBase::initialize(); if(result != HasReturnvaluesIF::RETURN_OK) { return result; @@ -74,13 +63,14 @@ ReturnValue_t TcpTmTcServer::initialize() { hints.ai_protocol = IPPROTO_TCP; hints.ai_flags = AI_PASSIVE; + // Listen to all addresses (0.0.0.0) by using AI_PASSIVE in the hint flags retval = getaddrinfo(nullptr, tcpPort.c_str(), &hints, &addrResult); if (retval != 0) { handleError(Protocol::TCP, ErrorSources::GETADDRINFO_CALL); return HasReturnvaluesIF::RETURN_FAILED; } - /* Open TCP (stream) socket */ + // Open TCP (stream) socket listenerTcpSocket = socket(addrResult->ai_family, addrResult->ai_socktype, addrResult->ai_protocol); if(listenerTcpSocket == INVALID_SOCKET) { @@ -89,6 +79,7 @@ ReturnValue_t TcpTmTcServer::initialize() { return HasReturnvaluesIF::RETURN_FAILED; } + // Bind to the address found by getaddrinfo retval = bind(listenerTcpSocket, addrResult->ai_addr, static_cast(addrResult->ai_addrlen)); if(retval == SOCKET_ERROR) { freeaddrinfo(addrResult); @@ -107,15 +98,15 @@ TcpTmTcServer::~TcpTmTcServer() { ReturnValue_t TcpTmTcServer::performOperation(uint8_t opCode) { using namespace tcpip; - /* If a connection is accepted, the corresponding socket will be assigned to the new socket */ + // If a connection is accepted, the corresponding socket will be assigned to the new socket socket_t connSocket = 0; sockaddr clientSockAddr = {}; socklen_t connectorSockAddrLen = 0; int retval = 0; - /* Listen for connection requests permanently for lifetime of program */ + // Listen for connection requests permanently for lifetime of program while(true) { - retval = listen(listenerTcpSocket, currentBacklog); + retval = listen(listenerTcpSocket, tcpBacklog); if(retval == SOCKET_ERROR) { handleError(Protocol::TCP, ErrorSources::LISTEN_CALL, 500); continue; @@ -131,7 +122,7 @@ ReturnValue_t TcpTmTcServer::performOperation(uint8_t opCode) { handleServerOperation(connSocket); - /* Done, shut down connection */ + // Done, shut down connection and go back to listening for client requests retval = shutdown(connSocket, SHUT_SEND); if(retval != 0) { handleError(Protocol::TCP, ErrorSources::SHUTDOWN_CALL); @@ -142,29 +133,21 @@ ReturnValue_t TcpTmTcServer::performOperation(uint8_t opCode) { } ReturnValue_t TcpTmTcServer::initializeAfterTaskCreation() { + if(tmtcBridge == nullptr) { + return ObjectManagerIF::CHILD_INIT_FAILED; + } /* Initialize the destination after task creation. This ensures that the destination has already been set in the TMTC bridge. */ targetTcDestination = tmtcBridge->getRequestQueue(); - -// -// if(tcpRingBuffer != nullptr) { -// auto fifoCheck = tcpRingBuffer->getReceiveSizesFIFO(); -// if (fifoCheck == nullptr) { -//#if FSFW_CPP_OSTREAM_ENABLED == 1 -// sif::error << "TcpTmTcServer::initializeAfterTaskCreation: " -// "TCP ring buffer does not have a FIFO!" << std::endl; -//#else -// sif::printError("TcpTmTcServer::initialize: TCP ring buffer does not have a FIFO!\n"); -//#endif /* FSFW_CPP_OSTREAM_ENABLED == 0 */ -// } -// } - + tcStore = tmtcBridge->tcStore; + tmStore = tmtcBridge->tmStore; return HasReturnvaluesIF::RETURN_OK; } void TcpTmTcServer::handleServerOperation(socket_t connSocket) { int retval = 0; do { + // Read all telecommands sent by the client retval = recv(connSocket, reinterpret_cast(receptionBuffer.data()), receptionBuffer.capacity(), @@ -173,10 +156,12 @@ void TcpTmTcServer::handleServerOperation(socket_t connSocket) { handleTcReception(retval); } else if(retval == 0) { - /* Client has finished sending telecommands, send telemetry now */ + // Client has finished sending telecommands, send telemetry now + handleTmSending(connSocket); } else { - /* Should not happen */ + // Should not happen + tcpip::handleError(tcpip::Protocol::TCP, tcpip::ErrorSources::RECV_CALL); } } while(retval > 0); } @@ -210,3 +195,32 @@ ReturnValue_t TcpTmTcServer::handleTcReception(size_t bytesRecvd) { } return result; } + +void TcpTmTcServer::setTcpBacklog(uint8_t tcpBacklog) { + this->tcpBacklog = tcpBacklog; +} + +ReturnValue_t TcpTmTcServer::handleTmSending(socket_t connSocket) { + // Access to the FIFO is mutex protected because it is filled by the bridge + MutexGuard(tmtcBridge->mutex, tmtcBridge->timeoutType, tmtcBridge->mutexTimeoutMs); + store_address_t storeId; + while((not tmtcBridge->tmFifo->empty()) and + (tmtcBridge->packetSentCounter < tmtcBridge->sentPacketsPerCycle)) { + tmtcBridge->tmFifo->retrieve(&storeId); + + // Using the store accessor will take care of deleting TM from the store automatically + ConstStorageAccessor storeAccessor(storeId); + ReturnValue_t result = tmStore->getData(storeId, storeAccessor); + if(result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + int retval = send(connSocket, + reinterpret_cast(storeAccessor.data()), + storeAccessor.size(), + tcpTmFlags); + if(retval != static_cast(storeAccessor.size())) { + tcpip::handleError(tcpip::Protocol::TCP, tcpip::ErrorSources::SEND_CALL); + } + } + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/osal/common/TcpTmTcServer.h b/osal/common/TcpTmTcServer.h index 6db6621d..e4328370 100644 --- a/osal/common/TcpTmTcServer.h +++ b/osal/common/TcpTmTcServer.h @@ -1,5 +1,5 @@ -#ifndef FSFW_OSAL_WINDOWS_TCWINTCPSERVER_H_ -#define FSFW_OSAL_WINDOWS_TCWINTCPSERVER_H_ +#ifndef FSFW_OSAL_COMMON_TCP_TMTC_SERVER_H_ +#define FSFW_OSAL_COMMON_TCP_TMTC_SERVER_H_ #include "TcpIpBase.h" #include "../../ipc/messageQueueDefinitions.h" @@ -17,13 +17,22 @@ #include class TcpTmTcBridge; -//class SharedRingBuffer; - /** - * @brief Windows TCP server used to receive telecommands on a Windows Host + * @brief TCP server implementation * @details - * Based on: https://docs.microsoft.com/en-us/windows/win32/winsock/complete-server-code + * This server will run for the whole program lifetime and will take care of serving client + * requests on a specified TCP server port. This server waas written in a generic way and + * can be used on Unix and on Windows systems. + * + * If a connection is accepted, the server will read all telecommands sent by a client and then + * send all telemetry currently found in the TMTC bridge FIFO. + * + * Reading telemetry without sending telecommands is possible by connecting, shutting down the + * send operation immediately and then reading the telemetry. It is therefore recommended to + * connect to the server regularly, even if no telecommands need to be sent. + * + * The server will listen to a specific port on all addresses (0.0.0.0). */ class TcpTmTcServer: public SystemObject, @@ -35,18 +44,28 @@ public: static const std::string DEFAULT_TCP_CLIENT_PORT; static constexpr size_t ETHERNET_MTU_SIZE = 1500; - TcpTmTcServer(object_id_t objectId, object_id_t tmtcTcpBridge /*, SharedRingBuffer* tcpRingBuffer*/, - size_t receptionBufferSize = ETHERNET_MTU_SIZE, + /** + * TCP Server Constructor + * @param objectId Object ID of the TCP Server + * @param tmtcTcpBridge Object ID of the TCP TMTC Bridge object + * @param receptionBufferSize This will be the size of the reception buffer. Default buffer + * size will be the Ethernet MTU size + * @param customTcpServerPort The user can specify another port than the default (7301) here. + */ + TcpTmTcServer(object_id_t objectId, object_id_t tmtcTcpBridge, + size_t receptionBufferSize = ETHERNET_MTU_SIZE + 1, std::string customTcpServerPort = ""); virtual~ TcpTmTcServer(); + void setTcpBacklog(uint8_t tcpBacklog); + ReturnValue_t initialize() override; ReturnValue_t performOperation(uint8_t opCode) override; ReturnValue_t initializeAfterTaskCreation() override; protected: StorageManagerIF* tcStore = nullptr; - + StorageManagerIF* tmStore = nullptr; private: //! TMTC bridge is cached. object_id_t tmtcBridgeId = objects::NO_OBJECT; @@ -58,14 +77,15 @@ private: struct sockaddr tcpAddress; MessageQueueId_t targetTcDestination = MessageQueueIF::NO_QUEUE; int tcpAddrLen = sizeof(tcpAddress); - int currentBacklog = 3; + int tcpBacklog = 3; std::vector receptionBuffer; - //SharedRingBuffer* tcpRingBuffer; int tcpSockOpt = 0; + int tcpTmFlags = 0; void handleServerOperation(socket_t connSocket); ReturnValue_t handleTcReception(size_t bytesRecvd); + ReturnValue_t handleTmSending(socket_t connSocket); }; -#endif /* FSFW_OSAL_WINDOWS_TCWINTCPSERVER_H_ */ +#endif /* FSFW_OSAL_COMMON_TCP_TMTC_SERVER_H_ */ diff --git a/osal/common/UdpTcPollingTask.h b/osal/common/UdpTcPollingTask.h index cfe74b34..9a680fb8 100644 --- a/osal/common/UdpTcPollingTask.h +++ b/osal/common/UdpTcPollingTask.h @@ -9,8 +9,11 @@ #include /** - * @brief This class should be used with the UdpTmTcBridge to implement a UDP server + * @brief This class can be used with the UdpTmTcBridge to implement a UDP server * for receiving and sending PUS TMTC. + * @details + * This task is exclusively used to poll telecommands from a given socket and transfer them + * to the FSFW software bus. It used the blocking recvfrom call to do this. */ class UdpTcPollingTask: public TcpIpBase, @@ -45,8 +48,6 @@ private: object_id_t tmtcBridgeId = objects::NO_OBJECT; UdpTmTcBridge* tmtcBridge = nullptr; MessageQueueId_t targetTcDestination = MessageQueueIF::NO_QUEUE; - - //! See: https://docs.microsoft.com/en-us/windows/win32/api/winsock/nf-winsock-recvfrom int receptionFlags = 0; std::vector receptionBuffer; diff --git a/osal/common/UdpTmTcBridge.cpp b/osal/common/UdpTmTcBridge.cpp index ccbb194e..b07ca7a5 100644 --- a/osal/common/UdpTmTcBridge.cpp +++ b/osal/common/UdpTmTcBridge.cpp @@ -23,7 +23,7 @@ const std::string UdpTmTcBridge::DEFAULT_UDP_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT; UdpTmTcBridge::UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination, - object_id_t tmStoreId, object_id_t tcStoreId, std::string udpServerPort): + std::string udpServerPort, object_id_t tmStoreId, object_id_t tcStoreId): TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) { if(udpServerPort == "") { this->udpServerPort = DEFAULT_UDP_SERVER_PORT; diff --git a/osal/common/UdpTmTcBridge.h b/osal/common/UdpTmTcBridge.h index 290f5eb0..74084a9d 100644 --- a/osal/common/UdpTmTcBridge.h +++ b/osal/common/UdpTmTcBridge.h @@ -17,8 +17,13 @@ #include /** - * @brief This class should be used with the UdpTcPollingTask to implement a UDP server + * @brief This class can be used with the UdpTcPollingTask to implement a UDP server * for receiving and sending PUS TMTC. + * @details + * This bridge task will take care of sending telemetry back to a UDP client if a connection + * was established and store them in a FIFO if this was not done yet. It is also be the default + * destination for telecommands, but the telecommands will be relayed to a specified tcDestination + * directly. */ class UdpTmTcBridge: public TmTcBridge, @@ -29,7 +34,8 @@ public: static const std::string DEFAULT_UDP_SERVER_PORT; UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination, - object_id_t tmStoreId, object_id_t tcStoreId, std::string udpServerPort = ""); + std::string udpServerPort = "", object_id_t tmStoreId = objects::TM_STORE, + object_id_t tcStoreId = objects::TC_STORE); virtual~ UdpTmTcBridge(); /** diff --git a/osal/common/tcpipCommon.cpp b/osal/common/tcpipCommon.cpp index d4a3e8e6..ca4dbf18 100644 --- a/osal/common/tcpipCommon.cpp +++ b/osal/common/tcpipCommon.cpp @@ -32,6 +32,12 @@ void tcpip::determineErrorStrings(Protocol protocol, ErrorSources errorSrc, std: else if(errorSrc == ErrorSources::RECVFROM_CALL) { srcString = "recvfrom call"; } + else if(errorSrc == ErrorSources::SEND_CALL) { + srcString = "send call"; + } + else if(errorSrc == ErrorSources::SENDTO_CALL) { + srcString = "sendto call"; + } else if(errorSrc == ErrorSources::GETADDRINFO_CALL) { srcString = "getaddrinfo call"; } diff --git a/osal/common/tcpipCommon.h b/osal/common/tcpipCommon.h index eb1bd910..ce7a90cd 100644 --- a/osal/common/tcpipCommon.h +++ b/osal/common/tcpipCommon.h @@ -29,6 +29,7 @@ enum class ErrorSources { RECVFROM_CALL, LISTEN_CALL, ACCEPT_CALL, + SEND_CALL, SENDTO_CALL, SHUTDOWN_CALL }; diff --git a/tmtcservices/TmTcBridge.cpp b/tmtcservices/TmTcBridge.cpp index dcffac41..1257ef89 100644 --- a/tmtcservices/TmTcBridge.cpp +++ b/tmtcservices/TmTcBridge.cpp @@ -183,8 +183,11 @@ ReturnValue_t TmTcBridge::storeDownlinkData(TmTcMessage *message) { if(tmFifo->full()) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << "TmTcBridge::storeDownlinkData: TM downlink max. number " - << "of stored packet IDs reached! " << std::endl; + sif::warning << "TmTcBridge::storeDownlinkData: TM downlink max. number " + "of stored packet IDs reached!" << std::endl; +#else + sif::printWarning("TmTcBridge::storeDownlinkData: TM downlink max. number " + "of stored packet IDs reached!\n"); #endif if(overwriteOld) { tmFifo->retrieve(&storeId); diff --git a/tmtcservices/TmTcBridge.h b/tmtcservices/TmTcBridge.h index 0177648c..d3e1c547 100644 --- a/tmtcservices/TmTcBridge.h +++ b/tmtcservices/TmTcBridge.h @@ -150,8 +150,7 @@ protected: void printData(uint8_t * data, size_t dataLen); /** - * This fifo can be used to store downlink data - * which can not be sent at the moment. + * This FIFO can be used to store downlink data which can not be sent at the moment. */ DynamicFIFO* tmFifo = nullptr; uint8_t sentPacketsPerCycle = DEFAULT_STORED_DATA_SENT_PER_CYCLE; From 8b17c40aa61537a70ce947b1db8bf338dea2ae16 Mon Sep 17 00:00:00 2001 From: Steffen Gaisser Date: Tue, 11 May 2021 15:02:04 +0200 Subject: [PATCH 071/389] Added Network Byte Order --- serialize/SerializeIF.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/serialize/SerializeIF.h b/serialize/SerializeIF.h index d72218f0..dfd854e3 100644 --- a/serialize/SerializeIF.h +++ b/serialize/SerializeIF.h @@ -19,7 +19,10 @@ class SerializeIF { public: enum class Endianness : uint8_t { - BIG, LITTLE, MACHINE + BIG, + LITTLE, + MACHINE, + NETWORK = BIG // Added for convenience like htons on sockets }; static const uint8_t INTERFACE_ID = CLASS_ID::SERIALIZE_IF; From d807998f4de768be499aa3a48f9bf2d577057667 Mon Sep 17 00:00:00 2001 From: Steffen Gaisser Date: Tue, 11 May 2021 15:25:38 +0200 Subject: [PATCH 072/389] Added Missing includes in Host Osal Updated correct defaults for Host MessageQueues --- osal/host/MessageQueue.cpp | 2 ++ osal/host/MessageQueue.h | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/osal/host/MessageQueue.cpp b/osal/host/MessageQueue.cpp index 41c55a3d..4e286271 100644 --- a/osal/host/MessageQueue.cpp +++ b/osal/host/MessageQueue.cpp @@ -5,6 +5,8 @@ #include "../../ipc/MutexFactory.h" #include "../../ipc/MutexGuard.h" +#include + MessageQueue::MessageQueue(size_t messageDepth, size_t maxMessageSize): messageSize(maxMessageSize), messageDepth(messageDepth) { queueLock = MutexFactory::instance()->createMutex(); diff --git a/osal/host/MessageQueue.h b/osal/host/MessageQueue.h index e965123d..1c9b5e33 100644 --- a/osal/host/MessageQueue.h +++ b/osal/host/MessageQueue.h @@ -217,15 +217,15 @@ private: * @brief The class stores the queue id it got assigned. * If initialization fails, the queue id is set to zero. */ - MessageQueueId_t mqId = 0; + MessageQueueId_t mqId = MessageQueueIF::NO_QUEUE; size_t messageSize = 0; size_t messageDepth = 0; MutexIF* queueLock; bool defaultDestinationSet = false; - MessageQueueId_t defaultDestination = 0; - MessageQueueId_t lastPartner = 0; + MessageQueueId_t defaultDestination = MessageQueueIF::NO_QUEUE; + MessageQueueId_t lastPartner = MessageQueueIF::NO_QUEUE; }; #endif /* FRAMEWORK_OSAL_HOST_MESSAGEQUEUE_H_ */ From 9d0155d9ae58425bf982cd4712be3b7d83efc87b Mon Sep 17 00:00:00 2001 From: Steffen Gaisser Date: Tue, 11 May 2021 15:30:49 +0200 Subject: [PATCH 073/389] Added a returnvalue --- osal/host/MessageQueue.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osal/host/MessageQueue.cpp b/osal/host/MessageQueue.cpp index 4e286271..a779bdcb 100644 --- a/osal/host/MessageQueue.cpp +++ b/osal/host/MessageQueue.cpp @@ -128,8 +128,7 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo, internalErrorReporter->queueMessageNotSent(); } } - // TODO: Better returnvalue - return HasReturnvaluesIF::RETURN_FAILED; + return MessageQueueIF::DESTINATION_INVALID; } if(targetQueue->messageQueue.size() < targetQueue->messageDepth) { MutexGuard mutexLock(targetQueue->queueLock, MutexIF::TimeoutType::WAITING, 20); From e1c91f82b763b0d57710a16ab40697df87e6ce74 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 12 May 2021 10:54:10 +0200 Subject: [PATCH 074/389] some fixes and tweaks --- events/EventManager.cpp | 48 +++++++++++++++++++---------- objectmanager/ObjectManagerIF.h | 2 +- serviceinterface/ServiceInterface.h | 4 +-- 3 files changed, 35 insertions(+), 19 deletions(-) diff --git a/events/EventManager.cpp b/events/EventManager.cpp index 5b2b31b5..2d4b6a49 100644 --- a/events/EventManager.cpp +++ b/events/EventManager.cpp @@ -2,7 +2,7 @@ #include "EventMessage.h" #include -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "../serviceinterface/ServiceInterface.h" #include "../ipc/QueueFactory.h" #include "../ipc/MutexFactory.h" @@ -120,23 +120,39 @@ ReturnValue_t EventManager::unsubscribeFromEventRange(MessageQueueId_t listener, void EventManager::printEvent(EventMessage* message) { const char *string = 0; switch (message->getSeverity()) { - case severity::INFO: -#if DEBUG_INFO_EVENT == 1 - string = translateObject(message->getReporter()); + case severity::INFO: { +#if FSFW_DEBUG_INFO == 1 + string = translateObject(message->getReporter()); #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::info << "EVENT: "; - if (string != 0) { - sif::info << string; - } else { - sif::info << "0x" << std::hex << message->getReporter() << std::dec; - } - sif::info << " reported " << translateEvents(message->getEvent()) << " (" - << std::dec << message->getEventId() << std::hex << ") P1: 0x" - << message->getParameter1() << " P2: 0x" - << message->getParameter2() << std::dec << std::endl; -#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ + sif::info << "EVENT: "; + if (string != 0) { + sif::info << string; + } + else { + sif::info << "0x" << std::hex << std::setfill('0') << std::setw(8) << + message->getReporter() << std::setfill(' ') << std::dec; + } + sif::info << " reported " << translateEvents(message->getEvent()) << " (" + << std::dec << message->getEventId() << std::hex << ") P1: 0x" + << message->getParameter1() << " P2: 0x" + << message->getParameter2() << std::dec << std::endl; +#else + const char totalString[140] = {}; + if (string != 0) { + snprintf((char*) totalString, sizeof(totalString),"Event: %s", string); + } + else { + snprintf((char*) totalString, sizeof(totalString),"Event: 0x%08x", + message->getReporter()); + } + snprintf((char*) totalString, sizeof(totalString), + " reported %s | ID %d | P1: 0x%x | P2: 0x%x\n", translateEvents(message->getEvent()), + message->getEventId(), message->getParameter1(), message->getParameter2()); + sif::printInfo("%s", totalString); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 0 */ #endif /* DEBUG_INFO_EVENT == 1 */ - break; + break; + } default: string = translateObject(message->getReporter()); #if FSFW_CPP_OSTREAM_ENABLED == 1 diff --git a/objectmanager/ObjectManagerIF.h b/objectmanager/ObjectManagerIF.h index 8bebb609..61e6f423 100644 --- a/objectmanager/ObjectManagerIF.h +++ b/objectmanager/ObjectManagerIF.h @@ -4,7 +4,7 @@ #include "frameworkObjects.h" #include "SystemObjectIF.h" #include "../returnvalues/HasReturnvaluesIF.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "../serviceinterface/ServiceInterface.h" /** * @brief This class provides an interface to the global object manager. diff --git a/serviceinterface/ServiceInterface.h b/serviceinterface/ServiceInterface.h index 1f7e5e84..e95dd9a4 100644 --- a/serviceinterface/ServiceInterface.h +++ b/serviceinterface/ServiceInterface.h @@ -5,9 +5,9 @@ #include "serviceInterfaceDefintions.h" #if FSFW_CPP_OSTREAM_ENABLED == 1 -#include +#include "ServiceInterfaceStream.h" #else -#include +#include "ServiceInterfacePrinter.h" #endif #endif /* FSFW_SERVICEINTERFACE_SERVICEINTERFACE_H_ */ From cd016c8281598140708952e44c7823f71e1e63cf Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 12 May 2021 13:40:26 +0200 Subject: [PATCH 075/389] event manager printout refactoring --- events/EventManager.cpp | 150 +++++++++++++++++++++++----------------- events/EventManager.h | 2 + 2 files changed, 87 insertions(+), 65 deletions(-) diff --git a/events/EventManager.cpp b/events/EventManager.cpp index 2d4b6a49..8e8f797f 100644 --- a/events/EventManager.cpp +++ b/events/EventManager.cpp @@ -1,8 +1,6 @@ #include "EventManager.h" #include "EventMessage.h" -#include -#include "../serviceinterface/ServiceInterface.h" #include "../ipc/QueueFactory.h" #include "../ipc/MutexFactory.h" @@ -115,69 +113,6 @@ ReturnValue_t EventManager::unsubscribeFromEventRange(MessageQueueId_t listener, return result; } -#if FSFW_OBJ_EVENT_TRANSLATION == 1 - -void EventManager::printEvent(EventMessage* message) { - const char *string = 0; - switch (message->getSeverity()) { - case severity::INFO: { -#if FSFW_DEBUG_INFO == 1 - string = translateObject(message->getReporter()); -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::info << "EVENT: "; - if (string != 0) { - sif::info << string; - } - else { - sif::info << "0x" << std::hex << std::setfill('0') << std::setw(8) << - message->getReporter() << std::setfill(' ') << std::dec; - } - sif::info << " reported " << translateEvents(message->getEvent()) << " (" - << std::dec << message->getEventId() << std::hex << ") P1: 0x" - << message->getParameter1() << " P2: 0x" - << message->getParameter2() << std::dec << std::endl; -#else - const char totalString[140] = {}; - if (string != 0) { - snprintf((char*) totalString, sizeof(totalString),"Event: %s", string); - } - else { - snprintf((char*) totalString, sizeof(totalString),"Event: 0x%08x", - message->getReporter()); - } - snprintf((char*) totalString, sizeof(totalString), - " reported %s | ID %d | P1: 0x%x | P2: 0x%x\n", translateEvents(message->getEvent()), - message->getEventId(), message->getParameter1(), message->getParameter2()); - sif::printInfo("%s", totalString); -#endif /* FSFW_CPP_OSTREAM_ENABLED == 0 */ -#endif /* DEBUG_INFO_EVENT == 1 */ - break; - } - default: - string = translateObject(message->getReporter()); -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << "EventManager: "; - if (string != 0) { - sif::debug << string; - } - else { - sif::debug << "0x" << std::hex << message->getReporter() << std::dec; - } - sif::debug << " reported " << translateEvents(message->getEvent()) - << " (" << std::dec << message->getEventId() << ") " - << std::endl; - sif::debug << std::hex << "P1 Hex: 0x" << message->getParameter1() - << ", P1 Dec: " << std::dec << message->getParameter1() - << std::endl; - sif::debug << std::hex << "P2 Hex: 0x" << message->getParameter2() - << ", P2 Dec: " << std::dec << message->getParameter2() - << std::endl; -#endif - break; - } -} -#endif - void EventManager::lockMutex() { mutex->lockMutex(timeoutType, timeoutMs); } @@ -191,3 +126,88 @@ void EventManager::setMutexTimeout(MutexIF::TimeoutType timeoutType, this->timeoutType = timeoutType; this->timeoutMs = timeoutMs; } + +#if FSFW_OBJ_EVENT_TRANSLATION == 1 + +void EventManager::printEvent(EventMessage* message) { + switch (message->getSeverity()) { + case severity::INFO: { +#if FSFW_DEBUG_INFO == 1 + printUtility(sif::OutputTypes::OUT_INFO, message); +#endif /* DEBUG_INFO_EVENT == 1 */ + break; + } + default: + printUtility(sif::OutputTypes::OUT_DEBUG, message); + break; + } +} + +void EventManager::printUtility(sif::OutputTypes printType, EventMessage *message) { + const char *string = 0; + if(printType == sif::OutputTypes::OUT_INFO) { + string = translateObject(message->getReporter()); +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "EventManager: "; + if (string != 0) { + sif::info << string; + } + else { + sif::info << "0x" << std::hex << std::setw(8) << std::setfill('0') << + message->getReporter() << std::setfill(' ') << std::dec; + } + sif::info << " reported " << translateEvents(message->getEvent()) + << " with event ID " << std::dec << message->getEventId() << std::endl; + sif::info << std::hex << "P1 Hex: 0x" << message->getParameter1() << + " | P1 Dec: " << std::dec << message->getParameter1() << std::hex << + " | P2 Hex: 0x" << message->getParameter2() << " | P2 Dec: " << std::dec << + message->getParameter2() << std::endl; +#else + if (string != 0) { + sif::printInfo("Event Manager: %s reported %s with event ID %d\n", + message->getReporter(), translateEvents(message->getEvent()), + message->getEventId()); + } + else { + sif::printInfo("Event Manager: Reporter ID 0x%08x reported %s with event ID %d\n", + string, translateEvents(message->getEvent()), message->getEventId()); + } + sif::printInfo("P1 Hex: 0x%x | P1 Dec: %d | P2 Hex: 0x%x | P2 Dec: %d\n", + message->getParameter1(), message->getParameter1(), + message->getParameter2(), message->getParameter2()); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 0 */ + } + else { + string = translateObject(message->getReporter()); +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::debug << "EventManager: "; + if (string != 0) { + sif::debug << string; + } + else { + sif::debug << "0x" << std::hex << message->getReporter() << std::dec; + } + sif::debug << " reported " << translateEvents(message->getEvent()) + << " with event ID " << std::dec << message->getEventId() << std::endl; + sif::debug << std::hex << "P1 Hex: 0x" << message->getParameter1() << + " | P1 Dec: " << std::dec << message->getParameter1() << std::hex << + " | P2 Hex: 0x" << message->getParameter2() << " | P2 Dec: " << std::dec << + message->getParameter2() << std::endl; +#else + if (string != 0) { + sif::printDebug("Event Manager: %s reported %s with event ID %d\n", + message->getReporter(), translateEvents(message->getEvent()), + message->getEventId()); + } + else { + sif::printDebug("Event Manager: Reporter ID 0x%08x reported %s with event ID %d\n", + string, translateEvents(message->getEvent()), message->getEventId()); + } + sif::printDebug("P1 Hex: 0x%x | P1 Dec: %d | P2 Hex: 0x%x | P2 Dec: %d\n", + message->getParameter1(), message->getParameter1(), + message->getParameter2(), message->getParameter2()); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 0 */ + } +} + +#endif /* FSFW_OBJ_EVENT_TRANSLATION == 1 */ diff --git a/events/EventManager.h b/events/EventManager.h index abce9b8b..9189d9e7 100644 --- a/events/EventManager.h +++ b/events/EventManager.h @@ -6,6 +6,7 @@ #include +#include "../serviceinterface/ServiceInterface.h" #include "../objectmanager/SystemObject.h" #include "../storagemanager/LocalPool.h" #include "../tasks/ExecutableObjectIF.h" @@ -67,6 +68,7 @@ protected: #if FSFW_OBJ_EVENT_TRANSLATION == 1 void printEvent(EventMessage *message); + void printUtility(sif::OutputTypes printType, EventMessage* message); #endif void lockMutex(); From 5b23b928cf9b187eb19b18f366a9fecfaff21c31 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 12 May 2021 14:28:37 +0200 Subject: [PATCH 076/389] added missing include --- osal/host/MessageQueue.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osal/host/MessageQueue.cpp b/osal/host/MessageQueue.cpp index 41c55a3d..4e286271 100644 --- a/osal/host/MessageQueue.cpp +++ b/osal/host/MessageQueue.cpp @@ -5,6 +5,8 @@ #include "../../ipc/MutexFactory.h" #include "../../ipc/MutexGuard.h" +#include + MessageQueue::MessageQueue(size_t messageDepth, size_t maxMessageSize): messageSize(maxMessageSize), messageDepth(messageDepth) { queueLock = MutexFactory::instance()->createMutex(); From d81c6f40fbc86ac9fd0123d08b5fdba09bad9d00 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 12 May 2021 14:43:08 +0200 Subject: [PATCH 077/389] define fixes --- osal/host/Clock.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osal/host/Clock.cpp b/osal/host/Clock.cpp index c097f619..bcf486ec 100644 --- a/osal/host/Clock.cpp +++ b/osal/host/Clock.cpp @@ -2,9 +2,9 @@ #include "../../timemanager/Clock.h" #include -#if defined(WIN32) +#if defined(_WIN32) #include -#elif defined(LINUX) +#elif defined(__unix__) #include #endif @@ -92,7 +92,7 @@ timeval Clock::getUptime() { auto fraction = uptime - secondsChrono; timeval.tv_usec = std::chrono::duration_cast( fraction).count(); -#elif defined(LINUX) +#elif defined(__unix__) double uptimeSeconds; if (std::ifstream("/proc/uptime", std::ios::in) >> uptimeSeconds) { @@ -120,7 +120,6 @@ ReturnValue_t Clock::getUptime(uint32_t* uptimeMs) { } -ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) { /* Do some magic with chrono (C++20!) */ /* Right now, the library doesn't have the new features to get the required values yet. so we work around that for now. */ From 8293e6b0c742e18ddd78d4db05ac64fe58f09c60 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 12 May 2021 14:48:39 +0200 Subject: [PATCH 078/389] more include fixes --- osal/host/Clock.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osal/host/Clock.cpp b/osal/host/Clock.cpp index bcf486ec..cf9349c1 100644 --- a/osal/host/Clock.cpp +++ b/osal/host/Clock.cpp @@ -46,7 +46,7 @@ ReturnValue_t Clock::setClock(const timeval* time) { } ReturnValue_t Clock::getClock_timeval(timeval* time) { -#if defined(WIN32) +#if defined(_WIN32) auto now = std::chrono::system_clock::now(); auto secondsChrono = std::chrono::time_point_cast(now); auto epoch = now.time_since_epoch(); @@ -54,7 +54,7 @@ ReturnValue_t Clock::getClock_timeval(timeval* time) { auto fraction = now - secondsChrono; time->tv_usec = std::chrono::duration_cast(fraction).count(); return HasReturnvaluesIF::RETURN_OK; -#elif defined(LINUX) +#elif defined(__unix__) timespec timeUnix; int status = clock_gettime(CLOCK_REALTIME,&timeUnix); if(status!=0){ @@ -85,7 +85,7 @@ ReturnValue_t Clock::getClock_usecs(uint64_t* time) { timeval Clock::getUptime() { timeval timeval; -#if defined(WIN32) +#if defined(_WIN32) auto uptime = std::chrono::milliseconds(GetTickCount64()); auto secondsChrono = std::chrono::duration_cast(uptime); timeval.tv_sec = secondsChrono.count(); From a6dd2d5dcb21058c4c487ac1ef027ea6ece1b98f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 12 May 2021 16:37:12 +0200 Subject: [PATCH 079/389] event manager update --- events/EventManager.cpp | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/events/EventManager.cpp b/events/EventManager.cpp index 8e8f797f..2337ba83 100644 --- a/events/EventManager.cpp +++ b/events/EventManager.cpp @@ -156,21 +156,19 @@ void EventManager::printUtility(sif::OutputTypes printType, EventMessage *messag sif::info << "0x" << std::hex << std::setw(8) << std::setfill('0') << message->getReporter() << std::setfill(' ') << std::dec; } - sif::info << " reported " << translateEvents(message->getEvent()) - << " with event ID " << std::dec << message->getEventId() << std::endl; + sif::info << " report event with ID " << message->getEventId() << std::endl; sif::info << std::hex << "P1 Hex: 0x" << message->getParameter1() << " | P1 Dec: " << std::dec << message->getParameter1() << std::hex << " | P2 Hex: 0x" << message->getParameter2() << " | P2 Dec: " << std::dec << message->getParameter2() << std::endl; #else if (string != 0) { - sif::printInfo("Event Manager: %s reported %s with event ID %d\n", - message->getReporter(), translateEvents(message->getEvent()), + sif::printInfo("Event Manager: %s reported event with ID %d\n", string, message->getEventId()); } else { - sif::printInfo("Event Manager: Reporter ID 0x%08x reported %s with event ID %d\n", - string, translateEvents(message->getEvent()), message->getEventId()); + sif::printInfo("Event Manager: Reporter ID 0x%08x reported event with ID %d\n", + message->getReporter(), message->getEventId()); } sif::printInfo("P1 Hex: 0x%x | P1 Dec: %d | P2 Hex: 0x%x | P2 Dec: %d\n", message->getParameter1(), message->getParameter1(), @@ -185,23 +183,22 @@ void EventManager::printUtility(sif::OutputTypes printType, EventMessage *messag sif::debug << string; } else { - sif::debug << "0x" << std::hex << message->getReporter() << std::dec; + sif::debug << "0x" << std::hex << std::setw(8) << std::setfill('0') << + message->getReporter() << std::setfill(' ') << std::dec; } - sif::debug << " reported " << translateEvents(message->getEvent()) - << " with event ID " << std::dec << message->getEventId() << std::endl; + sif::debug << " report event with ID " << message->getEventId() << std::endl; sif::debug << std::hex << "P1 Hex: 0x" << message->getParameter1() << " | P1 Dec: " << std::dec << message->getParameter1() << std::hex << " | P2 Hex: 0x" << message->getParameter2() << " | P2 Dec: " << std::dec << message->getParameter2() << std::endl; #else if (string != 0) { - sif::printDebug("Event Manager: %s reported %s with event ID %d\n", - message->getReporter(), translateEvents(message->getEvent()), + sif::printDebug("Event Manager: %s reported event with ID %d\n", string, message->getEventId()); } else { - sif::printDebug("Event Manager: Reporter ID 0x%08x reported %s with event ID %d\n", - string, translateEvents(message->getEvent()), message->getEventId()); + sif::printDebug("Event Manager: Reporter ID 0x%08x reported event with ID %d\n", + message->getReporter(), message->getEventId()); } sif::printDebug("P1 Hex: 0x%x | P1 Dec: %d | P2 Hex: 0x%x | P2 Dec: %d\n", message->getParameter1(), message->getParameter1(), From d27f49c9680190169e004dead07ae0ebe0cc4fc4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 12 May 2021 16:38:02 +0200 Subject: [PATCH 080/389] added platform header file --- platform.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 platform.h diff --git a/platform.h b/platform.h new file mode 100644 index 00000000..08260094 --- /dev/null +++ b/platform.h @@ -0,0 +1,15 @@ +#ifndef FSFW_PLATFORM_H_ +#define FSFW_PLATFORM_H_ + +#if defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)) + +#define PLATFORM_UNIX + +#elif defined(_WIN32) + +#define PLATFORM_WIN + +#endif + + +#endif /* FSFW_PLATFORM_H_ */ From 1626b266d703f10444b6ea3f9fb1c1be228ec400 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 12 May 2021 16:47:53 +0200 Subject: [PATCH 081/389] platform header file --- osal/common/TcpIpBase.cpp | 13 ++++++------- osal/common/TcpIpBase.h | 9 +++++---- osal/common/TcpTmTcServer.cpp | 8 +++----- osal/common/TcpTmTcServer.h | 3 ++- osal/common/UdpTcPollingTask.cpp | 13 +++++-------- osal/common/UdpTmTcBridge.cpp | 15 ++++++--------- osal/common/UdpTmTcBridge.h | 9 +++------ osal/host/Clock.cpp | 6 ++++-- osal/host/FixedTimeslotTask.cpp | 5 +++-- osal/host/PeriodicTask.cpp | 9 +++++---- 10 files changed, 42 insertions(+), 48 deletions(-) diff --git a/osal/common/TcpIpBase.cpp b/osal/common/TcpIpBase.cpp index 27384ecc..0b37e38c 100644 --- a/osal/common/TcpIpBase.cpp +++ b/osal/common/TcpIpBase.cpp @@ -1,10 +1,9 @@ #include "TcpIpBase.h" +#include "../../platform.h" -#ifdef __unix__ - +#ifdef PLATFORM_UNIX #include #include - #endif TcpIpBase::TcpIpBase() { @@ -37,17 +36,17 @@ TcpIpBase::~TcpIpBase() { } int TcpIpBase::closeSocket(socket_t socket) { -#ifdef _WIN32 +#ifdef PLATFORM_WIN return closesocket(socket); -#elif defined(__unix__) +#elif defined(PLATFORM_UNIX) return close(socket); #endif } int TcpIpBase::getLastSocketError() { -#ifdef _WIN32 +#ifdef PLATFORM_WIN return WSAGetLastError(); -#elif defined(__unix__) +#elif defined(PLATFORM_UNIX) return errno; #endif } diff --git a/osal/common/TcpIpBase.h b/osal/common/TcpIpBase.h index 652d791a..79eefad2 100644 --- a/osal/common/TcpIpBase.h +++ b/osal/common/TcpIpBase.h @@ -1,13 +1,14 @@ #ifndef FSFW_OSAL_COMMON_TCPIPIF_H_ #define FSFW_OSAL_COMMON_TCPIPIF_H_ -#include +#include "../../returnvalues/HasReturnvaluesIF.h" +#include "../../platform.h" -#ifdef _WIN32 +#ifdef PLATFORM_WIN #include -#elif defined(__unix__) +#elif defined(PLATFORM_UNIX) #include @@ -16,7 +17,7 @@ class TcpIpBase { protected: -#ifdef _WIN32 +#ifdef PLATFORM_WIN static constexpr int SHUT_RECV = SD_RECEIVE; static constexpr int SHUT_SEND = SD_SEND; static constexpr int SHUT_BOTH = SD_BOTH; diff --git a/osal/common/TcpTmTcServer.cpp b/osal/common/TcpTmTcServer.cpp index 08a62ffb..e1a26fe7 100644 --- a/osal/common/TcpTmTcServer.cpp +++ b/osal/common/TcpTmTcServer.cpp @@ -1,15 +1,13 @@ #include "TcpTmTcServer.h" #include "tcpipHelpers.h" +#include "../../platform.h" #include "../../serviceinterface/ServiceInterface.h" -#ifdef _WIN32 +#ifdef PLATFORM_WIN #include #include - -#elif defined(__unix__) - +#elif defined(PLATFORM_UNIX) #include - #endif const std::string TcpTmTcServer::DEFAULT_TCP_SERVER_PORT = "7301"; diff --git a/osal/common/TcpTmTcServer.h b/osal/common/TcpTmTcServer.h index 4dcc77a2..91c579e5 100644 --- a/osal/common/TcpTmTcServer.h +++ b/osal/common/TcpTmTcServer.h @@ -2,10 +2,11 @@ #define FSFW_OSAL_WINDOWS_TCWINTCPSERVER_H_ #include "TcpIpBase.h" +#include "../../platform.h" #include "../../objectmanager/SystemObject.h" #include "../../tasks/ExecutableObjectIF.h" -#ifdef __unix__ +#ifdef PLATFORM_UNIX #include #endif diff --git a/osal/common/UdpTcPollingTask.cpp b/osal/common/UdpTcPollingTask.cpp index 47f67b29..68108323 100644 --- a/osal/common/UdpTcPollingTask.cpp +++ b/osal/common/UdpTcPollingTask.cpp @@ -1,17 +1,14 @@ #include "UdpTcPollingTask.h" #include "tcpipHelpers.h" +#include "../../platform.h" #include "../../globalfunctions/arrayprinter.h" #include "../../serviceinterface/ServiceInterfaceStream.h" -#ifdef _WIN32 - +#ifdef PLATFORM_WIN #include - -#else - +#elif defined(PLATFORM_UNIX) #include #include - #endif //! Debugging preprocessor define. @@ -155,7 +152,7 @@ ReturnValue_t UdpTcPollingTask::initializeAfterTaskCreation() { } void UdpTcPollingTask::setTimeout(double timeoutSeconds) { -#ifdef _WIN32 +#ifdef PLATFORM_WIN DWORD timeoutMs = timeoutSeconds * 1000.0; int result = setsockopt(serverSocket, SOL_SOCKET, SO_RCVTIMEO, reinterpret_cast(&timeoutMs), sizeof(DWORD)); @@ -165,7 +162,7 @@ void UdpTcPollingTask::setTimeout(double timeoutSeconds) { "receive timeout failed with " << strerror(errno) << std::endl; #endif } -#elif defined(__unix__) +#elif defined(PLATFORM_UNIX) timeval tval; tval = timevalOperations::toTimeval(timeoutSeconds); int result = setsockopt(serverSocket, SOL_SOCKET, SO_RCVTIMEO, diff --git a/osal/common/UdpTmTcBridge.cpp b/osal/common/UdpTmTcBridge.cpp index ba23f521..2ecc7b7c 100644 --- a/osal/common/UdpTmTcBridge.cpp +++ b/osal/common/UdpTmTcBridge.cpp @@ -1,18 +1,15 @@ +#include "UdpTmTcBridge.h" #include "tcpipHelpers.h" -#include -#include -#include - -#ifdef _WIN32 +#include "../../platform.h" +#include "../../serviceinterface/ServiceInterface.h" +#include "../../ipc/MutexGuard.h" +#ifdef PLATFORM_WIN #include - -#elif defined(__unix__) - +#elif defined(PLATFORM_UNIX) #include #include - #endif //! Debugging preprocessor define. diff --git a/osal/common/UdpTmTcBridge.h b/osal/common/UdpTmTcBridge.h index 8b8d1949..360643bb 100644 --- a/osal/common/UdpTmTcBridge.h +++ b/osal/common/UdpTmTcBridge.h @@ -2,16 +2,13 @@ #define FSFW_OSAL_WINDOWS_TMTCWINUDPBRIDGE_H_ #include "TcpIpBase.h" +#include "../../platform.h" #include "../../tmtcservices/TmTcBridge.h" -#ifdef _WIN32 - +#ifdef PLATFORM_WIN #include - -#elif defined(__unix__) - +#elif defined(PLATFORM_UNIX) #include - #endif #include diff --git a/osal/host/Clock.cpp b/osal/host/Clock.cpp index cf9349c1..b2e4c171 100644 --- a/osal/host/Clock.cpp +++ b/osal/host/Clock.cpp @@ -1,10 +1,12 @@ #include "../../serviceinterface/ServiceInterface.h" #include "../../timemanager/Clock.h" +#include "../../platform.h" #include -#if defined(_WIN32) + +#if defined(PLATFORM_WIN) #include -#elif defined(__unix__) +#elif defined(PLATFORM_UNIX) #include #endif diff --git a/osal/host/FixedTimeslotTask.cpp b/osal/host/FixedTimeslotTask.cpp index 89daa278..55f37499 100644 --- a/osal/host/FixedTimeslotTask.cpp +++ b/osal/host/FixedTimeslotTask.cpp @@ -1,4 +1,5 @@ #include "taskHelpers.h" +#include "../../platform.h" #include "../../osal/host/FixedTimeslotTask.h" #include "../../ipc/MutexFactory.h" #include "../../osal/host/Mutex.h" @@ -9,10 +10,10 @@ #include #include -#if defined(WIN32) +#if defined(PLATFORM_WIN) #include #include "../windows/winTaskHelpers.h" -#elif defined(LINUX) +#elif defined(PLATFORM_UNIX) #include #endif diff --git a/osal/host/PeriodicTask.cpp b/osal/host/PeriodicTask.cpp index 09df410f..4b3fa626 100644 --- a/osal/host/PeriodicTask.cpp +++ b/osal/host/PeriodicTask.cpp @@ -2,6 +2,7 @@ #include "PeriodicTask.h" #include "taskHelpers.h" +#include "../../platform.h" #include "../../ipc/MutexFactory.h" #include "../../serviceinterface/ServiceInterfaceStream.h" #include "../../tasks/ExecutableObjectIF.h" @@ -9,10 +10,10 @@ #include #include -#if defined(WIN32) +#if defined(PLATFORM_WIN) #include #include -#elif defined(__unix__) +#elif defined(PLATFORM_UNIX) #include #endif @@ -24,9 +25,9 @@ PeriodicTask::PeriodicTask(const char *name, TaskPriority setPriority, // It is probably possible to set task priorities by using the native // task handles for Windows / Linux mainThread = std::thread(&PeriodicTask::taskEntryPoint, this, this); -#if defined(_WIN32) +#if defined(PLATFORM_WIN) tasks::setTaskPriority(reinterpret_cast(mainThread.native_handle()), setPriority); -#elif defined(__unix__) +#elif defined(PLATFORM_UNIX) // TODO: We could reuse existing code here. #endif tasks::insertTaskName(mainThread.get_id(), taskName); From 4095be449ae4b6ebaf89fdcbfc5bc31b854594d5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 12 May 2021 17:32:40 +0200 Subject: [PATCH 082/389] some more preprocessor replacements --- osal/common/TcpIpBase.h | 6 +----- osal/host/Clock.cpp | 10 +++++----- platform.h | 5 ----- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/osal/common/TcpIpBase.h b/osal/common/TcpIpBase.h index 79eefad2..fe6a763c 100644 --- a/osal/common/TcpIpBase.h +++ b/osal/common/TcpIpBase.h @@ -5,13 +5,9 @@ #include "../../platform.h" #ifdef PLATFORM_WIN - #include - #elif defined(PLATFORM_UNIX) - #include - #endif class TcpIpBase { @@ -23,7 +19,7 @@ protected: static constexpr int SHUT_BOTH = SD_BOTH; using socket_t = SOCKET; -#elif defined(__unix__) +#elif defined(PLATFORM_UNIX) using socket_t = int; static constexpr int INVALID_SOCKET = -1; diff --git a/osal/host/Clock.cpp b/osal/host/Clock.cpp index b2e4c171..ed5aab62 100644 --- a/osal/host/Clock.cpp +++ b/osal/host/Clock.cpp @@ -48,7 +48,7 @@ ReturnValue_t Clock::setClock(const timeval* time) { } ReturnValue_t Clock::getClock_timeval(timeval* time) { -#if defined(_WIN32) +#if defined(PLATFORM_WIN) auto now = std::chrono::system_clock::now(); auto secondsChrono = std::chrono::time_point_cast(now); auto epoch = now.time_since_epoch(); @@ -56,7 +56,7 @@ ReturnValue_t Clock::getClock_timeval(timeval* time) { auto fraction = now - secondsChrono; time->tv_usec = std::chrono::duration_cast(fraction).count(); return HasReturnvaluesIF::RETURN_OK; -#elif defined(__unix__) +#elif defined(PLATFORM_UNIX) timespec timeUnix; int status = clock_gettime(CLOCK_REALTIME,&timeUnix); if(status!=0){ @@ -87,14 +87,14 @@ ReturnValue_t Clock::getClock_usecs(uint64_t* time) { timeval Clock::getUptime() { timeval timeval; -#if defined(_WIN32) +#if defined(PLATFORM_WIN) auto uptime = std::chrono::milliseconds(GetTickCount64()); auto secondsChrono = std::chrono::duration_cast(uptime); timeval.tv_sec = secondsChrono.count(); auto fraction = uptime - secondsChrono; timeval.tv_usec = std::chrono::duration_cast( fraction).count(); -#elif defined(__unix__) +#elif defined(PLATFORM_UNIX) double uptimeSeconds; if (std::ifstream("/proc/uptime", std::ios::in) >> uptimeSeconds) { @@ -121,7 +121,7 @@ ReturnValue_t Clock::getUptime(uint32_t* uptimeMs) { return HasReturnvaluesIF::RETURN_OK; } - +ReturnValue_t Clock::getDateAndTime(TimeOfDay_t* time) { /* Do some magic with chrono (C++20!) */ /* Right now, the library doesn't have the new features to get the required values yet. so we work around that for now. */ diff --git a/platform.h b/platform.h index 08260094..4bca3398 100644 --- a/platform.h +++ b/platform.h @@ -2,14 +2,9 @@ #define FSFW_PLATFORM_H_ #if defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)) - #define PLATFORM_UNIX - #elif defined(_WIN32) - #define PLATFORM_WIN - #endif - #endif /* FSFW_PLATFORM_H_ */ From 4fa56a2f1d3424c2afa30d34013ce2e11533ae84 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 12 May 2021 18:37:52 +0200 Subject: [PATCH 083/389] moved string port argument --- osal/common/UdpTmTcBridge.cpp | 2 +- osal/common/UdpTmTcBridge.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osal/common/UdpTmTcBridge.cpp b/osal/common/UdpTmTcBridge.cpp index ba23f521..a3b4efa7 100644 --- a/osal/common/UdpTmTcBridge.cpp +++ b/osal/common/UdpTmTcBridge.cpp @@ -21,7 +21,7 @@ const std::string UdpTmTcBridge::DEFAULT_UDP_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT; UdpTmTcBridge::UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination, - object_id_t tmStoreId, object_id_t tcStoreId, std::string udpServerPort): + std::string udpServerPort, object_id_t tmStoreId, object_id_t tcStoreId): TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) { if(udpServerPort == "") { this->udpServerPort = DEFAULT_UDP_SERVER_PORT; diff --git a/osal/common/UdpTmTcBridge.h b/osal/common/UdpTmTcBridge.h index 8b8d1949..49d846a1 100644 --- a/osal/common/UdpTmTcBridge.h +++ b/osal/common/UdpTmTcBridge.h @@ -28,8 +28,8 @@ public: /* The ports chosen here should not be used by any other process. */ static const std::string DEFAULT_UDP_SERVER_PORT; - UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination, - object_id_t tmStoreId, object_id_t tcStoreId, std::string udpServerPort = ""); + UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination, std::string udpServerPort = "", + object_id_t tmStoreId = objects::TM_STORE, object_id_t tcStoreId = objects::TC_STORE); virtual~ UdpTmTcBridge(); /** From 0bc124fd2187bfad49589562bba812ac79a1d387 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 13 May 2021 21:46:46 +0200 Subject: [PATCH 084/389] renamed tcpip tasks --- unittest/user/testcfg/objects/systemObjectList.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unittest/user/testcfg/objects/systemObjectList.h b/unittest/user/testcfg/objects/systemObjectList.h index 88b92131..76f1ff90 100644 --- a/unittest/user/testcfg/objects/systemObjectList.h +++ b/unittest/user/testcfg/objects/systemObjectList.h @@ -15,8 +15,8 @@ namespace objects { PUS_DISTRIBUTOR = 11, TM_FUNNEL = 12, - UDP_BRIDGE = 15, - UDP_POLLING_TASK = 16, + TCPIP_BRIDGE = 15, + TCPIP_HELPER = 16, TEST_ECHO_COM_IF = 20, TEST_DEVICE = 21, From 5847081a246aea8d56b184e122052bd792b02661 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 13 May 2021 22:17:21 +0200 Subject: [PATCH 085/389] tweaks and fixes for TCP --- osal/common/TcpTmTcServer.cpp | 7 ++++--- osal/common/TcpTmTcServer.h | 2 +- osal/windows/tcpipHelpers.cpp | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/osal/common/TcpTmTcServer.cpp b/osal/common/TcpTmTcServer.cpp index 0663fed1..28fab422 100644 --- a/osal/common/TcpTmTcServer.cpp +++ b/osal/common/TcpTmTcServer.cpp @@ -99,8 +99,8 @@ ReturnValue_t TcpTmTcServer::performOperation(uint8_t opCode) { using namespace tcpip; // If a connection is accepted, the corresponding socket will be assigned to the new socket socket_t connSocket = 0; - sockaddr clientSockAddr = {}; - socklen_t connectorSockAddrLen = 0; + // sockaddr clientSockAddr = {}; + // socklen_t connectorSockAddrLen = 0; int retval = 0; // Listen for connection requests permanently for lifetime of program @@ -111,7 +111,8 @@ ReturnValue_t TcpTmTcServer::performOperation(uint8_t opCode) { continue; } - connSocket = accept(listenerTcpSocket, &clientSockAddr, &connectorSockAddrLen); + //connSocket = accept(listenerTcpSocket, &clientSockAddr, &connectorSockAddrLen); + connSocket = accept(listenerTcpSocket, nullptr, nullptr); if(connSocket == INVALID_SOCKET) { handleError(Protocol::TCP, ErrorSources::ACCEPT_CALL, 500); diff --git a/osal/common/TcpTmTcServer.h b/osal/common/TcpTmTcServer.h index 191fff7b..f7c36d69 100644 --- a/osal/common/TcpTmTcServer.h +++ b/osal/common/TcpTmTcServer.h @@ -43,7 +43,7 @@ class TcpTmTcServer: public: /* The ports chosen here should not be used by any other process. */ static const std::string DEFAULT_TCP_SERVER_PORT; - static const std::string DEFAULT_TCP_CLIENT_PORT; + static constexpr size_t ETHERNET_MTU_SIZE = 1500; /** diff --git a/osal/windows/tcpipHelpers.cpp b/osal/windows/tcpipHelpers.cpp index 03278a92..3dab9406 100644 --- a/osal/windows/tcpipHelpers.cpp +++ b/osal/windows/tcpipHelpers.cpp @@ -50,8 +50,8 @@ void tcpip::handleError(Protocol protocol, ErrorSources errorSrc, dur_millis_t s sif::warning << "tcpip::handleError: " << protocolString << " | " << errorSrcString << " | " << infoString << std::endl; #else - sif::printWarning("tcpip::handleError: %s | %s | %s\n", protocolString, - errorSrcString, infoString); + sif::printWarning("tcpip::handleError: %s | %s | %s\n", protocolString.c_str(), + errorSrcString.c_str(), infoString.c_str()); #endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ #endif /* FSFW_VERBOSE_LEVEL >= 1 */ From 58a532fc4d54139ed0f39517e03f2b7788870c9a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 18 May 2021 11:13:28 +0200 Subject: [PATCH 086/389] added health service to fsfw objects --- objectmanager/frameworkObjects.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/objectmanager/frameworkObjects.h b/objectmanager/frameworkObjects.h index 2174f829..47ba6df2 100644 --- a/objectmanager/frameworkObjects.h +++ b/objectmanager/frameworkObjects.h @@ -16,6 +16,8 @@ enum framework_objects: object_id_t { PUS_SERVICE_17_TEST = 0x53000017, PUS_SERVICE_20_PARAMETERS = 0x53000020, PUS_SERVICE_200_MODE_MGMT = 0x53000200, + PUS_SERVICE_201_HEALTH = 0x53000201, + //Generic IDs for IPC, modes, health, events HEALTH_TABLE = 0x53010000, From d3423b30b0f0e2259f9fbde12b1757d54cdd1259 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 18 May 2021 11:14:26 +0200 Subject: [PATCH 087/389] minot changes --- objectmanager/frameworkObjects.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/objectmanager/frameworkObjects.h b/objectmanager/frameworkObjects.h index 47ba6df2..fdb72e30 100644 --- a/objectmanager/frameworkObjects.h +++ b/objectmanager/frameworkObjects.h @@ -1,7 +1,7 @@ #ifndef FSFW_OBJECTMANAGER_FRAMEWORKOBJECTS_H_ #define FSFW_OBJECTMANAGER_FRAMEWORKOBJECTS_H_ -#include +#include "SystemObjectIF.h" namespace objects { enum framework_objects: object_id_t { @@ -18,7 +18,6 @@ enum framework_objects: object_id_t { PUS_SERVICE_200_MODE_MGMT = 0x53000200, PUS_SERVICE_201_HEALTH = 0x53000201, - //Generic IDs for IPC, modes, health, events HEALTH_TABLE = 0x53010000, // MODE_STORE = 0x53010100, From 9e0146f5791b1c7f34c467e7118f4efb683d7205 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 18 May 2021 11:16:54 +0200 Subject: [PATCH 088/389] comment added --- objectmanager/frameworkObjects.h | 1 + 1 file changed, 1 insertion(+) diff --git a/objectmanager/frameworkObjects.h b/objectmanager/frameworkObjects.h index fdb72e30..36010807 100644 --- a/objectmanager/frameworkObjects.h +++ b/objectmanager/frameworkObjects.h @@ -3,6 +3,7 @@ #include "SystemObjectIF.h" +// The objects will be instantiated in the ID order namespace objects { enum framework_objects: object_id_t { FSFW_OBJECTS_START = 0x53000000, From 94062c67d398966ef814a206811fde07b926866a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 18 May 2021 11:28:37 +0200 Subject: [PATCH 089/389] added more pus services --- events/fwSubsystemIdRanges.h | 51 ++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/events/fwSubsystemIdRanges.h b/events/fwSubsystemIdRanges.h index 1b0b238e..88dee9b4 100644 --- a/events/fwSubsystemIdRanges.h +++ b/events/fwSubsystemIdRanges.h @@ -1,30 +1,37 @@ #ifndef FSFW_EVENTS_FWSUBSYSTEMIDRANGES_H_ #define FSFW_EVENTS_FWSUBSYSTEMIDRANGES_H_ +#include + namespace SUBSYSTEM_ID { -enum { - MEMORY = 22, - OBSW = 26, - CDH = 28, - TCS_1 = 59, - PCDU_1 = 42, - PCDU_2 = 43, - HEATER = 50, - T_SENSORS = 52, - FDIR = 70, - FDIR_1 = 71, - FDIR_2 = 72, - HK = 73, - SYSTEM_MANAGER = 74, - SYSTEM_MANAGER_1 = 75, - SYSTEM_1 = 79, - PUS_SERVICE_1 = 80, - PUS_SERVICE_9 = 89, - PUS_SERVICE_17 = 97, - FW_SUBSYSTEM_ID_RANGE +enum: uint8_t { + MEMORY = 22, + OBSW = 26, + CDH = 28, + TCS_1 = 59, + PCDU_1 = 42, + PCDU_2 = 43, + HEATER = 50, + T_SENSORS = 52, + FDIR = 70, + FDIR_1 = 71, + FDIR_2 = 72, + HK = 73, + SYSTEM_MANAGER = 74, + SYSTEM_MANAGER_1 = 75, + SYSTEM_1 = 79, + PUS_SERVICE_1 = 80, + PUS_SERVICE_2 = 82, + PUS_SERVICE_3 = 83, + PUS_SERVICE_5 = 85, + PUS_SERVICE_6 = 86, + PUS_SERVICE_8 = 88, + PUS_SERVICE_9 = 89, + PUS_SERVICE_17 = 97, + PUS_SERVICE_23 = 103, + + FW_SUBSYSTEM_ID_RANGE }; } - - #endif /* FSFW_EVENTS_FWSUBSYSTEMIDRANGES_H_ */ From 6db2efc20dc04de5e433ad2a66f23b89a70bb875 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 18 May 2021 11:36:36 +0200 Subject: [PATCH 090/389] copmment block for fw class ids --- returnvalues/FwClassIds.h | 135 ++++++++++++++++++++------------------ 1 file changed, 70 insertions(+), 65 deletions(-) diff --git a/returnvalues/FwClassIds.h b/returnvalues/FwClassIds.h index 4c9f022b..2bb83f73 100644 --- a/returnvalues/FwClassIds.h +++ b/returnvalues/FwClassIds.h @@ -1,72 +1,77 @@ #ifndef FSFW_RETURNVALUES_FWCLASSIDS_H_ #define FSFW_RETURNVALUES_FWCLASSIDS_H_ +#include + +// The comment block at the end is used by the returnvalue exporter. +// It is recommended to add it as well for mission returnvalues namespace CLASS_ID { -enum { - OPERATING_SYSTEM_ABSTRACTION = 1, //OS - OBJECT_MANAGER_IF, //OM - DEVICE_HANDLER_BASE, //DHB - RMAP_CHANNEL, //RMP - POWER_SWITCH_IF, //PS - HAS_MEMORY_IF, //PP - DEVICE_STATE_MACHINE_BASE, //DSMB - DATA_SET_CLASS, //DPS - POOL_RAW_ACCESS_CLASS, //DPR - CONTROLLER_BASE, //CTR - SUBSYSTEM_BASE, //SB - MODE_STORE_IF, //MS - SUBSYSTEM, //SS - HAS_MODES_IF, //HM - COMMAND_MESSAGE, //CM - CCSDS_TIME_HELPER_CLASS, //TIM - ARRAY_LIST, //AL - ASSEMBLY_BASE, //AB - MEMORY_HELPER, //MH - SERIALIZE_IF, //SE - FIXED_MAP, //FM - FIXED_MULTIMAP, //FMM - HAS_HEALTH_IF, //HHI - FIFO_CLASS, //FF - MESSAGE_PROXY, //MQP - TRIPLE_REDUNDACY_CHECK, //TRC - TC_PACKET_CHECK, //TCC - PACKET_DISTRIBUTION, //TCD - ACCEPTS_TELECOMMANDS_IF, //PUS - DEVICE_SERVICE_BASE, //DSB - COMMAND_SERVICE_BASE, //CSB - TM_STORE_BACKEND_IF, //TMB - TM_STORE_FRONTEND_IF, //TMF - STORAGE_AND_RETRIEVAL_SERVICE, //SR - MATCH_TREE_CLASS, //MT - EVENT_MANAGER_IF, //EV - HANDLES_FAILURES_IF, //FDI - DEVICE_HANDLER_IF, //DHI - STORAGE_MANAGER_IF, //SM - THERMAL_COMPONENT_IF, //TC - INTERNAL_ERROR_CODES, //IEC - TRAP, //TRP - CCSDS_HANDLER_IF, //CCS - PARAMETER_WRAPPER, //PAW - HAS_PARAMETERS_IF, //HPA - ASCII_CONVERTER, //ASC - POWER_SWITCHER, //POS - LIMITS_IF, //LIM - COMMANDS_ACTIONS_IF, //CF - HAS_ACTIONS_IF, //HF - DEVICE_COMMUNICATION_IF, //DC - BSP, //BSP - TIME_STAMPER_IF, //TSI 53 - SGP4PROPAGATOR_CLASS, //SGP4 54 - MUTEX_IF, //MUX 55 - MESSAGE_QUEUE_IF,//MQI 56 - SEMAPHORE_IF, //SPH 57 - LOCAL_POOL_OWNER_IF, //LPIF 58 - POOL_VARIABLE_IF, //PVA 59 - HOUSEKEEPING_MANAGER, //HKM 60 - DLE_ENCODER, //DLEE 61 - PUS_SERVICE_9, //PUS9 62 - FILE_SYSTEM, //FILS 63 - FW_CLASS_ID_COUNT //is actually count + 1 ! +enum: uint8_t { + OPERATING_SYSTEM_ABSTRACTION = 1, //OS + OBJECT_MANAGER_IF, //OM + DEVICE_HANDLER_BASE, //DHB + RMAP_CHANNEL, //RMP + POWER_SWITCH_IF, //PS + HAS_MEMORY_IF, //PP + DEVICE_STATE_MACHINE_BASE, //DSMB + DATA_SET_CLASS, //DPS + POOL_RAW_ACCESS_CLASS, //DPR + CONTROLLER_BASE, //CTR + SUBSYSTEM_BASE, //SB + MODE_STORE_IF, //MS + SUBSYSTEM, //SS + HAS_MODES_IF, //HM + COMMAND_MESSAGE, //CM + CCSDS_TIME_HELPER_CLASS, //TIM + ARRAY_LIST, //AL + ASSEMBLY_BASE, //AB + MEMORY_HELPER, //MH + SERIALIZE_IF, //SE + FIXED_MAP, //FM + FIXED_MULTIMAP, //FMM + HAS_HEALTH_IF, //HHI + FIFO_CLASS, //FF + MESSAGE_PROXY, //MQP + TRIPLE_REDUNDACY_CHECK, //TRC + TC_PACKET_CHECK, //TCC + PACKET_DISTRIBUTION, //TCD + ACCEPTS_TELECOMMANDS_IF, //PUS + DEVICE_SERVICE_BASE, //DSB + COMMAND_SERVICE_BASE, //CSB + TM_STORE_BACKEND_IF, //TMB + TM_STORE_FRONTEND_IF, //TMF + STORAGE_AND_RETRIEVAL_SERVICE, //SR + MATCH_TREE_CLASS, //MT + EVENT_MANAGER_IF, //EV + HANDLES_FAILURES_IF, //FDI + DEVICE_HANDLER_IF, //DHI + STORAGE_MANAGER_IF, //SM + THERMAL_COMPONENT_IF, //TC + INTERNAL_ERROR_CODES, //IEC + TRAP, //TRP + CCSDS_HANDLER_IF, //CCS + PARAMETER_WRAPPER, //PAW + HAS_PARAMETERS_IF, //HPA + ASCII_CONVERTER, //ASC + POWER_SWITCHER, //POS + LIMITS_IF, //LIM + COMMANDS_ACTIONS_IF, //CF + HAS_ACTIONS_IF, //HF + DEVICE_COMMUNICATION_IF, //DC + BSP, //BSP + TIME_STAMPER_IF, //TSI + SGP4PROPAGATOR_CLASS, //SGP4 + MUTEX_IF, //MUX + MESSAGE_QUEUE_IF,//MQI + SEMAPHORE_IF, //SPH + LOCAL_POOL_OWNER_IF, //LPIF + POOL_VARIABLE_IF, //PVA + HOUSEKEEPING_MANAGER, //HKM + DLE_ENCODER, //DLEE + PUS_SERVICE_3, //PUS3 + PUS_SERVICE_9, //PUS9 + FILE_SYSTEM, //FILS + FW_CLASS_ID_COUNT //is actually count + 1 ! }; } From c07672f9b461531e065213e0ef77e0246f09674f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 18 May 2021 14:57:54 +0200 Subject: [PATCH 091/389] changed class id file for refactored modgen --- returnvalues/FwClassIds.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/returnvalues/FwClassIds.h b/returnvalues/FwClassIds.h index 2bb83f73..17c37a79 100644 --- a/returnvalues/FwClassIds.h +++ b/returnvalues/FwClassIds.h @@ -7,7 +7,8 @@ // It is recommended to add it as well for mission returnvalues namespace CLASS_ID { enum: uint8_t { - OPERATING_SYSTEM_ABSTRACTION = 1, //OS + FW_CLASS_ID_START = 0, // [EXPORT] : [START] + OPERATING_SYSTEM_ABSTRACTION, //OS OBJECT_MANAGER_IF, //OM DEVICE_HANDLER_BASE, //DHB RMAP_CHANNEL, //RMP @@ -71,7 +72,7 @@ enum: uint8_t { PUS_SERVICE_3, //PUS3 PUS_SERVICE_9, //PUS9 FILE_SYSTEM, //FILS - FW_CLASS_ID_COUNT //is actually count + 1 ! + FW_CLASS_ID_COUNT // [EXPORT] : [END] }; } From e2ae9756f3eda0a54d1ec2c2beecba18d74c3618 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 18 May 2021 15:12:48 +0200 Subject: [PATCH 092/389] updated documentation --- doc/README-config.md | 24 ++++++++++++++++++--- doc/README-core.md | 20 ++++++++++++------ doc/README-highlevel.md | 47 ++++++++++++++++++++++++----------------- 3 files changed, 62 insertions(+), 29 deletions(-) diff --git a/doc/README-config.md b/doc/README-config.md index 036a7d14..b314b84e 100644 --- a/doc/README-config.md +++ b/doc/README-config.md @@ -1,10 +1,27 @@ - ## Configuring the FSFW The FSFW can be configured via the `fsfwconfig` folder. A template folder has been provided to have a starting point for this. The folder should be added -to the include path. +to the include path. The primary configuration file is the `FSFWConfig.h` folder. Some +of the available options will be explained in more detail here. +## Auto-Translation of Events + +The FSFW allows the automatic translation of events, which allows developers to track triggered +events directly via consoke output. Using this feature requires: + +1. `FSFW_OBJ_EVENT_TRANSLATION` set to 1 in the configuration file. +2. Special auto-generated translation files which translate event IDs and object IDs into + human readable strings. These files can be generated using the + [modgen Python scripts](https://git.ksat-stuttgart.de/source/modgen.git). +3. The generated translation files for the object IDs should be named `translatesObjects.cpp` + and `translateObjects.h` and should be copied to the `fsfwconfig/objects` folder +4. The generated translation files for the event IDs should be named `translateEvents.cpp` and + `translateEvents.h` and should be copied to the `fsfwconfig/events` folder + +An example implementations of these translation file generators can be found as part +of the [SOURCE project here](https://git.ksat-stuttgart.de/source/sourceobsw/-/tree/development/generators) +or the [FSFW example](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example_public/src/branch/master/generators) ### Configuring the Event Manager @@ -18,4 +35,5 @@ static constexpr size_t FSFW_EVENTMGMR_MATCHTREE_NODES = 240; static constexpr size_t FSFW_EVENTMGMT_EVENTIDMATCHERS = 120; static constexpr size_t FSFW_EVENTMGMR_RANGEMATCHERS = 120; } -``` \ No newline at end of file +``` + diff --git a/doc/README-core.md b/doc/README-core.md index 6431b831..e34890ae 100644 --- a/doc/README-core.md +++ b/doc/README-core.md @@ -19,8 +19,9 @@ A nullptr check of the returning Pointer must be done. This function is based on ```cpp template T* ObjectManagerIF::get( object_id_t id ) ``` -* A typical way to create all objects on startup is a handing a static produce function to the ObjectManager on creation. -By calling objectManager->initialize() the produce function will be called and all SystemObjects will be initialized afterwards. +* A typical way to create all objects on startup is a handing a static produce function to the + ObjectManager on creation. By calling objectManager->initialize() the produce function will be + called and all SystemObjects will be initialized afterwards. ### Event Manager @@ -36,14 +37,19 @@ By calling objectManager->initialize() the produce function will be called and a ### Stores -* The message based communication can only exchange a few bytes of information inside the message itself. Therefore, additional information can - be exchanged with Stores. With this, only the store address must be exchanged in the message. -* Internally, the FSFW uses an IPC Store to exchange data between processes. For incoming TCs a TC Store is used. For outgoing TM a TM store is used. +* The message based communication can only exchange a few bytes of information inside the message + itself. Therefore, additional information can be exchanged with Stores. With this, only the + store address must be exchanged in the message. +* Internally, the FSFW uses an IPC Store to exchange data between processes. For incoming TCs a TC + Store is used. For outgoing TM a TM store is used. * All of them should use the Thread Safe Class storagemanager/PoolManager ### Tasks There are two different types of tasks: - * The PeriodicTask just executes objects that are of type ExecutableObjectIF in the order of the insertion to the Tasks. - * FixedTimeslotTask executes a list of calls in the order of the given list. This is intended for DeviceHandlers, where polling should be in a defined order. An example can be found in defaultcfg/fsfwconfig/pollingSequence + * The PeriodicTask just executes objects that are of type ExecutableObjectIF in the order of the + insertion to the Tasks. + * FixedTimeslotTask executes a list of calls in the order of the given list. This is intended for + DeviceHandlers, where polling should be in a defined order. An example can be found in + `defaultcfg/fsfwconfig/pollingSequence` folder diff --git a/doc/README-highlevel.md b/doc/README-highlevel.md index fac89c53..dd94d6da 100644 --- a/doc/README-highlevel.md +++ b/doc/README-highlevel.md @@ -3,11 +3,12 @@ ## Structure The general structure is driven by the usage of interfaces provided by objects. -The FSFW uses C++11 as baseline. The intention behind this is that this C++ Standard should be widely available, even with older compilers. +The FSFW uses C++11 as baseline. The intention behind this is that this C++ Standard should be +widely available, even with older compilers. The FSFW uses dynamic allocation during the initialization but provides static containers during runtime. This simplifies the instantiation of objects and allows the usage of some standard containers. -Dynamic Allocation after initialization is discouraged and different solutions are provided in the FSFW to achieve that. -The fsfw uses run-time type information but exceptions are not allowed. +Dynamic Allocation after initialization is discouraged and different solutions are provided in the +FSFW to achieve that. The fsfw uses run-time type information but exceptions are not allowed. ### Failure Handling @@ -41,10 +42,11 @@ An example setup of ids can be found in the example config in "defaultcft/fsfwco ### Events -Events are tied to objects. EventIds can be generated by calling the Macro MAKE_EVENT. This works analog to the returnvalues. -Every object that needs own EventIds has to get a unique SUBSYSTEM_ID. -Every SystemObject can call triggerEvent from the parent class. -Therefore, event messages contain the specific EventId and the objectId of the object that has triggered. +Events are tied to objects. EventIds can be generated by calling the Macro MAKE_EVENT. +This works analog to the returnvalues. Every object that needs own EventIds has to get a +unique SUBSYSTEM_ID. Every SystemObject can call triggerEvent from the parent class. +Therefore, event messages contain the specific EventId and the objectId of the object that +has triggered. ### Internal Communication @@ -59,17 +61,19 @@ The services can be seen as a conversion from a TC to a message based communicat #### CCSDS Frames, CCSDS Space Packets and PUS -If the communication is based on CCSDS Frames and Space Packets, several classes can be used to distributed the packets to the corresponding services. Those can be found in tcdistribution. -If Space Packets are used, a timestamper must be created. -An example can be found in the timemanager folder, this uses CCSDSTime::CDS_short. +If the communication is based on CCSDS Frames and Space Packets, several classes can be used to +distributed the packets to the corresponding services. Those can be found in `tcdistribution`. +If Space Packets are used, a timestamper has to be provided by the user. +An example can be found in the `timemanager` folder, which uses `CCSDSTime::CDS_short`. #### Device Handlers DeviceHandlers are another important component of the FSFW. -The idea is, to have a software counterpart of every physical device to provide a simple mode, health and commanding interface. -By separating the underlying Communication Interface with DeviceCommunicationIF, a device handler (DH) can be tested on different hardware. -The DH has mechanisms to monitor the communication with the physical device which allow for FDIR reaction. -Device Handlers can be created by overriding `DeviceHandlerBase`. +The idea is, to have a software counterpart of every physical device to provide a simple mode, +health and commanding interface. By separating the underlying Communication Interface with +`DeviceCommunicationIF`, a device handler (DH) can be tested on different hardware. +The DH has mechanisms to monitor the communication with the physical device which allow +for FDIR reaction. Device Handlers can be created by implementing `DeviceHandlerBase`. A standard FDIR component for the DH will be created automatically but can be overwritten by the user. More information on DeviceHandlers can be found in the related [documentation section](doc/README-devicehandlers.md#top). @@ -81,13 +85,17 @@ DeviceHandlers and Controllers are the lowest part of the hierarchy. The next layer are Assemblies. Those assemblies act as a component which handle redundancies of handlers. Assemblies share a common core with the next level which are the Subsystems. -Those Assemblies are intended to act as auto-generated components from a database which describes the subsystem modes. -The definitions contain transition and target tables which contain the DH, Assembly and Controller Modes to be commanded. -Transition tables contain as many steps as needed to reach the mode from any other mode, e.g. a switch into any higher AOCS mode might first turn on the sensors, than the actuators and the controller as last component. +Those Assemblies are intended to act as auto-generated components from a database which describes +the subsystem modes. The definitions contain transition and target tables which contain the DH, +Assembly and Controller Modes to be commanded. +Transition tables contain as many steps as needed to reach the mode from any other mode, e.g. a +switch into any higher AOCS mode might first turn on the sensors, than the actuators and the +controller as last component. The target table is used to describe the state that is checked continuously by the subsystem. All of this allows System Modes to be generated as Subsystem object as well from the same database. This System contains list of subsystem modes in the transition and target tables. -Therefore, it allows a modular system to create system modes and easy commanding of those, because only the highest components must be commanded. +Therefore, it allows a modular system to create system modes and easy commanding of those, because +only the highest components must be commanded. The health state represents if the component is able to perform its tasks. This can be used to signal the system to avoid using this component instead of a redundant one. @@ -95,5 +103,6 @@ The on-board FDIR uses the health state for isolation and recovery. ## Unit Tests -Unit Tests are provided in the unittest folder. Those use the catch2 framework but do not include catch2 itself. More information on how to run these tests can be found in the separate +Unit Tests are provided in the unittest folder. Those use the catch2 framework but do not include +catch2 itself. More information on how to run these tests can be found in the separate [`fsfw_tests` reposoitory](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_tests) From ed27d388d5d954dfbb580b5972d6dfcb3cf59aef Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 18 May 2021 15:31:04 +0200 Subject: [PATCH 093/389] added tmtc chapter in doc --- doc/README-config.md | 7 ++-- doc/README-highlevel.md | 84 ++++++++++++++++++++++++++--------------- 2 files changed, 58 insertions(+), 33 deletions(-) diff --git a/doc/README-config.md b/doc/README-config.md index b314b84e..6afba83c 100644 --- a/doc/README-config.md +++ b/doc/README-config.md @@ -1,11 +1,12 @@ -## Configuring the FSFW +Configuring the FSFW +====== The FSFW can be configured via the `fsfwconfig` folder. A template folder has been provided to have a starting point for this. The folder should be added to the include path. The primary configuration file is the `FSFWConfig.h` folder. Some of the available options will be explained in more detail here. -## Auto-Translation of Events +# Auto-Translation of Events The FSFW allows the automatic translation of events, which allows developers to track triggered events directly via consoke output. Using this feature requires: @@ -23,7 +24,7 @@ An example implementations of these translation file generators can be found as of the [SOURCE project here](https://git.ksat-stuttgart.de/source/sourceobsw/-/tree/development/generators) or the [FSFW example](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example_public/src/branch/master/generators) -### Configuring the Event Manager +## Configuring the Event Manager The number of allowed subscriptions can be modified with the following parameters: diff --git a/doc/README-highlevel.md b/doc/README-highlevel.md index dd94d6da..7bf96c64 100644 --- a/doc/README-highlevel.md +++ b/doc/README-highlevel.md @@ -1,6 +1,7 @@ -# High-level overview +High-level overview +====== -## Structure +# Structure The general structure is driven by the usage of interfaces provided by objects. The FSFW uses C++11 as baseline. The intention behind this is that this C++ Standard should be @@ -10,37 +11,44 @@ This simplifies the instantiation of objects and allows the usage of some standa Dynamic Allocation after initialization is discouraged and different solutions are provided in the FSFW to achieve that. The fsfw uses run-time type information but exceptions are not allowed. -### Failure Handling +# Failure Handling -Functions should return a defined ReturnValue_t to signal to the caller that something has gone wrong. -Returnvalues must be unique. For this the function HasReturnvaluesIF::makeReturnCode or the Macro MAKE_RETURN can be used. -The CLASS_ID is a unique id for that type of object. See returnvalues/FwClassIds. +Functions should return a defined `ReturnValue_t` to signal to the caller that something has +gone wrong. Returnvalues must be unique. For this the function `HasReturnvaluesIF::makeReturnCode` +or the macro `MAKE_RETURN` can be used. The `CLASS_ID` is a unique id for that type of object. +See `returnvalues/FwClassIds` folder. The user can add custom `CLASS_ID`s via the +`fsfwconfig` folder. -### OSAL +# OSAL The FSFW provides operation system abstraction layers for Linux, FreeRTOS and RTEMS. The OSAL provides periodic tasks, message queues, clocks and semaphores as well as mutexes. -The [OSAL README](doc/README-osal.md#top) provides more detailed information on provided components and how to use them. +The [OSAL README](doc/README-osal.md#top) provides more detailed information on provided components +and how to use them. -### Core Components +# Core Components The FSFW has following core components. More detailed informations can be found in the [core component section](doc/README-core.md#top): -1. Tasks: Abstraction for different (periodic) task types like periodic tasks or tasks with fixed timeslots -2. ObjectManager: This module stores all `SystemObjects` by mapping a provided unique object ID to the object handles. -3. Static Stores: Different stores are provided to store data of variable size (like telecommands or small telemetry) in a pool structure without - using dynamic memory allocation. These pools are allocated up front. +1. Tasks: Abstraction for different (periodic) task types like periodic tasks or tasks + with fixed timeslots +2. ObjectManager: This module stores all `SystemObjects` by mapping a provided unique object ID + to the object handles. +3. Static Stores: Different stores are provided to store data of variable size (like telecommands + or small telemetry) in a pool structure without using dynamic memory allocation. + These pools are allocated up front. 3. Clock: This module provided common time related functions 4. EventManager: This module allows routing of events generated by `SystemObjects` 5. HealthTable: A component which stores the health states of objects -### Static IDs in the framework +# Static IDs in the framework Some parts of the framework use a static routing address for communication. -An example setup of ids can be found in the example config in "defaultcft/fsfwconfig/objects/Factory::setStaticFrameworkObjectIds()". +An example setup of ids can be found in the example config in `defaultcft/fsfwconfig/objects` + inside the function `Factory::setStaticFrameworkObjectIds()`. -### Events +# Events Events are tied to objects. EventIds can be generated by calling the Macro MAKE_EVENT. This works analog to the returnvalues. Every object that needs own EventIds has to get a @@ -48,25 +56,39 @@ unique SUBSYSTEM_ID. Every SystemObject can call triggerEvent from the parent cl Therefore, event messages contain the specific EventId and the objectId of the object that has triggered. -### Internal Communication +# Internal Communication -Components communicate mostly over Message through Queues. -Those queues are created by calling the singleton QueueFactory::instance()->create(). +Components communicate mostly via Messages through Queues. +Those queues are created by calling the singleton `QueueFactory::instance()->create()` which +will create `MessageQueue` instances for the used OSAL. -### External Communication +# External Communication The external communication with the mission control system is mostly up to the user implementation. The FSFW provides PUS Services which can be used to but don't need to be used. The services can be seen as a conversion from a TC to a message based communication and back. -#### CCSDS Frames, CCSDS Space Packets and PUS +## TMTC Communication + +The FSFW provides some components to facilitate TMTC handling via the PUS commands. +For example, a UDP or TCP PUS server socket can be opended on a specific port using the +files located in `osal/common`. The FSFW example uses this functionality to allow sending telecommands +and receiving telemetry using the [TMTC commander application](https://github.com/spacefisch/tmtccmd). +Simple commands like the PUS Service 17 ping service can be tested by simply running the +`tmtc_client_cli.py` or `tmtc_client_gui.py` utility in +the [example tmtc folder](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example_public/src/branch/master/tmtc). + +More generally, any class responsible for handling incoming telecommands and sending telemetry +can implement the generic `TmTcBridge` class located in `tmtcservices`. + +## CCSDS Frames, CCSDS Space Packets and PUS If the communication is based on CCSDS Frames and Space Packets, several classes can be used to distributed the packets to the corresponding services. Those can be found in `tcdistribution`. If Space Packets are used, a timestamper has to be provided by the user. An example can be found in the `timemanager` folder, which uses `CCSDSTime::CDS_short`. -#### Device Handlers +# Device Handlers DeviceHandlers are another important component of the FSFW. The idea is, to have a software counterpart of every physical device to provide a simple mode, @@ -74,16 +96,18 @@ health and commanding interface. By separating the underlying Communication Inte `DeviceCommunicationIF`, a device handler (DH) can be tested on different hardware. The DH has mechanisms to monitor the communication with the physical device which allow for FDIR reaction. Device Handlers can be created by implementing `DeviceHandlerBase`. -A standard FDIR component for the DH will be created automatically but can be overwritten by the user. -More information on DeviceHandlers can be found in the related [documentation section](doc/README-devicehandlers.md#top). +A standard FDIR component for the DH will be created automatically but can +be overwritten by the user. More information on DeviceHandlers can be found in the +related [documentation section](doc/README-devicehandlers.md#top). -#### Modes, Health +# Modes and Health -The two interfaces HasModesIF and HasHealthIF provide access for commanding and monitoring of components. -On-board Mode Management is implement in hierarchy system. +The two interfaces `HasModesIF` and `HasHealthIF` provide access for commanding and monitoring +of components. On-board Mode Management is implement in hierarchy system. DeviceHandlers and Controllers are the lowest part of the hierarchy. -The next layer are Assemblies. Those assemblies act as a component which handle redundancies of handlers. -Assemblies share a common core with the next level which are the Subsystems. +The next layer are Assemblies. Those assemblies act as a component which handle +redundancies of handlers. Assemblies share a common core with the next level which +are the Subsystems. Those Assemblies are intended to act as auto-generated components from a database which describes the subsystem modes. The definitions contain transition and target tables which contain the DH, @@ -101,7 +125,7 @@ The health state represents if the component is able to perform its tasks. This can be used to signal the system to avoid using this component instead of a redundant one. The on-board FDIR uses the health state for isolation and recovery. -## Unit Tests +# Unit Tests Unit Tests are provided in the unittest folder. Those use the catch2 framework but do not include catch2 itself. More information on how to run these tests can be found in the separate From a8c0d96c3901d7424fdc4cb81e9d970599e3614e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 18 May 2021 15:32:52 +0200 Subject: [PATCH 094/389] some fixes --- doc/README-highlevel.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/README-highlevel.md b/doc/README-highlevel.md index 7bf96c64..33a73239 100644 --- a/doc/README-highlevel.md +++ b/doc/README-highlevel.md @@ -71,12 +71,13 @@ The services can be seen as a conversion from a TC to a message based communicat ## TMTC Communication The FSFW provides some components to facilitate TMTC handling via the PUS commands. -For example, a UDP or TCP PUS server socket can be opended on a specific port using the +For example, a UDP or TCP PUS server socket can be opened on a specific port using the files located in `osal/common`. The FSFW example uses this functionality to allow sending telecommands and receiving telemetry using the [TMTC commander application](https://github.com/spacefisch/tmtccmd). Simple commands like the PUS Service 17 ping service can be tested by simply running the `tmtc_client_cli.py` or `tmtc_client_gui.py` utility in -the [example tmtc folder](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example_public/src/branch/master/tmtc). +the [example tmtc folder](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example_public/src/branch/master/tmtc) +while the `fsfw_example` application is running. More generally, any class responsible for handling incoming telecommands and sending telemetry can implement the generic `TmTcBridge` class located in `tmtcservices`. From e147d5a4f58650adfb2c1466c437173f573723ee Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 18 May 2021 15:34:31 +0200 Subject: [PATCH 095/389] some more information --- doc/README-highlevel.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/README-highlevel.md b/doc/README-highlevel.md index 33a73239..262138a7 100644 --- a/doc/README-highlevel.md +++ b/doc/README-highlevel.md @@ -80,7 +80,9 @@ the [example tmtc folder](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example_pu while the `fsfw_example` application is running. More generally, any class responsible for handling incoming telecommands and sending telemetry -can implement the generic `TmTcBridge` class located in `tmtcservices`. +can implement the generic `TmTcBridge` class located in `tmtcservices`. Many applications +also use a dedicated polling task for reading telecommands which passes telecommands +to the `TmTcBridge` implementation. ## CCSDS Frames, CCSDS Space Packets and PUS From b7060a9c78e57f755f9c04de37e8195ddc83194e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 18 May 2021 15:35:47 +0200 Subject: [PATCH 096/389] update README --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fb3be429..484d65c0 100644 --- a/README.md +++ b/README.md @@ -38,11 +38,12 @@ a starting point. The [configuration section](doc/README-config.md#top) provides [1. High-level overview](doc/README-highlevel.md#top)
[2. Core components](doc/README-core.md#top)
-[3. OSAL overview](doc/README-osal.md#top)
-[4. PUS services](doc/README-pus.md#top)
-[5. Device Handler overview](doc/README-devicehandlers.md#top)
-[6. Controller overview](doc/README-controllers.md#top)
-[7. Local Data Pools](doc/README-localpools.md#top)
+[3. Configuration](doc/README-config.md#top)
+[4. OSAL overview](doc/README-osal.md#top)
+[5. PUS services](doc/README-pus.md#top)
+[6. Device Handler overview](doc/README-devicehandlers.md#top)
+[7. Controller overview](doc/README-controllers.md#top)
+[8. Local Data Pools](doc/README-localpools.md#top)
From 36030ef87c96b0fce7664d8c57e12f540fa43090 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 18 May 2021 15:37:05 +0200 Subject: [PATCH 097/389] typo --- doc/README-config.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/README-config.md b/doc/README-config.md index 6afba83c..d71feb97 100644 --- a/doc/README-config.md +++ b/doc/README-config.md @@ -9,7 +9,7 @@ of the available options will be explained in more detail here. # Auto-Translation of Events The FSFW allows the automatic translation of events, which allows developers to track triggered -events directly via consoke output. Using this feature requires: +events directly via console output. Using this feature requires: 1. `FSFW_OBJ_EVENT_TRANSLATION` set to 1 in the configuration file. 2. Special auto-generated translation files which translate event IDs and object IDs into From 5d2c62e75de447a3aed1fde78e8654f9ce8e1205 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 26 May 2021 14:15:48 +0200 Subject: [PATCH 098/389] abstract function defined again --- controller/ExtendedControllerBase.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/controller/ExtendedControllerBase.h b/controller/ExtendedControllerBase.h index d5d43933..63c350e2 100644 --- a/controller/ExtendedControllerBase.h +++ b/controller/ExtendedControllerBase.h @@ -66,6 +66,10 @@ protected: virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, LocalDataPoolManager& poolManager) override = 0; virtual LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override = 0; + + // Mode abstract functions + virtual ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, + uint32_t *msToReachTheMode) override = 0; }; From 2bf5a972e177676b30d83178488b3da01f14e8d1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 27 May 2021 11:56:52 +0200 Subject: [PATCH 099/389] introduced std check --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ba6a187..00c0bc95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,13 @@ add_library(${LIB_FSFW_NAME}) set_property(CACHE OS_FSFW PROPERTY STRINGS host linux rtems freertos) +if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD_REQUIRED True) +elseif(${CMAKE_CXX_STANDARD} LESS 11) + message(FATAL_ERROR "Compiling the FSFW requires a minimum of C++11 support") +endif() + if(NOT OS_FSFW) message(STATUS "No OS for FSFW via OS_FSFW set. Assuming host OS") # Assume host OS and autodetermine from OS_FSFW From 5eadcaf10d03abfec13ddd57f7134c1588f88532 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 27 May 2021 12:46:45 +0200 Subject: [PATCH 100/389] file system message update --- memory/CMakeLists.txt | 8 +-- memory/GenericFileSystemMessage.cpp | 62 ++++++++++++++++++++++ memory/GenericFileSystemMessage.h | 80 +++++++++++++++++++++++++++++ 3 files changed, 146 insertions(+), 4 deletions(-) create mode 100644 memory/GenericFileSystemMessage.cpp create mode 100644 memory/GenericFileSystemMessage.h diff --git a/memory/CMakeLists.txt b/memory/CMakeLists.txt index 9edb9031..c713cd42 100644 --- a/memory/CMakeLists.txt +++ b/memory/CMakeLists.txt @@ -1,5 +1,5 @@ -target_sources(${LIB_FSFW_NAME} - PRIVATE - MemoryHelper.cpp - MemoryMessage.cpp +target_sources(${LIB_FSFW_NAME} PRIVATE + MemoryHelper.cpp + MemoryMessage.cpp + GenericFileSystemMessage.cpp ) \ No newline at end of file diff --git a/memory/GenericFileSystemMessage.cpp b/memory/GenericFileSystemMessage.cpp new file mode 100644 index 00000000..a0ce8d59 --- /dev/null +++ b/memory/GenericFileSystemMessage.cpp @@ -0,0 +1,62 @@ +#include "GenericFileSystemMessage.h" + + +void GenericFileSystemMessage::setCreateFileCommand(CommandMessage* message, + store_address_t storeId) { + message->setCommand(CMD_CREATE_FILE); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setDeleteFileCommand( + CommandMessage* message, store_address_t storeId) { + message->setCommand(CMD_DELETE_FILE); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setCreateDirectoryCommand( + CommandMessage* message, store_address_t storeId) { + message->setCommand(CMD_CREATE_DIRECTORY); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setReportFileAttributesCommand(CommandMessage *message, + store_address_t storeId) { + message->setCommand(CMD_REPORT_FILE_ATTRIBUTES); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setReportFileAttributesReply(CommandMessage *message, + store_address_t storeId) { + message->setCommand(REPLY_REPORT_FILE_ATTRIBUTES); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setDeleteDirectoryCommand(CommandMessage* message, + store_address_t storeId) { + message->setCommand(CMD_DELETE_DIRECTORY); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setLockFileCommand(CommandMessage *message, + store_address_t storeId) { + message->setCommand(CMD_LOCK_FILE); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setUnlockFileCommand(CommandMessage *message, + store_address_t storeId) { + message->setCommand(CMD_UNLOCK_FILE); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setSuccessReply(CommandMessage *message) { + message->setCommand(COMPLETION_SUCCESS); +} + +void GenericFileSystemMessage::setFailureReply(CommandMessage *message, + ReturnValue_t errorCode, uint32_t errorParam) { + message->setCommand(COMPLETION_FAILED); + message->setParameter(errorCode); + message->setParameter2(errorParam); +} + diff --git a/memory/GenericFileSystemMessage.h b/memory/GenericFileSystemMessage.h new file mode 100644 index 00000000..174431e4 --- /dev/null +++ b/memory/GenericFileSystemMessage.h @@ -0,0 +1,80 @@ +#ifndef MISSION_MEMORY_GENERICFILESYSTEMMESSAGE_H_ +#define MISSION_MEMORY_GENERICFILESYSTEMMESSAGE_H_ + +#include + +#include +#include +#include +#include + +/** + * @brief These messages are sent to an object implementing HasFilesystemIF. + * @details + * Enables a message-based file management. The user can add custo commands be implementing + * this generic class. + * @author Jakob Meier, R. Mueller + */ +class GenericFileSystemMessage { +public: + /* Instantiation forbidden */ + GenericFileSystemMessage() = delete; + + static const uint8_t MESSAGE_ID = messagetypes::FILE_SYSTEM_MESSAGE; + /* PUS standard (ECSS-E-ST-70-41C15 2016 p.654) */ + static const Command_t CMD_CREATE_FILE = MAKE_COMMAND_ID(1); + static const Command_t CMD_DELETE_FILE = MAKE_COMMAND_ID(2); + /** Report file attributes */ + static const Command_t CMD_REPORT_FILE_ATTRIBUTES = MAKE_COMMAND_ID(3); + static const Command_t REPLY_REPORT_FILE_ATTRIBUTES = MAKE_COMMAND_ID(4); + /** Command to lock a file, setting it read-only */ + static const Command_t CMD_LOCK_FILE = MAKE_COMMAND_ID(5); + /** Command to unlock a file, enabling further operations on it */ + static const Command_t CMD_UNLOCK_FILE = MAKE_COMMAND_ID(6); + /** + * Find file in repository, using a search pattern. + * Please note that * is the wildcard character. + * For example, when looking for all files which start with have the + * structure tm.bin, tm*.bin can be used. + */ + static const Command_t CMD_FIND_FILE = MAKE_COMMAND_ID(7); + static const Command_t CMD_CREATE_DIRECTORY = MAKE_COMMAND_ID(9); + static const Command_t CMD_DELETE_DIRECTORY = MAKE_COMMAND_ID(10); + static const Command_t CMD_RENAME_DIRECTORY = MAKE_COMMAND_ID(11); + + /** Dump contents of a repository */ + static const Command_t CMD_DUMP_REPOSITORY = MAKE_COMMAND_ID(12); + /** Repository dump reply */ + static const Command_t REPLY_DUMY_REPOSITORY = MAKE_COMMAND_ID(13); + static constexpr Command_t CMD_COPY_FILE = MAKE_COMMAND_ID(14); + static constexpr Command_t CMD_MOVE_FILE = MAKE_COMMAND_ID(15); + + static const Command_t COMPLETION_SUCCESS = MAKE_COMMAND_ID(128); + static const Command_t COMPLETION_FAILED = MAKE_COMMAND_ID(129); + + static void setLockFileCommand(CommandMessage* message, store_address_t storeId); + static void setUnlockFileCommand(CommandMessage* message, store_address_t storeId); + + static void setCreateFileCommand(CommandMessage* message, + store_address_t storeId); + static void setDeleteFileCommand(CommandMessage* message, + store_address_t storeId); + + static void setReportFileAttributesCommand(CommandMessage* message, + store_address_t storeId); + static void setReportFileAttributesReply(CommandMessage* message, + store_address_t storeId); + + static void setCreateDirectoryCommand(CommandMessage* message, + store_address_t storeId); + static void setDeleteDirectoryCommand(CommandMessage* message, + store_address_t storeId); + + static void setSuccessReply(CommandMessage* message); + static void setFailureReply(CommandMessage* message, + ReturnValue_t errorCode, uint32_t errorParam = 0); +}; + + + +#endif /* MISSION_MEMORY_GENERICFILESYSTEMMESSAGE_H_ */ From 59e7f0caae5375913ed93fa14710d3ccdcdebea7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 27 May 2021 12:50:48 +0200 Subject: [PATCH 101/389] added more messages --- memory/GenericFileSystemMessage.cpp | 70 +++++++++++++++++++++++++++++ memory/GenericFileSystemMessage.h | 37 ++++++++++++++- 2 files changed, 105 insertions(+), 2 deletions(-) diff --git a/memory/GenericFileSystemMessage.cpp b/memory/GenericFileSystemMessage.cpp index a0ce8d59..d9355567 100644 --- a/memory/GenericFileSystemMessage.cpp +++ b/memory/GenericFileSystemMessage.cpp @@ -60,3 +60,73 @@ void GenericFileSystemMessage::setFailureReply(CommandMessage *message, message->setParameter2(errorParam); } +store_address_t GenericFileSystemMessage::getStoreId(const CommandMessage* message) { + store_address_t temp; + temp.raw = message->getParameter2(); + return temp; +} + +ReturnValue_t GenericFileSystemMessage::getFailureReply( + const CommandMessage *message, uint32_t* errorParam) { + if(errorParam != nullptr) { + *errorParam = message->getParameter2(); + } + return message->getParameter(); +} + +void GenericFileSystemMessage::setFinishStopWriteCommand(CommandMessage *message, + store_address_t storeId) { + message->setCommand(CMD_FINISH_APPEND_TO_FILE); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setFinishStopWriteReply(CommandMessage *message, + store_address_t storeId) { + message->setCommand(REPLY_FINISH_APPEND); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setCopyCommand(CommandMessage* message, + store_address_t storeId) { + message->setCommand(CMD_COPY_FILE); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setWriteCommand(CommandMessage* message, + store_address_t storeId) { + message->setCommand(CMD_APPEND_TO_FILE); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setReadCommand(CommandMessage* message, + store_address_t storeId) { + message->setCommand(CMD_READ_FROM_FILE); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setFinishAppendReply(CommandMessage* message, + store_address_t storageID) { + message->setCommand(REPLY_FINISH_APPEND); + message->setParameter2(storageID.raw); +} + +void GenericFileSystemMessage::setReadReply(CommandMessage* message, + bool readFinished, store_address_t storeId) { + message->setCommand(REPLY_READ_FROM_FILE); + message->setParameter(readFinished); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setReadFinishedReply(CommandMessage *message, + store_address_t storeId) { + message->setCommand(REPLY_READ_FINISHED_STOP); + message->setParameter2(storeId.raw); +} + +bool GenericFileSystemMessage::getReadReply(const CommandMessage *message, + store_address_t *storeId) { + if(storeId != nullptr) { + (*storeId).raw = message->getParameter2(); + } + return message->getParameter(); +} diff --git a/memory/GenericFileSystemMessage.h b/memory/GenericFileSystemMessage.h index 174431e4..1a19a69b 100644 --- a/memory/GenericFileSystemMessage.h +++ b/memory/GenericFileSystemMessage.h @@ -52,6 +52,17 @@ public: static const Command_t COMPLETION_SUCCESS = MAKE_COMMAND_ID(128); static const Command_t COMPLETION_FAILED = MAKE_COMMAND_ID(129); + // These command IDs will remain until CFDP has been introduced and consolidated. + /** Append operation commands */ + static const Command_t CMD_APPEND_TO_FILE = MAKE_COMMAND_ID(130); + static const Command_t CMD_FINISH_APPEND_TO_FILE = MAKE_COMMAND_ID(131); + static const Command_t REPLY_FINISH_APPEND = MAKE_COMMAND_ID(132); + + static const Command_t CMD_READ_FROM_FILE = MAKE_COMMAND_ID(140); + static const Command_t REPLY_READ_FROM_FILE = MAKE_COMMAND_ID(141); + static const Command_t CMD_STOP_READ = MAKE_COMMAND_ID(142); + static const Command_t REPLY_READ_FINISHED_STOP = MAKE_COMMAND_ID(143); + static void setLockFileCommand(CommandMessage* message, store_address_t storeId); static void setUnlockFileCommand(CommandMessage* message, store_address_t storeId); @@ -73,8 +84,30 @@ public: static void setSuccessReply(CommandMessage* message); static void setFailureReply(CommandMessage* message, ReturnValue_t errorCode, uint32_t errorParam = 0); + static void setCopyCommand(CommandMessage* message, store_address_t storeId); + + static void setWriteCommand(CommandMessage* message, + store_address_t storeId); + static void setFinishStopWriteCommand(CommandMessage* message, + store_address_t storeId); + static void setFinishStopWriteReply(CommandMessage* message, + store_address_t storeId); + static void setFinishAppendReply(CommandMessage* message, + store_address_t storeId); + + static void setReadCommand(CommandMessage* message, + store_address_t storeId); + static void setReadFinishedReply(CommandMessage* message, + store_address_t storeId); + static void setReadReply(CommandMessage* message, bool readFinished, + store_address_t storeId); + static bool getReadReply(const CommandMessage* message, + store_address_t* storeId); + + static store_address_t getStoreId(const CommandMessage* message); + static ReturnValue_t getFailureReply(const CommandMessage* message, + uint32_t* errorParam = nullptr); + }; - - #endif /* MISSION_MEMORY_GENERICFILESYSTEMMESSAGE_H_ */ From e15f03fb0abf2484b03fe15ef923d868f8a74bde Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 27 May 2021 13:12:34 +0200 Subject: [PATCH 102/389] added FreeRTOS queue map manager --- osal/FreeRTOS/CMakeLists.txt | 1 + osal/FreeRTOS/QueueMapManager.cpp | 49 +++++++++++++++++++++++ osal/FreeRTOS/QueueMapManager.h | 50 ++++++++++++++++++++++++ osal/host/QueueMapManager.cpp | 65 +++++++++++++++---------------- osal/host/QueueMapManager.h | 49 ++++++++++++----------- 5 files changed, 157 insertions(+), 57 deletions(-) create mode 100644 osal/FreeRTOS/QueueMapManager.cpp create mode 100644 osal/FreeRTOS/QueueMapManager.h diff --git a/osal/FreeRTOS/CMakeLists.txt b/osal/FreeRTOS/CMakeLists.txt index 95462010..4da24a71 100644 --- a/osal/FreeRTOS/CMakeLists.txt +++ b/osal/FreeRTOS/CMakeLists.txt @@ -15,6 +15,7 @@ target_sources(${LIB_FSFW_NAME} TaskFactory.cpp Timekeeper.cpp TaskManagement.cpp + QueueMapManager.cpp ) # FreeRTOS is required to link the FSFW now. It is recommended to compile diff --git a/osal/FreeRTOS/QueueMapManager.cpp b/osal/FreeRTOS/QueueMapManager.cpp new file mode 100644 index 00000000..520e54cd --- /dev/null +++ b/osal/FreeRTOS/QueueMapManager.cpp @@ -0,0 +1,49 @@ +#include "QueueMapManager.h" +#include "../../ipc/MutexFactory.h" +#include "../../ipc/MutexGuard.h" + +QueueMapManager::QueueMapManager() { + mapLock = MutexFactory::instance()->createMutex(); +} + +ReturnValue_t QueueMapManager::addMessageQueue(QueueHandle_t queue, MessageQueueId_t* id) { + MutexGuard lock(mapLock); + uint32_t currentId = queueCounter++; + auto returnPair = queueMap.emplace(currentId, queue); + if(not returnPair.second) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "QueueMapManager::addMessageQueue This ID is already " + "inside the map!" << std::endl; +#else + sif::printError("QueueMapManager::addMessageQueue This ID is already " + "inside the map!\n"); +#endif + return HasReturnvaluesIF::RETURN_FAILED; + } + if (id != nullptr) { + *id = currentId; + } + return HasReturnvaluesIF::RETURN_OK; + +} + +QueueHandle_t QueueMapManager::getMessageQueue(MessageQueueId_t messageQueueId) const { + auto queueIter = queueMap.find(messageQueueId); + if(queueIter != queueMap.end()) { + return queueIter->second; + } + else { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "QueueMapManager::getQueueHandle: The ID " << messageQueueId << + " does not exists in the map!" << std::endl; +#else + sif::printWarning("QueueMapManager::getQueueHandle: The ID %d does not exist in the map!\n", + messageQueueId); +#endif + } + return nullptr; +} + +QueueMapManager::~QueueMapManager() { + MutexFactory::instance()->deleteMutex(mapLock); +} diff --git a/osal/FreeRTOS/QueueMapManager.h b/osal/FreeRTOS/QueueMapManager.h new file mode 100644 index 00000000..91a839f0 --- /dev/null +++ b/osal/FreeRTOS/QueueMapManager.h @@ -0,0 +1,50 @@ +#ifndef FSFW_OSAL_FREERTOS_QUEUEMAPMANAGER_H_ +#define FSFW_OSAL_FREERTOS_QUEUEMAPMANAGER_H_ + +#include "../../ipc/MutexIF.h" +#include "../../ipc/messageQueueDefinitions.h" +#include "../../ipc/MessageQueueIF.h" + +#include "freertos/FreeRTOS.h" +#include "freertos/queue.h" + +#include + +using QueueMap = std::map; + +class QueueMapManager { +public: + + //! Returns the single instance of QueueMapManager + static QueueMapManager* instance(); + + /** + * Insert a message queue and the corresponding QueueHandle into the map + * @param queue The message queue to insert. + * @param id The passed value will be set unless a nullptr is passed + * @return + */ + ReturnValue_t addMessageQueue(QueueHandle_t queue, MessageQueueId_t* id); + + /** + * Get the message queue handle by providing a message queue ID. Returns nullptr + * if the queue ID does not exist in the internal map. + * @param messageQueueId + * @return + */ + QueueHandle_t getMessageQueue(MessageQueueId_t messageQueueId) const; + +private: + //! External instantiation forbidden. Constructor still required for singleton instantiation. + QueueMapManager(); + ~QueueMapManager(); + + uint32_t queueCounter = 0; + MutexIF* mapLock; + QueueMap queueMap; + static QueueMapManager* mqManagerInstance; +}; + + + +#endif /* FSFW_OSAL_FREERTOS_QUEUEMAPMANAGER_H_ */ diff --git a/osal/host/QueueMapManager.cpp b/osal/host/QueueMapManager.cpp index c9100fe9..879bc36d 100644 --- a/osal/host/QueueMapManager.cpp +++ b/osal/host/QueueMapManager.cpp @@ -15,52 +15,49 @@ QueueMapManager::~QueueMapManager() { } QueueMapManager* QueueMapManager::instance() { - if (mqManagerInstance == nullptr){ - mqManagerInstance = new QueueMapManager(); - } - return QueueMapManager::mqManagerInstance; + if (mqManagerInstance == nullptr){ + mqManagerInstance = new QueueMapManager(); + } + return QueueMapManager::mqManagerInstance; } ReturnValue_t QueueMapManager::addMessageQueue( - MessageQueueIF* queueToInsert, MessageQueueId_t* id) { - /* Not thread-safe, but it is assumed all message queues are created at software initialization - now. If this is to be made thread-safe in the future, it propably would be sufficient to lock - the increment operation here. */ - uint32_t currentId = queueCounter++; - auto returnPair = queueMap.emplace(currentId, queueToInsert); - if(not returnPair.second) { - /* This should never happen for the atomic variable. */ + MessageQueueIF* queueToInsert, MessageQueueId_t* id) { + MutexGuard lock(mapLock); + uint32_t currentId = queueCounter++; + auto returnPair = queueMap.emplace(currentId, queueToInsert); + if(not returnPair.second) { + /* This should never happen for the atomic variable. */ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "QueueMapManager::addMessageQueue This ID is already " - "inside the map!" << std::endl; + sif::error << "QueueMapManager::addMessageQueue This ID is already " + "inside the map!" << std::endl; #else - sif::printError("QueueMapManager::addMessageQueue This ID is already " + sif::printError("QueueMapManager::addMessageQueue This ID is already " "inside the map!\n"); #endif - return HasReturnvaluesIF::RETURN_FAILED; - } - if (id != nullptr) { - *id = currentId; - } - return HasReturnvaluesIF::RETURN_OK; + return HasReturnvaluesIF::RETURN_FAILED; + } + if (id != nullptr) { + *id = currentId; + } + return HasReturnvaluesIF::RETURN_OK; } MessageQueueIF* QueueMapManager::getMessageQueue( - MessageQueueId_t messageQueueId) const { - MutexGuard(mapLock, MutexIF::TimeoutType::WAITING, 50); - auto queueIter = queueMap.find(messageQueueId); - if(queueIter != queueMap.end()) { - return queueIter->second; - } - else { + MessageQueueId_t messageQueueId) const { + auto queueIter = queueMap.find(messageQueueId); + if(queueIter != queueMap.end()) { + return queueIter->second; + } + else { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "QueueMapManager::getQueueHandle: The ID " << messageQueueId << - " does not exists in the map!" << std::endl; + sif::warning << "QueueMapManager::getQueueHandle: The ID " << messageQueueId << + " does not exists in the map!" << std::endl; #else - sif::printWarning("QueueMapManager::getQueueHandle: The ID %d does not exist in the map!\n", - messageQueueId); + sif::printWarning("QueueMapManager::getQueueHandle: The ID %d does not exist in the map!\n", + messageQueueId); #endif - return nullptr; - } + } + return nullptr; } diff --git a/osal/host/QueueMapManager.h b/osal/host/QueueMapManager.h index 90c39c2f..e274bed2 100644 --- a/osal/host/QueueMapManager.h +++ b/osal/host/QueueMapManager.h @@ -15,33 +15,36 @@ using QueueMap = std::unordered_map; */ class QueueMapManager { public: - //! Returns the single instance of SemaphoreFactory. - static QueueMapManager* instance(); - /** - * Insert a message queue into the map and returns a message queue ID - * @param queue The message queue to insert. - * @param id The passed value will be set unless a nullptr is passed - * @return - */ - ReturnValue_t addMessageQueue(MessageQueueIF* queue, MessageQueueId_t* - id = nullptr); - /** - * Get the message queue handle by providing a message queue ID. - * @param messageQueueId - * @return - */ - MessageQueueIF* getMessageQueue(MessageQueueId_t messageQueueId) const; + + //! Returns the single instance of QueueMapManager. + static QueueMapManager* instance(); + + /** + * Insert a message queue into the map and returns a message queue ID + * @param queue The message queue to insert. + * @param id The passed value will be set unless a nullptr is passed + * @return + */ + ReturnValue_t addMessageQueue(MessageQueueIF* queue, MessageQueueId_t* + id = nullptr); + /** + * Get the message queue handle by providing a message queue ID. Returns nullptr + * if the queue ID is not contained inside the internal map. + * @param messageQueueId + * @return + */ + MessageQueueIF* getMessageQueue(MessageQueueId_t messageQueueId) const; private: - //! External instantiation is forbidden. - QueueMapManager(); - ~QueueMapManager(); + //! External instantiation is forbidden. Constructor still required for singleton instantiation. + QueueMapManager(); + ~QueueMapManager(); - uint32_t queueCounter = 0; - MutexIF* mapLock; - QueueMap queueMap; - static QueueMapManager* mqManagerInstance; + uint32_t queueCounter = 0; + MutexIF* mapLock; + QueueMap queueMap; + static QueueMapManager* mqManagerInstance; }; From e6868464bfeb7fd7150b5373b895474e33c877bc Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 27 May 2021 13:38:40 +0200 Subject: [PATCH 103/389] queue map manager working --- osal/FreeRTOS/MessageQueue.cpp | 58 ++++++++++++++----------------- osal/FreeRTOS/MessageQueue.h | 9 +++-- osal/FreeRTOS/QueueMapManager.cpp | 9 +++++ 3 files changed, 39 insertions(+), 37 deletions(-) diff --git a/osal/FreeRTOS/MessageQueue.cpp b/osal/FreeRTOS/MessageQueue.cpp index 3a0f654e..a74d32ea 100644 --- a/osal/FreeRTOS/MessageQueue.cpp +++ b/osal/FreeRTOS/MessageQueue.cpp @@ -1,26 +1,23 @@ #include "MessageQueue.h" +#include "QueueMapManager.h" #include "../../objectmanager/ObjectManagerIF.h" #include "../../serviceinterface/ServiceInterfaceStream.h" -// TODO I guess we should have a way of checking if we are in an ISR and then -// use the "fromISR" versions of all calls -// As a first step towards this, introduces system context variable which needs -// to be switched manually -// Haven't found function to find system context. MessageQueue::MessageQueue(size_t messageDepth, size_t maxMessageSize): maxMessageSize(maxMessageSize) { handle = xQueueCreate(messageDepth, maxMessageSize); -#if FSFW_CPP_OSTREAM_ENABLED == 1 if (handle == nullptr) { - sif::error << "MessageQueue::MessageQueue:" - << " Creation failed." << std::endl; - sif::error << "Specified Message Depth: " << messageDepth - << std::endl; - sif::error << "Specified Maximum Message Size: " - << maxMessageSize << std::endl; - - } +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "MessageQueue::MessageQueue: Creation failed" << std::endl; + sif::error << "Specified Message Depth: " << messageDepth << std::endl; + sif::error << "Specified Maximum Message Size: " << maxMessageSize << std::endl; +#else + sif::printError("MessageQueue::MessageQueue: Creation failed\n"); + sif::printError("Specified Message Depth: %d\n", messageDepth); + sif::printError("Specified MAximum Message Size: %d\n", maxMessageSize); #endif + } + QueueMapManager::instance()->addMessageQueue(handle, &queueId); } MessageQueue::~MessageQueue() { @@ -62,13 +59,15 @@ ReturnValue_t MessageQueue::sendMessageFrom(MessageQueueId_t sendTo, callContext); } +QueueHandle_t MessageQueue::getNativeQueueHandle() { + return handle; +} ReturnValue_t MessageQueue::handleSendResult(BaseType_t result, bool ignoreFault) { if (result != pdPASS) { if (not ignoreFault) { InternalErrorReporterIF* internalErrorReporter = objectManager-> - get( - objects::INTERNAL_ERROR_REPORTER); + get(objects::INTERNAL_ERROR_REPORTER); if (internalErrorReporter != nullptr) { internalErrorReporter->queueMessageNotSent(); } @@ -110,7 +109,7 @@ ReturnValue_t MessageQueue::flush(uint32_t* count) { } MessageQueueId_t MessageQueue::getId() const { - return reinterpret_cast(handle); + return queueId; } void MessageQueue::setDefaultDestination(MessageQueueId_t defaultDestination) { @@ -132,30 +131,25 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo, MessageQueueMessageIF* message, MessageQueueId_t sentFrom, bool ignoreFault, CallContext callContext) { BaseType_t result = pdFALSE; - QueueHandle_t destination = nullptr; - - if(sendTo == MessageQueueIF::NO_QUEUE or sendTo == 0x00) { - return MessageQueueIF::DESTINATION_INVALID; + if(sendTo == MessageQueueIF::NO_QUEUE) { + return MessageQueueIF::DESTINATION_INVALID; } - else { - destination = reinterpret_cast(sendTo); + + QueueHandle_t destination = QueueMapManager::instance()->getMessageQueue(sendTo); + if(destination == nullptr) { + return MessageQueueIF::DESTINATION_INVALID; } message->setSender(sentFrom); - - if(callContext == CallContext::TASK) { - result = xQueueSendToBack(destination, - static_cast(message->getBuffer()), 0); + result = xQueueSendToBack(destination, static_cast(message->getBuffer()), 0); } else { - /* If the call context is from an interrupt, - * request a context switch if a higher priority task - * was blocked by the interrupt. */ + /* If the call context is from an interrupt, request a context switch if a higher priority + task was blocked by the interrupt. */ BaseType_t xHigherPriorityTaskWoken = pdFALSE; result = xQueueSendFromISR(reinterpret_cast(sendTo), - static_cast(message->getBuffer()), - &xHigherPriorityTaskWoken); + static_cast(message->getBuffer()), &xHigherPriorityTaskWoken); if(xHigherPriorityTaskWoken == pdTRUE) { TaskManagement::requestContextSwitch(callContext); } diff --git a/osal/FreeRTOS/MessageQueue.h b/osal/FreeRTOS/MessageQueue.h index 8fa86283..9cee5b22 100644 --- a/osal/FreeRTOS/MessageQueue.h +++ b/osal/FreeRTOS/MessageQueue.h @@ -11,11 +11,6 @@ #include #include -// TODO: this class assumes that MessageQueueId_t is the same size as void* -// (the FreeRTOS handle type), compiler will catch this but it might be nice -// to have something checking or even an always working solution -// https://scaryreasoner.wordpress.com/2009/02/28/checking-sizeof-at-compile-time/ - /** * @brief This class manages sending and receiving of * message queue messages. @@ -112,6 +107,8 @@ public: bool isDefaultDestinationSet() const override; + QueueHandle_t getNativeQueueHandle(); + protected: /** * @brief Implementation to be called from any send Call within @@ -141,6 +138,8 @@ protected: private: bool defaultDestinationSet = false; QueueHandle_t handle; + MessageQueueId_t queueId = MessageQueueIF::NO_QUEUE; + MessageQueueId_t defaultDestination = MessageQueueIF::NO_QUEUE; MessageQueueId_t lastPartner = MessageQueueIF::NO_QUEUE; const size_t maxMessageSize; diff --git a/osal/FreeRTOS/QueueMapManager.cpp b/osal/FreeRTOS/QueueMapManager.cpp index 520e54cd..51cfe11d 100644 --- a/osal/FreeRTOS/QueueMapManager.cpp +++ b/osal/FreeRTOS/QueueMapManager.cpp @@ -2,10 +2,19 @@ #include "../../ipc/MutexFactory.h" #include "../../ipc/MutexGuard.h" +QueueMapManager* QueueMapManager::mqManagerInstance = nullptr; + QueueMapManager::QueueMapManager() { mapLock = MutexFactory::instance()->createMutex(); } +QueueMapManager* QueueMapManager::instance() { + if (mqManagerInstance == nullptr){ + mqManagerInstance = new QueueMapManager(); + } + return QueueMapManager::mqManagerInstance; +} + ReturnValue_t QueueMapManager::addMessageQueue(QueueHandle_t queue, MessageQueueId_t* id) { MutexGuard lock(mapLock); uint32_t currentId = queueCounter++; From 46cfe7452a198d49528f2c51e1ed4044cae9d933 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 27 May 2021 13:40:01 +0200 Subject: [PATCH 104/389] for for ISR variant --- osal/FreeRTOS/MessageQueue.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osal/FreeRTOS/MessageQueue.cpp b/osal/FreeRTOS/MessageQueue.cpp index a74d32ea..b5c9035d 100644 --- a/osal/FreeRTOS/MessageQueue.cpp +++ b/osal/FreeRTOS/MessageQueue.cpp @@ -148,8 +148,8 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo, /* If the call context is from an interrupt, request a context switch if a higher priority task was blocked by the interrupt. */ BaseType_t xHigherPriorityTaskWoken = pdFALSE; - result = xQueueSendFromISR(reinterpret_cast(sendTo), - static_cast(message->getBuffer()), &xHigherPriorityTaskWoken); + result = xQueueSendFromISR(destination, static_cast(message->getBuffer()), + &xHigherPriorityTaskWoken); if(xHigherPriorityTaskWoken == pdTRUE) { TaskManagement::requestContextSwitch(callContext); } From aab3fd828b5aaba0b7b4a81ea2a076d97b369fc1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 27 May 2021 13:43:13 +0200 Subject: [PATCH 105/389] removed unrelated changes --- memory/CMakeLists.txt | 8 +- memory/GenericFileSystemMessage.cpp | 132 ---------------------------- memory/GenericFileSystemMessage.h | 113 ------------------------ 3 files changed, 4 insertions(+), 249 deletions(-) delete mode 100644 memory/GenericFileSystemMessage.cpp delete mode 100644 memory/GenericFileSystemMessage.h diff --git a/memory/CMakeLists.txt b/memory/CMakeLists.txt index c713cd42..9edb9031 100644 --- a/memory/CMakeLists.txt +++ b/memory/CMakeLists.txt @@ -1,5 +1,5 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - MemoryHelper.cpp - MemoryMessage.cpp - GenericFileSystemMessage.cpp +target_sources(${LIB_FSFW_NAME} + PRIVATE + MemoryHelper.cpp + MemoryMessage.cpp ) \ No newline at end of file diff --git a/memory/GenericFileSystemMessage.cpp b/memory/GenericFileSystemMessage.cpp deleted file mode 100644 index d9355567..00000000 --- a/memory/GenericFileSystemMessage.cpp +++ /dev/null @@ -1,132 +0,0 @@ -#include "GenericFileSystemMessage.h" - - -void GenericFileSystemMessage::setCreateFileCommand(CommandMessage* message, - store_address_t storeId) { - message->setCommand(CMD_CREATE_FILE); - message->setParameter2(storeId.raw); -} - -void GenericFileSystemMessage::setDeleteFileCommand( - CommandMessage* message, store_address_t storeId) { - message->setCommand(CMD_DELETE_FILE); - message->setParameter2(storeId.raw); -} - -void GenericFileSystemMessage::setCreateDirectoryCommand( - CommandMessage* message, store_address_t storeId) { - message->setCommand(CMD_CREATE_DIRECTORY); - message->setParameter2(storeId.raw); -} - -void GenericFileSystemMessage::setReportFileAttributesCommand(CommandMessage *message, - store_address_t storeId) { - message->setCommand(CMD_REPORT_FILE_ATTRIBUTES); - message->setParameter2(storeId.raw); -} - -void GenericFileSystemMessage::setReportFileAttributesReply(CommandMessage *message, - store_address_t storeId) { - message->setCommand(REPLY_REPORT_FILE_ATTRIBUTES); - message->setParameter2(storeId.raw); -} - -void GenericFileSystemMessage::setDeleteDirectoryCommand(CommandMessage* message, - store_address_t storeId) { - message->setCommand(CMD_DELETE_DIRECTORY); - message->setParameter2(storeId.raw); -} - -void GenericFileSystemMessage::setLockFileCommand(CommandMessage *message, - store_address_t storeId) { - message->setCommand(CMD_LOCK_FILE); - message->setParameter2(storeId.raw); -} - -void GenericFileSystemMessage::setUnlockFileCommand(CommandMessage *message, - store_address_t storeId) { - message->setCommand(CMD_UNLOCK_FILE); - message->setParameter2(storeId.raw); -} - -void GenericFileSystemMessage::setSuccessReply(CommandMessage *message) { - message->setCommand(COMPLETION_SUCCESS); -} - -void GenericFileSystemMessage::setFailureReply(CommandMessage *message, - ReturnValue_t errorCode, uint32_t errorParam) { - message->setCommand(COMPLETION_FAILED); - message->setParameter(errorCode); - message->setParameter2(errorParam); -} - -store_address_t GenericFileSystemMessage::getStoreId(const CommandMessage* message) { - store_address_t temp; - temp.raw = message->getParameter2(); - return temp; -} - -ReturnValue_t GenericFileSystemMessage::getFailureReply( - const CommandMessage *message, uint32_t* errorParam) { - if(errorParam != nullptr) { - *errorParam = message->getParameter2(); - } - return message->getParameter(); -} - -void GenericFileSystemMessage::setFinishStopWriteCommand(CommandMessage *message, - store_address_t storeId) { - message->setCommand(CMD_FINISH_APPEND_TO_FILE); - message->setParameter2(storeId.raw); -} - -void GenericFileSystemMessage::setFinishStopWriteReply(CommandMessage *message, - store_address_t storeId) { - message->setCommand(REPLY_FINISH_APPEND); - message->setParameter2(storeId.raw); -} - -void GenericFileSystemMessage::setCopyCommand(CommandMessage* message, - store_address_t storeId) { - message->setCommand(CMD_COPY_FILE); - message->setParameter2(storeId.raw); -} - -void GenericFileSystemMessage::setWriteCommand(CommandMessage* message, - store_address_t storeId) { - message->setCommand(CMD_APPEND_TO_FILE); - message->setParameter2(storeId.raw); -} - -void GenericFileSystemMessage::setReadCommand(CommandMessage* message, - store_address_t storeId) { - message->setCommand(CMD_READ_FROM_FILE); - message->setParameter2(storeId.raw); -} - -void GenericFileSystemMessage::setFinishAppendReply(CommandMessage* message, - store_address_t storageID) { - message->setCommand(REPLY_FINISH_APPEND); - message->setParameter2(storageID.raw); -} - -void GenericFileSystemMessage::setReadReply(CommandMessage* message, - bool readFinished, store_address_t storeId) { - message->setCommand(REPLY_READ_FROM_FILE); - message->setParameter(readFinished); - message->setParameter2(storeId.raw); -} - -void GenericFileSystemMessage::setReadFinishedReply(CommandMessage *message, - store_address_t storeId) { - message->setCommand(REPLY_READ_FINISHED_STOP); - message->setParameter2(storeId.raw); -} - -bool GenericFileSystemMessage::getReadReply(const CommandMessage *message, - store_address_t *storeId) { - if(storeId != nullptr) { - (*storeId).raw = message->getParameter2(); - } - return message->getParameter(); -} diff --git a/memory/GenericFileSystemMessage.h b/memory/GenericFileSystemMessage.h deleted file mode 100644 index 1a19a69b..00000000 --- a/memory/GenericFileSystemMessage.h +++ /dev/null @@ -1,113 +0,0 @@ -#ifndef MISSION_MEMORY_GENERICFILESYSTEMMESSAGE_H_ -#define MISSION_MEMORY_GENERICFILESYSTEMMESSAGE_H_ - -#include - -#include -#include -#include -#include - -/** - * @brief These messages are sent to an object implementing HasFilesystemIF. - * @details - * Enables a message-based file management. The user can add custo commands be implementing - * this generic class. - * @author Jakob Meier, R. Mueller - */ -class GenericFileSystemMessage { -public: - /* Instantiation forbidden */ - GenericFileSystemMessage() = delete; - - static const uint8_t MESSAGE_ID = messagetypes::FILE_SYSTEM_MESSAGE; - /* PUS standard (ECSS-E-ST-70-41C15 2016 p.654) */ - static const Command_t CMD_CREATE_FILE = MAKE_COMMAND_ID(1); - static const Command_t CMD_DELETE_FILE = MAKE_COMMAND_ID(2); - /** Report file attributes */ - static const Command_t CMD_REPORT_FILE_ATTRIBUTES = MAKE_COMMAND_ID(3); - static const Command_t REPLY_REPORT_FILE_ATTRIBUTES = MAKE_COMMAND_ID(4); - /** Command to lock a file, setting it read-only */ - static const Command_t CMD_LOCK_FILE = MAKE_COMMAND_ID(5); - /** Command to unlock a file, enabling further operations on it */ - static const Command_t CMD_UNLOCK_FILE = MAKE_COMMAND_ID(6); - /** - * Find file in repository, using a search pattern. - * Please note that * is the wildcard character. - * For example, when looking for all files which start with have the - * structure tm.bin, tm*.bin can be used. - */ - static const Command_t CMD_FIND_FILE = MAKE_COMMAND_ID(7); - static const Command_t CMD_CREATE_DIRECTORY = MAKE_COMMAND_ID(9); - static const Command_t CMD_DELETE_DIRECTORY = MAKE_COMMAND_ID(10); - static const Command_t CMD_RENAME_DIRECTORY = MAKE_COMMAND_ID(11); - - /** Dump contents of a repository */ - static const Command_t CMD_DUMP_REPOSITORY = MAKE_COMMAND_ID(12); - /** Repository dump reply */ - static const Command_t REPLY_DUMY_REPOSITORY = MAKE_COMMAND_ID(13); - static constexpr Command_t CMD_COPY_FILE = MAKE_COMMAND_ID(14); - static constexpr Command_t CMD_MOVE_FILE = MAKE_COMMAND_ID(15); - - static const Command_t COMPLETION_SUCCESS = MAKE_COMMAND_ID(128); - static const Command_t COMPLETION_FAILED = MAKE_COMMAND_ID(129); - - // These command IDs will remain until CFDP has been introduced and consolidated. - /** Append operation commands */ - static const Command_t CMD_APPEND_TO_FILE = MAKE_COMMAND_ID(130); - static const Command_t CMD_FINISH_APPEND_TO_FILE = MAKE_COMMAND_ID(131); - static const Command_t REPLY_FINISH_APPEND = MAKE_COMMAND_ID(132); - - static const Command_t CMD_READ_FROM_FILE = MAKE_COMMAND_ID(140); - static const Command_t REPLY_READ_FROM_FILE = MAKE_COMMAND_ID(141); - static const Command_t CMD_STOP_READ = MAKE_COMMAND_ID(142); - static const Command_t REPLY_READ_FINISHED_STOP = MAKE_COMMAND_ID(143); - - static void setLockFileCommand(CommandMessage* message, store_address_t storeId); - static void setUnlockFileCommand(CommandMessage* message, store_address_t storeId); - - static void setCreateFileCommand(CommandMessage* message, - store_address_t storeId); - static void setDeleteFileCommand(CommandMessage* message, - store_address_t storeId); - - static void setReportFileAttributesCommand(CommandMessage* message, - store_address_t storeId); - static void setReportFileAttributesReply(CommandMessage* message, - store_address_t storeId); - - static void setCreateDirectoryCommand(CommandMessage* message, - store_address_t storeId); - static void setDeleteDirectoryCommand(CommandMessage* message, - store_address_t storeId); - - static void setSuccessReply(CommandMessage* message); - static void setFailureReply(CommandMessage* message, - ReturnValue_t errorCode, uint32_t errorParam = 0); - static void setCopyCommand(CommandMessage* message, store_address_t storeId); - - static void setWriteCommand(CommandMessage* message, - store_address_t storeId); - static void setFinishStopWriteCommand(CommandMessage* message, - store_address_t storeId); - static void setFinishStopWriteReply(CommandMessage* message, - store_address_t storeId); - static void setFinishAppendReply(CommandMessage* message, - store_address_t storeId); - - static void setReadCommand(CommandMessage* message, - store_address_t storeId); - static void setReadFinishedReply(CommandMessage* message, - store_address_t storeId); - static void setReadReply(CommandMessage* message, bool readFinished, - store_address_t storeId); - static bool getReadReply(const CommandMessage* message, - store_address_t* storeId); - - static store_address_t getStoreId(const CommandMessage* message); - static ReturnValue_t getFailureReply(const CommandMessage* message, - uint32_t* errorParam = nullptr); - -}; - -#endif /* MISSION_MEMORY_GENERICFILESYSTEMMESSAGE_H_ */ From 237ba8112b83944d65cde1c0680184c8ad502f24 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 27 May 2021 13:43:48 +0200 Subject: [PATCH 106/389] more unrelated changes removed --- datalinklayer/DataLinkLayer.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/datalinklayer/DataLinkLayer.h b/datalinklayer/DataLinkLayer.h index 27e69006..17a57d61 100644 --- a/datalinklayer/DataLinkLayer.h +++ b/datalinklayer/DataLinkLayer.h @@ -19,8 +19,7 @@ class VirtualChannelReception; class DataLinkLayer : public CCSDSReturnValuesIF { public: static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SYSTEM_1; - //! [EXPORT] : [COMMENT] A RF available signal was detected. P1: raw RFA state, P2: 0 - static const Event RF_AVAILABLE = MAKE_EVENT(0, severity::INFO); + static const Event RF_AVAILABLE = MAKE_EVENT(0, severity::INFO); //!< A RF available signal was detected. P1: raw RFA state, P2: 0 static const Event RF_LOST = MAKE_EVENT(1, severity::INFO); //!< A previously found RF available signal was lost. P1: raw RFA state, P2: 0 static const Event BIT_LOCK = MAKE_EVENT(2, severity::INFO); //!< A Bit Lock signal. Was detected. P1: raw BLO state, P2: 0 static const Event BIT_LOCK_LOST = MAKE_EVENT(3, severity::INFO); //!< A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0 From e7ac2c7009102ff241e636544a55df4aae696772 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 27 May 2021 13:46:04 +0200 Subject: [PATCH 107/389] maybe this works --- datalinklayer/DataLinkLayer.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/datalinklayer/DataLinkLayer.h b/datalinklayer/DataLinkLayer.h index 17a57d61..27e69006 100644 --- a/datalinklayer/DataLinkLayer.h +++ b/datalinklayer/DataLinkLayer.h @@ -19,7 +19,8 @@ class VirtualChannelReception; class DataLinkLayer : public CCSDSReturnValuesIF { public: static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SYSTEM_1; - static const Event RF_AVAILABLE = MAKE_EVENT(0, severity::INFO); //!< A RF available signal was detected. P1: raw RFA state, P2: 0 + //! [EXPORT] : [COMMENT] A RF available signal was detected. P1: raw RFA state, P2: 0 + static const Event RF_AVAILABLE = MAKE_EVENT(0, severity::INFO); static const Event RF_LOST = MAKE_EVENT(1, severity::INFO); //!< A previously found RF available signal was lost. P1: raw RFA state, P2: 0 static const Event BIT_LOCK = MAKE_EVENT(2, severity::INFO); //!< A Bit Lock signal. Was detected. P1: raw BLO state, P2: 0 static const Event BIT_LOCK_LOST = MAKE_EVENT(3, severity::INFO); //!< A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0 From f0a7b1cad2129392b6bc155bece6151cfab15e70 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 27 May 2021 13:47:22 +0200 Subject: [PATCH 108/389] indentation --- osal/FreeRTOS/MessageQueue.cpp | 138 +++++++++++++------------- osal/FreeRTOS/MessageQueue.h | 174 ++++++++++++++++----------------- 2 files changed, 156 insertions(+), 156 deletions(-) diff --git a/osal/FreeRTOS/MessageQueue.cpp b/osal/FreeRTOS/MessageQueue.cpp index b5c9035d..43d4fa40 100644 --- a/osal/FreeRTOS/MessageQueue.cpp +++ b/osal/FreeRTOS/MessageQueue.cpp @@ -4,59 +4,59 @@ #include "../../serviceinterface/ServiceInterfaceStream.h" MessageQueue::MessageQueue(size_t messageDepth, size_t maxMessageSize): - maxMessageSize(maxMessageSize) { - handle = xQueueCreate(messageDepth, maxMessageSize); - if (handle == nullptr) { + maxMessageSize(maxMessageSize) { + handle = xQueueCreate(messageDepth, maxMessageSize); + if (handle == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::MessageQueue: Creation failed" << std::endl; - sif::error << "Specified Message Depth: " << messageDepth << std::endl; - sif::error << "Specified Maximum Message Size: " << maxMessageSize << std::endl; + sif::error << "MessageQueue::MessageQueue: Creation failed" << std::endl; + sif::error << "Specified Message Depth: " << messageDepth << std::endl; + sif::error << "Specified Maximum Message Size: " << maxMessageSize << std::endl; #else - sif::printError("MessageQueue::MessageQueue: Creation failed\n"); - sif::printError("Specified Message Depth: %d\n", messageDepth); - sif::printError("Specified MAximum Message Size: %d\n", maxMessageSize); + sif::printError("MessageQueue::MessageQueue: Creation failed\n"); + sif::printError("Specified Message Depth: %d\n", messageDepth); + sif::printError("Specified MAximum Message Size: %d\n", maxMessageSize); #endif - } + } QueueMapManager::instance()->addMessageQueue(handle, &queueId); } MessageQueue::~MessageQueue() { - if (handle != nullptr) { - vQueueDelete(handle); - } + if (handle != nullptr) { + vQueueDelete(handle); + } } void MessageQueue::switchSystemContext(CallContext callContext) { - this->callContext = callContext; + this->callContext = callContext; } ReturnValue_t MessageQueue::sendMessage(MessageQueueId_t sendTo, - MessageQueueMessageIF* message, bool ignoreFault) { - return sendMessageFrom(sendTo, message, this->getId(), ignoreFault); + MessageQueueMessageIF* message, bool ignoreFault) { + return sendMessageFrom(sendTo, message, this->getId(), ignoreFault); } ReturnValue_t MessageQueue::sendToDefault(MessageQueueMessageIF* message) { - return sendToDefaultFrom(message, this->getId()); + return sendToDefaultFrom(message, this->getId()); } ReturnValue_t MessageQueue::sendToDefaultFrom(MessageQueueMessageIF* message, - MessageQueueId_t sentFrom, bool ignoreFault) { - return sendMessageFrom(defaultDestination,message,sentFrom,ignoreFault); + MessageQueueId_t sentFrom, bool ignoreFault) { + return sendMessageFrom(defaultDestination,message,sentFrom,ignoreFault); } ReturnValue_t MessageQueue::reply(MessageQueueMessageIF* message) { - if (this->lastPartner != MessageQueueIF::NO_QUEUE) { - return sendMessageFrom(this->lastPartner, message, this->getId()); - } else { - return NO_REPLY_PARTNER; - } + if (this->lastPartner != MessageQueueIF::NO_QUEUE) { + return sendMessageFrom(this->lastPartner, message, this->getId()); + } else { + return NO_REPLY_PARTNER; + } } ReturnValue_t MessageQueue::sendMessageFrom(MessageQueueId_t sendTo, - MessageQueueMessageIF* message, MessageQueueId_t sentFrom, - bool ignoreFault) { - return sendMessageFromMessageQueue(sendTo, message, sentFrom, ignoreFault, - callContext); + MessageQueueMessageIF* message, MessageQueueId_t sentFrom, + bool ignoreFault) { + return sendMessageFromMessageQueue(sendTo, message, sentFrom, ignoreFault, + callContext); } QueueHandle_t MessageQueue::getNativeQueueHandle() { @@ -64,65 +64,65 @@ QueueHandle_t MessageQueue::getNativeQueueHandle() { } ReturnValue_t MessageQueue::handleSendResult(BaseType_t result, bool ignoreFault) { - if (result != pdPASS) { - if (not ignoreFault) { - InternalErrorReporterIF* internalErrorReporter = objectManager-> - get(objects::INTERNAL_ERROR_REPORTER); - if (internalErrorReporter != nullptr) { - internalErrorReporter->queueMessageNotSent(); - } - } - return MessageQueueIF::FULL; - } - return HasReturnvaluesIF::RETURN_OK; + if (result != pdPASS) { + if (not ignoreFault) { + InternalErrorReporterIF* internalErrorReporter = objectManager-> + get(objects::INTERNAL_ERROR_REPORTER); + if (internalErrorReporter != nullptr) { + internalErrorReporter->queueMessageNotSent(); + } + } + return MessageQueueIF::FULL; + } + return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message, - MessageQueueId_t* receivedFrom) { - ReturnValue_t status = this->receiveMessage(message); - if(status == HasReturnvaluesIF::RETURN_OK) { - *receivedFrom = this->lastPartner; - } - return status; + MessageQueueId_t* receivedFrom) { + ReturnValue_t status = this->receiveMessage(message); + if(status == HasReturnvaluesIF::RETURN_OK) { + *receivedFrom = this->lastPartner; + } + return status; } ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) { - BaseType_t result = xQueueReceive(handle,reinterpret_cast( - message->getBuffer()), 0); - if (result == pdPASS){ - this->lastPartner = message->getSender(); - return HasReturnvaluesIF::RETURN_OK; - } else { - return MessageQueueIF::EMPTY; - } + BaseType_t result = xQueueReceive(handle,reinterpret_cast( + message->getBuffer()), 0); + if (result == pdPASS){ + this->lastPartner = message->getSender(); + return HasReturnvaluesIF::RETURN_OK; + } else { + return MessageQueueIF::EMPTY; + } } MessageQueueId_t MessageQueue::getLastPartner() const { - return lastPartner; + return lastPartner; } ReturnValue_t MessageQueue::flush(uint32_t* count) { - //TODO FreeRTOS does not support flushing partially - //Is always successful - xQueueReset(handle); - return HasReturnvaluesIF::RETURN_OK; + //TODO FreeRTOS does not support flushing partially + //Is always successful + xQueueReset(handle); + return HasReturnvaluesIF::RETURN_OK; } MessageQueueId_t MessageQueue::getId() const { - return queueId; + return queueId; } void MessageQueue::setDefaultDestination(MessageQueueId_t defaultDestination) { - defaultDestinationSet = true; - this->defaultDestination = defaultDestination; + defaultDestinationSet = true; + this->defaultDestination = defaultDestination; } MessageQueueId_t MessageQueue::getDefaultDestination() const { - return defaultDestination; + return defaultDestination; } bool MessageQueue::isDefaultDestinationSet() const { - return defaultDestinationSet; + return defaultDestinationSet; } @@ -130,15 +130,15 @@ bool MessageQueue::isDefaultDestinationSet() const { ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo, MessageQueueMessageIF* message, MessageQueueId_t sentFrom, bool ignoreFault, CallContext callContext) { - BaseType_t result = pdFALSE; - if(sendTo == MessageQueueIF::NO_QUEUE) { + BaseType_t result = pdFALSE; + if(sendTo == MessageQueueIF::NO_QUEUE) { return MessageQueueIF::DESTINATION_INVALID; - } + } - QueueHandle_t destination = QueueMapManager::instance()->getMessageQueue(sendTo); - if(destination == nullptr) { + QueueHandle_t destination = QueueMapManager::instance()->getMessageQueue(sendTo); + if(destination == nullptr) { return MessageQueueIF::DESTINATION_INVALID; - } + } message->setSender(sentFrom); if(callContext == CallContext::TASK) { diff --git a/osal/FreeRTOS/MessageQueue.h b/osal/FreeRTOS/MessageQueue.h index 9cee5b22..be74d4fe 100644 --- a/osal/FreeRTOS/MessageQueue.h +++ b/osal/FreeRTOS/MessageQueue.h @@ -35,116 +35,116 @@ * @ingroup message_queue */ class MessageQueue : public MessageQueueIF { - friend class MessageQueueSenderIF; + friend class MessageQueueSenderIF; public: - /** - * @brief The constructor initializes and configures the message queue. - * @details - * By making use of the according operating system call, a message queue - * is created and initialized. The message depth - the maximum number of - * messages to be buffered - may be set with the help of a parameter, - * whereas the message size is automatically set to the maximum message - * queue message size. The operating system sets the message queue id, or - * in case of failure, it is set to zero. - * @param message_depth - * The number of messages to be buffered before passing an error to the - * sender. Default is three. - * @param max_message_size - * With this parameter, the maximum message size can be adjusted. - * This should be left default. - */ - MessageQueue( size_t messageDepth = 3, - size_t maxMessageSize = MessageQueueMessage::MAX_MESSAGE_SIZE ); + /** + * @brief The constructor initializes and configures the message queue. + * @details + * By making use of the according operating system call, a message queue + * is created and initialized. The message depth - the maximum number of + * messages to be buffered - may be set with the help of a parameter, + * whereas the message size is automatically set to the maximum message + * queue message size. The operating system sets the message queue id, or + * in case of failure, it is set to zero. + * @param message_depth + * The number of messages to be buffered before passing an error to the + * sender. Default is three. + * @param max_message_size + * With this parameter, the maximum message size can be adjusted. + * This should be left default. + */ + MessageQueue( size_t messageDepth = 3, + size_t maxMessageSize = MessageQueueMessage::MAX_MESSAGE_SIZE ); - /** Copying message queues forbidden */ - MessageQueue(const MessageQueue&) = delete; - MessageQueue& operator=(const MessageQueue&) = delete; + /** Copying message queues forbidden */ + MessageQueue(const MessageQueue&) = delete; + MessageQueue& operator=(const MessageQueue&) = delete; - /** - * @brief The destructor deletes the formerly created message queue. - * @details This is accomplished by using the delete call provided - * by the operating system. - */ - virtual ~MessageQueue(); + /** + * @brief The destructor deletes the formerly created message queue. + * @details This is accomplished by using the delete call provided + * by the operating system. + */ + virtual ~MessageQueue(); - /** - * This function is used to switch the call context. This has to be called - * if a message is sent or received from an ISR! - * @param callContext - */ - void switchSystemContext(CallContext callContext); + /** + * This function is used to switch the call context. This has to be called + * if a message is sent or received from an ISR! + * @param callContext + */ + void switchSystemContext(CallContext callContext); - /** MessageQueueIF implementation */ - ReturnValue_t sendMessage(MessageQueueId_t sendTo, - MessageQueueMessageIF* message, bool ignoreFault = false) override; + /** MessageQueueIF implementation */ + ReturnValue_t sendMessage(MessageQueueId_t sendTo, + MessageQueueMessageIF* message, bool ignoreFault = false) override; - ReturnValue_t sendToDefault(MessageQueueMessageIF* message) override; + ReturnValue_t sendToDefault(MessageQueueMessageIF* message) override; - ReturnValue_t reply(MessageQueueMessageIF* message) override; - virtual ReturnValue_t sendMessageFrom(MessageQueueId_t sendTo, - MessageQueueMessageIF* message, - MessageQueueId_t sentFrom = NO_QUEUE, - bool ignoreFault = false) override; + ReturnValue_t reply(MessageQueueMessageIF* message) override; + virtual ReturnValue_t sendMessageFrom(MessageQueueId_t sendTo, + MessageQueueMessageIF* message, + MessageQueueId_t sentFrom = NO_QUEUE, + bool ignoreFault = false) override; - virtual ReturnValue_t sendToDefaultFrom( MessageQueueMessageIF* message, - MessageQueueId_t sentFrom = NO_QUEUE, - bool ignoreFault = false) override; + virtual ReturnValue_t sendToDefaultFrom( MessageQueueMessageIF* message, + MessageQueueId_t sentFrom = NO_QUEUE, + bool ignoreFault = false) override; - ReturnValue_t receiveMessage(MessageQueueMessageIF* message, - MessageQueueId_t *receivedFrom) override; + ReturnValue_t receiveMessage(MessageQueueMessageIF* message, + MessageQueueId_t *receivedFrom) override; - ReturnValue_t receiveMessage(MessageQueueMessageIF* message) override; + ReturnValue_t receiveMessage(MessageQueueMessageIF* message) override; - ReturnValue_t flush(uint32_t* count) override; + ReturnValue_t flush(uint32_t* count) override; - MessageQueueId_t getLastPartner() const override; + MessageQueueId_t getLastPartner() const override; - MessageQueueId_t getId() const override; + MessageQueueId_t getId() const override; - void setDefaultDestination(MessageQueueId_t defaultDestination) override; + void setDefaultDestination(MessageQueueId_t defaultDestination) override; - MessageQueueId_t getDefaultDestination() const override; + MessageQueueId_t getDefaultDestination() const override; - bool isDefaultDestinationSet() const override; + bool isDefaultDestinationSet() const override; - QueueHandle_t getNativeQueueHandle(); + QueueHandle_t getNativeQueueHandle(); protected: - /** - * @brief Implementation to be called from any send Call within - * MessageQueue and MessageQueueSenderIF. - * @details - * This method takes the message provided, adds the sentFrom information and - * passes it on to the destination provided with an operating system call. - * The OS's return value is returned. - * @param sendTo - * This parameter specifies the message queue id to send the message to. - * @param message - * This is a pointer to a previously created message, which is sent. - * @param sentFrom - * The sentFrom information can be set to inject the sender's queue id into - * the message. This variable is set to zero by default. - * @param ignoreFault - * If set to true, the internal software fault counter is not incremented - * if queue is full. - * @param context Specify whether call is made from task or from an ISR. - */ - static ReturnValue_t sendMessageFromMessageQueue(MessageQueueId_t sendTo, - MessageQueueMessageIF* message, MessageQueueId_t sentFrom = NO_QUEUE, - bool ignoreFault=false, CallContext callContext = CallContext::TASK); + /** + * @brief Implementation to be called from any send Call within + * MessageQueue and MessageQueueSenderIF. + * @details + * This method takes the message provided, adds the sentFrom information and + * passes it on to the destination provided with an operating system call. + * The OS's return value is returned. + * @param sendTo + * This parameter specifies the message queue id to send the message to. + * @param message + * This is a pointer to a previously created message, which is sent. + * @param sentFrom + * The sentFrom information can be set to inject the sender's queue id into + * the message. This variable is set to zero by default. + * @param ignoreFault + * If set to true, the internal software fault counter is not incremented + * if queue is full. + * @param context Specify whether call is made from task or from an ISR. + */ + static ReturnValue_t sendMessageFromMessageQueue(MessageQueueId_t sendTo, + MessageQueueMessageIF* message, MessageQueueId_t sentFrom = NO_QUEUE, + bool ignoreFault=false, CallContext callContext = CallContext::TASK); - static ReturnValue_t handleSendResult(BaseType_t result, bool ignoreFault); + static ReturnValue_t handleSendResult(BaseType_t result, bool ignoreFault); private: - bool defaultDestinationSet = false; - QueueHandle_t handle; - MessageQueueId_t queueId = MessageQueueIF::NO_QUEUE; + bool defaultDestinationSet = false; + QueueHandle_t handle; + MessageQueueId_t queueId = MessageQueueIF::NO_QUEUE; - MessageQueueId_t defaultDestination = MessageQueueIF::NO_QUEUE; - MessageQueueId_t lastPartner = MessageQueueIF::NO_QUEUE; - const size_t maxMessageSize; - //! Stores the current system context - CallContext callContext = CallContext::TASK; + MessageQueueId_t defaultDestination = MessageQueueIF::NO_QUEUE; + MessageQueueId_t lastPartner = MessageQueueIF::NO_QUEUE; + const size_t maxMessageSize; + //! Stores the current system context + CallContext callContext = CallContext::TASK; }; #endif /* FSFW_OSAL_FREERTOS_MESSAGEQUEUE_H_ */ From 567699954c0e91f0a5ebd692f3e27ab51d94d1f3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 28 May 2021 18:30:43 +0200 Subject: [PATCH 109/389] added missing event translation --- events/EventManager.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/events/EventManager.cpp b/events/EventManager.cpp index 2337ba83..8e2a2a82 100644 --- a/events/EventManager.cpp +++ b/events/EventManager.cpp @@ -156,11 +156,11 @@ void EventManager::printUtility(sif::OutputTypes printType, EventMessage *messag sif::info << "0x" << std::hex << std::setw(8) << std::setfill('0') << message->getReporter() << std::setfill(' ') << std::dec; } - sif::info << " report event with ID " << message->getEventId() << std::endl; - sif::info << std::hex << "P1 Hex: 0x" << message->getParameter1() << - " | P1 Dec: " << std::dec << message->getParameter1() << std::hex << - " | P2 Hex: 0x" << message->getParameter2() << " | P2 Dec: " << std::dec << - message->getParameter2() << std::endl; + sif::info << " reported event with ID " << message->getEventId() << std::endl; + sif::debug << translateEvents(message->getEvent()) << " | " <getParameter1() << " | P1 Dec: " << std::dec << message->getParameter1() << + std::hex << " | P2 Hex: 0x" << message->getParameter2() << " | P2 Dec: " << + std::dec << message->getParameter2() << std::endl; #else if (string != 0) { sif::printInfo("Event Manager: %s reported event with ID %d\n", string, @@ -186,11 +186,11 @@ void EventManager::printUtility(sif::OutputTypes printType, EventMessage *messag sif::debug << "0x" << std::hex << std::setw(8) << std::setfill('0') << message->getReporter() << std::setfill(' ') << std::dec; } - sif::debug << " report event with ID " << message->getEventId() << std::endl; - sif::debug << std::hex << "P1 Hex: 0x" << message->getParameter1() << - " | P1 Dec: " << std::dec << message->getParameter1() << std::hex << - " | P2 Hex: 0x" << message->getParameter2() << " | P2 Dec: " << std::dec << - message->getParameter2() << std::endl; + sif::debug << " reported event with ID " << message->getEventId() << std::endl; + sif::debug << translateEvents(message->getEvent()) << " | " <getParameter1() << " | P1 Dec: " << std::dec << message->getParameter1() << + std::hex << " | P2 Hex: 0x" << message->getParameter2() << " | P2 Dec: " << + std::dec << message->getParameter2() << std::endl; #else if (string != 0) { sif::printDebug("Event Manager: %s reported event with ID %d\n", string, From 404c3821e60f9d690fee6167739df237ff907ced Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 31 May 2021 11:12:52 +0200 Subject: [PATCH 110/389] corrected include --- unittest/tests/datapoollocal/LocalPoolOwnerBase.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unittest/tests/datapoollocal/LocalPoolOwnerBase.h b/unittest/tests/datapoollocal/LocalPoolOwnerBase.h index 8d2073b0..4c244b16 100644 --- a/unittest/tests/datapoollocal/LocalPoolOwnerBase.h +++ b/unittest/tests/datapoollocal/LocalPoolOwnerBase.h @@ -1,7 +1,7 @@ #ifndef FSFW_UNITTEST_TESTS_DATAPOOLLOCAL_LOCALPOOLOWNERBASE_H_ #define FSFW_UNITTEST_TESTS_DATAPOOLLOCAL_LOCALPOOLOWNERBASE_H_ -#include +#include "objects/systemObjectList.h" #include #include From c9836abf03388b6fe17a8901d8d8ef2cccd5ca59 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 31 May 2021 11:36:32 +0200 Subject: [PATCH 111/389] minor tweak --- events/EventManager.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/events/EventManager.h b/events/EventManager.h index 9189d9e7..012247db 100644 --- a/events/EventManager.h +++ b/events/EventManager.h @@ -3,8 +3,7 @@ #include "EventManagerIF.h" #include "eventmatching/EventMatchTree.h" - -#include +#include "FSFWConfig.h" #include "../serviceinterface/ServiceInterface.h" #include "../objectmanager/SystemObject.h" From e961f3f038eaac96784846a8623cbb0c55cece1d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 31 May 2021 12:22:33 +0200 Subject: [PATCH 112/389] better error handling for mq_receive() --- osal/linux/MessageQueue.cpp | 583 +++++++++++++++++++----------------- 1 file changed, 300 insertions(+), 283 deletions(-) diff --git a/osal/linux/MessageQueue.cpp b/osal/linux/MessageQueue.cpp index 12774a58..9399183d 100644 --- a/osal/linux/MessageQueue.cpp +++ b/osal/linux/MessageQueue.cpp @@ -11,65 +11,64 @@ MessageQueue::MessageQueue(uint32_t messageDepth, size_t maxMessageSize): - id(MessageQueueIF::NO_QUEUE),lastPartner(MessageQueueIF::NO_QUEUE), - defaultDestination(MessageQueueIF::NO_QUEUE), - maxMessageSize(maxMessageSize) { - //debug << "MessageQueue::MessageQueue: Creating a queue" << std::endl; - mq_attr attributes; - this->id = 0; - //Set attributes - attributes.mq_curmsgs = 0; - attributes.mq_maxmsg = messageDepth; - attributes.mq_msgsize = maxMessageSize; - attributes.mq_flags = 0; //Flags are ignored on Linux during mq_open - //Set the name of the queue. The slash is mandatory! - sprintf(name, "/FSFW_MQ%u\n", queueCounter++); + id(MessageQueueIF::NO_QUEUE),lastPartner(MessageQueueIF::NO_QUEUE), + defaultDestination(MessageQueueIF::NO_QUEUE), maxMessageSize(maxMessageSize) { + //debug << "MessageQueue::MessageQueue: Creating a queue" << std::endl; + mq_attr attributes; + this->id = 0; + //Set attributes + attributes.mq_curmsgs = 0; + attributes.mq_maxmsg = messageDepth; + attributes.mq_msgsize = maxMessageSize; + attributes.mq_flags = 0; //Flags are ignored on Linux during mq_open + //Set the name of the queue. The slash is mandatory! + sprintf(name, "/FSFW_MQ%u\n", queueCounter++); - // Create a nonblocking queue if the name is available (the queue is read - // and writable for the owner as well as the group) - int oflag = O_NONBLOCK | O_RDWR | O_CREAT | O_EXCL; - mode_t mode = S_IWUSR | S_IREAD | S_IWGRP | S_IRGRP | S_IROTH | S_IWOTH; - mqd_t tempId = mq_open(name, oflag, mode, &attributes); - if (tempId == -1) { - handleError(&attributes, messageDepth); - } - else { - //Successful mq_open call - this->id = tempId; - } + // Create a nonblocking queue if the name is available (the queue is read + // and writable for the owner as well as the group) + int oflag = O_NONBLOCK | O_RDWR | O_CREAT | O_EXCL; + mode_t mode = S_IWUSR | S_IREAD | S_IWGRP | S_IRGRP | S_IROTH | S_IWOTH; + mqd_t tempId = mq_open(name, oflag, mode, &attributes); + if (tempId == -1) { + handleError(&attributes, messageDepth); + } + else { + //Successful mq_open call + this->id = tempId; + } } MessageQueue::~MessageQueue() { - int status = mq_close(this->id); - if(status != 0){ + int status = mq_close(this->id); + if(status != 0){ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::Destructor: mq_close Failed with status: " - << strerror(errno) <> - defaultMqMaxMsg and defaultMqMaxMsg < messageDepth) { - /* + size_t defaultMqMaxMsg = 0; + // Not POSIX conformant, but should work for all UNIX systems. + // Just an additional helpful printout :-) + if(std::ifstream("/proc/sys/fs/mqueue/msg_max",std::ios::in) >> + defaultMqMaxMsg and defaultMqMaxMsg < messageDepth) { + /* See: https://www.man7.org/linux/man-pages/man3/mq_open.3.html This happens if the msg_max value is not large enough It is ignored if the executable is run in privileged mode. @@ -83,326 +82,344 @@ ReturnValue_t MessageQueue::handleError(mq_attr* attributes, sudo nano /etc/sysctl.conf Append at end: fs/mqueue/msg_max = Apply changes with: sudo sysctl -p - */ + */ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::MessageQueue: Default MQ size " - << defaultMqMaxMsg << " is too small for requested size " - << messageDepth << std::endl; - sif::error << "This error can be fixed by setting the maximum " - "allowed message size higher!" << std::endl; + sif::error << "MessageQueue::MessageQueue: Default MQ size " + << defaultMqMaxMsg << " is too small for requested size " + << messageDepth << std::endl; + sif::error << "This error can be fixed by setting the maximum " + "allowed message size higher!" << std::endl; #endif - - } - break; - } - case(EEXIST): { - // An error occured during open - // We need to distinguish if it is caused by an already created queue - //There's another queue with the same name - //We unlink the other queue - int status = mq_unlink(name); - if (status != 0) { + } + break; + } + case(EEXIST): { + // An error occured during open + // We need to distinguish if it is caused by an already created queue + // There's another queue with the same name + // We unlink the other queue + int status = mq_unlink(name); + if (status != 0) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "mq_unlink Failed with status: " << strerror(errno) - << std::endl; + sif::error << "mq_unlink Failed with status: " << strerror(errno) + << std::endl; #endif - } - else { - // Successful unlinking, try to open again - mqd_t tempId = mq_open(name, - O_NONBLOCK | O_RDWR | O_CREAT | O_EXCL, - S_IWUSR | S_IREAD | S_IWGRP | S_IRGRP, attributes); - if (tempId != -1) { - //Successful mq_open - this->id = tempId; - return HasReturnvaluesIF::RETURN_OK; - } - } - break; - } + } + else { + // Successful unlinking, try to open again + mqd_t tempId = mq_open(name, + O_NONBLOCK | O_RDWR | O_CREAT | O_EXCL, + S_IWUSR | S_IREAD | S_IWGRP | S_IRGRP, attributes); + if (tempId != -1) { + //Successful mq_open + this->id = tempId; + return HasReturnvaluesIF::RETURN_OK; + } + } + break; + } - default: { - // Failed either the first time or the second time + default: { + // Failed either the first time or the second time #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::MessageQueue: Creating Queue " << name - << " failed with status: " << strerror(errno) << std::endl; + sif::error << "MessageQueue::MessageQueue: Creating Queue " << name + << " failed with status: " << strerror(errno) << std::endl; #else - sif::printError("MessageQueue::MessageQueue: Creating Queue %s" - " failed with status: %s\n", name, strerror(errno)); + sif::printError("MessageQueue::MessageQueue: Creating Queue %s" + " failed with status: %s\n", name, strerror(errno)); #endif - } - } - return HasReturnvaluesIF::RETURN_FAILED; + } + } + return HasReturnvaluesIF::RETURN_FAILED; } ReturnValue_t MessageQueue::sendMessage(MessageQueueId_t sendTo, - MessageQueueMessageIF* message, bool ignoreFault) { - return sendMessageFrom(sendTo, message, this->getId(), false); + MessageQueueMessageIF* message, bool ignoreFault) { + return sendMessageFrom(sendTo, message, this->getId(), false); } ReturnValue_t MessageQueue::sendToDefault(MessageQueueMessageIF* message) { - return sendToDefaultFrom(message, this->getId()); + return sendToDefaultFrom(message, this->getId()); } ReturnValue_t MessageQueue::reply(MessageQueueMessageIF* message) { - if (this->lastPartner != 0) { - return sendMessageFrom(this->lastPartner, message, this->getId()); - } else { - return NO_REPLY_PARTNER; - } + if (this->lastPartner != 0) { + return sendMessageFrom(this->lastPartner, message, this->getId()); + } else { + return NO_REPLY_PARTNER; + } } ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message, - MessageQueueId_t* receivedFrom) { - ReturnValue_t status = this->receiveMessage(message); - *receivedFrom = this->lastPartner; - return status; + MessageQueueId_t* receivedFrom) { + ReturnValue_t status = this->receiveMessage(message); + *receivedFrom = this->lastPartner; + return status; } ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) { - if(message == nullptr) { + if(message == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::receiveMessage: Message is " - "nullptr!" << std::endl; + sif::error << "MessageQueue::receiveMessage: Message is " + "nullptr!" << std::endl; #endif - return HasReturnvaluesIF::RETURN_FAILED; - } + return HasReturnvaluesIF::RETURN_FAILED; + } - if(message->getMaximumMessageSize() < maxMessageSize) { + if(message->getMaximumMessageSize() < maxMessageSize) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::receiveMessage: Message size " - << message->getMaximumMessageSize() - << " too small to receive data!" << std::endl; + sif::error << "MessageQueue::receiveMessage: Message size " + << message->getMaximumMessageSize() + << " too small to receive data!" << std::endl; #endif - return HasReturnvaluesIF::RETURN_FAILED; - } + return HasReturnvaluesIF::RETURN_FAILED; + } - unsigned int messagePriority = 0; - int status = mq_receive(id,reinterpret_cast(message->getBuffer()), - message->getMaximumMessageSize(),&messagePriority); - if (status > 0) { - this->lastPartner = message->getSender(); - //Check size of incoming message. - if (message->getMessageSize() < message->getMinimumMessageSize()) { - return HasReturnvaluesIF::RETURN_FAILED; - } - return HasReturnvaluesIF::RETURN_OK; - } - else if (status==0) { - //Success but no message received - return MessageQueueIF::EMPTY; - } - else { - //No message was received. Keep lastPartner anyway, I might send - //something later. But still, delete packet content. - memset(message->getData(), 0, message->getMaximumDataSize()); - switch(errno){ - case EAGAIN: - //O_NONBLOCK or MQ_NONBLOCK was set and there are no messages - //currently on the specified queue. - return MessageQueueIF::EMPTY; - case EBADF: - //mqdes doesn't represent a valid queue open for reading. + unsigned int messagePriority = 0; + int status = mq_receive(id,reinterpret_cast(message->getBuffer()), + message->getMaximumMessageSize(),&messagePriority); + if (status > 0) { + this->lastPartner = message->getSender(); + //Check size of incoming message. + if (message->getMessageSize() < message->getMinimumMessageSize()) { + return HasReturnvaluesIF::RETURN_FAILED; + } + return HasReturnvaluesIF::RETURN_OK; + } + else if (status==0) { + //Success but no message received + return MessageQueueIF::EMPTY; + } + else { + //No message was received. Keep lastPartner anyway, I might send + //something later. But still, delete packet content. + memset(message->getData(), 0, message->getMaximumDataSize()); + switch(errno){ + case EAGAIN: + //O_NONBLOCK or MQ_NONBLOCK was set and there are no messages + //currently on the specified queue. + return MessageQueueIF::EMPTY; + case EBADF: { + //mqdes doesn't represent a valid queue open for reading. #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::receive: configuration error " - << strerror(errno) << std::endl; + sif::error << "MessageQueue::receive: configuration error " + << strerror(errno) << std::endl; #endif - /*NO BREAK*/ - case EINVAL: - /* - * This value indicates one of the following: - * - The pointer to the buffer for storing the received message, - * msg_ptr, is NULL. - * - The number of bytes requested, msg_len is less than zero. - * - msg_len is anything other than the mq_msgsize of the specified - * queue, and the QNX extended option MQ_READBUF_DYNAMIC hasn't - * been set in the queue's mq_flags. - */ + return HasReturnvaluesIF::RETURN_FAILED; + } + case EINVAL: { + /* + * This value indicates one of the following: + * - The pointer to the buffer for storing the received message, + * msg_ptr, is NULL. + * - The number of bytes requested, msg_len is less than zero. + * - msg_len is anything other than the mq_msgsize of the specified + * queue, and the QNX extended option MQ_READBUF_DYNAMIC hasn't + * been set in the queue's mq_flags. + */ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::receive: configuration error " - << strerror(errno) << std::endl; + sif::error << "MessageQueue::receive: EINVAL error " + << strerror(errno) << std::endl; #endif - /*NO BREAK*/ - case EMSGSIZE: - /* - * This value indicates one of the following: - * - the QNX extended option MQ_READBUF_DYNAMIC hasn't been set, - * and the given msg_len is shorter than the mq_msgsize for - * the given queue. - * - the extended option MQ_READBUF_DYNAMIC has been set, but the - * given msg_len is too short for the message that would have - * been received. - */ + return HasReturnvaluesIF::RETURN_FAILED; + } + case EMSGSIZE: { + /* + * This value indicates one of the following: + * - the QNX extended option MQ_READBUF_DYNAMIC hasn't been set, + * and the given msg_len is shorter than the mq_msgsize for + * the given queue. + * - the extended option MQ_READBUF_DYNAMIC has been set, but the + * given msg_len is too short for the message that would have + * been received. + */ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::receive: configuration error " - << strerror(errno) << std::endl; + sif::error << "MessageQueue::receive: EMSGSIZE error " + << strerror(errno) << std::endl; #endif - /*NO BREAK*/ - case EINTR: - //The operation was interrupted by a signal. - default: + return HasReturnvaluesIF::RETURN_FAILED; + } - return HasReturnvaluesIF::RETURN_FAILED; - } + case EINTR: { + //The operation was interrupted by a signal. +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "MessageQueue::receiveMessage: EINTR error " << strerror(errno) << + std::endl; +#endif + return HasReturnvaluesIF::RETURN_FAILED; + } + case ETIMEDOUT: { + //The operation was interrupted by a signal. +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "MessageQueue::receiveMessage: ETIMEDOUT error " << strerror(errno) << + std::endl; +#endif + return HasReturnvaluesIF::RETURN_FAILED; + } - } + default: + + return HasReturnvaluesIF::RETURN_FAILED; + } + + } } MessageQueueId_t MessageQueue::getLastPartner() const { - return this->lastPartner; + return this->lastPartner; } ReturnValue_t MessageQueue::flush(uint32_t* count) { - mq_attr attrib; - int status = mq_getattr(id,&attrib); - if(status != 0){ - switch(errno){ - case EBADF: - //mqdes doesn't represent a valid message queue. + mq_attr attrib; + int status = mq_getattr(id,&attrib); + if(status != 0){ + switch(errno){ + case EBADF: + //mqdes doesn't represent a valid message queue. #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::flush configuration error, " - "called flush with an invalid queue ID" << std::endl; + sif::error << "MessageQueue::flush configuration error, " + "called flush with an invalid queue ID" << std::endl; #endif - /*NO BREAK*/ - case EINVAL: - //mq_attr is NULL - default: - return HasReturnvaluesIF::RETURN_FAILED; - } - } - *count = attrib.mq_curmsgs; - attrib.mq_curmsgs = 0; - status = mq_setattr(id,&attrib,NULL); - if(status != 0){ - switch(errno){ - case EBADF: - //mqdes doesn't represent a valid message queue. + /*NO BREAK*/ + case EINVAL: + //mq_attr is NULL + default: + return HasReturnvaluesIF::RETURN_FAILED; + } + } + *count = attrib.mq_curmsgs; + attrib.mq_curmsgs = 0; + status = mq_setattr(id,&attrib,NULL); + if(status != 0){ + switch(errno){ + case EBADF: + //mqdes doesn't represent a valid message queue. #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::flush configuration error, " - "called flush with an invalid queue ID" << std::endl; + sif::error << "MessageQueue::flush configuration error, " + "called flush with an invalid queue ID" << std::endl; #endif - /*NO BREAK*/ - case EINVAL: - /* - * This value indicates one of the following: - * - mq_attr is NULL. - * - MQ_MULT_NOTIFY had been set for this queue, and the given - * mq_flags includes a 0 in the MQ_MULT_NOTIFY bit. Once - * MQ_MULT_NOTIFY has been turned on, it may never be turned off. - */ - default: - return HasReturnvaluesIF::RETURN_FAILED; - } - } - return HasReturnvaluesIF::RETURN_OK; + /*NO BREAK*/ + case EINVAL: + /* + * This value indicates one of the following: + * - mq_attr is NULL. + * - MQ_MULT_NOTIFY had been set for this queue, and the given + * mq_flags includes a 0 in the MQ_MULT_NOTIFY bit. Once + * MQ_MULT_NOTIFY has been turned on, it may never be turned off. + */ + default: + return HasReturnvaluesIF::RETURN_FAILED; + } + } + return HasReturnvaluesIF::RETURN_OK; } MessageQueueId_t MessageQueue::getId() const { - return this->id; + return this->id; } void MessageQueue::setDefaultDestination(MessageQueueId_t defaultDestination) { - this->defaultDestination = defaultDestination; + this->defaultDestination = defaultDestination; } ReturnValue_t MessageQueue::sendToDefaultFrom(MessageQueueMessageIF* message, - MessageQueueId_t sentFrom, bool ignoreFault) { - return sendMessageFrom(defaultDestination, message, sentFrom, ignoreFault); + MessageQueueId_t sentFrom, bool ignoreFault) { + return sendMessageFrom(defaultDestination, message, sentFrom, ignoreFault); } ReturnValue_t MessageQueue::sendMessageFrom(MessageQueueId_t sendTo, - MessageQueueMessageIF* message, MessageQueueId_t sentFrom, - bool ignoreFault) { - return sendMessageFromMessageQueue(sendTo,message, sentFrom,ignoreFault); + MessageQueueMessageIF* message, MessageQueueId_t sentFrom, + bool ignoreFault) { + return sendMessageFromMessageQueue(sendTo,message, sentFrom,ignoreFault); } MessageQueueId_t MessageQueue::getDefaultDestination() const { - return this->defaultDestination; + return this->defaultDestination; } bool MessageQueue::isDefaultDestinationSet() const { - return (defaultDestination != NO_QUEUE); + return (defaultDestination != NO_QUEUE); } uint16_t MessageQueue::queueCounter = 0; ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo, - MessageQueueMessageIF *message, MessageQueueId_t sentFrom, - bool ignoreFault) { - if(message == nullptr) { + MessageQueueMessageIF *message, MessageQueueId_t sentFrom, + bool ignoreFault) { + if(message == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::sendMessageFromMessageQueue: Message is " - "nullptr!" << std::endl; + sif::error << "MessageQueue::sendMessageFromMessageQueue: Message is " + "nullptr!" << std::endl; #endif - return HasReturnvaluesIF::RETURN_FAILED; - } + return HasReturnvaluesIF::RETURN_FAILED; + } - message->setSender(sentFrom); - int result = mq_send(sendTo, - reinterpret_cast(message->getBuffer()), - message->getMessageSize(),0); + message->setSender(sentFrom); + int result = mq_send(sendTo, + reinterpret_cast(message->getBuffer()), + message->getMessageSize(),0); - //TODO: Check if we're in ISR. - if (result != 0) { - if(!ignoreFault){ - InternalErrorReporterIF* internalErrorReporter = - objectManager->get( - objects::INTERNAL_ERROR_REPORTER); - if (internalErrorReporter != NULL) { - internalErrorReporter->queueMessageNotSent(); - } - } - switch(errno){ - case EAGAIN: - //The O_NONBLOCK flag was set when opening the queue, or the - //MQ_NONBLOCK flag was set in its attributes, and the - //specified queue is full. - return MessageQueueIF::FULL; - case EBADF: { - //mq_des doesn't represent a valid message queue descriptor, - //or mq_des wasn't opened for writing. + //TODO: Check if we're in ISR. + if (result != 0) { + if(!ignoreFault){ + InternalErrorReporterIF* internalErrorReporter = + objectManager->get( + objects::INTERNAL_ERROR_REPORTER); + if (internalErrorReporter != NULL) { + internalErrorReporter->queueMessageNotSent(); + } + } + switch(errno){ + case EAGAIN: + //The O_NONBLOCK flag was set when opening the queue, or the + //MQ_NONBLOCK flag was set in its attributes, and the + //specified queue is full. + return MessageQueueIF::FULL; + case EBADF: { + //mq_des doesn't represent a valid message queue descriptor, + //or mq_des wasn't opened for writing. #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::sendMessage: Configuration error, MQ" - << " destination invalid." << std::endl; - sif::error << strerror(errno) << " in " - <<"mq_send to: " << sendTo << " sent from " - << sentFrom << std::endl; + sif::error << "MessageQueue::sendMessage: Configuration error, MQ" + << " destination invalid." << std::endl; + sif::error << strerror(errno) << " in " + <<"mq_send to: " << sendTo << " sent from " + << sentFrom << std::endl; #endif - return DESTINATION_INVALID; - } - case EINTR: - //The call was interrupted by a signal. - case EINVAL: - /* - * This value indicates one of the following: - * - msg_ptr is NULL. - * - msg_len is negative. - * - msg_prio is greater than MQ_PRIO_MAX. - * - msg_prio is less than 0. - * - MQ_PRIO_RESTRICT is set in the mq_attr of mq_des, and - * msg_prio is greater than the priority of the calling process. - */ + return DESTINATION_INVALID; + } + case EINTR: + //The call was interrupted by a signal. + case EINVAL: + /* + * This value indicates one of the following: + * - msg_ptr is NULL. + * - msg_len is negative. + * - msg_prio is greater than MQ_PRIO_MAX. + * - msg_prio is less than 0. + * - MQ_PRIO_RESTRICT is set in the mq_attr of mq_des, and + * msg_prio is greater than the priority of the calling process. + */ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::sendMessage: Configuration error " - << strerror(errno) << " in mq_send" << std::endl; + sif::error << "MessageQueue::sendMessage: Configuration error " + << strerror(errno) << " in mq_send" << std::endl; #endif - /*NO BREAK*/ - case EMSGSIZE: - // The msg_len is greater than the msgsize associated with - //the specified queue. + /*NO BREAK*/ + case EMSGSIZE: + // The msg_len is greater than the msgsize associated with + //the specified queue. #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::sendMessage: Size error [" << - strerror(errno) << "] in mq_send" << std::endl; + sif::error << "MessageQueue::sendMessage: Size error [" << + strerror(errno) << "] in mq_send" << std::endl; #endif - /*NO BREAK*/ - default: - return HasReturnvaluesIF::RETURN_FAILED; - } - } - return HasReturnvaluesIF::RETURN_OK; + /*NO BREAK*/ + default: + return HasReturnvaluesIF::RETURN_FAILED; + } + } + return HasReturnvaluesIF::RETURN_OK; } From 54e60f4ddc88a8e108588c5a8b69ae744686a295 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 31 May 2021 12:30:54 +0200 Subject: [PATCH 113/389] cleaned up a bit --- osal/linux/MessageQueue.cpp | 44 ++++++++++++++++--------------------- osal/linux/MessageQueue.h | 1 + 2 files changed, 20 insertions(+), 25 deletions(-) diff --git a/osal/linux/MessageQueue.cpp b/osal/linux/MessageQueue.cpp index 9399183d..bfd97e56 100644 --- a/osal/linux/MessageQueue.cpp +++ b/osal/linux/MessageQueue.cpp @@ -204,11 +204,7 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) { return MessageQueueIF::EMPTY; case EBADF: { //mqdes doesn't represent a valid queue open for reading. -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::receive: configuration error " - << strerror(errno) << std::endl; -#endif - return HasReturnvaluesIF::RETURN_FAILED; + return handleRecvError("EBADF"); } case EINVAL: { /* @@ -220,11 +216,7 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) { * queue, and the QNX extended option MQ_READBUF_DYNAMIC hasn't * been set in the queue's mq_flags. */ -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::receive: EINVAL error " - << strerror(errno) << std::endl; -#endif - return HasReturnvaluesIF::RETURN_FAILED; + return handleRecvError("EINVAL"); } case EMSGSIZE: { /* @@ -236,28 +228,16 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) { * given msg_len is too short for the message that would have * been received. */ -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::receive: EMSGSIZE error " - << strerror(errno) << std::endl; -#endif - return HasReturnvaluesIF::RETURN_FAILED; + return handleRecvError("EMSGSIZE"); } case EINTR: { //The operation was interrupted by a signal. -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::receiveMessage: EINTR error " << strerror(errno) << - std::endl; -#endif - return HasReturnvaluesIF::RETURN_FAILED; + return handleRecvError("EINTR"); } case ETIMEDOUT: { //The operation was interrupted by a signal. -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::receiveMessage: ETIMEDOUT error " << strerror(errno) << - std::endl; -#endif - return HasReturnvaluesIF::RETURN_FAILED; + return handleRecvError("ETIMEDOUT"); } default: @@ -423,3 +403,17 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo, } return HasReturnvaluesIF::RETURN_OK; } + +ReturnValue_t MessageQueue::handleRecvError(const char * const failString) { + if(failString == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "MessageQueue::receiveMessage: " << failString << " error " + << strerror(errno) << std::endl; +#else + sif::printError("MessageQueue::receiveMessage: %s error %s\n", failString, + strerror(errno)); +#endif + return HasReturnvaluesIF::RETURN_FAILED; +} diff --git a/osal/linux/MessageQueue.h b/osal/linux/MessageQueue.h index 239bbbdb..0bef0a73 100644 --- a/osal/linux/MessageQueue.h +++ b/osal/linux/MessageQueue.h @@ -182,6 +182,7 @@ private: const size_t maxMessageSize; ReturnValue_t handleError(mq_attr* attributes, uint32_t messageDepth); + ReturnValue_t handleRecvError(const char* const failString); }; #endif /* FSFW_OSAL_LINUX_MESSAGEQUEUE_H_ */ From 722a7b3240248cac2a93e3d4e3a09e3ec5966e9a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 31 May 2021 16:46:32 +0200 Subject: [PATCH 114/389] renamed variable --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ba6a187..43ff71b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -131,7 +131,7 @@ else() ) endif() -foreach(INCLUDE_PATH ${FSFW_ADDITIONAL_INC_PATH}) +foreach(INCLUDE_PATH ${FSFW_ADDITIONAL_INC_PATHS}) if(IS_ABSOLUTE ${INCLUDE_PATH}) set(CURR_ABS_INC_PATH "${FREERTOS_PATH}") else() From ad820fbe99d2fa0fb49eb71ed70611bfea7efa99 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 31 May 2021 17:00:51 +0200 Subject: [PATCH 115/389] important bugfix --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 43ff71b3..3d4053e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,7 +133,7 @@ endif() foreach(INCLUDE_PATH ${FSFW_ADDITIONAL_INC_PATHS}) if(IS_ABSOLUTE ${INCLUDE_PATH}) - set(CURR_ABS_INC_PATH "${FREERTOS_PATH}") + set(CURR_ABS_INC_PATH "${INCLUDE_PATH}") else() get_filename_component(CURR_ABS_INC_PATH ${INCLUDE_PATH} REALPATH BASE_DIR ${CMAKE_SOURCE_DIR}) From 38910143400e455f5184ad85be98e05638c2eea6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 3 Jun 2021 12:29:06 +0200 Subject: [PATCH 116/389] linux error print handling improved --- osal/host/MessageQueue.cpp | 7 +- osal/linux/BinarySemaphore.cpp | 233 ++++++++++---------- osal/linux/BinarySemaphore.h | 1 + osal/linux/CMakeLists.txt | 1 + osal/linux/CountingSemaphore.cpp | 76 ++++--- osal/linux/MessageQueue.cpp | 242 ++++++++++----------- osal/linux/MessageQueue.h | 4 +- osal/linux/Mutex.cpp | 27 +-- osal/linux/PeriodicPosixTask.cpp | 13 +- osal/linux/PosixThread.cpp | 352 +++++++++++++++---------------- osal/linux/PosixThread.h | 110 +++++----- osal/linux/unixUtility.cpp | 32 +++ osal/linux/unixUtility.h | 13 ++ 13 files changed, 558 insertions(+), 553 deletions(-) create mode 100644 osal/linux/unixUtility.cpp create mode 100644 osal/linux/unixUtility.h diff --git a/osal/host/MessageQueue.cpp b/osal/host/MessageQueue.cpp index a779bdcb..ef846f9c 100644 --- a/osal/host/MessageQueue.cpp +++ b/osal/host/MessageQueue.cpp @@ -1,7 +1,7 @@ #include "MessageQueue.h" #include "QueueMapManager.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "../../serviceinterface/ServiceInterface.h" #include "../../ipc/MutexFactory.h" #include "../../ipc/MutexGuard.h" @@ -13,8 +13,9 @@ MessageQueue::MessageQueue(size_t messageDepth, size_t maxMessageSize): auto result = QueueMapManager::instance()->addMessageQueue(this, &mqId); if(result != HasReturnvaluesIF::RETURN_OK) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::MessageQueue:" - << " Could not be created" << std::endl; + sif::error << "MessageQueue::MessageQueue: Could not be created" << std::endl; +#else + sif::printError("MessageQueue::MessageQueue: Could not be created\n"); #endif } } diff --git a/osal/linux/BinarySemaphore.cpp b/osal/linux/BinarySemaphore.cpp index 5716e560..110b0a90 100644 --- a/osal/linux/BinarySemaphore.cpp +++ b/osal/linux/BinarySemaphore.cpp @@ -1,4 +1,5 @@ #include "BinarySemaphore.h" +#include "unixUtility.h" #include "../../serviceinterface/ServiceInterfacePrinter.h" #include "../../serviceinterface/ServiceInterfaceStream.h" @@ -8,154 +9,154 @@ BinarySemaphore::BinarySemaphore() { - // Using unnamed semaphores for now - initSemaphore(); + // Using unnamed semaphores for now + initSemaphore(); } BinarySemaphore::~BinarySemaphore() { - sem_destroy(&handle); + sem_destroy(&handle); } BinarySemaphore::BinarySemaphore(BinarySemaphore&& s) { - initSemaphore(); + initSemaphore(); } BinarySemaphore& BinarySemaphore::operator =( BinarySemaphore&& s) { - initSemaphore(); - return * this; + initSemaphore(); + return * this; } ReturnValue_t BinarySemaphore::acquire(TimeoutType timeoutType, - uint32_t timeoutMs) { - int result = 0; - if(timeoutType == TimeoutType::POLLING) { - result = sem_trywait(&handle); - } - else if(timeoutType == TimeoutType::BLOCKING) { - result = sem_wait(&handle); - } - else if(timeoutType == TimeoutType::WAITING){ - timespec timeOut; - clock_gettime(CLOCK_REALTIME, &timeOut); - uint64_t nseconds = timeOut.tv_sec * 1000000000 + timeOut.tv_nsec; - nseconds += timeoutMs * 1000000; - timeOut.tv_sec = nseconds / 1000000000; - timeOut.tv_nsec = nseconds - timeOut.tv_sec * 1000000000; - result = sem_timedwait(&handle, &timeOut); - if(result != 0 and errno == EINVAL) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << "BinarySemaphore::acquire: Invalid time value possible" - << std::endl; -#endif - } - } - if(result == 0) { - return HasReturnvaluesIF::RETURN_OK; - } + uint32_t timeoutMs) { + int result = 0; + if(timeoutType == TimeoutType::POLLING) { + result = sem_trywait(&handle); + } + else if(timeoutType == TimeoutType::BLOCKING) { + result = sem_wait(&handle); + } + else if(timeoutType == TimeoutType::WAITING){ + timespec timeOut; + clock_gettime(CLOCK_REALTIME, &timeOut); + uint64_t nseconds = timeOut.tv_sec * 1000000000 + timeOut.tv_nsec; + nseconds += timeoutMs * 1000000; + timeOut.tv_sec = nseconds / 1000000000; + timeOut.tv_nsec = nseconds - timeOut.tv_sec * 1000000000; + result = sem_timedwait(&handle, &timeOut); + if(result != 0 and errno == EINVAL) { + utility::printUnixErrorGeneric(CLASS_NAME, "acquire", "sem_timedwait"); + } + } + if(result == 0) { + return HasReturnvaluesIF::RETURN_OK; + } - switch(errno) { - case(EAGAIN): - // Operation could not be performed without blocking (for sem_trywait) - case(ETIMEDOUT): - // Semaphore is 0 - return SemaphoreIF::SEMAPHORE_TIMEOUT; - case(EINVAL): - // Semaphore invalid - return SemaphoreIF::SEMAPHORE_INVALID; - case(EINTR): - // Call was interrupted by signal handler -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << "BinarySemaphore::acquire: Signal handler interrupted." - "Code " << strerror(errno) << std::endl; -#endif - /* No break */ - default: - return HasReturnvaluesIF::RETURN_FAILED; - } + switch(errno) { + case(EAGAIN): + // Operation could not be performed without blocking (for sem_trywait) + case(ETIMEDOUT): { + // Semaphore is 0 + utility::printUnixErrorGeneric(CLASS_NAME, "acquire", "ETIMEDOUT"); + return SemaphoreIF::SEMAPHORE_TIMEOUT; + } + case(EINVAL): { + // Semaphore invalid + utility::printUnixErrorGeneric(CLASS_NAME, "acquire", "EINVAL"); + return SemaphoreIF::SEMAPHORE_INVALID; + } + case(EINTR): { + // Call was interrupted by signal handler + utility::printUnixErrorGeneric(CLASS_NAME, "acquire", "EINTR"); + return HasReturnvaluesIF::RETURN_FAILED; + } + default: + return HasReturnvaluesIF::RETURN_FAILED; + } } ReturnValue_t BinarySemaphore::release() { - return BinarySemaphore::release(&this->handle); + return BinarySemaphore::release(&this->handle); } ReturnValue_t BinarySemaphore::release(sem_t *handle) { - ReturnValue_t countResult = checkCount(handle, 1); - if(countResult != HasReturnvaluesIF::RETURN_OK) { - return countResult; - } + ReturnValue_t countResult = checkCount(handle, 1); + if(countResult != HasReturnvaluesIF::RETURN_OK) { + return countResult; + } - int result = sem_post(handle); - if(result == 0) { - return HasReturnvaluesIF::RETURN_OK; - } + int result = sem_post(handle); + if(result == 0) { + return HasReturnvaluesIF::RETURN_OK; + } - switch(errno) { - case(EINVAL): - // Semaphore invalid - return SemaphoreIF::SEMAPHORE_INVALID; - case(EOVERFLOW): - // SEM_MAX_VALUE overflow. This should never happen - default: - return HasReturnvaluesIF::RETURN_FAILED; - } + switch(errno) { + case(EINVAL): { + // Semaphore invalid + utility::printUnixErrorGeneric(CLASS_NAME, "release", "EINVAL"); + return SemaphoreIF::SEMAPHORE_INVALID; + } + case(EOVERFLOW): { + // SEM_MAX_VALUE overflow. This should never happen + utility::printUnixErrorGeneric(CLASS_NAME, "release", "EOVERFLOW"); + return HasReturnvaluesIF::RETURN_FAILED; + } + default: + return HasReturnvaluesIF::RETURN_FAILED; + } } uint8_t BinarySemaphore::getSemaphoreCounter() const { - // And another ugly cast :-D - return getSemaphoreCounter(const_cast(&this->handle)); + // And another ugly cast :-D + return getSemaphoreCounter(const_cast(&this->handle)); } uint8_t BinarySemaphore::getSemaphoreCounter(sem_t *handle) { - int value = 0; - int result = sem_getvalue(handle, &value); - if (result == 0) { - return value; - } - else if(result != 0 and errno == EINVAL) { - // Could be called from interrupt, use lightweight printf - sif::printError("BinarySemaphore::getSemaphoreCounter: " - "Invalid semaphore\n"); - return 0; - } - else { - // This should never happen. - return 0; - } + int value = 0; + int result = sem_getvalue(handle, &value); + if (result == 0) { + return value; + } + else if(result != 0 and errno == EINVAL) { + // Could be called from interrupt, use lightweight printf + sif::printError("BinarySemaphore::getSemaphoreCounter: " + "Invalid semaphore\n"); + return 0; + } + else { + // This should never happen. + return 0; + } } void BinarySemaphore::initSemaphore(uint8_t initCount) { - auto result = sem_init(&handle, true, initCount); - if(result == -1) { - switch(errno) { - case(EINVAL): - // Value exceeds SEM_VALUE_MAX - case(ENOSYS): { - // System does not support process-shared semaphores -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "BinarySemaphore: Init failed with " - << strerror(errno) << std::endl; -#else - sif::printError("BinarySemaphore: Init failed with %s\n", - strerror(errno)); -#endif - } - } - } + auto result = sem_init(&handle, true, initCount); + if(result == -1) { + switch(errno) { + case(EINVAL): { + utility::printUnixErrorGeneric(CLASS_NAME, "initSemaphore", "EINVAL"); + break; + } + case(ENOSYS): { + // System does not support process-shared semaphores + utility::printUnixErrorGeneric(CLASS_NAME, "initSemaphore", "ENOSYS"); + break; + } + } + } } ReturnValue_t BinarySemaphore::checkCount(sem_t* handle, uint8_t maxCount) { - int value = getSemaphoreCounter(handle); - if(value >= maxCount) { - if(maxCount == 1 and value > 1) { - // Binary Semaphore special case. - // This is a config error use lightweight printf is this is called - // from an interrupt - printf("BinarySemaphore::release: Value of binary semaphore greater" - " than 1!\n"); - return HasReturnvaluesIF::RETURN_FAILED; - } - return SemaphoreIF::SEMAPHORE_NOT_OWNED; - } - return HasReturnvaluesIF::RETURN_OK; + int value = getSemaphoreCounter(handle); + if(value >= maxCount) { + if(maxCount == 1 and value > 1) { + // Binary Semaphore special case. + // This is a config error use lightweight printf is this is called + // from an interrupt + printf("BinarySemaphore::release: Value of binary semaphore greater than 1!\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + return SemaphoreIF::SEMAPHORE_NOT_OWNED; + } + return HasReturnvaluesIF::RETURN_OK; } diff --git a/osal/linux/BinarySemaphore.h b/osal/linux/BinarySemaphore.h index e9bb8bb6..2e6ded15 100644 --- a/osal/linux/BinarySemaphore.h +++ b/osal/linux/BinarySemaphore.h @@ -76,6 +76,7 @@ public: static ReturnValue_t checkCount(sem_t* handle, uint8_t maxCount); protected: sem_t handle; + static constexpr const char* CLASS_NAME = "BinarySemaphore"; }; #endif /* FRAMEWORK_OSAL_FREERTOS_BINARYSEMPAHORE_H_ */ diff --git a/osal/linux/CMakeLists.txt b/osal/linux/CMakeLists.txt index 332fe2f4..0fb66b3e 100644 --- a/osal/linux/CMakeLists.txt +++ b/osal/linux/CMakeLists.txt @@ -15,6 +15,7 @@ target_sources(${LIB_FSFW_NAME} TaskFactory.cpp Timer.cpp tcpipHelpers.cpp + unixUtility.cpp ) find_package(Threads REQUIRED) diff --git a/osal/linux/CountingSemaphore.cpp b/osal/linux/CountingSemaphore.cpp index 07c52212..752e150b 100644 --- a/osal/linux/CountingSemaphore.cpp +++ b/osal/linux/CountingSemaphore.cpp @@ -1,58 +1,70 @@ -#include "../../osal/linux/CountingSemaphore.h" +#include "CountingSemaphore.h" +#include "unixUtility.h" + #include "../../serviceinterface/ServiceInterface.h" #include CountingSemaphore::CountingSemaphore(const uint8_t maxCount, uint8_t initCount): - maxCount(maxCount), initCount(initCount) { - if(initCount > maxCount) { + maxCount(maxCount), initCount(initCount) { + if(initCount > maxCount) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "CountingSemaphoreUsingTask: Max count bigger than " - "intial cout. Setting initial count to max count." << std::endl; + sif::warning << "CountingSemaphoreUsingTask: Max count bigger than " + "intial cout. Setting initial count to max count" << std::endl; +#else + sif::printWarning("CountingSemaphoreUsingTask: Max count bigger than " + "intial cout. Setting initial count to max count\n"); #endif - initCount = maxCount; - } + initCount = maxCount; + } - initSemaphore(initCount); + initSemaphore(initCount); } CountingSemaphore::CountingSemaphore(CountingSemaphore&& other): - maxCount(other.maxCount), initCount(other.initCount) { - initSemaphore(initCount); + maxCount(other.maxCount), initCount(other.initCount) { + initSemaphore(initCount); } CountingSemaphore& CountingSemaphore::operator =( - CountingSemaphore&& other) { - initSemaphore(other.initCount); - return * this; + CountingSemaphore&& other) { + initSemaphore(other.initCount); + return * this; } ReturnValue_t CountingSemaphore::release() { - ReturnValue_t result = checkCount(&handle, maxCount); - if(result != HasReturnvaluesIF::RETURN_OK) { - return result; - } - return CountingSemaphore::release(&this->handle); + ReturnValue_t result = checkCount(&handle, maxCount); + if(result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + return CountingSemaphore::release(&this->handle); } ReturnValue_t CountingSemaphore::release(sem_t* handle) { - int result = sem_post(handle); - if(result == 0) { - return HasReturnvaluesIF::RETURN_OK; - } + int result = sem_post(handle); + if(result == 0) { + return HasReturnvaluesIF::RETURN_OK; + } - switch(errno) { - case(EINVAL): - // Semaphore invalid - return SemaphoreIF::SEMAPHORE_INVALID; - case(EOVERFLOW): - // SEM_MAX_VALUE overflow. This should never happen - default: - return HasReturnvaluesIF::RETURN_FAILED; - } + switch(errno) { + case(EINVAL): { + // Semaphore invalid + utility::printUnixErrorGeneric("CountingSemaphore", "release", "EINVAL"); + return SemaphoreIF::SEMAPHORE_INVALID; + } + + case(EOVERFLOW): { + // SEM_MAX_VALUE overflow. This should never happen + utility::printUnixErrorGeneric("CountingSemaphore", "release", "EOVERFLOW"); + return SemaphoreIF::SEMAPHORE_INVALID; + } + + default: + return HasReturnvaluesIF::RETURN_FAILED; + } } uint8_t CountingSemaphore::getMaxCount() const { - return maxCount; + return maxCount; } diff --git a/osal/linux/MessageQueue.cpp b/osal/linux/MessageQueue.cpp index bfd97e56..a75dff7a 100644 --- a/osal/linux/MessageQueue.cpp +++ b/osal/linux/MessageQueue.cpp @@ -1,4 +1,5 @@ #include "MessageQueue.h" +#include "unixUtility.h" #include "../../serviceinterface/ServiceInterface.h" #include "../../objectmanager/ObjectManagerIF.h" @@ -13,7 +14,6 @@ MessageQueue::MessageQueue(uint32_t messageDepth, size_t maxMessageSize): id(MessageQueueIF::NO_QUEUE),lastPartner(MessageQueueIF::NO_QUEUE), defaultDestination(MessageQueueIF::NO_QUEUE), maxMessageSize(maxMessageSize) { - //debug << "MessageQueue::MessageQueue: Creating a queue" << std::endl; mq_attr attributes; this->id = 0; //Set attributes @@ -30,7 +30,7 @@ MessageQueue::MessageQueue(uint32_t messageDepth, size_t maxMessageSize): mode_t mode = S_IWUSR | S_IREAD | S_IWGRP | S_IRGRP | S_IROTH | S_IWOTH; mqd_t tempId = mq_open(name, oflag, mode, &attributes); if (tempId == -1) { - handleError(&attributes, messageDepth); + handleOpenError(&attributes, messageDepth); } else { //Successful mq_open call @@ -41,101 +41,14 @@ MessageQueue::MessageQueue(uint32_t messageDepth, size_t maxMessageSize): MessageQueue::~MessageQueue() { int status = mq_close(this->id); if(status != 0){ -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::Destructor: mq_close Failed with status: " - << strerror(errno) <> - defaultMqMaxMsg and defaultMqMaxMsg < messageDepth) { - /* - See: https://www.man7.org/linux/man-pages/man3/mq_open.3.html - This happens if the msg_max value is not large enough - It is ignored if the executable is run in privileged mode. - Run the unlockRealtime script or grant the mode manually by using: - sudo setcap 'CAP_SYS_RESOURCE=+ep' - - Persistent solution for session: - echo | sudo tee /proc/sys/fs/mqueue/msg_max - - Permanent solution: - sudo nano /etc/sysctl.conf - Append at end: fs/mqueue/msg_max = - Apply changes with: sudo sysctl -p - */ -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::MessageQueue: Default MQ size " - << defaultMqMaxMsg << " is too small for requested size " - << messageDepth << std::endl; - sif::error << "This error can be fixed by setting the maximum " - "allowed message size higher!" << std::endl; -#endif - } - break; - } - case(EEXIST): { - // An error occured during open - // We need to distinguish if it is caused by an already created queue - // There's another queue with the same name - // We unlink the other queue - int status = mq_unlink(name); - if (status != 0) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "mq_unlink Failed with status: " << strerror(errno) - << std::endl; -#endif - } - else { - // Successful unlinking, try to open again - mqd_t tempId = mq_open(name, - O_NONBLOCK | O_RDWR | O_CREAT | O_EXCL, - S_IWUSR | S_IREAD | S_IWGRP | S_IRGRP, attributes); - if (tempId != -1) { - //Successful mq_open - this->id = tempId; - return HasReturnvaluesIF::RETURN_OK; - } - } - break; - } - - default: { - // Failed either the first time or the second time -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::MessageQueue: Creating Queue " << name - << " failed with status: " << strerror(errno) << std::endl; -#else - sif::printError("MessageQueue::MessageQueue: Creating Queue %s" - " failed with status: %s\n", name, strerror(errno)); -#endif - } - } - return HasReturnvaluesIF::RETURN_FAILED; - - - -} - ReturnValue_t MessageQueue::sendMessage(MessageQueueId_t sendTo, MessageQueueMessageIF* message, bool ignoreFault) { return sendMessageFrom(sendTo, message, this->getId(), false); @@ -204,7 +117,8 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) { return MessageQueueIF::EMPTY; case EBADF: { //mqdes doesn't represent a valid queue open for reading. - return handleRecvError("EBADF"); + utility::printUnixErrorGeneric(CLASS_NAME, "receiveMessage", "EBADF"); + break; } case EINVAL: { /* @@ -216,7 +130,8 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) { * queue, and the QNX extended option MQ_READBUF_DYNAMIC hasn't * been set in the queue's mq_flags. */ - return handleRecvError("EINVAL"); + utility::printUnixErrorGeneric(CLASS_NAME, "receiveMessage", "EINVAL"); + break; } case EMSGSIZE: { /* @@ -228,23 +143,25 @@ ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessageIF* message) { * given msg_len is too short for the message that would have * been received. */ - return handleRecvError("EMSGSIZE"); + utility::printUnixErrorGeneric(CLASS_NAME, "receiveMessage", "EMSGSIZE"); + break; } case EINTR: { //The operation was interrupted by a signal. - return handleRecvError("EINTR"); + utility::printUnixErrorGeneric(CLASS_NAME, "receiveMessage", "EINTR"); + break; } case ETIMEDOUT: { //The operation was interrupted by a signal. - return handleRecvError("ETIMEDOUT"); + utility::printUnixErrorGeneric(CLASS_NAME, "receiveMessage", "ETIMEDOUT"); + break; } default: - return HasReturnvaluesIF::RETURN_FAILED; } - + return HasReturnvaluesIF::RETURN_FAILED; } } @@ -259,29 +176,27 @@ ReturnValue_t MessageQueue::flush(uint32_t* count) { switch(errno){ case EBADF: //mqdes doesn't represent a valid message queue. -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::flush configuration error, " - "called flush with an invalid queue ID" << std::endl; -#endif + utility::printUnixErrorGeneric(CLASS_NAME, "flush", "EBADF"); + break; /*NO BREAK*/ case EINVAL: //mq_attr is NULL + utility::printUnixErrorGeneric(CLASS_NAME, "flush", "EINVAL"); + break; default: return HasReturnvaluesIF::RETURN_FAILED; } + return HasReturnvaluesIF::RETURN_FAILED; } *count = attrib.mq_curmsgs; attrib.mq_curmsgs = 0; status = mq_setattr(id,&attrib,NULL); if(status != 0){ - switch(errno){ + switch(errno) { case EBADF: //mqdes doesn't represent a valid message queue. -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::flush configuration error, " - "called flush with an invalid queue ID" << std::endl; -#endif - /*NO BREAK*/ + utility::printUnixErrorGeneric(CLASS_NAME, "flush", "EBADF"); + break; case EINVAL: /* * This value indicates one of the following: @@ -290,9 +205,12 @@ ReturnValue_t MessageQueue::flush(uint32_t* count) { * mq_flags includes a 0 in the MQ_MULT_NOTIFY bit. Once * MQ_MULT_NOTIFY has been turned on, it may never be turned off. */ + utility::printUnixErrorGeneric(CLASS_NAME, "flush", "EINVAL"); + break; default: return HasReturnvaluesIF::RETURN_FAILED; } + return HasReturnvaluesIF::RETURN_FAILED; } return HasReturnvaluesIF::RETURN_OK; } @@ -333,8 +251,9 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo, bool ignoreFault) { if(message == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::sendMessageFromMessageQueue: Message is " - "nullptr!" << std::endl; + sif::error << "MessageQueue::sendMessageFromMessageQueue: Message is nullptr!" << std::endl; +#else + sif::printError("MessageQueue::sendMessageFromMessageQueue: Message is nullptr!\n"); #endif return HasReturnvaluesIF::RETURN_FAILED; } @@ -348,8 +267,7 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo, if (result != 0) { if(!ignoreFault){ InternalErrorReporterIF* internalErrorReporter = - objectManager->get( - objects::INTERNAL_ERROR_REPORTER); + objectManager->get(objects::INTERNAL_ERROR_REPORTER); if (internalErrorReporter != NULL) { internalErrorReporter->queueMessageNotSent(); } @@ -363,17 +281,20 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo, case EBADF: { //mq_des doesn't represent a valid message queue descriptor, //or mq_des wasn't opened for writing. + + utility::printUnixErrorGeneric(CLASS_NAME, "sendMessageFromMessageQueue", "EBADF"); #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::sendMessage: Configuration error, MQ" - << " destination invalid." << std::endl; - sif::error << strerror(errno) << " in " - <<"mq_send to: " << sendTo << " sent from " - << sentFrom << std::endl; + sif::warning << "mq_send to: " << sendTo << " sent from " + << sentFrom << "failed" << std::endl; +#else + sif::printWarning("mq_send to: %d sent from %d failed\n", sendTo, sentFrom); #endif return DESTINATION_INVALID; } case EINTR: //The call was interrupted by a signal. + utility::printUnixErrorGeneric(CLASS_NAME, "sendMessageFromMessageQueue", "EINTR"); + break; case EINVAL: /* * This value indicates one of the following: @@ -384,36 +305,87 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo, * - MQ_PRIO_RESTRICT is set in the mq_attr of mq_des, and * msg_prio is greater than the priority of the calling process. */ -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::sendMessage: Configuration error " - << strerror(errno) << " in mq_send" << std::endl; -#endif - /*NO BREAK*/ + utility::printUnixErrorGeneric(CLASS_NAME, "sendMessageFromMessageQueue", "EINVAL"); + break; case EMSGSIZE: // The msg_len is greater than the msgsize associated with //the specified queue. -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::sendMessage: Size error [" << - strerror(errno) << "] in mq_send" << std::endl; -#endif - /*NO BREAK*/ + utility::printUnixErrorGeneric(CLASS_NAME, "sendMessageFromMessageQueue", "EMSGSIZE"); + break; default: return HasReturnvaluesIF::RETURN_FAILED; } + return HasReturnvaluesIF::RETURN_FAILED; } return HasReturnvaluesIF::RETURN_OK; } -ReturnValue_t MessageQueue::handleRecvError(const char * const failString) { - if(failString == nullptr) { - return HasReturnvaluesIF::RETURN_FAILED; - } +ReturnValue_t MessageQueue::handleOpenError(mq_attr* attributes, + uint32_t messageDepth) { + switch(errno) { + case(EINVAL): { + utility::printUnixErrorGeneric(CLASS_NAME, "MessageQueue", "EINVAL"); + size_t defaultMqMaxMsg = 0; + // Not POSIX conformant, but should work for all UNIX systems. + // Just an additional helpful printout :-) + if(std::ifstream("/proc/sys/fs/mqueue/msg_max",std::ios::in) >> + defaultMqMaxMsg and defaultMqMaxMsg < messageDepth) { + /* + See: https://www.man7.org/linux/man-pages/man3/mq_open.3.html + This happens if the msg_max value is not large enough + It is ignored if the executable is run in privileged mode. + Run the unlockRealtime script or grant the mode manually by using: + sudo setcap 'CAP_SYS_RESOURCE=+ep' + + Persistent solution for session: + echo | sudo tee /proc/sys/fs/mqueue/msg_max + + Permanent solution: + sudo nano /etc/sysctl.conf + Append at end: fs/mqueue/msg_max = + Apply changes with: sudo sysctl -p + */ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::receiveMessage: " << failString << " error " - << strerror(errno) << std::endl; + sif::error << "MessageQueue::MessageQueue: Default MQ size " << defaultMqMaxMsg << + " is too small for requested size " << messageDepth << std::endl; + sif::error << "This error can be fixed by setting the maximum " + "allowed message size higher!" << std::endl; #else - sif::printError("MessageQueue::receiveMessage: %s error %s\n", failString, - strerror(errno)); + sif::printError("MessageQueue::MessageQueue: Default MQ size %d is too small for" + "requested size %d\n"); + sif::printError("This error can be fixes by setting the maximum allowed" + "message size higher!\n"); #endif + } + break; + } + case(EEXIST): { + // An error occured during open. + // We need to distinguish if it is caused by an already created queue + // There's another queue with the same name + // We unlink the other queue + int status = mq_unlink(name); + if (status != 0) { + utility::printUnixErrorGeneric(CLASS_NAME, "MessageQueue", "EEXIST"); + } + else { + // Successful unlinking, try to open again + mqd_t tempId = mq_open(name, + O_NONBLOCK | O_RDWR | O_CREAT | O_EXCL, + S_IWUSR | S_IREAD | S_IWGRP | S_IRGRP, attributes); + if (tempId != -1) { + //Successful mq_open + this->id = tempId; + return HasReturnvaluesIF::RETURN_OK; + } + } + break; + } + + default: { + // Failed either the first time or the second time + utility::printUnixErrorGeneric(CLASS_NAME, "MessageQueue", "Unknown"); + } + } return HasReturnvaluesIF::RETURN_FAILED; } diff --git a/osal/linux/MessageQueue.h b/osal/linux/MessageQueue.h index 0bef0a73..935ee948 100644 --- a/osal/linux/MessageQueue.h +++ b/osal/linux/MessageQueue.h @@ -181,8 +181,8 @@ private: static uint16_t queueCounter; const size_t maxMessageSize; - ReturnValue_t handleError(mq_attr* attributes, uint32_t messageDepth); - ReturnValue_t handleRecvError(const char* const failString); + static constexpr const char* CLASS_NAME = "MessageQueue"; + ReturnValue_t handleOpenError(mq_attr* attributes, uint32_t messageDepth); }; #endif /* FSFW_OSAL_LINUX_MESSAGEQUEUE_H_ */ diff --git a/osal/linux/Mutex.cpp b/osal/linux/Mutex.cpp index c642b132..33e84aac 100644 --- a/osal/linux/Mutex.cpp +++ b/osal/linux/Mutex.cpp @@ -1,43 +1,34 @@ #include "Mutex.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "unixUtility.h" + +#include "../../serviceinterface/ServiceInterface.h" #include "../../timemanager/Clock.h" -uint8_t Mutex::count = 0; - - #include #include +uint8_t Mutex::count = 0; + Mutex::Mutex() { pthread_mutexattr_t mutexAttr; int status = pthread_mutexattr_init(&mutexAttr); if (status != 0) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "Mutex: Attribute init failed with: " << strerror(status) << std::endl; -#endif + utility::printUnixErrorGeneric("Mutex", "Mutex", "pthread_mutexattr_init"); } status = pthread_mutexattr_setprotocol(&mutexAttr, PTHREAD_PRIO_INHERIT); if (status != 0) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "Mutex: Attribute set PRIO_INHERIT failed with: " << strerror(status) - << std::endl; -#endif + utility::printUnixErrorGeneric("Mutex", "Mutex", "pthread_mutexattr_setprotocol"); } status = pthread_mutex_init(&mutex, &mutexAttr); if (status != 0) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "Mutex: creation with name, id " << mutex.__data.__count - << ", " << " failed with " << strerror(status) << std::endl; -#endif + utility::printUnixErrorGeneric("Mutex", "Mutex", "pthread_mutex_init"); } // After a mutex attributes object has been used to initialize one or more // mutexes, any function affecting the attributes object // (including destruction) shall not affect any previously initialized mutexes. status = pthread_mutexattr_destroy(&mutexAttr); if (status != 0) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "Mutex: Attribute destroy failed with " << strerror(status) << std::endl; -#endif + utility::printUnixErrorGeneric("Mutex", "Mutex", "pthread_mutexattr_destroy"); } } diff --git a/osal/linux/PeriodicPosixTask.cpp b/osal/linux/PeriodicPosixTask.cpp index 630dd8e0..c60f639f 100644 --- a/osal/linux/PeriodicPosixTask.cpp +++ b/osal/linux/PeriodicPosixTask.cpp @@ -1,7 +1,8 @@ -#include "../../tasks/ExecutableObjectIF.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" -#include #include "PeriodicPosixTask.h" +#include "../../tasks/ExecutableObjectIF.h" +#include "../../serviceinterface/ServiceInterface.h" + +#include PeriodicPosixTask::PeriodicPosixTask(const char* name_, int priority_, size_t stackSize_, uint32_t period_, void(deadlineMissedFunc_)()): @@ -28,6 +29,9 @@ ReturnValue_t PeriodicPosixTask::addComponent(object_id_t object) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "PeriodicTask::addComponent: Invalid object. Make sure" << " it implements ExecutableObjectIF!" << std::endl; +#else + sif::printError("PeriodicTask::addComponent: Invalid object. Make sure it" + "implements ExecutableObjectIF!\n"); #endif return HasReturnvaluesIF::RETURN_FAILED; } @@ -44,9 +48,6 @@ ReturnValue_t PeriodicPosixTask::sleepFor(uint32_t ms) { ReturnValue_t PeriodicPosixTask::startTask(void) { started = true; -#if FSFW_CPP_OSTREAM_ENABLED == 1 - //sif::info << stackSize << std::endl; -#endif PosixThread::createTask(&taskEntryPoint,this); return HasReturnvaluesIF::RETURN_OK; } diff --git a/osal/linux/PosixThread.cpp b/osal/linux/PosixThread.cpp index 72adfb14..36501282 100644 --- a/osal/linux/PosixThread.cpp +++ b/osal/linux/PosixThread.cpp @@ -1,4 +1,5 @@ #include "PosixThread.h" +#include "unixUtility.h" #include "../../serviceinterface/ServiceInterface.h" @@ -6,263 +7,240 @@ #include PosixThread::PosixThread(const char* name_, int priority_, size_t stackSize_): - thread(0), priority(priority_), stackSize(stackSize_) { + thread(0), priority(priority_), stackSize(stackSize_) { name[0] = '\0'; std::strncat(name, name_, PTHREAD_MAX_NAMELEN - 1); } PosixThread::~PosixThread() { - //No deletion and no free of Stack Pointer + //No deletion and no free of Stack Pointer } ReturnValue_t PosixThread::sleep(uint64_t ns) { - //TODO sleep might be better with timer instead of sleep() - timespec time; - time.tv_sec = ns/1000000000; - time.tv_nsec = ns - time.tv_sec*1e9; + //TODO sleep might be better with timer instead of sleep() + timespec time; + time.tv_sec = ns/1000000000; + time.tv_nsec = ns - time.tv_sec*1e9; - //Remaining Time is not set here - int status = nanosleep(&time,NULL); - if(status != 0){ - switch(errno){ - case EINTR: - //The nanosleep() function was interrupted by a signal. - return HasReturnvaluesIF::RETURN_FAILED; - case EINVAL: - //The rqtp argument specified a nanosecond value less than zero or - // greater than or equal to 1000 million. - return HasReturnvaluesIF::RETURN_FAILED; - default: - return HasReturnvaluesIF::RETURN_FAILED; - } + //Remaining Time is not set here + int status = nanosleep(&time,NULL); + if(status != 0){ + switch(errno){ + case EINTR: + //The nanosleep() function was interrupted by a signal. + return HasReturnvaluesIF::RETURN_FAILED; + case EINVAL: + //The rqtp argument specified a nanosecond value less than zero or + // greater than or equal to 1000 million. + return HasReturnvaluesIF::RETURN_FAILED; + default: + return HasReturnvaluesIF::RETURN_FAILED; + } - } - return HasReturnvaluesIF::RETURN_OK; + } + return HasReturnvaluesIF::RETURN_OK; } void PosixThread::suspend() { - //Wait for SIGUSR1 - int caughtSig = 0; - sigset_t waitSignal; - sigemptyset(&waitSignal); - sigaddset(&waitSignal, SIGUSR1); - sigwait(&waitSignal, &caughtSig); - if (caughtSig != SIGUSR1) { + //Wait for SIGUSR1 + int caughtSig = 0; + sigset_t waitSignal; + sigemptyset(&waitSignal); + sigaddset(&waitSignal, SIGUSR1); + sigwait(&waitSignal, &caughtSig); + if (caughtSig != SIGUSR1) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "FixedTimeslotTask: Unknown Signal received: " << - caughtSig << std::endl; + sif::error << "FixedTimeslotTask::suspend: Unknown Signal received: " << caughtSig << + std::endl; +#else + sif::printError("FixedTimeslotTask::suspend: Unknown Signal received: %d\n", caughtSig); #endif - } + } } void PosixThread::resume(){ - /* Signal the thread to start. Makes sense to call kill to start or? ;) - * - * According to Posix raise(signal) will call pthread_kill(pthread_self(), sig), - * but as the call must be done from the thread itsself this is not possible here - */ - pthread_kill(thread,SIGUSR1); + /* Signal the thread to start. Makes sense to call kill to start or? ;) + * + * According to Posix raise(signal) will call pthread_kill(pthread_self(), sig), + * but as the call must be done from the thread itsself this is not possible here + */ + pthread_kill(thread,SIGUSR1); } bool PosixThread::delayUntil(uint64_t* const prevoiusWakeTime_ms, - const uint64_t delayTime_ms) { - uint64_t nextTimeToWake_ms; - bool shouldDelay = false; - //Get current Time - const uint64_t currentTime_ms = getCurrentMonotonicTimeMs(); - /* Generate the tick time at which the task wants to wake. */ - nextTimeToWake_ms = (*prevoiusWakeTime_ms) + delayTime_ms; + const uint64_t delayTime_ms) { + uint64_t nextTimeToWake_ms; + bool shouldDelay = false; + //Get current Time + const uint64_t currentTime_ms = getCurrentMonotonicTimeMs(); + /* Generate the tick time at which the task wants to wake. */ + nextTimeToWake_ms = (*prevoiusWakeTime_ms) + delayTime_ms; - if (currentTime_ms < *prevoiusWakeTime_ms) { - /* The tick count has overflowed since this function was + if (currentTime_ms < *prevoiusWakeTime_ms) { + /* The tick count has overflowed since this function was lasted called. In this case the only time we should ever actually delay is if the wake time has also overflowed, and the wake time is greater than the tick time. When this is the case it is as if neither time had overflowed. */ - if ((nextTimeToWake_ms < *prevoiusWakeTime_ms) - && (nextTimeToWake_ms > currentTime_ms)) { - shouldDelay = true; - } - } else { - /* The tick time has not overflowed. In this case we will + if ((nextTimeToWake_ms < *prevoiusWakeTime_ms) + && (nextTimeToWake_ms > currentTime_ms)) { + shouldDelay = true; + } + } else { + /* The tick time has not overflowed. In this case we will delay if either the wake time has overflowed, and/or the tick time is less than the wake time. */ - if ((nextTimeToWake_ms < *prevoiusWakeTime_ms) - || (nextTimeToWake_ms > currentTime_ms)) { - shouldDelay = true; - } - } + if ((nextTimeToWake_ms < *prevoiusWakeTime_ms) + || (nextTimeToWake_ms > currentTime_ms)) { + shouldDelay = true; + } + } - /* Update the wake time ready for the next call. */ + /* Update the wake time ready for the next call. */ - (*prevoiusWakeTime_ms) = nextTimeToWake_ms; + (*prevoiusWakeTime_ms) = nextTimeToWake_ms; - if (shouldDelay) { - uint64_t sleepTime = nextTimeToWake_ms - currentTime_ms; - PosixThread::sleep(sleepTime * 1000000ull); - return true; - } - //We are shifting the time in case the deadline was missed like rtems - (*prevoiusWakeTime_ms) = currentTime_ms; - return false; + if (shouldDelay) { + uint64_t sleepTime = nextTimeToWake_ms - currentTime_ms; + PosixThread::sleep(sleepTime * 1000000ull); + return true; + } + //We are shifting the time in case the deadline was missed like rtems + (*prevoiusWakeTime_ms) = currentTime_ms; + return false; } uint64_t PosixThread::getCurrentMonotonicTimeMs(){ - timespec timeNow; - clock_gettime(CLOCK_MONOTONIC_RAW, &timeNow); - uint64_t currentTime_ms = (uint64_t) timeNow.tv_sec * 1000 - + timeNow.tv_nsec / 1000000; + timespec timeNow; + clock_gettime(CLOCK_MONOTONIC_RAW, &timeNow); + uint64_t currentTime_ms = (uint64_t) timeNow.tv_sec * 1000 + + timeNow.tv_nsec / 1000000; - return currentTime_ms; + return currentTime_ms; } void PosixThread::createTask(void* (*fnc_)(void*), void* arg_) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - //sif::debug << "PosixThread::createTask" << std::endl; + //sif::debug << "PosixThread::createTask" << std::endl; #endif - /* - * The attr argument points to a pthread_attr_t structure whose contents + /* + * The attr argument points to a pthread_attr_t structure whose contents are used at thread creation time to determine attributes for the new thread; this structure is initialized using pthread_attr_init(3) and related functions. If attr is NULL, then the thread is created with default attributes. - */ - pthread_attr_t attributes; - int status = pthread_attr_init(&attributes); - if(status != 0){ + */ + pthread_attr_t attributes; + int status = pthread_attr_init(&attributes); + if(status != 0){ + utility::printUnixErrorGeneric(CLASS_NAME, "createTask", "pthread_attr_init"); + } + void* stackPointer; + status = posix_memalign(&stackPointer, sysconf(_SC_PAGESIZE), stackSize); + if(status != 0) { + if(errno == ENOMEM) { + size_t stackMb = stackSize/10e6; #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "Posix Thread attribute init failed with: " << - strerror(status) << std::endl; -#endif - } - void* stackPointer; - status = posix_memalign(&stackPointer, sysconf(_SC_PAGESIZE), stackSize); - if(status != 0){ -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "PosixThread::createTask: Stack init failed with: " << - strerror(status) << std::endl; -#endif - if(errno == ENOMEM) { - size_t stackMb = stackSize/10e6; -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "PosixThread::createTask: Insufficient memory for" - " the requested " << stackMb << " MB" << std::endl; + sif::error << "PosixThread::createTask: Insufficient memory for" + " the requested " << stackMb << " MB" << std::endl; #else - sif::printError("PosixThread::createTask: Insufficient memory for " - "the requested %lu MB\n", static_cast(stackMb)); + sif::printError("PosixThread::createTask: Insufficient memory for " + "the requested %lu MB\n", static_cast(stackMb)); #endif - } - else if(errno == EINVAL) { + utility::printUnixErrorGeneric(CLASS_NAME, "createTask", "ENOMEM"); + } + else if(errno == EINVAL) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "PosixThread::createTask: Wrong alignment argument!" - << std::endl; + sif::error << "PosixThread::createTask: Wrong alignment argument!" + << std::endl; #else - sif::printError("PosixThread::createTask: " - "Wrong alignment argument!\n"); + sif::printError("PosixThread::createTask: Wrong alignment argument!\n"); #endif - } - return; - } + utility::printUnixErrorGeneric(CLASS_NAME, "createTask", "EINVAL"); + } + return; + } - status = pthread_attr_setstack(&attributes, stackPointer, stackSize); - if(status != 0){ + status = pthread_attr_setstack(&attributes, stackPointer, stackSize); + if(status != 0) { + utility::printUnixErrorGeneric(CLASS_NAME, "createTask", "pthread_attr_setstack"); #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "PosixThread::createTask: pthread_attr_setstack " - " failed with: " << strerror(status) << std::endl; - sif::error << "Make sure the specified stack size is valid and is " - "larger than the minimum allowed stack size." << std::endl; + sif::warning << "Make sure the specified stack size is valid and is " + "larger than the minimum allowed stack size." << std::endl; +#else + sif::printWarning("Make sure the specified stack size is valid and is " + "larger than the minimum allowed stack size.\n"); #endif - } + } - status = pthread_attr_setinheritsched(&attributes, PTHREAD_EXPLICIT_SCHED); - if(status != 0){ -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "Posix Thread attribute setinheritsched failed with: " << - strerror(status) << std::endl; -#endif - } + status = pthread_attr_setinheritsched(&attributes, PTHREAD_EXPLICIT_SCHED); + if(status != 0){ + utility::printUnixErrorGeneric(CLASS_NAME, "createTask", "pthread_attr_setinheritsched"); + } #ifndef FSFW_USE_REALTIME_FOR_LINUX #error "Please define FSFW_USE_REALTIME_FOR_LINUX with either 0 or 1" #endif #if FSFW_USE_REALTIME_FOR_LINUX == 1 - // FIFO -> This needs root privileges for the process - status = pthread_attr_setschedpolicy(&attributes,SCHED_FIFO); - if(status != 0){ -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "Posix Thread attribute schedule policy failed with: " << - strerror(status) << std::endl; -#endif - } + // FIFO -> This needs root privileges for the process + status = pthread_attr_setschedpolicy(&attributes,SCHED_FIFO); + if(status != 0){ + utility::printUnixErrorGeneric(CLASS_NAME, "createTask", "pthread_attr_setschedpolicy"); + } - sched_param scheduleParams; - scheduleParams.__sched_priority = priority; - status = pthread_attr_setschedparam(&attributes, &scheduleParams); - if(status != 0){ -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "Posix Thread attribute schedule params failed with: " << - strerror(status) << std::endl; + sched_param scheduleParams; + scheduleParams.__sched_priority = priority; + status = pthread_attr_setschedparam(&attributes, &scheduleParams); + if(status != 0){ + utility::printUnixErrorGeneric(CLASS_NAME, "createTask", "pthread_attr_setschedparam"); + } #endif - } -#endif - //Set Signal Mask for suspend until startTask is called - sigset_t waitSignal; - sigemptyset(&waitSignal); - sigaddset(&waitSignal, SIGUSR1); - status = pthread_sigmask(SIG_BLOCK, &waitSignal, NULL); - if(status != 0){ -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "Posix Thread sigmask failed failed with: " << - strerror(status) << " errno: " << strerror(errno) << std::endl; -#endif - } + //Set Signal Mask for suspend until startTask is called + sigset_t waitSignal; + sigemptyset(&waitSignal); + sigaddset(&waitSignal, SIGUSR1); + status = pthread_sigmask(SIG_BLOCK, &waitSignal, NULL); + if(status != 0){ + utility::printUnixErrorGeneric(CLASS_NAME, "createTask", "pthread_sigmask"); + } - - status = pthread_create(&thread,&attributes,fnc_,arg_); - if(status != 0){ + status = pthread_create(&thread,&attributes,fnc_,arg_); + if(status != 0){ + utility::printUnixErrorGeneric(CLASS_NAME, "createTask", "pthread_create"); #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "PosixThread::createTask: Failed with: " << - strerror(status) << std::endl; - sif::error << "For FSFW_USE_REALTIME_FOR_LINUX == 1 make sure to call " << - "\"all sudo setcap 'cap_sys_nice=eip'\" on the application or set " - "/etc/security/limit.conf" << std::endl; + sif::error << "For FSFW_USE_REALTIME_FOR_LINUX == 1 make sure to call " << + "\"all sudo setcap 'cap_sys_nice=eip'\" on the application or set " + "/etc/security/limit.conf" << std::endl; #else - sif::printError("PosixThread::createTask: Create failed with: %s\n", strerror(status)); - sif::printError("For FSFW_USE_REALTIME_FOR_LINUX == 1 make sure to call " - "\"all sudo setcap 'cap_sys_nice=eip'\" on the application or set " + sif::printError("For FSFW_USE_REALTIME_FOR_LINUX == 1 make sure to call " + "\"all sudo setcap 'cap_sys_nice=eip'\" on the application or set " "/etc/security/limit.conf\n"); #endif - } + } - status = pthread_setname_np(thread,name); - if(status != 0){ + status = pthread_setname_np(thread,name); + if(status != 0){ + utility::printUnixErrorGeneric(CLASS_NAME, "createTask", "pthread_setname_np"); + if(status == ERANGE) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "PosixThread::createTask: setname failed with: " << - strerror(status) << std::endl; + sif::warning << "PosixThread::createTask: Task name length longer" + " than 16 chars. Truncating.." << std::endl; +#else + sif::printWarning("PosixThread::createTask: Task name length longer" + " than 16 chars. Truncating..\n"); #endif - if(status == ERANGE) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "PosixThread::createTask: Task name length longer" - " than 16 chars. Truncating.." << std::endl; -#endif - name[15] = '\0'; - status = pthread_setname_np(thread,name); - if(status != 0){ -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "PosixThread::createTask: Setting name" - " did not work.." << std::endl; -#endif - } - } - } + name[15] = '\0'; + status = pthread_setname_np(thread,name); + if(status != 0){ + utility::printUnixErrorGeneric(CLASS_NAME, "createTask", "pthread_setname_np"); + } + } + } - status = pthread_attr_destroy(&attributes); - if(status!=0){ -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "Posix Thread attribute destroy failed with: " << - strerror(status) << std::endl; -#endif - } + status = pthread_attr_destroy(&attributes); + if (status != 0) { + utility::printUnixErrorGeneric(CLASS_NAME, "createTask", "pthread_attr_destroy"); + } } diff --git a/osal/linux/PosixThread.h b/osal/linux/PosixThread.h index 7d8d349a..9c0ad39b 100644 --- a/osal/linux/PosixThread.h +++ b/osal/linux/PosixThread.h @@ -9,69 +9,71 @@ class PosixThread { public: - static constexpr uint8_t PTHREAD_MAX_NAMELEN = 16; - PosixThread(const char* name_, int priority_, size_t stackSize_); - virtual ~PosixThread(); - /** - * Set the Thread to sleep state - * @param ns Nanosecond sleep time - * @return Returns Failed if sleep fails - */ - static ReturnValue_t sleep(uint64_t ns); - /** - * @brief Function to suspend the task until SIGUSR1 was received - * - * @details Will be called in the beginning to suspend execution until startTask() is called explicitly. - */ - void suspend(); + static constexpr uint8_t PTHREAD_MAX_NAMELEN = 16; + PosixThread(const char* name_, int priority_, size_t stackSize_); + virtual ~PosixThread(); + /** + * Set the Thread to sleep state + * @param ns Nanosecond sleep time + * @return Returns Failed if sleep fails + */ + static ReturnValue_t sleep(uint64_t ns); + /** + * @brief Function to suspend the task until SIGUSR1 was received + * + * @details Will be called in the beginning to suspend execution until startTask() is called explicitly. + */ + void suspend(); - /** - * @brief Function to allow a other thread to start the thread again from suspend state - * - * @details Restarts the Thread after suspend call - */ - void resume(); + /** + * @brief Function to allow a other thread to start the thread again from suspend state + * + * @details Restarts the Thread after suspend call + */ + void resume(); - /** - * Delay function similar to FreeRtos delayUntil function - * - * @param prevoiusWakeTime_ms Needs the previous wake time and returns the next wakeup time - * @param delayTime_ms Time period to delay - * - * @return False If deadline was missed; True if task was delayed - */ - static bool delayUntil(uint64_t* const prevoiusWakeTime_ms, const uint64_t delayTime_ms); + /** + * Delay function similar to FreeRtos delayUntil function + * + * @param prevoiusWakeTime_ms Needs the previous wake time and returns the next wakeup time + * @param delayTime_ms Time period to delay + * + * @return False If deadline was missed; True if task was delayed + */ + static bool delayUntil(uint64_t* const prevoiusWakeTime_ms, const uint64_t delayTime_ms); - /** - * Returns the current time in milliseconds from CLOCK_MONOTONIC - * - * @return current time in milliseconds from CLOCK_MONOTONIC - */ - static uint64_t getCurrentMonotonicTimeMs(); + /** + * Returns the current time in milliseconds from CLOCK_MONOTONIC + * + * @return current time in milliseconds from CLOCK_MONOTONIC + */ + static uint64_t getCurrentMonotonicTimeMs(); protected: - pthread_t thread; + pthread_t thread; - /** - * @brief Function that has to be called by derived class because the - * derived class pointer has to be valid as argument. - * @details - * This function creates a pthread with the given parameters. As the - * function requires a pointer to the derived object it has to be called - * after the this pointer of the derived object is valid. - * Sets the taskEntryPoint as function to be called by new a thread. - * @param fnc_ Function which will be executed by the thread. - * @param arg_ - * argument of the taskEntryPoint function, needs to be this pointer - * of derived class - */ - void createTask(void* (*fnc_)(void*),void* arg_); + /** + * @brief Function that has to be called by derived class because the + * derived class pointer has to be valid as argument. + * @details + * This function creates a pthread with the given parameters. As the + * function requires a pointer to the derived object it has to be called + * after the this pointer of the derived object is valid. + * Sets the taskEntryPoint as function to be called by new a thread. + * @param fnc_ Function which will be executed by the thread. + * @param arg_ + * argument of the taskEntryPoint function, needs to be this pointer + * of derived class + */ + void createTask(void* (*fnc_)(void*),void* arg_); private: - char name[PTHREAD_MAX_NAMELEN]; - int priority; - size_t stackSize = 0; + char name[PTHREAD_MAX_NAMELEN]; + int priority; + size_t stackSize = 0; + + static constexpr const char* CLASS_NAME = "PosixThread"; }; #endif /* FRAMEWORK_OSAL_LINUX_POSIXTHREAD_H_ */ diff --git a/osal/linux/unixUtility.cpp b/osal/linux/unixUtility.cpp new file mode 100644 index 00000000..d7aab4ba --- /dev/null +++ b/osal/linux/unixUtility.cpp @@ -0,0 +1,32 @@ +#include "FSFWConfig.h" +#include "unixUtility.h" +#include "../../serviceinterface/ServiceInterface.h" + +#include +#include + +void utility::printUnixErrorGeneric(const char* const className, + const char* const function, const char* const failString, + sif::OutputTypes outputType) { + if(className == nullptr or failString == nullptr or function == nullptr) { + return; + } +#if FSFW_VERBOSE_LEVEL >= 1 + if(outputType == sif::OutputTypes::OUT_ERROR) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << className << "::" << function << ":" << failString << " error: " + << strerror(errno) << std::endl; +#else + sif::printError("%s::%s: %s error: %s\n", className, function, failString, strerror(errno)); +#endif + } + else { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << className << "::" << function << ":" << failString << " error: " + << strerror(errno) << std::endl; +#else + sif::printWarning("%s::%s: %s error: %s\n", className, function, failString, strerror(errno)); +#endif + } +#endif +} diff --git a/osal/linux/unixUtility.h b/osal/linux/unixUtility.h new file mode 100644 index 00000000..8a964f3a --- /dev/null +++ b/osal/linux/unixUtility.h @@ -0,0 +1,13 @@ +#ifndef FSFW_OSAL_LINUX_UNIXUTILITY_H_ +#define FSFW_OSAL_LINUX_UNIXUTILITY_H_ + +#include "../../serviceinterface/serviceInterfaceDefintions.h" + +namespace utility { + +void printUnixErrorGeneric(const char* const className, const char* const function, + const char* const failString, sif::OutputTypes outputType = sif::OutputTypes::OUT_ERROR); + +} + +#endif /* FSFW_OSAL_LINUX_UNIXUTILITY_H_ */ From 070c3f3bbfdbddbda54b18cdb5d1c9928640a0dd Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 4 Jun 2021 14:39:21 +0200 Subject: [PATCH 117/389] added example usage --- serviceinterface/ServiceInterfacePrinter.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/serviceinterface/ServiceInterfacePrinter.h b/serviceinterface/ServiceInterfacePrinter.h index 6b062108..98421444 100644 --- a/serviceinterface/ServiceInterfacePrinter.h +++ b/serviceinterface/ServiceInterfacePrinter.h @@ -7,6 +7,8 @@ //! https://stackoverflow.com/questions/111928/is-there-a-printf-converter-to-print-in-binary-format //! Can be used to print out binary numbers in human-readable format. +//! Example usage: +//! sif::printInfo("Status register: " BYTE_TO_BINARY_PATTERN "\n",BYTE_TO_BINARY(0x1f)); #define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c" #define BYTE_TO_BINARY(byte) \ (byte & 0x80 ? '1' : '0'), \ From 33e7c635c57055597caf3d9e9cbafc15c7364266 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 5 Jun 2021 00:05:03 +0200 Subject: [PATCH 118/389] added hal class ids --- returnvalues/FwClassIds.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/returnvalues/FwClassIds.h b/returnvalues/FwClassIds.h index 17c37a79..60cb33ac 100644 --- a/returnvalues/FwClassIds.h +++ b/returnvalues/FwClassIds.h @@ -72,6 +72,9 @@ enum: uint8_t { PUS_SERVICE_3, //PUS3 PUS_SERVICE_9, //PUS9 FILE_SYSTEM, //FILS + HAL_SPI, //HSPI + HAL_UART, //HURT + HAL_I2C, //HI2C FW_CLASS_ID_COUNT // [EXPORT] : [END] }; From 57699cccb741dda67fa0af0983509f0d4e15234a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 5 Jun 2021 19:52:38 +0200 Subject: [PATCH 119/389] object manager is now a singleton --- action/ActionHelper.cpp | 4 +- action/ActionMessage.cpp | 4 +- action/CommandActionHelper.cpp | 9 +- controller/ControllerBase.cpp | 3 +- datalinklayer/MapPacketExtraction.cpp | 9 +- datapoollocal/HasLocalDataPoolIF.h | 3 +- datapoollocal/LocalDataPoolManager.cpp | 13 +-- datapoollocal/LocalPoolDataSetBase.cpp | 3 +- datapoollocal/LocalPoolObjectBase.cpp | 4 +- devicehandlers/ChildHandlerBase.cpp | 3 +- devicehandlers/DeviceHandlerBase.cpp | 10 +- .../DeviceHandlerFailureIsolation.cpp | 3 +- devicehandlers/DeviceHandlerMessage.cpp | 4 +- events/EventManagerIF.h | 4 +- fdir/FailureIsolationBase.cpp | 8 +- health/HealthHelper.cpp | 6 +- housekeeping/HousekeepingMessage.cpp | 4 +- memory/MemoryHelper.cpp | 6 +- memory/MemoryMessage.cpp | 4 +- monitoring/LimitViolationReporter.cpp | 23 ++--- monitoring/MonitoringMessage.cpp | 4 +- monitoring/MonitoringMessageContent.h | 4 +- monitoring/TriplexMonitor.h | 4 +- objectmanager/ObjectManager.cpp | 37 +++++--- objectmanager/ObjectManager.h | 92 ++++++++++++------- objectmanager/ObjectManagerIF.h | 48 ++-------- objectmanager/SystemObject.cpp | 12 +-- osal/FreeRTOS/FixedTimeslotTask.cpp | 6 +- osal/FreeRTOS/MessageQueue.cpp | 6 +- osal/FreeRTOS/PeriodicTask.cpp | 5 +- osal/common/TcpTmTcServer.cpp | 6 +- osal/common/UdpTcPollingTask.cpp | 7 +- osal/host/FixedTimeslotTask.cpp | 4 +- osal/host/MessageQueue.cpp | 8 +- osal/host/PeriodicTask.cpp | 5 +- osal/linux/FixedTimeslotTask.cpp | 6 +- osal/linux/MessageQueue.cpp | 5 +- osal/linux/PeriodicPosixTask.cpp | 12 ++- osal/rtems/FixedTimeslotTask.cpp | 4 +- osal/rtems/MessageQueue.cpp | 9 +- osal/rtems/PeriodicTask.cpp | 3 +- parameters/ParameterHelper.cpp | 5 +- parameters/ParameterMessage.cpp | 7 +- power/Fuse.cpp | 4 +- power/PowerSwitcher.cpp | 6 +- pus/CService200ModeCommanding.cpp | 5 +- pus/CService201HealthCommanding.cpp | 8 +- pus/Service1TelecommandVerification.cpp | 3 +- pus/Service20ParameterManagement.cpp | 12 +-- pus/Service20ParameterManagement.h | 2 +- pus/Service2DeviceAccess.cpp | 3 +- pus/Service3Housekeeping.cpp | 5 +- pus/Service5EventReporting.cpp | 5 +- pus/Service8FunctionManagement.cpp | 5 +- storagemanager/LocalPool.cpp | 7 +- subsystem/Subsystem.cpp | 7 +- subsystem/SubsystemBase.cpp | 13 +-- subsystem/modes/ModeSequenceMessage.cpp | 4 +- tcdistribution/CCSDSDistributor.cpp | 3 +- tcdistribution/PUSDistributor.cpp | 3 +- thermal/Heater.cpp | 5 +- tmstorage/TmStoreMessage.cpp | 4 +- tmtcpacket/pus/TcPacketStored.cpp | 7 +- tmtcpacket/pus/TmPacketBase.cpp | 4 +- tmtcpacket/pus/TmPacketStoredBase.cpp | 8 +- tmtcservices/CommandingServiceBase.cpp | 10 +- tmtcservices/PusServiceBase.cpp | 7 +- tmtcservices/TmTcBridge.cpp | 7 +- tmtcservices/VerificationReporter.cpp | 5 +- unittest/tests/datapoollocal/DataSetTest.cpp | 3 +- .../datapoollocal/LocalPoolManagerTest.cpp | 3 +- .../datapoollocal/LocalPoolVariableTest.cpp | 3 +- .../datapoollocal/LocalPoolVectorTest.cpp | 3 +- .../user/unittest/core/CatchDefinitions.cpp | 6 +- unittest/user/unittest/core/CatchFactory.h | 2 +- 75 files changed, 321 insertions(+), 277 deletions(-) diff --git a/action/ActionHelper.cpp b/action/ActionHelper.cpp index b2374ed6..73007ea3 100644 --- a/action/ActionHelper.cpp +++ b/action/ActionHelper.cpp @@ -2,7 +2,7 @@ #include "HasActionsIF.h" #include "../ipc/MessageQueueSenderIF.h" -#include "../objectmanager/ObjectManagerIF.h" +#include "../objectmanager/ObjectManager.h" #include "../serviceinterface/ServiceInterface.h" ActionHelper::ActionHelper(HasActionsIF* setOwner, @@ -25,7 +25,7 @@ ReturnValue_t ActionHelper::handleActionMessage(CommandMessage* command) { } ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) { - ipcStore = objectManager->get(objects::IPC_STORE); + ipcStore = ObjectManager::instance()->get(objects::IPC_STORE); if (ipcStore == nullptr) { return HasReturnvaluesIF::RETURN_FAILED; } diff --git a/action/ActionMessage.cpp b/action/ActionMessage.cpp index 66c7f058..f25858af 100644 --- a/action/ActionMessage.cpp +++ b/action/ActionMessage.cpp @@ -1,7 +1,7 @@ #include "ActionMessage.h" #include "HasActionsIF.h" -#include "../objectmanager/ObjectManagerIF.h" +#include "../objectmanager/ObjectManager.h" #include "../storagemanager/StorageManagerIF.h" ActionMessage::ActionMessage() { @@ -69,7 +69,7 @@ void ActionMessage::clear(CommandMessage* message) { switch(message->getCommand()) { case EXECUTE_ACTION: case DATA_REPLY: { - StorageManagerIF *ipcStore = objectManager->get( + StorageManagerIF *ipcStore = ObjectManager::instance()->get( objects::IPC_STORE); if (ipcStore != NULL) { ipcStore->deleteData(getStoreId(message)); diff --git a/action/CommandActionHelper.cpp b/action/CommandActionHelper.cpp index 148b3657..31650cae 100644 --- a/action/CommandActionHelper.cpp +++ b/action/CommandActionHelper.cpp @@ -2,7 +2,8 @@ #include "CommandActionHelper.h" #include "CommandsActionsIF.h" #include "HasActionsIF.h" -#include "../objectmanager/ObjectManagerIF.h" + +#include "../objectmanager/ObjectManager.h" CommandActionHelper::CommandActionHelper(CommandsActionsIF *setOwner) : owner(setOwner), queueToUse(NULL), ipcStore( @@ -14,7 +15,7 @@ CommandActionHelper::~CommandActionHelper() { ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, ActionId_t actionId, SerializeIF *data) { - HasActionsIF *receiver = objectManager->get(commandTo); + HasActionsIF *receiver = ObjectManager::instance()->get(commandTo); if (receiver == NULL) { return CommandsActionsIF::OBJECT_HAS_NO_FUNCTIONS; } @@ -40,7 +41,7 @@ ReturnValue_t CommandActionHelper::commandAction(object_id_t commandTo, // if (commandCount != 0) { // return CommandsFunctionsIF::ALREADY_COMMANDING; // } - HasActionsIF *receiver = objectManager->get(commandTo); + HasActionsIF *receiver = ObjectManager::instance()->get(commandTo); if (receiver == NULL) { return CommandsActionsIF::OBJECT_HAS_NO_FUNCTIONS; } @@ -66,7 +67,7 @@ ReturnValue_t CommandActionHelper::sendCommand(MessageQueueId_t queueId, } ReturnValue_t CommandActionHelper::initialize() { - ipcStore = objectManager->get(objects::IPC_STORE); + ipcStore = ObjectManager::instance()->get(objects::IPC_STORE); if (ipcStore == NULL) { return HasReturnvaluesIF::RETURN_FAILED; } diff --git a/controller/ControllerBase.cpp b/controller/ControllerBase.cpp index 89f0ff68..5a94c082 100644 --- a/controller/ControllerBase.cpp +++ b/controller/ControllerBase.cpp @@ -3,6 +3,7 @@ #include "../subsystem/SubsystemBase.h" #include "../ipc/QueueFactory.h" #include "../action/HasActionsIF.h" +#include "../objectmanager/ObjectManager.h" ControllerBase::ControllerBase(object_id_t setObjectId, object_id_t parentId, size_t commandQueueDepth) : @@ -25,7 +26,7 @@ ReturnValue_t ControllerBase::initialize() { MessageQueueId_t parentQueue = 0; if (parentId != objects::NO_OBJECT) { - SubsystemBase *parent = objectManager->get(parentId); + SubsystemBase *parent = ObjectManager::instance()->get(parentId); if (parent == nullptr) { return RETURN_FAILED; } diff --git a/datalinklayer/MapPacketExtraction.cpp b/datalinklayer/MapPacketExtraction.cpp index cdc9ae27..d377ca34 100644 --- a/datalinklayer/MapPacketExtraction.cpp +++ b/datalinklayer/MapPacketExtraction.cpp @@ -1,10 +1,13 @@ #include "MapPacketExtraction.h" + #include "../ipc/QueueFactory.h" #include "../serviceinterface/ServiceInterfaceStream.h" #include "../storagemanager/StorageManagerIF.h" #include "../tmtcpacket/SpacePacketBase.h" #include "../tmtcservices/AcceptsTelecommandsIF.h" #include "../tmtcservices/TmTcMessage.h" +#include "../objectmanager/ObjectManager.h" + #include MapPacketExtraction::MapPacketExtraction(uint8_t setMapId, @@ -131,9 +134,9 @@ void MapPacketExtraction::clearBuffers() { } ReturnValue_t MapPacketExtraction::initialize() { - packetStore = objectManager->get(objects::TC_STORE); - AcceptsTelecommandsIF* distributor = objectManager->get< - AcceptsTelecommandsIF>(packetDestination); + packetStore = ObjectManager::instance()->get(objects::TC_STORE); + AcceptsTelecommandsIF* distributor = ObjectManager::instance()-> + get(packetDestination); if ((packetStore != NULL) && (distributor != NULL)) { tcQueueId = distributor->getRequestQueue(); return RETURN_OK; diff --git a/datapoollocal/HasLocalDataPoolIF.h b/datapoollocal/HasLocalDataPoolIF.h index 74e372c9..6051f068 100644 --- a/datapoollocal/HasLocalDataPoolIF.h +++ b/datapoollocal/HasLocalDataPoolIF.h @@ -34,7 +34,8 @@ class LocalPoolObjectBase; * can be retrieved using the object manager, provided the target object is a SystemObject. * For example, the following line of code can be used to retrieve the interface * - * HasLocalDataPoolIF* poolIF = objectManager->get(objects::SOME_OBJECT); + * HasLocalDataPoolIF* poolIF = ObjectManager::instance()-> + * get(objects::SOME_OBJECT); * if(poolIF != nullptr) { * doSomething() * } diff --git a/datapoollocal/LocalDataPoolManager.cpp b/datapoollocal/LocalDataPoolManager.cpp index dbe68ff1..1cbf8201 100644 --- a/datapoollocal/LocalDataPoolManager.cpp +++ b/datapoollocal/LocalDataPoolManager.cpp @@ -6,6 +6,7 @@ #include "internal/HasLocalDpIFManagerAttorney.h" #include "../housekeeping/HousekeepingSetPacket.h" +#include "../objectmanager/ObjectManager.h" #include "../housekeeping/HousekeepingSnapshot.h" #include "../housekeeping/AcceptsHkPacketsIF.h" #include "../timemanager/CCSDSTime.h" @@ -52,7 +53,7 @@ ReturnValue_t LocalDataPoolManager::initialize(MessageQueueIF* queueToUse) { } hkQueue = queueToUse; - ipcStore = objectManager->get(objects::IPC_STORE); + ipcStore = ObjectManager::instance()->get(objects::IPC_STORE); if(ipcStore == nullptr) { /* Error, all destinations invalid */ printWarningOrError(sif::OutputTypes::OUT_ERROR, @@ -63,8 +64,8 @@ ReturnValue_t LocalDataPoolManager::initialize(MessageQueueIF* queueToUse) { if(defaultHkDestination != objects::NO_OBJECT) { - AcceptsHkPacketsIF* hkPacketReceiver = - objectManager->get(defaultHkDestination); + AcceptsHkPacketsIF* hkPacketReceiver = ObjectManager::instance()-> + get(defaultHkDestination); if(hkPacketReceiver != nullptr) { hkDestinationId = hkPacketReceiver->getHkQueue(); } @@ -360,8 +361,8 @@ void LocalDataPoolManager::resetHkUpdateResetHelper() { ReturnValue_t LocalDataPoolManager::subscribeForPeriodicPacket(sid_t sid, bool enableReporting, float collectionInterval, bool isDiagnostics, object_id_t packetDestination) { - AcceptsHkPacketsIF* hkReceiverObject = - objectManager->get(packetDestination); + AcceptsHkPacketsIF* hkReceiverObject = ObjectManager::instance()-> + get(packetDestination); if(hkReceiverObject == nullptr) { printWarningOrError(sif::OutputTypes::OUT_WARNING, "subscribeForPeriodicPacket", QUEUE_OR_DESTINATION_INVALID); @@ -391,7 +392,7 @@ ReturnValue_t LocalDataPoolManager::subscribeForUpdatePacket(sid_t sid, bool isDiagnostics, bool reportingEnabled, object_id_t packetDestination) { AcceptsHkPacketsIF* hkReceiverObject = - objectManager->get(packetDestination); + ObjectManager::instance()->get(packetDestination); if(hkReceiverObject == nullptr) { printWarningOrError(sif::OutputTypes::OUT_WARNING, "subscribeForPeriodicPacket", QUEUE_OR_DESTINATION_INVALID); diff --git a/datapoollocal/LocalPoolDataSetBase.cpp b/datapoollocal/LocalPoolDataSetBase.cpp index a72e9db1..a7a7e6c8 100644 --- a/datapoollocal/LocalPoolDataSetBase.cpp +++ b/datapoollocal/LocalPoolDataSetBase.cpp @@ -3,6 +3,7 @@ #include "internal/HasLocalDpIFUserAttorney.h" #include "../serviceinterface/ServiceInterface.h" +#include "../objectmanager/ObjectManager.h" #include "../globalfunctions/bitutility.h" #include "../datapoollocal/LocalDataPoolManager.h" #include "../housekeeping/PeriodicHousekeepingHelper.h" @@ -45,7 +46,7 @@ LocalPoolDataSetBase::LocalPoolDataSetBase(HasLocalDataPoolIF *hkOwner, LocalPoolDataSetBase::LocalPoolDataSetBase(sid_t sid, PoolVariableIF** registeredVariablesArray, const size_t maxNumberOfVariables): PoolDataSetBase(registeredVariablesArray, maxNumberOfVariables) { - HasLocalDataPoolIF* hkOwner = objectManager->get( + HasLocalDataPoolIF* hkOwner = ObjectManager::instance()->get( sid.objectId); if(hkOwner != nullptr) { AccessPoolManagerIF* accessor = HasLocalDpIFUserAttorney::getAccessorHandle(hkOwner); diff --git a/datapoollocal/LocalPoolObjectBase.cpp b/datapoollocal/LocalPoolObjectBase.cpp index b6db0608..6920749b 100644 --- a/datapoollocal/LocalPoolObjectBase.cpp +++ b/datapoollocal/LocalPoolObjectBase.cpp @@ -4,7 +4,7 @@ #include "HasLocalDataPoolIF.h" #include "internal/HasLocalDpIFUserAttorney.h" -#include "../objectmanager/ObjectManagerIF.h" +#include "../objectmanager/ObjectManager.h" LocalPoolObjectBase::LocalPoolObjectBase(lp_id_t poolId, HasLocalDataPoolIF* hkOwner, @@ -43,7 +43,7 @@ LocalPoolObjectBase::LocalPoolObjectBase(object_id_t poolOwner, lp_id_t poolId, "which is the NO_PARAMETER value!\n"); #endif } - HasLocalDataPoolIF* hkOwner = objectManager->get(poolOwner); + HasLocalDataPoolIF* hkOwner = ObjectManager::instance()->get(poolOwner); if(hkOwner == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "LocalPoolVariable: The supplied pool owner did not implement the correct " diff --git a/devicehandlers/ChildHandlerBase.cpp b/devicehandlers/ChildHandlerBase.cpp index d4ef67ad..628ea3e0 100644 --- a/devicehandlers/ChildHandlerBase.cpp +++ b/devicehandlers/ChildHandlerBase.cpp @@ -1,6 +1,5 @@ #include "ChildHandlerBase.h" #include "../subsystem/SubsystemBase.h" -#include "../subsystem/SubsystemBase.h" ChildHandlerBase::ChildHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication, CookieIF * cookie, @@ -30,7 +29,7 @@ ReturnValue_t ChildHandlerBase::initialize() { MessageQueueId_t parentQueue = 0; if (parentId != objects::NO_OBJECT) { - SubsystemBase *parent = objectManager->get(parentId); + SubsystemBase *parent = ObjectManager::instance()->get(parentId); if (parent == NULL) { return RETURN_FAILED; } diff --git a/devicehandlers/DeviceHandlerBase.cpp b/devicehandlers/DeviceHandlerBase.cpp index 1623a1ac..43660616 100644 --- a/devicehandlers/DeviceHandlerBase.cpp +++ b/devicehandlers/DeviceHandlerBase.cpp @@ -119,7 +119,7 @@ ReturnValue_t DeviceHandlerBase::initialize() { return result; } - communicationInterface = objectManager->get( + communicationInterface = ObjectManager::instance()->get( deviceCommunicationId); if (communicationInterface == nullptr) { printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize", @@ -136,7 +136,7 @@ ReturnValue_t DeviceHandlerBase::initialize() { return result; } - IPCStore = objectManager->get(objects::IPC_STORE); + IPCStore = ObjectManager::instance()->get(objects::IPC_STORE); if (IPCStore == nullptr) { printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize", ObjectManagerIF::CHILD_INIT_FAILED, "IPC Store not set up"); @@ -144,8 +144,8 @@ ReturnValue_t DeviceHandlerBase::initialize() { } if(rawDataReceiverId != objects::NO_OBJECT) { - AcceptsDeviceResponsesIF *rawReceiver = objectManager->get< - AcceptsDeviceResponsesIF>(rawDataReceiverId); + AcceptsDeviceResponsesIF *rawReceiver = ObjectManager::instance()-> + get(rawDataReceiverId); if (rawReceiver == nullptr) { printWarningOrError(sif::OutputTypes::OUT_ERROR, @@ -164,7 +164,7 @@ ReturnValue_t DeviceHandlerBase::initialize() { } if(powerSwitcherId != objects::NO_OBJECT) { - powerSwitcher = objectManager->get(powerSwitcherId); + powerSwitcher = ObjectManager::instance()->get(powerSwitcherId); if (powerSwitcher == nullptr) { printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize", ObjectManagerIF::CHILD_INIT_FAILED, diff --git a/devicehandlers/DeviceHandlerFailureIsolation.cpp b/devicehandlers/DeviceHandlerFailureIsolation.cpp index ba118090..b0708a59 100644 --- a/devicehandlers/DeviceHandlerFailureIsolation.cpp +++ b/devicehandlers/DeviceHandlerFailureIsolation.cpp @@ -1,6 +1,7 @@ #include "DeviceHandlerFailureIsolation.h" #include "../devicehandlers/DeviceHandlerIF.h" +#include "../objectmanager/ObjectManager.h" #include "../modes/HasModesIF.h" #include "../health/HealthTableIF.h" #include "../power/Fuse.h" @@ -175,7 +176,7 @@ ReturnValue_t DeviceHandlerFailureIsolation::initialize() { #endif return result; } - ConfirmsFailuresIF* power = objectManager->get( + ConfirmsFailuresIF* power = ObjectManager::instance()->get( powerConfirmationId); if (power != nullptr) { powerConfirmation = power->getEventReceptionQueue(); diff --git a/devicehandlers/DeviceHandlerMessage.cpp b/devicehandlers/DeviceHandlerMessage.cpp index cb9043db..69c9deb9 100644 --- a/devicehandlers/DeviceHandlerMessage.cpp +++ b/devicehandlers/DeviceHandlerMessage.cpp @@ -1,5 +1,5 @@ #include "DeviceHandlerMessage.h" -#include "../objectmanager/ObjectManagerIF.h" +#include "../objectmanager/ObjectManager.h" store_address_t DeviceHandlerMessage::getStoreAddress( const CommandMessage* message) { @@ -70,7 +70,7 @@ void DeviceHandlerMessage::clear(CommandMessage* message) { case REPLY_RAW_COMMAND: case REPLY_RAW_REPLY: case REPLY_DIRECT_COMMAND_DATA: { - StorageManagerIF *ipcStore = objectManager->get( + StorageManagerIF *ipcStore = ObjectManager::instance()->get( objects::IPC_STORE); if (ipcStore != nullptr) { ipcStore->deleteData(getStoreAddress(message)); diff --git a/events/EventManagerIF.h b/events/EventManagerIF.h index ea22f8ae..0ba126a2 100644 --- a/events/EventManagerIF.h +++ b/events/EventManagerIF.h @@ -3,7 +3,7 @@ #include "EventMessage.h" #include "eventmatching/eventmatching.h" -#include "../objectmanager/ObjectManagerIF.h" +#include "../objectmanager/ObjectManager.h" #include "../ipc/MessageQueueSenderIF.h" #include "../ipc/MessageQueueIF.h" #include "../serviceinterface/ServiceInterface.h" @@ -43,7 +43,7 @@ public: static void triggerEvent(EventMessage* message, MessageQueueId_t sentFrom = 0) { if (eventmanagerQueue == MessageQueueIF::NO_QUEUE) { - EventManagerIF *eventmanager = objectManager->get( + EventManagerIF *eventmanager = ObjectManager::instance()->get( objects::EVENT_MANAGER); if (eventmanager == nullptr) { #if FSFW_VERBOSE_LEVEL >= 1 diff --git a/fdir/FailureIsolationBase.cpp b/fdir/FailureIsolationBase.cpp index 69cb0f01..764fc918 100644 --- a/fdir/FailureIsolationBase.cpp +++ b/fdir/FailureIsolationBase.cpp @@ -3,7 +3,7 @@ #include "../health/HasHealthIF.h" #include "../health/HealthMessage.h" #include "../ipc/QueueFactory.h" -#include "../objectmanager/ObjectManagerIF.h" +#include "../objectmanager/ObjectManager.h" FailureIsolationBase::FailureIsolationBase(object_id_t owner, object_id_t parent, uint8_t messageDepth, uint8_t parameterDomainBase) : @@ -18,7 +18,7 @@ FailureIsolationBase::~FailureIsolationBase() { } ReturnValue_t FailureIsolationBase::initialize() { - EventManagerIF* manager = objectManager->get( + EventManagerIF* manager = ObjectManager::instance()->get( objects::EVENT_MANAGER); if (manager == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 @@ -36,7 +36,7 @@ ReturnValue_t FailureIsolationBase::initialize() { if (result != HasReturnvaluesIF::RETURN_OK) { return result; } - owner = objectManager->get(ownerId); + owner = ObjectManager::instance()->get(ownerId); if (owner == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "FailureIsolationBase::intialize: Owner object " @@ -46,7 +46,7 @@ ReturnValue_t FailureIsolationBase::initialize() { } } if (faultTreeParent != objects::NO_OBJECT) { - ConfirmsFailuresIF* parentIF = objectManager->get( + ConfirmsFailuresIF* parentIF = ObjectManager::instance()->get( faultTreeParent); if (parentIF == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 diff --git a/health/HealthHelper.cpp b/health/HealthHelper.cpp index 231d616e..28419108 100644 --- a/health/HealthHelper.cpp +++ b/health/HealthHelper.cpp @@ -1,5 +1,5 @@ #include "HealthHelper.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "../serviceinterface/ServiceInterface.h" HealthHelper::HealthHelper(HasHealthIF* owner, object_id_t objectId) : objectId(objectId), owner(owner) { @@ -37,8 +37,8 @@ void HealthHelper::setParentQueue(MessageQueueId_t parentQueue) { } ReturnValue_t HealthHelper::initialize() { - healthTable = objectManager->get(objects::HEALTH_TABLE); - eventSender = objectManager->get(objectId); + healthTable = ObjectManager::instance()->get(objects::HEALTH_TABLE); + eventSender = ObjectManager::instance()->get(objectId); if (healthTable == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 diff --git a/housekeeping/HousekeepingMessage.cpp b/housekeeping/HousekeepingMessage.cpp index 90ca73c8..71f7ff17 100644 --- a/housekeeping/HousekeepingMessage.cpp +++ b/housekeeping/HousekeepingMessage.cpp @@ -1,6 +1,6 @@ #include "HousekeepingMessage.h" -#include "../objectmanager/ObjectManagerIF.h" +#include "../objectmanager/ObjectManager.h" #include HousekeepingMessage::~HousekeepingMessage() {} @@ -161,7 +161,7 @@ void HousekeepingMessage::clear(CommandMessage* message) { case(UPDATE_SNAPSHOT_VARIABLE): { store_address_t storeId; getHkDataReply(message, &storeId); - StorageManagerIF *ipcStore = objectManager->get( + StorageManagerIF *ipcStore = ObjectManager::instance()->get( objects::IPC_STORE); if (ipcStore != nullptr) { ipcStore->deleteData(storeId); diff --git a/memory/MemoryHelper.cpp b/memory/MemoryHelper.cpp index 42ac2654..d83a9fab 100644 --- a/memory/MemoryHelper.cpp +++ b/memory/MemoryHelper.cpp @@ -2,9 +2,9 @@ #include "MemoryMessage.h" #include "../globalfunctions/CRC.h" -#include "../objectmanager/ObjectManagerIF.h" +#include "../objectmanager/ObjectManager.h" #include "../serialize/EndianConverter.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "../serviceinterface/ServiceInterface.h" MemoryHelper::MemoryHelper(HasMemoryIF* workOnThis, MessageQueueIF* useThisQueue): @@ -187,7 +187,7 @@ ReturnValue_t MemoryHelper::initialize(MessageQueueIF* queueToUse_) { } ReturnValue_t MemoryHelper::initialize() { - ipcStore = objectManager->get(objects::IPC_STORE); + ipcStore = ObjectManager::instance()->get(objects::IPC_STORE); if (ipcStore != nullptr) { return RETURN_OK; } else { diff --git a/memory/MemoryMessage.cpp b/memory/MemoryMessage.cpp index 94fa4691..1f050ef8 100644 --- a/memory/MemoryMessage.cpp +++ b/memory/MemoryMessage.cpp @@ -1,6 +1,6 @@ #include "MemoryMessage.h" -#include "../objectmanager/ObjectManagerIF.h" +#include "../objectmanager/ObjectManager.h" uint32_t MemoryMessage::getAddress(const CommandMessage* message) { return message->getParameter(); @@ -44,7 +44,7 @@ void MemoryMessage::clear(CommandMessage* message) { switch (message->getCommand()) { case CMD_MEMORY_LOAD: case REPLY_MEMORY_DUMP: { - StorageManagerIF *ipcStore = objectManager->get( + StorageManagerIF *ipcStore = ObjectManager::instance()->get( objects::IPC_STORE); if (ipcStore != NULL) { ipcStore->deleteData(getStoreID(message)); diff --git a/monitoring/LimitViolationReporter.cpp b/monitoring/LimitViolationReporter.cpp index c531a6e6..2de1e008 100644 --- a/monitoring/LimitViolationReporter.cpp +++ b/monitoring/LimitViolationReporter.cpp @@ -1,13 +1,8 @@ -/** - * @file LimitViolationReporter.cpp - * @brief This file defines the LimitViolationReporter class. - * @date 17.07.2014 - * @author baetz - */ #include "LimitViolationReporter.h" #include "MonitoringIF.h" #include "ReceivesMonitoringReportsIF.h" -#include "../objectmanager/ObjectManagerIF.h" + +#include "../objectmanager/ObjectManager.h" #include "../serialize/SerializeAdapter.h" ReturnValue_t LimitViolationReporter::sendLimitViolationReport(const SerializeIF* data) { @@ -16,7 +11,7 @@ ReturnValue_t LimitViolationReporter::sendLimitViolationReport(const SerializeIF return result; } store_address_t storeId; - uint8_t* dataTarget = NULL; + uint8_t* dataTarget = nullptr; size_t maxSize = data->getSerializedSize(); if (maxSize > MonitoringIF::VIOLATION_REPORT_MAX_SIZE) { return MonitoringIF::INVALID_SIZE; @@ -38,16 +33,16 @@ ReturnValue_t LimitViolationReporter::sendLimitViolationReport(const SerializeIF ReturnValue_t LimitViolationReporter::checkClassLoaded() { if (reportQueue == 0) { - ReceivesMonitoringReportsIF* receiver = objectManager->get< + ReceivesMonitoringReportsIF* receiver = ObjectManager::instance()->get< ReceivesMonitoringReportsIF>(reportingTarget); - if (receiver == NULL) { + if (receiver == nullptr) { return ObjectManagerIF::NOT_FOUND; } reportQueue = receiver->getCommandQueue(); } - if (ipcStore == NULL) { - ipcStore = objectManager->get(objects::IPC_STORE); - if (ipcStore == NULL) { + if (ipcStore == nullptr) { + ipcStore = ObjectManager::instance()->get(objects::IPC_STORE); + if (ipcStore == nullptr) { return HasReturnvaluesIF::RETURN_FAILED; } } @@ -56,5 +51,5 @@ ReturnValue_t LimitViolationReporter::checkClassLoaded() { //Lazy initialization. MessageQueueId_t LimitViolationReporter::reportQueue = 0; -StorageManagerIF* LimitViolationReporter::ipcStore = NULL; +StorageManagerIF* LimitViolationReporter::ipcStore = nullptr; object_id_t LimitViolationReporter::reportingTarget = 0; diff --git a/monitoring/MonitoringMessage.cpp b/monitoring/MonitoringMessage.cpp index 8caa27ae..6e5f49cc 100644 --- a/monitoring/MonitoringMessage.cpp +++ b/monitoring/MonitoringMessage.cpp @@ -1,5 +1,5 @@ #include "MonitoringMessage.h" -#include "../objectmanager/ObjectManagerIF.h" +#include "../objectmanager/ObjectManager.h" MonitoringMessage::~MonitoringMessage() { } @@ -25,7 +25,7 @@ void MonitoringMessage::clear(CommandMessage* message) { message->setCommand(CommandMessage::CMD_NONE); switch (message->getCommand()) { case MonitoringMessage::LIMIT_VIOLATION_REPORT: { - StorageManagerIF *ipcStore = objectManager->get( + StorageManagerIF *ipcStore = ObjectManager::instance()->get( objects::IPC_STORE); if (ipcStore != NULL) { ipcStore->deleteData(getStoreId(message)); diff --git a/monitoring/MonitoringMessageContent.h b/monitoring/MonitoringMessageContent.h index 0314d7ed..1d5f9c92 100644 --- a/monitoring/MonitoringMessageContent.h +++ b/monitoring/MonitoringMessageContent.h @@ -5,7 +5,7 @@ #include "MonitoringIF.h" #include "../datapoollocal/localPoolDefinitions.h" -#include "../objectmanager/ObjectManagerIF.h" +#include "../objectmanager/ObjectManager.h" #include "../serialize/SerialBufferAdapter.h" #include "../serialize/SerialFixedArrayListAdapter.h" #include "../serialize/SerializeElement.h" @@ -71,7 +71,7 @@ private: } bool checkAndSetStamper() { if (timeStamper == nullptr) { - timeStamper = objectManager->get( timeStamperId ); + timeStamper = ObjectManager::instance()->get( timeStamperId ); if ( timeStamper == nullptr ) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "MonitoringReportContent::checkAndSetStamper: " diff --git a/monitoring/TriplexMonitor.h b/monitoring/TriplexMonitor.h index d9ee8305..295a6174 100644 --- a/monitoring/TriplexMonitor.h +++ b/monitoring/TriplexMonitor.h @@ -5,7 +5,7 @@ #include "../datapool/PIDReaderList.h" #include "../health/HealthTableIF.h" #include "../parameters/HasParametersIF.h" -#include "../objectmanager/ObjectManagerIF.h" +#include "../objectmanager/ObjectManager.h" //SHOULDDO: This is by far not perfect. Could be merged with new Monitor classes. But still, it's over-engineering. @@ -64,7 +64,7 @@ public: return result; } ReturnValue_t initialize() { - healthTable = objectManager->get(objects::HEALTH_TABLE); + healthTable = ObjectManager::instance()->get(objects::HEALTH_TABLE); if (healthTable == NULL) { return HasReturnvaluesIF::RETURN_FAILED; } diff --git a/objectmanager/ObjectManager.cpp b/objectmanager/ObjectManager.cpp index 3c2be532..a0cc3423 100644 --- a/objectmanager/ObjectManager.cpp +++ b/objectmanager/ObjectManager.cpp @@ -6,11 +6,23 @@ #endif #include -ObjectManager::ObjectManager( void (*setProducer)() ): - produceObjects(setProducer) { - //There's nothing special to do in the constructor. +ObjectManager* ObjectManager::objManagerInstance = nullptr; + +ObjectManager* ObjectManager::instance() { + if(objManagerInstance == nullptr) { + objManagerInstance = new ObjectManager(); + } + return objManagerInstance; } +void ObjectManager::setObjectFactoryFunction(produce_function_t objFactoryFunc, void *factoryArgs) { + this->objectFactoryFunction = objFactoryFunc; + this->factoryArgs = factoryArgs; +} + + +ObjectManager::ObjectManager() {} + ObjectManager::~ObjectManager() { for (auto const& iter : objectList) { @@ -28,10 +40,13 @@ ReturnValue_t ObjectManager::insert( object_id_t id, SystemObjectIF* object) { return this->RETURN_OK; } else { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "ObjectManager::insert: Object id " << std::hex - << static_cast(id) << std::dec - << " is already in use!" << std::endl; - sif::error << "Terminating program." << std::endl; + sif::error << "ObjectManager::insert: Object ID " << std::hex << + static_cast(id) << std::dec << " is already in use!" << std::endl; + sif::error << "Terminating program" << std::endl; +#else + sif::printError("ObjectManager::insert: Object ID 0x%08x is already in use!\n", + static_cast(id)); + sif::printError("Terminating program"); #endif //This is very severe and difficult to handle in other places. std::exit(INSERTION_FAILED); @@ -66,12 +81,8 @@ SystemObjectIF* ObjectManager::getSystemObject( object_id_t id ) { } } -ObjectManager::ObjectManager() : produceObjects(nullptr) { - -} - void ObjectManager::initialize() { - if(produceObjects == nullptr) { + if(objectFactoryFunction == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "ObjectManager::initialize: Passed produceObjects " "functions is nullptr!" << std::endl; @@ -80,7 +91,7 @@ void ObjectManager::initialize() { #endif return; } - this->produceObjects(); + objectFactoryFunction(factoryArgs); ReturnValue_t result = RETURN_FAILED; uint32_t errorCount = 0; for (auto const& it : objectList) { diff --git a/objectmanager/ObjectManager.h b/objectmanager/ObjectManager.h index 69a74f73..1d4c3185 100644 --- a/objectmanager/ObjectManager.h +++ b/objectmanager/ObjectManager.h @@ -5,6 +5,7 @@ #include "SystemObjectIF.h" #include + /** * @brief This class implements a global object manager. * @details This manager handles a list of available objects with system-wide @@ -19,44 +20,65 @@ * @author Bastian Baetz */ class ObjectManager : public ObjectManagerIF { -private: - //comparison? - /** - * @brief This is the map of all initialized objects in the manager. - * @details Objects in the List must inherit the SystemObjectIF. - */ - std::map objectList; -protected: - SystemObjectIF* getSystemObject( object_id_t id ); - /** - * @brief This attribute is initialized with the factory function - * that creates new objects. - * @details The function is called if an object was requested with - * getSystemObject, but not found in objectList. - * @param The id of the object to be created. - * @return Returns a pointer to the newly created object or NULL. - */ - void (*produceObjects)(); public: - /** - * @brief Apart from setting the producer function, nothing special - * happens in the constructor. - * @param setProducer A pointer to a factory function. - */ - ObjectManager( void (*produce)() ); - ObjectManager(); - /** - * @brief In the class's destructor, all objects in the list are deleted. - */ - // SHOULDDO: If, for some reason, deleting an ObjectManager instance is - // required, check if this works. - virtual ~ObjectManager( void ); - ReturnValue_t insert( object_id_t id, SystemObjectIF* object ); - ReturnValue_t remove( object_id_t id ); - void initialize(); - void printList(); + + using produce_function_t = void (*) (void* args); + + /** + * Returns the single instance of TaskFactory. + * The implementation of #instance is found in its subclasses. + * Thus, we choose link-time variability of the instance. + */ + static ObjectManager* instance(); + + void setObjectFactoryFunction(produce_function_t prodFunc, void* args); + + template T* get( object_id_t id ); + + /** + * @brief In the class's destructor, all objects in the list are deleted. + */ + virtual ~ObjectManager(); + ReturnValue_t insert(object_id_t id, SystemObjectIF* object) override; + ReturnValue_t remove(object_id_t id) override; + void initialize() override; + void printList() override; + +protected: + SystemObjectIF* getSystemObject(object_id_t id) override; + /** + * @brief This attribute is initialized with the factory function + * that creates new objects. + * @details The function is called if an object was requested with + * getSystemObject, but not found in objectList. + * @param The id of the object to be created. + * @return Returns a pointer to the newly created object or NULL. + */ + produce_function_t objectFactoryFunction = nullptr; + void* factoryArgs = nullptr; + +private: + ObjectManager(); + + /** + * @brief This is the map of all initialized objects in the manager. + * @details Objects in the List must inherit the SystemObjectIF. + */ + std::map objectList; + static ObjectManager* objManagerInstance; }; +/** + * @brief This is the forward declaration of the global objectManager instance. + */ +// SHOULDDO: maybe put this in the glob namespace to explicitely mark it global? +//extern ObjectManagerIF *objectManager; +/*Documentation can be found in the class method declaration above.*/ +template +T* ObjectManager::get( object_id_t id ) { + SystemObjectIF* temp = this->getSystemObject(id); + return dynamic_cast(temp); +} #endif /* FSFW_OBJECTMANAGER_OBJECTMANAGER_H_ */ diff --git a/objectmanager/ObjectManagerIF.h b/objectmanager/ObjectManagerIF.h index 61e6f423..561ff352 100644 --- a/objectmanager/ObjectManagerIF.h +++ b/objectmanager/ObjectManagerIF.h @@ -8,11 +8,11 @@ /** * @brief This class provides an interface to the global object manager. - * @details This manager handles a list of available objects with system-wide - * relevance, such as device handlers, and TM/TC services. They can be - * inserted, removed and retrieved from the list. On getting the - * object, the call checks if the object implements the requested - * interface. + * @details + * This manager handles a list of available objects with system-wide relevance, such as device + * handlers, and TM/TC services. They can be inserted, removed and retrieved from the list. + * On getting the object, the call checks if the object implements the requested interface. + * This interface does not specify a getter function because templates can't be used in interfaces. * @author Bastian Baetz * @ingroup system_objects */ @@ -21,7 +21,8 @@ public: static constexpr uint8_t INTERFACE_ID = CLASS_ID::OBJECT_MANAGER_IF; static constexpr ReturnValue_t INSERTION_FAILED = MAKE_RETURN_CODE( 1 ); static constexpr ReturnValue_t NOT_FOUND = MAKE_RETURN_CODE( 2 ); - static constexpr ReturnValue_t CHILD_INIT_FAILED = MAKE_RETURN_CODE( 3 ); //!< Can be used if the initialization of a SystemObject failed. + //!< Can be used if the initialization of a SystemObject failed. + static constexpr ReturnValue_t CHILD_INIT_FAILED = MAKE_RETURN_CODE( 3 ); static constexpr ReturnValue_t INTERNAL_ERR_REPORTER_UNINIT = MAKE_RETURN_CODE( 4 ); protected: @@ -49,22 +50,11 @@ public: * @li RETURN_OK in case the object was successfully inserted */ virtual ReturnValue_t insert( object_id_t id, SystemObjectIF* object ) = 0; - /** - * @brief With the get call, interfaces of an object can be retrieved in - * a type-safe manner. - * @details With the template-based call, the object list is searched with the - * getSystemObject method and afterwards it is checked, if the object - * implements the requested interface (with a dynamic_cast). - * @param id The object id of the requested object. - * @return The method returns a pointer to an object implementing the - * requested interface, or NULL. - */ - template T* get( object_id_t id ); /** * @brief With this call, an object is removed from the list. * @param id The object id of the object to be removed. - * @return \li NOT_FOUND in case the object was not found - * \li RETURN_OK in case the object was successfully removed + * @return @li NOT_FOUND in case the object was not found + * @li RETURN_OK in case the object was successfully removed */ virtual ReturnValue_t remove( object_id_t id ) = 0; virtual void initialize() = 0; @@ -75,24 +65,4 @@ public: virtual void printList() = 0; }; - -/** - * @brief This is the forward declaration of the global objectManager instance. - */ -// SHOULDDO: maybe put this in the glob namespace to explicitely mark it global? -extern ObjectManagerIF *objectManager; - -/*Documentation can be found in the class method declaration above.*/ -template -T* ObjectManagerIF::get( object_id_t id ) { - if(objectManager == nullptr) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "ObjectManagerIF: Global object manager has not " - "been initialized yet!" << std::endl; -#endif - } - SystemObjectIF* temp = this->getSystemObject(id); - return dynamic_cast(temp); -} - #endif /* OBJECTMANAGERIF_H_ */ diff --git a/objectmanager/SystemObject.cpp b/objectmanager/SystemObject.cpp index 9040002c..123bbe65 100644 --- a/objectmanager/SystemObject.cpp +++ b/objectmanager/SystemObject.cpp @@ -4,18 +4,14 @@ SystemObject::SystemObject(object_id_t setObjectId, bool doRegister) : objectId(setObjectId), registered(doRegister) { - if (registered) { - if(objectManager != nullptr) { - objectManager->insert(objectId, this); - } - } + if (registered) { + ObjectManager::instance()->insert(objectId, this); + } } SystemObject::~SystemObject() { if (registered) { - if(objectManager != nullptr) { - objectManager->remove(objectId); - } + ObjectManager::instance()->remove(objectId); } } diff --git a/osal/FreeRTOS/FixedTimeslotTask.cpp b/osal/FreeRTOS/FixedTimeslotTask.cpp index aa7e6c59..a722c958 100644 --- a/osal/FreeRTOS/FixedTimeslotTask.cpp +++ b/osal/FreeRTOS/FixedTimeslotTask.cpp @@ -1,6 +1,7 @@ #include "FixedTimeslotTask.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "../../objectmanager/ObjectManager.h" +#include "../../serviceinterface/ServiceInterface.h" uint32_t FixedTimeslotTask::deadlineMissedCount = 0; const size_t PeriodicTaskIF::MINIMUM_STACK_SIZE = configMINIMAL_STACK_SIZE; @@ -66,8 +67,7 @@ ReturnValue_t FixedTimeslotTask::startTask() { ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId, uint32_t slotTimeMs, int8_t executionStep) { - ExecutableObjectIF* handler = - objectManager->get(componentId); + ExecutableObjectIF* handler = ObjectManager::instance()->get(componentId); if (handler != nullptr) { pst.addSlot(componentId, slotTimeMs, executionStep, handler, this); return HasReturnvaluesIF::RETURN_OK; diff --git a/osal/FreeRTOS/MessageQueue.cpp b/osal/FreeRTOS/MessageQueue.cpp index b5c9035d..d8929923 100644 --- a/osal/FreeRTOS/MessageQueue.cpp +++ b/osal/FreeRTOS/MessageQueue.cpp @@ -1,7 +1,7 @@ #include "MessageQueue.h" #include "QueueMapManager.h" -#include "../../objectmanager/ObjectManagerIF.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "../../objectmanager/ObjectManager.h" +#include "../../serviceinterface/ServiceInterface.h" MessageQueue::MessageQueue(size_t messageDepth, size_t maxMessageSize): maxMessageSize(maxMessageSize) { @@ -66,7 +66,7 @@ QueueHandle_t MessageQueue::getNativeQueueHandle() { ReturnValue_t MessageQueue::handleSendResult(BaseType_t result, bool ignoreFault) { if (result != pdPASS) { if (not ignoreFault) { - InternalErrorReporterIF* internalErrorReporter = objectManager-> + InternalErrorReporterIF* internalErrorReporter = ObjectManager::instance()-> get(objects::INTERNAL_ERROR_REPORTER); if (internalErrorReporter != nullptr) { internalErrorReporter->queueMessageNotSent(); diff --git a/osal/FreeRTOS/PeriodicTask.cpp b/osal/FreeRTOS/PeriodicTask.cpp index 3e830c7f..42d6681d 100644 --- a/osal/FreeRTOS/PeriodicTask.cpp +++ b/osal/FreeRTOS/PeriodicTask.cpp @@ -1,6 +1,7 @@ #include "PeriodicTask.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "../../objectmanager/ObjectManager.h" +#include "../../serviceinterface/ServiceInterface.h" #include "../../tasks/ExecutableObjectIF.h" PeriodicTask::PeriodicTask(const char *name, TaskPriority setPriority, @@ -100,7 +101,7 @@ void PeriodicTask::taskFunctionality() { } ReturnValue_t PeriodicTask::addComponent(object_id_t object) { - ExecutableObjectIF* newObject = objectManager->get( + ExecutableObjectIF* newObject = ObjectManager::instance()->get( object); if (newObject == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 diff --git a/osal/common/TcpTmTcServer.cpp b/osal/common/TcpTmTcServer.cpp index 28fab422..38f72647 100644 --- a/osal/common/TcpTmTcServer.cpp +++ b/osal/common/TcpTmTcServer.cpp @@ -6,7 +6,7 @@ #include "../../container/SharedRingBuffer.h" #include "../../ipc/MessageQueueSenderIF.h" #include "../../ipc/MutexGuard.h" -#include "../../objectmanager/ObjectManagerIF.h" +#include "../../objectmanager/ObjectManager.h" #include "../../serviceinterface/ServiceInterface.h" #include "../../tmtcservices/TmTcMessage.h" @@ -41,7 +41,7 @@ ReturnValue_t TcpTmTcServer::initialize() { return result; } - tcStore = objectManager->get(objects::TC_STORE); + tcStore = ObjectManager::instance()->get(objects::TC_STORE); if (tcStore == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "TcpTmTcServer::initialize: TC store uninitialized!" << std::endl; @@ -51,7 +51,7 @@ ReturnValue_t TcpTmTcServer::initialize() { return ObjectManagerIF::CHILD_INIT_FAILED; } - tmtcBridge = objectManager->get(tmtcBridgeId); + tmtcBridge = ObjectManager::instance()->get(tmtcBridgeId); int retval = 0; struct addrinfo *addrResult = nullptr; diff --git a/osal/common/UdpTcPollingTask.cpp b/osal/common/UdpTcPollingTask.cpp index 877e7883..4453e1bc 100644 --- a/osal/common/UdpTcPollingTask.cpp +++ b/osal/common/UdpTcPollingTask.cpp @@ -2,7 +2,8 @@ #include "tcpipHelpers.h" #include "../../platform.h" #include "../../globalfunctions/arrayprinter.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "../../serviceinterface/ServiceInterface.h" +#include "../../objectmanager/ObjectManager.h" #ifdef PLATFORM_WIN #include @@ -116,7 +117,7 @@ ReturnValue_t UdpTcPollingTask::handleSuccessfullTcRead(size_t bytesRead) { } ReturnValue_t UdpTcPollingTask::initialize() { - tcStore = objectManager->get(objects::TC_STORE); + tcStore = ObjectManager::instance()->get(objects::TC_STORE); if (tcStore == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "UdpTcPollingTask::initialize: TC store uninitialized!" << std::endl; @@ -124,7 +125,7 @@ ReturnValue_t UdpTcPollingTask::initialize() { return ObjectManagerIF::CHILD_INIT_FAILED; } - tmtcBridge = objectManager->get(tmtcBridgeId); + tmtcBridge = ObjectManager::instance()->get(tmtcBridgeId); if(tmtcBridge == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "UdpTcPollingTask::initialize: Invalid TMTC bridge object!" << diff --git a/osal/host/FixedTimeslotTask.cpp b/osal/host/FixedTimeslotTask.cpp index 55f37499..3ad191e5 100644 --- a/osal/host/FixedTimeslotTask.cpp +++ b/osal/host/FixedTimeslotTask.cpp @@ -1,9 +1,11 @@ #include "taskHelpers.h" + #include "../../platform.h" #include "../../osal/host/FixedTimeslotTask.h" #include "../../ipc/MutexFactory.h" #include "../../osal/host/Mutex.h" #include "../../osal/host/FixedTimeslotTask.h" +#include "../../objectmanager/ObjectManager.h" #include "../../serviceinterface/ServiceInterface.h" #include "../../tasks/ExecutableObjectIF.h" @@ -110,7 +112,7 @@ void FixedTimeslotTask::taskFunctionality() { ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId, uint32_t slotTimeMs, int8_t executionStep) { - ExecutableObjectIF* executableObject = objectManager-> + ExecutableObjectIF* executableObject = ObjectManager::instance()-> get(componentId); if (executableObject != nullptr) { pollingSeqTable.addSlot(componentId, slotTimeMs, executionStep, diff --git a/osal/host/MessageQueue.cpp b/osal/host/MessageQueue.cpp index a779bdcb..0c16d808 100644 --- a/osal/host/MessageQueue.cpp +++ b/osal/host/MessageQueue.cpp @@ -1,7 +1,8 @@ #include "MessageQueue.h" #include "QueueMapManager.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "../../serviceinterface/ServiceInterface.h" +#include "../../objectmanager/ObjectManager.h" #include "../../ipc/MutexFactory.h" #include "../../ipc/MutexGuard.h" @@ -121,9 +122,8 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo, QueueMapManager::instance()->getMessageQueue(sendTo)); if(targetQueue == nullptr) { if(not ignoreFault) { - InternalErrorReporterIF* internalErrorReporter = - objectManager->get( - objects::INTERNAL_ERROR_REPORTER); + InternalErrorReporterIF* internalErrorReporter = ObjectManager::instance()-> + get(objects::INTERNAL_ERROR_REPORTER); if (internalErrorReporter != nullptr) { internalErrorReporter->queueMessageNotSent(); } diff --git a/osal/host/PeriodicTask.cpp b/osal/host/PeriodicTask.cpp index 4b3fa626..180272d0 100644 --- a/osal/host/PeriodicTask.cpp +++ b/osal/host/PeriodicTask.cpp @@ -4,7 +4,8 @@ #include "../../platform.h" #include "../../ipc/MutexFactory.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "../../objectmanager/ObjectManager.h" +#include "../../serviceinterface/ServiceInterface.h" #include "../../tasks/ExecutableObjectIF.h" #include @@ -103,7 +104,7 @@ void PeriodicTask::taskFunctionality() { } ReturnValue_t PeriodicTask::addComponent(object_id_t object) { - ExecutableObjectIF* newObject = objectManager->get( + ExecutableObjectIF* newObject = ObjectManager::instance()->get( object); if (newObject == nullptr) { return HasReturnvaluesIF::RETURN_FAILED; diff --git a/osal/linux/FixedTimeslotTask.cpp b/osal/linux/FixedTimeslotTask.cpp index a545eeb7..c60c287a 100644 --- a/osal/linux/FixedTimeslotTask.cpp +++ b/osal/linux/FixedTimeslotTask.cpp @@ -1,5 +1,7 @@ #include "FixedTimeslotTask.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" + +#include "../../objectmanager/ObjectManager.h" +#include "../../serviceinterface/ServiceInterface.h" #include @@ -40,7 +42,7 @@ uint32_t FixedTimeslotTask::getPeriodMs() const { ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId, uint32_t slotTimeMs, int8_t executionStep) { ExecutableObjectIF* executableObject = - objectManager->get(componentId); + ObjectManager::instance()->get(componentId); if (executableObject != nullptr) { pst.addSlot(componentId, slotTimeMs, executionStep, executableObject,this); diff --git a/osal/linux/MessageQueue.cpp b/osal/linux/MessageQueue.cpp index 12774a58..0abb7a35 100644 --- a/osal/linux/MessageQueue.cpp +++ b/osal/linux/MessageQueue.cpp @@ -1,6 +1,7 @@ #include "MessageQueue.h" + #include "../../serviceinterface/ServiceInterface.h" -#include "../../objectmanager/ObjectManagerIF.h" +#include "../../objectmanager/ObjectManager.h" #include @@ -351,7 +352,7 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo, if (result != 0) { if(!ignoreFault){ InternalErrorReporterIF* internalErrorReporter = - objectManager->get( + ObjectManager::instance()->get( objects::INTERNAL_ERROR_REPORTER); if (internalErrorReporter != NULL) { internalErrorReporter->queueMessageNotSent(); diff --git a/osal/linux/PeriodicPosixTask.cpp b/osal/linux/PeriodicPosixTask.cpp index 630dd8e0..956d4fdf 100644 --- a/osal/linux/PeriodicPosixTask.cpp +++ b/osal/linux/PeriodicPosixTask.cpp @@ -1,8 +1,12 @@ -#include "../../tasks/ExecutableObjectIF.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" -#include #include "PeriodicPosixTask.h" +#include "../../objectmanager/ObjectManager.h" +#include "../../tasks/ExecutableObjectIF.h" +#include "../../serviceinterface/ServiceInterface.h" + +#include + + PeriodicPosixTask::PeriodicPosixTask(const char* name_, int priority_, size_t stackSize_, uint32_t period_, void(deadlineMissedFunc_)()): PosixThread(name_, priority_, stackSize_), objectList(), started(false), @@ -22,7 +26,7 @@ void* PeriodicPosixTask::taskEntryPoint(void* arg) { } ReturnValue_t PeriodicPosixTask::addComponent(object_id_t object) { - ExecutableObjectIF* newObject = objectManager->get( + ExecutableObjectIF* newObject = ObjectManager::instance()->get( object); if (newObject == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 diff --git a/osal/rtems/FixedTimeslotTask.cpp b/osal/rtems/FixedTimeslotTask.cpp index 3a3be6b3..19960a4c 100644 --- a/osal/rtems/FixedTimeslotTask.cpp +++ b/osal/rtems/FixedTimeslotTask.cpp @@ -3,7 +3,7 @@ #include "../../tasks/FixedSequenceSlot.h" #include "../../objectmanager/SystemObjectIF.h" -#include "../../objectmanager/ObjectManagerIF.h" +#include "../../objectmanager/ObjectManager.h" #include "../../returnvalues/HasReturnvaluesIF.h" #include "../../serviceinterface/ServiceInterface.h" @@ -81,7 +81,7 @@ ReturnValue_t FixedTimeslotTask::startTask() { ReturnValue_t FixedTimeslotTask::addSlot(object_id_t componentId, uint32_t slotTimeMs, int8_t executionStep) { - ExecutableObjectIF* object = objectManager->get(componentId); + ExecutableObjectIF* object = ObjectManager::instance()->get(componentId); if (object != nullptr) { pst.addSlot(componentId, slotTimeMs, executionStep, object, this); return HasReturnvaluesIF::RETURN_OK; diff --git a/osal/rtems/MessageQueue.cpp b/osal/rtems/MessageQueue.cpp index 717b80dd..e8128e90 100644 --- a/osal/rtems/MessageQueue.cpp +++ b/osal/rtems/MessageQueue.cpp @@ -1,8 +1,11 @@ -#include "../../serviceinterface/ServiceInterfaceStream.h" -#include "../../objectmanager/ObjectManagerIF.h" #include "MessageQueue.h" #include "RtemsBasic.h" + +#include "../../serviceinterface/ServiceInterface.h" +#include "../../objectmanager/ObjectManager.h" + #include + MessageQueue::MessageQueue(size_t message_depth, size_t max_message_size) : id(0), lastPartner(0), defaultDestination(NO_QUEUE), internalErrorReporter(nullptr) { rtems_name name = ('Q' << 24) + (queueCounter++ << 8); @@ -94,7 +97,7 @@ ReturnValue_t MessageQueue::sendMessageFrom(MessageQueueId_t sendTo, //TODO: Check if we're in ISR. if (result != RTEMS_SUCCESSFUL && !ignoreFault) { if (internalErrorReporter == nullptr) { - internalErrorReporter = objectManager->get( + internalErrorReporter = ObjectManager::instance()->get( objects::INTERNAL_ERROR_REPORTER); } if (internalErrorReporter != nullptr) { diff --git a/osal/rtems/PeriodicTask.cpp b/osal/rtems/PeriodicTask.cpp index 067983cb..58717344 100644 --- a/osal/rtems/PeriodicTask.cpp +++ b/osal/rtems/PeriodicTask.cpp @@ -1,6 +1,7 @@ #include "PeriodicTask.h" #include "../../serviceinterface/ServiceInterface.h" +#include "../../objectmanager/ObjectManager.h" #include "../../tasks/ExecutableObjectIF.h" PeriodicTask::PeriodicTask(const char *name, rtems_task_priority setPriority, @@ -68,7 +69,7 @@ void PeriodicTask::taskFunctionality() { } ReturnValue_t PeriodicTask::addComponent(object_id_t object) { - ExecutableObjectIF* newObject = objectManager->get(object); + ExecutableObjectIF* newObject = ObjectManager::instance()->get(object); if (newObject == nullptr) { return HasReturnvaluesIF::RETURN_FAILED; } diff --git a/parameters/ParameterHelper.cpp b/parameters/ParameterHelper.cpp index e80c2c47..694ec5a4 100644 --- a/parameters/ParameterHelper.cpp +++ b/parameters/ParameterHelper.cpp @@ -1,6 +1,7 @@ #include "ParameterHelper.h" #include "ParameterMessage.h" -#include "../objectmanager/ObjectManagerIF.h" + +#include "../objectmanager/ObjectManager.h" ParameterHelper::ParameterHelper(ReceivesParameterMessagesIF* owner): owner(owner) {} @@ -124,7 +125,7 @@ ReturnValue_t ParameterHelper::sendParameter(MessageQueueId_t to, uint32_t id, ReturnValue_t ParameterHelper::initialize() { ownerQueueId = owner->getCommandQueue(); - storage = objectManager->get(objects::IPC_STORE); + storage = ObjectManager::instance()->get(objects::IPC_STORE); if (storage == nullptr) { return ObjectManagerIF::CHILD_INIT_FAILED; } diff --git a/parameters/ParameterMessage.cpp b/parameters/ParameterMessage.cpp index 88a45c80..8a5835ff 100644 --- a/parameters/ParameterMessage.cpp +++ b/parameters/ParameterMessage.cpp @@ -1,5 +1,6 @@ -#include "../parameters/ParameterMessage.h" -#include "../objectmanager/ObjectManagerIF.h" +#include "ParameterMessage.h" + +#include "../objectmanager/ObjectManager.h" ParameterId_t ParameterMessage::getParameterId(const CommandMessage* message) { return message->getParameter(); @@ -51,7 +52,7 @@ void ParameterMessage::clear(CommandMessage* message) { switch (message->getCommand()) { case CMD_PARAMETER_LOAD: case REPLY_PARAMETER_DUMP: { - StorageManagerIF *ipcStore = objectManager->get( + StorageManagerIF *ipcStore = ObjectManager::instance()->get( objects::IPC_STORE); if (ipcStore != NULL) { ipcStore->deleteData(getStoreId(message)); diff --git a/power/Fuse.cpp b/power/Fuse.cpp index 91da5388..0cb1385b 100644 --- a/power/Fuse.cpp +++ b/power/Fuse.cpp @@ -2,7 +2,7 @@ #include "../monitoring/LimitViolationReporter.h" #include "../monitoring/MonitoringMessageContent.h" -#include "../objectmanager/ObjectManagerIF.h" +#include "../objectmanager/ObjectManager.h" #include "../serialize/SerialFixedArrayListAdapter.h" #include "../ipc/QueueFactory.h" @@ -44,7 +44,7 @@ ReturnValue_t Fuse::initialize() { if (result != RETURN_OK) { return result; } - powerIF = objectManager->get(powerSwitchId); + powerIF = ObjectManager::instance()->get(powerSwitchId); if (powerIF == NULL) { return RETURN_FAILED; } diff --git a/power/PowerSwitcher.cpp b/power/PowerSwitcher.cpp index ed37998e..642a2697 100644 --- a/power/PowerSwitcher.cpp +++ b/power/PowerSwitcher.cpp @@ -1,7 +1,7 @@ #include "PowerSwitcher.h" -#include "../objectmanager/ObjectManagerIF.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "../objectmanager/ObjectManager.h" +#include "../serviceinterface/ServiceInterface.h" PowerSwitcher::PowerSwitcher(uint8_t setSwitch1, uint8_t setSwitch2, PowerSwitcher::State_t setStartState): @@ -10,7 +10,7 @@ PowerSwitcher::PowerSwitcher(uint8_t setSwitch1, uint8_t setSwitch2, } ReturnValue_t PowerSwitcher::initialize(object_id_t powerSwitchId) { - power = objectManager->get(powerSwitchId); + power = ObjectManager::instance()->get(powerSwitchId); if (power == nullptr) { return HasReturnvaluesIF::RETURN_FAILED; } diff --git a/pus/CService200ModeCommanding.cpp b/pus/CService200ModeCommanding.cpp index 70caadd1..d178b3a9 100644 --- a/pus/CService200ModeCommanding.cpp +++ b/pus/CService200ModeCommanding.cpp @@ -2,7 +2,8 @@ #include "servicepackets/Service200Packets.h" #include "../modes/HasModesIF.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "../objectmanager/ObjectManager.h" +#include "../serviceinterface/ServiceInterface.h" #include "../serialize/SerialLinkedListAdapter.h" #include "../modes/ModeMessage.h" @@ -40,7 +41,7 @@ ReturnValue_t CService200ModeCommanding::getMessageQueueAndObject( ReturnValue_t CService200ModeCommanding::checkInterfaceAndAcquireMessageQueue( MessageQueueId_t* messageQueueToSet, object_id_t* objectId) { - HasModesIF * destination = objectManager->get(*objectId); + HasModesIF * destination = ObjectManager::instance()->get(*objectId); if(destination == nullptr) { return CommandingServiceBase::INVALID_OBJECT; diff --git a/pus/CService201HealthCommanding.cpp b/pus/CService201HealthCommanding.cpp index ca761f14..52a8a603 100644 --- a/pus/CService201HealthCommanding.cpp +++ b/pus/CService201HealthCommanding.cpp @@ -1,9 +1,11 @@ #include "CService201HealthCommanding.h" +#include "servicepackets/Service201Packets.h" #include "../health/HasHealthIF.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "../serviceinterface/ServiceInterface.h" +#include "../objectmanager/ObjectManager.h" #include "../health/HealthMessage.h" -#include "servicepackets/Service201Packets.h" + CService201HealthCommanding::CService201HealthCommanding(object_id_t objectId, uint16_t apid, uint8_t serviceId, uint8_t numParallelCommands, @@ -43,7 +45,7 @@ ReturnValue_t CService201HealthCommanding::getMessageQueueAndObject( ReturnValue_t CService201HealthCommanding::checkInterfaceAndAcquireMessageQueue( MessageQueueId_t* messageQueueToSet, object_id_t* objectId) { - HasHealthIF * destination = objectManager->get(*objectId); + HasHealthIF * destination = ObjectManager::instance()->get(*objectId); if(destination == nullptr) { return CommandingServiceBase::INVALID_OBJECT; } diff --git a/pus/Service1TelecommandVerification.cpp b/pus/Service1TelecommandVerification.cpp index 7ef08de7..bef7b6b1 100644 --- a/pus/Service1TelecommandVerification.cpp +++ b/pus/Service1TelecommandVerification.cpp @@ -2,6 +2,7 @@ #include "servicepackets/Service1Packets.h" #include "../ipc/QueueFactory.h" +#include "../objectmanager/ObjectManager.h" #include "../tmtcservices/PusVerificationReport.h" #include "../tmtcpacket/pus/TmPacketStored.h" #include "../serviceinterface/ServiceInterfaceStream.h" @@ -99,7 +100,7 @@ ReturnValue_t Service1TelecommandVerification::generateSuccessReport( ReturnValue_t Service1TelecommandVerification::initialize() { // Get target object for TC verification messages - AcceptsTelemetryIF* funnel = objectManager-> + AcceptsTelemetryIF* funnel = ObjectManager::instance()-> get(targetDestination); if(funnel == nullptr){ #if FSFW_CPP_OSTREAM_ENABLED == 1 diff --git a/pus/Service20ParameterManagement.cpp b/pus/Service20ParameterManagement.cpp index 90e96650..8ebc6db0 100644 --- a/pus/Service20ParameterManagement.cpp +++ b/pus/Service20ParameterManagement.cpp @@ -1,11 +1,11 @@ #include "Service20ParameterManagement.h" #include "servicepackets/Service20Packets.h" -#include -#include -#include -#include -#include +#include "../serviceinterface/ServiceInterface.h" +#include "../parameters/HasParametersIF.h" +#include "../parameters/ParameterMessage.h" +#include "../objectmanager/ObjectManager.h" +#include "../parameters/ReceivesParameterMessagesIF.h" Service20ParameterManagement::Service20ParameterManagement(object_id_t objectId, uint16_t apid, @@ -65,7 +65,7 @@ ReturnValue_t Service20ParameterManagement::checkInterfaceAndAcquireMessageQueue MessageQueueId_t* messageQueueToSet, object_id_t* objectId) { // check ReceivesParameterMessagesIF property of target ReceivesParameterMessagesIF* possibleTarget = - objectManager->get(*objectId); + ObjectManager::instance()->get(*objectId); if(possibleTarget == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "Service20ParameterManagement::checkInterfaceAndAcquire" diff --git a/pus/Service20ParameterManagement.h b/pus/Service20ParameterManagement.h index 488edfb5..5370bfcb 100644 --- a/pus/Service20ParameterManagement.h +++ b/pus/Service20ParameterManagement.h @@ -1,7 +1,7 @@ #ifndef FSFW_PUS_SERVICE20PARAMETERMANAGEMENT_H_ #define FSFW_PUS_SERVICE20PARAMETERMANAGEMENT_H_ -#include +#include "../tmtcservices/CommandingServiceBase.h" /** * @brief PUS Service 20 Parameter Service implementation diff --git a/pus/Service2DeviceAccess.cpp b/pus/Service2DeviceAccess.cpp index 72db82df..4cf75d32 100644 --- a/pus/Service2DeviceAccess.cpp +++ b/pus/Service2DeviceAccess.cpp @@ -1,6 +1,7 @@ #include "Service2DeviceAccess.h" #include "servicepackets/Service2Packets.h" +#include "../objectmanager/ObjectManager.h" #include "../devicehandlers/DeviceHandlerIF.h" #include "../storagemanager/StorageManagerIF.h" #include "../devicehandlers/DeviceHandlerMessage.h" @@ -47,7 +48,7 @@ ReturnValue_t Service2DeviceAccess::getMessageQueueAndObject( ReturnValue_t Service2DeviceAccess::checkInterfaceAndAcquireMessageQueue( MessageQueueId_t * messageQueueToSet, object_id_t *objectId) { DeviceHandlerIF* possibleTarget = - objectManager->get(*objectId); + ObjectManager::instance()->get(*objectId); if(possibleTarget == nullptr) { return CommandingServiceBase::INVALID_OBJECT; } diff --git a/pus/Service3Housekeeping.cpp b/pus/Service3Housekeeping.cpp index c4f80c2a..6b1275b3 100644 --- a/pus/Service3Housekeeping.cpp +++ b/pus/Service3Housekeeping.cpp @@ -1,7 +1,8 @@ #include "Service3Housekeeping.h" #include "servicepackets/Service3Packets.h" -#include "../datapoollocal/HasLocalDataPoolIF.h" +#include "../objectmanager/ObjectManager.h" +#include "../datapoollocal/HasLocalDataPoolIF.h" Service3Housekeeping::Service3Housekeeping(object_id_t objectId, uint16_t apid, uint8_t serviceId): @@ -56,7 +57,7 @@ ReturnValue_t Service3Housekeeping::checkInterfaceAndAcquireMessageQueue( MessageQueueId_t* messageQueueToSet, object_id_t* objectId) { // check HasLocalDataPoolIF property of target HasLocalDataPoolIF* possibleTarget = - objectManager->get(*objectId); + ObjectManager::instance()->get(*objectId); if(possibleTarget == nullptr){ return CommandingServiceBase::INVALID_OBJECT; } diff --git a/pus/Service5EventReporting.cpp b/pus/Service5EventReporting.cpp index 62eefcb3..272cc203 100644 --- a/pus/Service5EventReporting.cpp +++ b/pus/Service5EventReporting.cpp @@ -1,7 +1,8 @@ #include "Service5EventReporting.h" #include "servicepackets/Service5Packets.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "../serviceinterface/ServiceInterface.h" +#include "../objectmanager/ObjectManager.h" #include "../events/EventManagerIF.h" #include "../ipc/QueueFactory.h" #include "../tmtcpacket/pus/TmPacketStored.h" @@ -89,7 +90,7 @@ ReturnValue_t Service5EventReporting::handleRequest(uint8_t subservice) { // In addition to the default PUSServiceBase initialization, this service needs // to be registered to the event manager to listen for events. ReturnValue_t Service5EventReporting::initialize() { - EventManagerIF* manager = objectManager->get( + EventManagerIF* manager = ObjectManager::instance()->get( objects::EVENT_MANAGER); if (manager == NULL) { return RETURN_FAILED; diff --git a/pus/Service8FunctionManagement.cpp b/pus/Service8FunctionManagement.cpp index 54187a82..77b7dc80 100644 --- a/pus/Service8FunctionManagement.cpp +++ b/pus/Service8FunctionManagement.cpp @@ -1,11 +1,12 @@ #include "Service8FunctionManagement.h" #include "servicepackets/Service8Packets.h" +#include "../objectmanager/ObjectManager.h" #include "../objectmanager/SystemObjectIF.h" #include "../action/HasActionsIF.h" #include "../devicehandlers/DeviceHandlerIF.h" #include "../serialize/SerializeAdapter.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "../serviceinterface/ServiceInterface.h" Service8FunctionManagement::Service8FunctionManagement(object_id_t objectId, uint16_t apid, uint8_t serviceId, uint8_t numParallelCommands, @@ -41,7 +42,7 @@ ReturnValue_t Service8FunctionManagement::getMessageQueueAndObject( ReturnValue_t Service8FunctionManagement::checkInterfaceAndAcquireMessageQueue( MessageQueueId_t* messageQueueToSet, object_id_t* objectId) { // check HasActionIF property of target - HasActionsIF* possibleTarget = objectManager->get(*objectId); + HasActionsIF* possibleTarget = ObjectManager::instance()->get(*objectId); if(possibleTarget == nullptr){ return CommandingServiceBase::INVALID_OBJECT; } diff --git a/storagemanager/LocalPool.cpp b/storagemanager/LocalPool.cpp index 2b733548..41c9250a 100644 --- a/storagemanager/LocalPool.cpp +++ b/storagemanager/LocalPool.cpp @@ -1,5 +1,8 @@ #include "LocalPool.h" -#include +#include "FSFWConfig.h" + +#include "../objectmanager/ObjectManager.h" + #include LocalPool::LocalPool(object_id_t setObjectId, const LocalPoolConfig& poolConfig, @@ -185,7 +188,7 @@ ReturnValue_t LocalPool::initialize() { if (result != RETURN_OK) { return result; } - internalErrorReporter = objectManager->get( + internalErrorReporter = ObjectManager::instance()->get( objects::INTERNAL_ERROR_REPORTER); if (internalErrorReporter == nullptr){ return ObjectManagerIF::INTERNAL_ERR_REPORTER_UNINIT; diff --git a/subsystem/Subsystem.cpp b/subsystem/Subsystem.cpp index 4de6906c..dffad034 100644 --- a/subsystem/Subsystem.cpp +++ b/subsystem/Subsystem.cpp @@ -1,6 +1,7 @@ #include "Subsystem.h" + #include "../health/HealthMessage.h" -#include "../objectmanager/ObjectManagerIF.h" +#include "../objectmanager/ObjectManager.h" #include "../serialize/SerialArrayListAdapter.h" #include "../serialize/SerialFixedArrayListAdapter.h" #include "../serialize/SerializeElement.h" @@ -477,13 +478,13 @@ ReturnValue_t Subsystem::initialize() { return result; } - IPCStore = objectManager->get(objects::IPC_STORE); + IPCStore = ObjectManager::instance()->get(objects::IPC_STORE); if (IPCStore == NULL) { return RETURN_FAILED; } #if FSFW_USE_MODESTORE == 1 - modeStore = objectManager->get(objects::MODE_STORE); + modeStore = ObjectManager::instance()->get(objects::MODE_STORE); if (modeStore == nullptr) { return RETURN_FAILED; diff --git a/subsystem/SubsystemBase.cpp b/subsystem/SubsystemBase.cpp index 565e0712..0d459324 100644 --- a/subsystem/SubsystemBase.cpp +++ b/subsystem/SubsystemBase.cpp @@ -1,6 +1,7 @@ -#include "../serviceinterface/ServiceInterfaceStream.h" -#include "../serviceinterface/ServiceInterfaceStream.h" -#include "../subsystem/SubsystemBase.h" +#include "SubsystemBase.h" + +#include "../serviceinterface/ServiceInterface.h" +#include "../objectmanager/ObjectManager.h" #include "../ipc/QueueFactory.h" SubsystemBase::SubsystemBase(object_id_t setObjectId, object_id_t parent, @@ -19,10 +20,10 @@ SubsystemBase::~SubsystemBase() { ReturnValue_t SubsystemBase::registerChild(object_id_t objectId) { ChildInfo info; - HasModesIF *child = objectManager->get(objectId); + HasModesIF *child = ObjectManager::instance()->get(objectId); // This is a rather ugly hack to have the changedHealth info for all // children available. - HasHealthIF* healthChild = objectManager->get(objectId); + HasHealthIF* healthChild = ObjectManager::instance()->get(objectId); if (child == nullptr) { if (healthChild == nullptr) { return CHILD_DOESNT_HAVE_MODES; @@ -174,7 +175,7 @@ ReturnValue_t SubsystemBase::initialize() { } if (parentId != objects::NO_OBJECT) { - SubsystemBase *parent = objectManager->get(parentId); + SubsystemBase *parent = ObjectManager::instance()->get(parentId); if (parent == nullptr) { return RETURN_FAILED; } diff --git a/subsystem/modes/ModeSequenceMessage.cpp b/subsystem/modes/ModeSequenceMessage.cpp index 7733098e..749a90bf 100644 --- a/subsystem/modes/ModeSequenceMessage.cpp +++ b/subsystem/modes/ModeSequenceMessage.cpp @@ -1,6 +1,6 @@ #include "ModeSequenceMessage.h" -#include "../../objectmanager/ObjectManagerIF.h" +#include "../../objectmanager/ObjectManager.h" #include "../../storagemanager/StorageManagerIF.h" void ModeSequenceMessage::setModeSequenceMessage(CommandMessage* message, @@ -50,7 +50,7 @@ void ModeSequenceMessage::clear(CommandMessage *message) { case TABLE_LIST: case TABLE: case SEQUENCE: { - StorageManagerIF *ipcStore = objectManager->get( + StorageManagerIF *ipcStore = ObjectManager::instance()->get( objects::IPC_STORE); if (ipcStore != nullptr){ ipcStore->deleteData(ModeSequenceMessage::getStoreAddress(message)); diff --git a/tcdistribution/CCSDSDistributor.cpp b/tcdistribution/CCSDSDistributor.cpp index 62cbfbf2..7380866a 100644 --- a/tcdistribution/CCSDSDistributor.cpp +++ b/tcdistribution/CCSDSDistributor.cpp @@ -1,5 +1,6 @@ #include "CCSDSDistributor.h" +#include "../objectmanager/ObjectManager.h" #include "../serviceinterface/ServiceInterface.h" #include "../tmtcpacket/SpacePacketBase.h" @@ -86,7 +87,7 @@ uint16_t CCSDSDistributor::getIdentifier() { ReturnValue_t CCSDSDistributor::initialize() { ReturnValue_t status = this->TcDistributor::initialize(); - this->tcStore = objectManager->get( objects::TC_STORE ); + this->tcStore = ObjectManager::instance()->get( objects::TC_STORE ); if (this->tcStore == nullptr) { #if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 diff --git a/tcdistribution/PUSDistributor.cpp b/tcdistribution/PUSDistributor.cpp index abdd1f8d..0fac9ba0 100644 --- a/tcdistribution/PUSDistributor.cpp +++ b/tcdistribution/PUSDistributor.cpp @@ -1,6 +1,7 @@ #include "CCSDSDistributorIF.h" #include "PUSDistributor.h" +#include "../objectmanager/ObjectManager.h" #include "../serviceinterface/ServiceInterface.h" #include "../tmtcpacket/pus/TcPacketStored.h" #include "../tmtcservices/PusVerificationReport.h" @@ -125,7 +126,7 @@ ReturnValue_t PUSDistributor::initialize() { } CCSDSDistributorIF* ccsdsDistributor = - objectManager->get(packetSource); + ObjectManager::instance()->get(packetSource); if (ccsdsDistributor == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "PUSDistributor::initialize: Packet source invalid" << std::endl; diff --git a/thermal/Heater.cpp b/thermal/Heater.cpp index 77049438..f97cb543 100644 --- a/thermal/Heater.cpp +++ b/thermal/Heater.cpp @@ -1,5 +1,6 @@ #include "Heater.h" +#include "../objectmanager/ObjectManager.h" #include "../devicehandlers/DeviceHandlerFailureIsolation.h" #include "../power/Fuse.h" #include "../ipc/QueueFactory.h" @@ -239,7 +240,7 @@ ReturnValue_t Heater::initialize() { return result; } - EventManagerIF* manager = objectManager->get( + EventManagerIF* manager = ObjectManager::instance()->get( objects::EVENT_MANAGER); if (manager == NULL) { return HasReturnvaluesIF::RETURN_FAILED; @@ -249,7 +250,7 @@ ReturnValue_t Heater::initialize() { return result; } - ConfirmsFailuresIF* pcdu = objectManager->get( + ConfirmsFailuresIF* pcdu = ObjectManager::instance()->get( DeviceHandlerFailureIsolation::powerConfirmationId); if (pcdu == NULL) { return HasReturnvaluesIF::RETURN_FAILED; diff --git a/tmstorage/TmStoreMessage.cpp b/tmstorage/TmStoreMessage.cpp index 033cbb1d..11af6121 100644 --- a/tmstorage/TmStoreMessage.cpp +++ b/tmstorage/TmStoreMessage.cpp @@ -1,5 +1,5 @@ #include "TmStoreMessage.h" -#include "../objectmanager/ObjectManagerIF.h" +#include "../objectmanager/ObjectManager.h" TmStoreMessage::~TmStoreMessage() { @@ -64,7 +64,7 @@ void TmStoreMessage::clear(CommandMessage* cmd) { case INDEX_REPORT: case DELETE_STORE_CONTENT_TIME: case DOWNLINK_STORE_CONTENT_TIME: { - StorageManagerIF *ipcStore = objectManager->get( + StorageManagerIF *ipcStore = ObjectManager::instance()->get( objects::IPC_STORE); if (ipcStore != NULL) { ipcStore->deleteData(getStoreId(cmd)); diff --git a/tmtcpacket/pus/TcPacketStored.cpp b/tmtcpacket/pus/TcPacketStored.cpp index f320386c..36fa8d11 100644 --- a/tmtcpacket/pus/TcPacketStored.cpp +++ b/tmtcpacket/pus/TcPacketStored.cpp @@ -1,6 +1,7 @@ #include "TcPacketStored.h" -#include "../../objectmanager/ObjectManagerIF.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" + +#include "../../objectmanager/ObjectManager.h" +#include "../../serviceinterface/ServiceInterface.h" #include @@ -63,7 +64,7 @@ ReturnValue_t TcPacketStored::deletePacket() { bool TcPacketStored::checkAndSetStore() { if (this->store == nullptr) { - this->store = objectManager->get(objects::TC_STORE); + this->store = ObjectManager::instance()->get(objects::TC_STORE); if (this->store == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "TcPacketStored::TcPacketStored: TC Store not found!" diff --git a/tmtcpacket/pus/TmPacketBase.cpp b/tmtcpacket/pus/TmPacketBase.cpp index 25193c92..acd69b65 100644 --- a/tmtcpacket/pus/TmPacketBase.cpp +++ b/tmtcpacket/pus/TmPacketBase.cpp @@ -2,7 +2,7 @@ #include "../../globalfunctions/CRC.h" #include "../../globalfunctions/arrayprinter.h" -#include "../../objectmanager/ObjectManagerIF.h" +#include "../../objectmanager/ObjectManager.h" #include "../../serviceinterface/ServiceInterface.h" #include "../../timemanager/CCSDSTime.h" @@ -53,7 +53,7 @@ void TmPacketBase::print() { bool TmPacketBase::checkAndSetStamper() { if (timeStamper == NULL) { - timeStamper = objectManager->get(timeStamperId); + timeStamper = ObjectManager::instance()->get(timeStamperId); if (timeStamper == NULL) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::warning << "TmPacketBase::checkAndSetStamper: Stamper not found!" << std::endl; diff --git a/tmtcpacket/pus/TmPacketStoredBase.cpp b/tmtcpacket/pus/TmPacketStoredBase.cpp index 3ab31a80..eeaa938d 100644 --- a/tmtcpacket/pus/TmPacketStoredBase.cpp +++ b/tmtcpacket/pus/TmPacketStoredBase.cpp @@ -1,7 +1,7 @@ #include "TmPacketStoredBase.h" -#include "../../objectmanager/ObjectManagerIF.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "../../objectmanager/ObjectManager.h" +#include "../../serviceinterface/ServiceInterface.h" #include "../../tmtcservices/TmTcMessage.h" #include @@ -48,7 +48,7 @@ void TmPacketStoredBase::setStoreAddress(store_address_t setAddress) { bool TmPacketStoredBase::checkAndSetStore() { if (store == nullptr) { - store = objectManager->get(objects::TM_STORE); + store = ObjectManager::instance()->get(objects::TM_STORE); if (store == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "TmPacketStored::TmPacketStored: TM Store not found!" @@ -83,7 +83,7 @@ ReturnValue_t TmPacketStoredBase::sendPacket(MessageQueueId_t destination, void TmPacketStoredBase::checkAndReportLostTm() { if (internalErrorReporter == nullptr) { - internalErrorReporter = objectManager->get( + internalErrorReporter = ObjectManager::instance()->get( objects::INTERNAL_ERROR_REPORTER); } if (internalErrorReporter != nullptr) { diff --git a/tmtcservices/CommandingServiceBase.cpp b/tmtcservices/CommandingServiceBase.cpp index fbd29468..863cba4f 100644 --- a/tmtcservices/CommandingServiceBase.cpp +++ b/tmtcservices/CommandingServiceBase.cpp @@ -4,7 +4,7 @@ #include #include "../tcdistribution/PUSDistributorIF.h" -#include "../objectmanager/ObjectManagerIF.h" +#include "../objectmanager/ObjectManager.h" #include "../ipc/QueueFactory.h" #include "../tmtcpacket/pus/TcPacketStored.h" #include "../tmtcpacket/pus/TmPacketStored.h" @@ -68,12 +68,12 @@ ReturnValue_t CommandingServiceBase::initialize() { packetDestination = defaultPacketDestination; } AcceptsTelemetryIF* packetForwarding = - objectManager->get(packetDestination); + ObjectManager::instance()->get(packetDestination); if(packetSource == objects::NO_OBJECT) { packetSource = defaultPacketSource; } - PUSDistributorIF* distributor = objectManager->get( + PUSDistributorIF* distributor = ObjectManager::instance()->get( packetSource); if (packetForwarding == nullptr or distributor == nullptr) { @@ -88,8 +88,8 @@ ReturnValue_t CommandingServiceBase::initialize() { requestQueue->setDefaultDestination( packetForwarding->getReportReceptionQueue()); - IPCStore = objectManager->get(objects::IPC_STORE); - TCStore = objectManager->get(objects::TC_STORE); + IPCStore = ObjectManager::instance()->get(objects::IPC_STORE); + TCStore = ObjectManager::instance()->get(objects::TC_STORE); if (IPCStore == nullptr or TCStore == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 diff --git a/tmtcservices/PusServiceBase.cpp b/tmtcservices/PusServiceBase.cpp index 0a5cb202..811c9bcb 100644 --- a/tmtcservices/PusServiceBase.cpp +++ b/tmtcservices/PusServiceBase.cpp @@ -3,7 +3,8 @@ #include "PusVerificationReport.h" #include "TmTcMessage.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "../objectmanager/ObjectManager.h" +#include "../serviceinterface/ServiceInterface.h" #include "../tcdistribution/PUSDistributorIF.h" #include "../ipc/QueueFactory.h" @@ -105,9 +106,9 @@ ReturnValue_t PusServiceBase::initialize() { if (result != RETURN_OK) { return result; } - AcceptsTelemetryIF* destService = objectManager->get( + AcceptsTelemetryIF* destService = ObjectManager::instance()->get( packetDestination); - PUSDistributorIF* distributor = objectManager->get( + PUSDistributorIF* distributor = ObjectManager::instance()->get( packetSource); if (destService == nullptr or distributor == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 diff --git a/tmtcservices/TmTcBridge.cpp b/tmtcservices/TmTcBridge.cpp index 1257ef89..7198bc76 100644 --- a/tmtcservices/TmTcBridge.cpp +++ b/tmtcservices/TmTcBridge.cpp @@ -1,5 +1,6 @@ #include "TmTcBridge.h" +#include "../objectmanager/ObjectManager.h" #include "../ipc/QueueFactory.h" #include "../serviceinterface/ServiceInterface.h" #include "../globalfunctions/arrayprinter.h" @@ -53,7 +54,7 @@ ReturnValue_t TmTcBridge::setMaxNumberOfPacketsStored( } ReturnValue_t TmTcBridge::initialize() { - tcStore = objectManager->get(tcStoreId); + tcStore = ObjectManager::instance()->get(tcStoreId); if (tcStore == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "TmTcBridge::initialize: TC store invalid. Make sure" @@ -61,7 +62,7 @@ ReturnValue_t TmTcBridge::initialize() { #endif return ObjectManagerIF::CHILD_INIT_FAILED; } - tmStore = objectManager->get(tmStoreId); + tmStore = ObjectManager::instance()->get(tmStoreId); if (tmStore == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "TmTcBridge::initialize: TM store invalid. Make sure" @@ -70,7 +71,7 @@ ReturnValue_t TmTcBridge::initialize() { return ObjectManagerIF::CHILD_INIT_FAILED; } AcceptsTelecommandsIF* tcDistributor = - objectManager->get(tcDestination); + ObjectManager::instance()->get(tcDestination); if (tcDistributor == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "TmTcBridge::initialize: TC Distributor invalid" diff --git a/tmtcservices/VerificationReporter.cpp b/tmtcservices/VerificationReporter.cpp index ff6f54f9..998cbfb6 100644 --- a/tmtcservices/VerificationReporter.cpp +++ b/tmtcservices/VerificationReporter.cpp @@ -2,8 +2,9 @@ #include "AcceptsVerifyMessageIF.h" #include "PusVerificationReport.h" +#include "../objectmanager/ObjectManager.h" #include "../ipc/MessageQueueIF.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "../serviceinterface/ServiceInterface.h" #include "../objectmanager/frameworkObjects.h" object_id_t VerificationReporter::messageReceiver = @@ -104,7 +105,7 @@ void VerificationReporter::initialize() { #endif return; } - AcceptsVerifyMessageIF* temp = objectManager->get( + AcceptsVerifyMessageIF* temp = ObjectManager::instance()->get( messageReceiver); if (temp == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 diff --git a/unittest/tests/datapoollocal/DataSetTest.cpp b/unittest/tests/datapoollocal/DataSetTest.cpp index d0b13e86..b8748eb4 100644 --- a/unittest/tests/datapoollocal/DataSetTest.cpp +++ b/unittest/tests/datapoollocal/DataSetTest.cpp @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -12,7 +13,7 @@ #include TEST_CASE("DataSetTest" , "[DataSetTest]") { - LocalPoolOwnerBase* poolOwner = objectManager-> + LocalPoolOwnerBase* poolOwner = ObjectManager::instance()-> get(objects::TEST_LOCAL_POOL_OWNER_BASE); REQUIRE(poolOwner != nullptr); REQUIRE(poolOwner->initializeHkManager() == retval::CATCH_OK); diff --git a/unittest/tests/datapoollocal/LocalPoolManagerTest.cpp b/unittest/tests/datapoollocal/LocalPoolManagerTest.cpp index 52485b01..4a4d08fb 100644 --- a/unittest/tests/datapoollocal/LocalPoolManagerTest.cpp +++ b/unittest/tests/datapoollocal/LocalPoolManagerTest.cpp @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -14,7 +15,7 @@ TEST_CASE("LocalPoolManagerTest" , "[LocManTest]") { - LocalPoolOwnerBase* poolOwner = objectManager-> + LocalPoolOwnerBase* poolOwner = ObjectManager::instance()-> get(objects::TEST_LOCAL_POOL_OWNER_BASE); REQUIRE(poolOwner != nullptr); REQUIRE(poolOwner->initializeHkManager() == retval::CATCH_OK); diff --git a/unittest/tests/datapoollocal/LocalPoolVariableTest.cpp b/unittest/tests/datapoollocal/LocalPoolVariableTest.cpp index 980ffda1..514d8125 100644 --- a/unittest/tests/datapoollocal/LocalPoolVariableTest.cpp +++ b/unittest/tests/datapoollocal/LocalPoolVariableTest.cpp @@ -1,12 +1,13 @@ #include "LocalPoolOwnerBase.h" #include +#include #include #include TEST_CASE("LocalPoolVariable" , "[LocPoolVarTest]") { - LocalPoolOwnerBase* poolOwner = objectManager-> + LocalPoolOwnerBase* poolOwner = ObjectManager::instance()-> get(objects::TEST_LOCAL_POOL_OWNER_BASE); REQUIRE(poolOwner != nullptr); REQUIRE(poolOwner->initializeHkManager() == retval::CATCH_OK); diff --git a/unittest/tests/datapoollocal/LocalPoolVectorTest.cpp b/unittest/tests/datapoollocal/LocalPoolVectorTest.cpp index db76fc00..5b3dd105 100644 --- a/unittest/tests/datapoollocal/LocalPoolVectorTest.cpp +++ b/unittest/tests/datapoollocal/LocalPoolVectorTest.cpp @@ -1,11 +1,12 @@ #include "LocalPoolOwnerBase.h" #include +#include #include #include TEST_CASE("LocalPoolVector" , "[LocPoolVecTest]") { - LocalPoolOwnerBase* poolOwner = objectManager-> + LocalPoolOwnerBase* poolOwner = ObjectManager::instance()-> get(objects::TEST_LOCAL_POOL_OWNER_BASE); REQUIRE(poolOwner != nullptr); REQUIRE(poolOwner->initializeHkManager() == retval::CATCH_OK); diff --git a/unittest/user/unittest/core/CatchDefinitions.cpp b/unittest/user/unittest/core/CatchDefinitions.cpp index bae02875..c44a561e 100644 --- a/unittest/user/unittest/core/CatchDefinitions.cpp +++ b/unittest/user/unittest/core/CatchDefinitions.cpp @@ -1,10 +1,10 @@ #include "CatchDefinitions.h" #include -#include +#include StorageManagerIF* tglob::getIpcStoreHandle() { - if(objectManager != nullptr) { - return objectManager->get(objects::IPC_STORE); + if(ObjectManager::instance() != nullptr) { + return ObjectManager::instance()->get(objects::IPC_STORE); } else { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "Global object manager uninitialized" << std::endl; diff --git a/unittest/user/unittest/core/CatchFactory.h b/unittest/user/unittest/core/CatchFactory.h index f06e7ae5..024f762e 100644 --- a/unittest/user/unittest/core/CatchFactory.h +++ b/unittest/user/unittest/core/CatchFactory.h @@ -8,7 +8,7 @@ namespace Factory { * @brief Creates all SystemObject elements which are persistent * during execution. */ - void produce(); + void produce(void* args); void setStaticFrameworkObjectIds(); } From 145dd33fb1e467ef7370ccd44671a91d96c60e26 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 5 Jun 2021 20:30:36 +0200 Subject: [PATCH 120/389] fixed merge conflict --- osal/linux/MessageQueue.cpp | 43 ++----------------------------------- 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/osal/linux/MessageQueue.cpp b/osal/linux/MessageQueue.cpp index 75376798..3c151143 100644 --- a/osal/linux/MessageQueue.cpp +++ b/osal/linux/MessageQueue.cpp @@ -252,48 +252,9 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo, bool ignoreFault) { if(message == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 -<<<<<<< HEAD - sif::error << "MessageQueue::sendMessageFromMessageQueue: Message is " - "nullptr!" << std::endl; -#endif - return HasReturnvaluesIF::RETURN_FAILED; - } - - message->setSender(sentFrom); - int result = mq_send(sendTo, - reinterpret_cast(message->getBuffer()), - message->getMessageSize(),0); - - //TODO: Check if we're in ISR. - if (result != 0) { - if(!ignoreFault){ - InternalErrorReporterIF* internalErrorReporter = - ObjectManager::instance()->get( - objects::INTERNAL_ERROR_REPORTER); - if (internalErrorReporter != NULL) { - internalErrorReporter->queueMessageNotSent(); - } - } - switch(errno){ - case EAGAIN: - //The O_NONBLOCK flag was set when opening the queue, or the - //MQ_NONBLOCK flag was set in its attributes, and the - //specified queue is full. - return MessageQueueIF::FULL; - case EBADF: { - //mq_des doesn't represent a valid message queue descriptor, - //or mq_des wasn't opened for writing. -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "MessageQueue::sendMessage: Configuration error, MQ" - << " destination invalid." << std::endl; - sif::error << strerror(errno) << " in " - <<"mq_send to: " << sendTo << " sent from " - << sentFrom << std::endl; -======= sif::error << "MessageQueue::sendMessageFromMessageQueue: Message is nullptr!" << std::endl; #else sif::printError("MessageQueue::sendMessageFromMessageQueue: Message is nullptr!\n"); ->>>>>>> 38910143400e455f5184ad85be98e05638c2eea6 #endif return HasReturnvaluesIF::RETURN_FAILED; } @@ -306,8 +267,8 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo, //TODO: Check if we're in ISR. if (result != 0) { if(!ignoreFault){ - InternalErrorReporterIF* internalErrorReporter = - objectManager->get(objects::INTERNAL_ERROR_REPORTER); + InternalErrorReporterIF* internalErrorReporter = ObjectManager::instance()-> + get(objects::INTERNAL_ERROR_REPORTER); if (internalErrorReporter != NULL) { internalErrorReporter->queueMessageNotSent(); } From 0157681471f16bf9f6412c1f27d1739c9ac1e6c9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 8 Jun 2021 14:27:21 +0200 Subject: [PATCH 121/389] removed obsolete code --- objectmanager/ObjectManager.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/objectmanager/ObjectManager.h b/objectmanager/ObjectManager.h index 1d4c3185..2ca52028 100644 --- a/objectmanager/ObjectManager.h +++ b/objectmanager/ObjectManager.h @@ -68,12 +68,6 @@ private: static ObjectManager* objManagerInstance; }; -/** - * @brief This is the forward declaration of the global objectManager instance. - */ -// SHOULDDO: maybe put this in the glob namespace to explicitely mark it global? -//extern ObjectManagerIF *objectManager; - /*Documentation can be found in the class method declaration above.*/ template T* ObjectManager::get( object_id_t id ) { From 75adf52d282f26e92d5640e8bd6f285ef0f74f79 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 8 Jun 2021 14:30:35 +0200 Subject: [PATCH 122/389] small update --- objectmanager/ObjectManager.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objectmanager/ObjectManager.h b/objectmanager/ObjectManager.h index 2ca52028..9f5f0c37 100644 --- a/objectmanager/ObjectManager.h +++ b/objectmanager/ObjectManager.h @@ -68,7 +68,7 @@ private: static ObjectManager* objManagerInstance; }; -/*Documentation can be found in the class method declaration above.*/ +// Documentation can be found in the class method declaration above template T* ObjectManager::get( object_id_t id ) { SystemObjectIF* temp = this->getSystemObject(id); From 40b2979ce841261083884234da595cc1347b285c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 8 Jun 2021 15:03:17 +0200 Subject: [PATCH 123/389] added generic file system message --- memory/CMakeLists.txt | 8 +- memory/GenericFileSystemMessage.cpp | 132 ++++++++++++++++++++++++++++ memory/GenericFileSystemMessage.h | 113 ++++++++++++++++++++++++ 3 files changed, 249 insertions(+), 4 deletions(-) create mode 100644 memory/GenericFileSystemMessage.cpp create mode 100644 memory/GenericFileSystemMessage.h diff --git a/memory/CMakeLists.txt b/memory/CMakeLists.txt index 9edb9031..c713cd42 100644 --- a/memory/CMakeLists.txt +++ b/memory/CMakeLists.txt @@ -1,5 +1,5 @@ -target_sources(${LIB_FSFW_NAME} - PRIVATE - MemoryHelper.cpp - MemoryMessage.cpp +target_sources(${LIB_FSFW_NAME} PRIVATE + MemoryHelper.cpp + MemoryMessage.cpp + GenericFileSystemMessage.cpp ) \ No newline at end of file diff --git a/memory/GenericFileSystemMessage.cpp b/memory/GenericFileSystemMessage.cpp new file mode 100644 index 00000000..d9355567 --- /dev/null +++ b/memory/GenericFileSystemMessage.cpp @@ -0,0 +1,132 @@ +#include "GenericFileSystemMessage.h" + + +void GenericFileSystemMessage::setCreateFileCommand(CommandMessage* message, + store_address_t storeId) { + message->setCommand(CMD_CREATE_FILE); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setDeleteFileCommand( + CommandMessage* message, store_address_t storeId) { + message->setCommand(CMD_DELETE_FILE); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setCreateDirectoryCommand( + CommandMessage* message, store_address_t storeId) { + message->setCommand(CMD_CREATE_DIRECTORY); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setReportFileAttributesCommand(CommandMessage *message, + store_address_t storeId) { + message->setCommand(CMD_REPORT_FILE_ATTRIBUTES); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setReportFileAttributesReply(CommandMessage *message, + store_address_t storeId) { + message->setCommand(REPLY_REPORT_FILE_ATTRIBUTES); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setDeleteDirectoryCommand(CommandMessage* message, + store_address_t storeId) { + message->setCommand(CMD_DELETE_DIRECTORY); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setLockFileCommand(CommandMessage *message, + store_address_t storeId) { + message->setCommand(CMD_LOCK_FILE); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setUnlockFileCommand(CommandMessage *message, + store_address_t storeId) { + message->setCommand(CMD_UNLOCK_FILE); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setSuccessReply(CommandMessage *message) { + message->setCommand(COMPLETION_SUCCESS); +} + +void GenericFileSystemMessage::setFailureReply(CommandMessage *message, + ReturnValue_t errorCode, uint32_t errorParam) { + message->setCommand(COMPLETION_FAILED); + message->setParameter(errorCode); + message->setParameter2(errorParam); +} + +store_address_t GenericFileSystemMessage::getStoreId(const CommandMessage* message) { + store_address_t temp; + temp.raw = message->getParameter2(); + return temp; +} + +ReturnValue_t GenericFileSystemMessage::getFailureReply( + const CommandMessage *message, uint32_t* errorParam) { + if(errorParam != nullptr) { + *errorParam = message->getParameter2(); + } + return message->getParameter(); +} + +void GenericFileSystemMessage::setFinishStopWriteCommand(CommandMessage *message, + store_address_t storeId) { + message->setCommand(CMD_FINISH_APPEND_TO_FILE); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setFinishStopWriteReply(CommandMessage *message, + store_address_t storeId) { + message->setCommand(REPLY_FINISH_APPEND); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setCopyCommand(CommandMessage* message, + store_address_t storeId) { + message->setCommand(CMD_COPY_FILE); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setWriteCommand(CommandMessage* message, + store_address_t storeId) { + message->setCommand(CMD_APPEND_TO_FILE); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setReadCommand(CommandMessage* message, + store_address_t storeId) { + message->setCommand(CMD_READ_FROM_FILE); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setFinishAppendReply(CommandMessage* message, + store_address_t storageID) { + message->setCommand(REPLY_FINISH_APPEND); + message->setParameter2(storageID.raw); +} + +void GenericFileSystemMessage::setReadReply(CommandMessage* message, + bool readFinished, store_address_t storeId) { + message->setCommand(REPLY_READ_FROM_FILE); + message->setParameter(readFinished); + message->setParameter2(storeId.raw); +} + +void GenericFileSystemMessage::setReadFinishedReply(CommandMessage *message, + store_address_t storeId) { + message->setCommand(REPLY_READ_FINISHED_STOP); + message->setParameter2(storeId.raw); +} + +bool GenericFileSystemMessage::getReadReply(const CommandMessage *message, + store_address_t *storeId) { + if(storeId != nullptr) { + (*storeId).raw = message->getParameter2(); + } + return message->getParameter(); +} diff --git a/memory/GenericFileSystemMessage.h b/memory/GenericFileSystemMessage.h new file mode 100644 index 00000000..1a19a69b --- /dev/null +++ b/memory/GenericFileSystemMessage.h @@ -0,0 +1,113 @@ +#ifndef MISSION_MEMORY_GENERICFILESYSTEMMESSAGE_H_ +#define MISSION_MEMORY_GENERICFILESYSTEMMESSAGE_H_ + +#include + +#include +#include +#include +#include + +/** + * @brief These messages are sent to an object implementing HasFilesystemIF. + * @details + * Enables a message-based file management. The user can add custo commands be implementing + * this generic class. + * @author Jakob Meier, R. Mueller + */ +class GenericFileSystemMessage { +public: + /* Instantiation forbidden */ + GenericFileSystemMessage() = delete; + + static const uint8_t MESSAGE_ID = messagetypes::FILE_SYSTEM_MESSAGE; + /* PUS standard (ECSS-E-ST-70-41C15 2016 p.654) */ + static const Command_t CMD_CREATE_FILE = MAKE_COMMAND_ID(1); + static const Command_t CMD_DELETE_FILE = MAKE_COMMAND_ID(2); + /** Report file attributes */ + static const Command_t CMD_REPORT_FILE_ATTRIBUTES = MAKE_COMMAND_ID(3); + static const Command_t REPLY_REPORT_FILE_ATTRIBUTES = MAKE_COMMAND_ID(4); + /** Command to lock a file, setting it read-only */ + static const Command_t CMD_LOCK_FILE = MAKE_COMMAND_ID(5); + /** Command to unlock a file, enabling further operations on it */ + static const Command_t CMD_UNLOCK_FILE = MAKE_COMMAND_ID(6); + /** + * Find file in repository, using a search pattern. + * Please note that * is the wildcard character. + * For example, when looking for all files which start with have the + * structure tm.bin, tm*.bin can be used. + */ + static const Command_t CMD_FIND_FILE = MAKE_COMMAND_ID(7); + static const Command_t CMD_CREATE_DIRECTORY = MAKE_COMMAND_ID(9); + static const Command_t CMD_DELETE_DIRECTORY = MAKE_COMMAND_ID(10); + static const Command_t CMD_RENAME_DIRECTORY = MAKE_COMMAND_ID(11); + + /** Dump contents of a repository */ + static const Command_t CMD_DUMP_REPOSITORY = MAKE_COMMAND_ID(12); + /** Repository dump reply */ + static const Command_t REPLY_DUMY_REPOSITORY = MAKE_COMMAND_ID(13); + static constexpr Command_t CMD_COPY_FILE = MAKE_COMMAND_ID(14); + static constexpr Command_t CMD_MOVE_FILE = MAKE_COMMAND_ID(15); + + static const Command_t COMPLETION_SUCCESS = MAKE_COMMAND_ID(128); + static const Command_t COMPLETION_FAILED = MAKE_COMMAND_ID(129); + + // These command IDs will remain until CFDP has been introduced and consolidated. + /** Append operation commands */ + static const Command_t CMD_APPEND_TO_FILE = MAKE_COMMAND_ID(130); + static const Command_t CMD_FINISH_APPEND_TO_FILE = MAKE_COMMAND_ID(131); + static const Command_t REPLY_FINISH_APPEND = MAKE_COMMAND_ID(132); + + static const Command_t CMD_READ_FROM_FILE = MAKE_COMMAND_ID(140); + static const Command_t REPLY_READ_FROM_FILE = MAKE_COMMAND_ID(141); + static const Command_t CMD_STOP_READ = MAKE_COMMAND_ID(142); + static const Command_t REPLY_READ_FINISHED_STOP = MAKE_COMMAND_ID(143); + + static void setLockFileCommand(CommandMessage* message, store_address_t storeId); + static void setUnlockFileCommand(CommandMessage* message, store_address_t storeId); + + static void setCreateFileCommand(CommandMessage* message, + store_address_t storeId); + static void setDeleteFileCommand(CommandMessage* message, + store_address_t storeId); + + static void setReportFileAttributesCommand(CommandMessage* message, + store_address_t storeId); + static void setReportFileAttributesReply(CommandMessage* message, + store_address_t storeId); + + static void setCreateDirectoryCommand(CommandMessage* message, + store_address_t storeId); + static void setDeleteDirectoryCommand(CommandMessage* message, + store_address_t storeId); + + static void setSuccessReply(CommandMessage* message); + static void setFailureReply(CommandMessage* message, + ReturnValue_t errorCode, uint32_t errorParam = 0); + static void setCopyCommand(CommandMessage* message, store_address_t storeId); + + static void setWriteCommand(CommandMessage* message, + store_address_t storeId); + static void setFinishStopWriteCommand(CommandMessage* message, + store_address_t storeId); + static void setFinishStopWriteReply(CommandMessage* message, + store_address_t storeId); + static void setFinishAppendReply(CommandMessage* message, + store_address_t storeId); + + static void setReadCommand(CommandMessage* message, + store_address_t storeId); + static void setReadFinishedReply(CommandMessage* message, + store_address_t storeId); + static void setReadReply(CommandMessage* message, bool readFinished, + store_address_t storeId); + static bool getReadReply(const CommandMessage* message, + store_address_t* storeId); + + static store_address_t getStoreId(const CommandMessage* message); + static ReturnValue_t getFailureReply(const CommandMessage* message, + uint32_t* errorParam = nullptr); + +}; + +#endif /* MISSION_MEMORY_GENERICFILESYSTEMMESSAGE_H_ */ From fb7b059137ca873b405b95f8d3072f4ae85ce2ff Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 8 Jun 2021 15:13:49 +0200 Subject: [PATCH 124/389] added clear message --- ipc/CommandMessageCleaner.cpp | 4 ++++ memory/GenericFileSystemMessage.cpp | 4 ++++ memory/GenericFileSystemMessage.h | 2 ++ 3 files changed, 10 insertions(+) diff --git a/ipc/CommandMessageCleaner.cpp b/ipc/CommandMessageCleaner.cpp index 6a364069..29998124 100644 --- a/ipc/CommandMessageCleaner.cpp +++ b/ipc/CommandMessageCleaner.cpp @@ -1,5 +1,6 @@ #include "CommandMessageCleaner.h" +#include "../memory/GenericFileSystemMessage.h" #include "../devicehandlers/DeviceHandlerMessage.h" #include "../health/HealthMessage.h" #include "../memory/MemoryMessage.h" @@ -42,6 +43,9 @@ void CommandMessageCleaner::clearCommandMessage(CommandMessage* message) { case messagetypes::HOUSEKEEPING: HousekeepingMessage::clear(message); break; + case messagetypes::FILE_SYSTEM_MESSAGE: + GenericFileSystemMessage::clear(message); + break; default: messagetypes::clearMissionMessage(message); break; diff --git a/memory/GenericFileSystemMessage.cpp b/memory/GenericFileSystemMessage.cpp index d9355567..e4edc7ac 100644 --- a/memory/GenericFileSystemMessage.cpp +++ b/memory/GenericFileSystemMessage.cpp @@ -130,3 +130,7 @@ bool GenericFileSystemMessage::getReadReply(const CommandMessage *message, } return message->getParameter(); } + +ReturnValue_t GenericFileSystemMessage::clear(CommandMessage* message) { + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/memory/GenericFileSystemMessage.h b/memory/GenericFileSystemMessage.h index 1a19a69b..6351dab9 100644 --- a/memory/GenericFileSystemMessage.h +++ b/memory/GenericFileSystemMessage.h @@ -108,6 +108,8 @@ public: static ReturnValue_t getFailureReply(const CommandMessage* message, uint32_t* errorParam = nullptr); + static ReturnValue_t clear(CommandMessage* message); + }; #endif /* MISSION_MEMORY_GENERICFILESYSTEMMESSAGE_H_ */ From 1630682548a8775bd0c293b3c76c29e120de5bf0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 11 Jun 2021 14:52:09 +0200 Subject: [PATCH 125/389] added function to set color --- serviceinterface/ServiceInterfaceBuffer.cpp | 4 ++++ serviceinterface/ServiceInterfaceBuffer.h | 1 + serviceinterface/ServiceInterfaceStream.cpp | 4 ++++ serviceinterface/ServiceInterfaceStream.h | 2 ++ 4 files changed, 11 insertions(+) diff --git a/serviceinterface/ServiceInterfaceBuffer.cpp b/serviceinterface/ServiceInterfaceBuffer.cpp index ccc051c3..a6a2cb71 100644 --- a/serviceinterface/ServiceInterfaceBuffer.cpp +++ b/serviceinterface/ServiceInterfaceBuffer.cpp @@ -171,6 +171,10 @@ bool ServiceInterfaceBuffer::crAdditionEnabled() const { return addCrToPreamble; } +void ServiceInterfaceBuffer::setAsciiColorPrefix(std::string colorPrefix) { + this->colorPrefix = colorPrefix; +} + #ifdef UT699 #include "../osal/rtems/Interrupt.h" diff --git a/serviceinterface/ServiceInterfaceBuffer.h b/serviceinterface/ServiceInterfaceBuffer.h index 9d3ce069..ad1148a2 100644 --- a/serviceinterface/ServiceInterfaceBuffer.h +++ b/serviceinterface/ServiceInterfaceBuffer.h @@ -48,6 +48,7 @@ private: #if FSFW_COLORED_OUTPUT == 1 std::string colorPrefix; + void setAsciiColorPrefix(std::string colorPrefix); #endif // For EOF detection diff --git a/serviceinterface/ServiceInterfaceStream.cpp b/serviceinterface/ServiceInterfaceStream.cpp index ad14cd04..be8dc770 100644 --- a/serviceinterface/ServiceInterfaceStream.cpp +++ b/serviceinterface/ServiceInterfaceStream.cpp @@ -19,5 +19,9 @@ bool ServiceInterfaceStream::crAdditionEnabled() const { return streambuf.crAdditionEnabled(); } +bool ServiceInterfaceStream::setAsciiColorPrefix(std::string asciiColorCode) { + streambuf.setAsciiColorPrefix(asciiColorCode); +} + #endif diff --git a/serviceinterface/ServiceInterfaceStream.h b/serviceinterface/ServiceInterfaceStream.h index 0ea44f0b..3c788b3c 100644 --- a/serviceinterface/ServiceInterfaceStream.h +++ b/serviceinterface/ServiceInterfaceStream.h @@ -46,6 +46,8 @@ public: */ bool crAdditionEnabled() const; + bool setAsciiColorPrefix(std::string asciiColorCode); + protected: ServiceInterfaceBuffer streambuf; }; From 589e64fc467cbf5cac5e721a896564c811cd25c6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 11 Jun 2021 15:05:43 +0200 Subject: [PATCH 126/389] void function now --- serviceinterface/ServiceInterfaceStream.cpp | 2 +- serviceinterface/ServiceInterfaceStream.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/serviceinterface/ServiceInterfaceStream.cpp b/serviceinterface/ServiceInterfaceStream.cpp index be8dc770..80942b88 100644 --- a/serviceinterface/ServiceInterfaceStream.cpp +++ b/serviceinterface/ServiceInterfaceStream.cpp @@ -19,7 +19,7 @@ bool ServiceInterfaceStream::crAdditionEnabled() const { return streambuf.crAdditionEnabled(); } -bool ServiceInterfaceStream::setAsciiColorPrefix(std::string asciiColorCode) { +void ServiceInterfaceStream::setAsciiColorPrefix(std::string asciiColorCode) { streambuf.setAsciiColorPrefix(asciiColorCode); } diff --git a/serviceinterface/ServiceInterfaceStream.h b/serviceinterface/ServiceInterfaceStream.h index 3c788b3c..aceddb22 100644 --- a/serviceinterface/ServiceInterfaceStream.h +++ b/serviceinterface/ServiceInterfaceStream.h @@ -46,7 +46,7 @@ public: */ bool crAdditionEnabled() const; - bool setAsciiColorPrefix(std::string asciiColorCode); + void setAsciiColorPrefix(std::string asciiColorCode); protected: ServiceInterfaceBuffer streambuf; From 73bae057bddf236f89a18e8d99b866c887d4d3b6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 12 Jun 2021 15:03:18 +0200 Subject: [PATCH 127/389] default color is magneta now for wanring --- datapoollocal/LocalDataPoolManager.cpp | 1465 ++++++++++--------- serviceinterface/ServiceInterfaceBuffer.cpp | 2 +- 2 files changed, 736 insertions(+), 731 deletions(-) diff --git a/datapoollocal/LocalDataPoolManager.cpp b/datapoollocal/LocalDataPoolManager.cpp index 1cbf8201..71997b9b 100644 --- a/datapoollocal/LocalDataPoolManager.cpp +++ b/datapoollocal/LocalDataPoolManager.cpp @@ -20,23 +20,23 @@ object_id_t LocalDataPoolManager::defaultHkDestination = objects::PUS_SERVICE_3_HOUSEKEEPING; LocalDataPoolManager::LocalDataPoolManager(HasLocalDataPoolIF* owner, MessageQueueIF* queueToUse, - bool appendValidityBuffer): - appendValidityBuffer(appendValidityBuffer) { - if(owner == nullptr) { - printWarningOrError(sif::OutputTypes::OUT_WARNING, - "LocalDataPoolManager", HasReturnvaluesIF::RETURN_FAILED, - "Invalid supplied owner"); - return; - } - this->owner = owner; - mutex = MutexFactory::instance()->createMutex(); - if(mutex == nullptr) { - printWarningOrError(sif::OutputTypes::OUT_ERROR, - "LocalDataPoolManager", HasReturnvaluesIF::RETURN_FAILED, - "Could not create mutex"); - } + bool appendValidityBuffer): + appendValidityBuffer(appendValidityBuffer) { + if(owner == nullptr) { + printWarningOrError(sif::OutputTypes::OUT_WARNING, + "LocalDataPoolManager", HasReturnvaluesIF::RETURN_FAILED, + "Invalid supplied owner"); + return; + } + this->owner = owner; + mutex = MutexFactory::instance()->createMutex(); + if(mutex == nullptr) { + printWarningOrError(sif::OutputTypes::OUT_ERROR, + "LocalDataPoolManager", HasReturnvaluesIF::RETURN_FAILED, + "Could not create mutex"); + } - hkQueue = queueToUse; + hkQueue = queueToUse; } LocalDataPoolManager::~LocalDataPoolManager() { @@ -46,898 +46,903 @@ LocalDataPoolManager::~LocalDataPoolManager() { } ReturnValue_t LocalDataPoolManager::initialize(MessageQueueIF* queueToUse) { - if(queueToUse == nullptr) { - /* Error, all destinations invalid */ - printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize", - QUEUE_OR_DESTINATION_INVALID); - } - hkQueue = queueToUse; + if(queueToUse == nullptr) { + /* Error, all destinations invalid */ + printWarningOrError(sif::OutputTypes::OUT_ERROR, "initialize", + QUEUE_OR_DESTINATION_INVALID); + } + hkQueue = queueToUse; - ipcStore = ObjectManager::instance()->get(objects::IPC_STORE); - if(ipcStore == nullptr) { - /* Error, all destinations invalid */ - printWarningOrError(sif::OutputTypes::OUT_ERROR, - "initialize", HasReturnvaluesIF::RETURN_FAILED, - "Could not set IPC store."); - return HasReturnvaluesIF::RETURN_FAILED; - } + ipcStore = ObjectManager::instance()->get(objects::IPC_STORE); + if(ipcStore == nullptr) { + /* Error, all destinations invalid */ + printWarningOrError(sif::OutputTypes::OUT_ERROR, + "initialize", HasReturnvaluesIF::RETURN_FAILED, + "Could not set IPC store."); + return HasReturnvaluesIF::RETURN_FAILED; + } - if(defaultHkDestination != objects::NO_OBJECT) { - AcceptsHkPacketsIF* hkPacketReceiver = ObjectManager::instance()-> - get(defaultHkDestination); - if(hkPacketReceiver != nullptr) { - hkDestinationId = hkPacketReceiver->getHkQueue(); - } - else { - printWarningOrError(sif::OutputTypes::OUT_ERROR, - "initialize", QUEUE_OR_DESTINATION_INVALID); - return QUEUE_OR_DESTINATION_INVALID; - } - } + if(defaultHkDestination != objects::NO_OBJECT) { + AcceptsHkPacketsIF* hkPacketReceiver = ObjectManager::instance()-> + get(defaultHkDestination); + if(hkPacketReceiver != nullptr) { + hkDestinationId = hkPacketReceiver->getHkQueue(); + } + else { + printWarningOrError(sif::OutputTypes::OUT_ERROR, + "initialize", QUEUE_OR_DESTINATION_INVALID); + return QUEUE_OR_DESTINATION_INVALID; + } + } - return HasReturnvaluesIF::RETURN_OK; + return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t LocalDataPoolManager::initializeAfterTaskCreation( - uint8_t nonDiagInvlFactor) { - setNonDiagnosticIntervalFactor(nonDiagInvlFactor); - return initializeHousekeepingPoolEntriesOnce(); + uint8_t nonDiagInvlFactor) { + setNonDiagnosticIntervalFactor(nonDiagInvlFactor); + return initializeHousekeepingPoolEntriesOnce(); } ReturnValue_t LocalDataPoolManager::initializeHousekeepingPoolEntriesOnce() { - if(not mapInitialized) { - ReturnValue_t result = owner->initializeLocalDataPool(localPoolMap, - *this); - if(result == HasReturnvaluesIF::RETURN_OK) { - mapInitialized = true; - } - return result; - } + if(not mapInitialized) { + ReturnValue_t result = owner->initializeLocalDataPool(localPoolMap, + *this); + if(result == HasReturnvaluesIF::RETURN_OK) { + mapInitialized = true; + } + return result; + } - printWarningOrError(sif::OutputTypes::OUT_WARNING, - "initialize", HasReturnvaluesIF::RETURN_FAILED, - "The map should only be initialized once"); - return HasReturnvaluesIF::RETURN_OK; + printWarningOrError(sif::OutputTypes::OUT_WARNING, + "initialize", HasReturnvaluesIF::RETURN_FAILED, + "The map should only be initialized once"); + return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t LocalDataPoolManager::performHkOperation() { - ReturnValue_t status = HasReturnvaluesIF::RETURN_OK; - for(auto& receiver: hkReceivers) { - switch(receiver.reportingType) { - case(ReportingType::PERIODIC): { - if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) { - /* Periodic packets shall only be generated from datasets */ - continue; - } - performPeriodicHkGeneration(receiver); - break; - } - case(ReportingType::UPDATE_HK): { - handleHkUpdate(receiver, status); - break; - } - case(ReportingType::UPDATE_NOTIFICATION): { - handleNotificationUpdate(receiver, status); - break; - } - case(ReportingType::UPDATE_SNAPSHOT): { - handleNotificationSnapshot(receiver, status); - break; - } - default: - // This should never happen. - return HasReturnvaluesIF::RETURN_FAILED; - } - } - resetHkUpdateResetHelper(); - return status; + ReturnValue_t status = HasReturnvaluesIF::RETURN_OK; + for(auto& receiver: hkReceivers) { + switch(receiver.reportingType) { + case(ReportingType::PERIODIC): { + if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) { + /* Periodic packets shall only be generated from datasets */ + continue; + } + performPeriodicHkGeneration(receiver); + break; + } + case(ReportingType::UPDATE_HK): { + handleHkUpdate(receiver, status); + break; + } + case(ReportingType::UPDATE_NOTIFICATION): { + handleNotificationUpdate(receiver, status); + break; + } + case(ReportingType::UPDATE_SNAPSHOT): { + handleNotificationSnapshot(receiver, status); + break; + } + default: + // This should never happen. + return HasReturnvaluesIF::RETURN_FAILED; + } + } + resetHkUpdateResetHelper(); + return status; } ReturnValue_t LocalDataPoolManager::handleHkUpdate(HkReceiver& receiver, - ReturnValue_t& status) { - if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) { - /* Update packets shall only be generated from datasets. */ - return HasReturnvaluesIF::RETURN_FAILED; - } - LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, - receiver.dataId.sid); - if(dataSet == nullptr) { + ReturnValue_t& status) { + if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) { + /* Update packets shall only be generated from datasets. */ + return HasReturnvaluesIF::RETURN_FAILED; + } + LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, + receiver.dataId.sid); + if(dataSet == nullptr) { return DATASET_NOT_FOUND; - } - if(dataSet->hasChanged()) { - /* Prepare and send update notification */ - ReturnValue_t result = generateHousekeepingPacket( - receiver.dataId.sid, dataSet, true); - if(result != HasReturnvaluesIF::RETURN_OK) { - status = result; - } - } - handleChangeResetLogic(receiver.dataType, receiver.dataId, - dataSet); - return HasReturnvaluesIF::RETURN_OK; + } + if(dataSet->hasChanged()) { + /* Prepare and send update notification */ + ReturnValue_t result = generateHousekeepingPacket( + receiver.dataId.sid, dataSet, true); + if(result != HasReturnvaluesIF::RETURN_OK) { + status = result; + } + } + handleChangeResetLogic(receiver.dataType, receiver.dataId, + dataSet); + return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t LocalDataPoolManager::handleNotificationUpdate(HkReceiver& receiver, - ReturnValue_t& status) { - MarkChangedIF* toReset = nullptr; - if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) { - LocalPoolObjectBase* poolObj = HasLocalDpIFManagerAttorney::getPoolObjectHandle(owner, - receiver.dataId.localPoolId); - if(poolObj == nullptr) { - printWarningOrError(sif::OutputTypes::OUT_WARNING, - "handleNotificationUpdate", POOLOBJECT_NOT_FOUND); - return POOLOBJECT_NOT_FOUND; - } - if(poolObj->hasChanged()) { - /* Prepare and send update notification. */ - CommandMessage notification; - HousekeepingMessage::setUpdateNotificationVariableCommand(¬ification, - gp_id_t(owner->getObjectId(), receiver.dataId.localPoolId)); - ReturnValue_t result = hkQueue->sendMessage(receiver.destinationQueue, ¬ification); - if(result != HasReturnvaluesIF::RETURN_OK) { - status = result; - } - toReset = poolObj; - } + ReturnValue_t& status) { + MarkChangedIF* toReset = nullptr; + if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) { + LocalPoolObjectBase* poolObj = HasLocalDpIFManagerAttorney::getPoolObjectHandle(owner, + receiver.dataId.localPoolId); + if(poolObj == nullptr) { + printWarningOrError(sif::OutputTypes::OUT_WARNING, + "handleNotificationUpdate", POOLOBJECT_NOT_FOUND); + return POOLOBJECT_NOT_FOUND; + } + if(poolObj->hasChanged()) { + /* Prepare and send update notification. */ + CommandMessage notification; + HousekeepingMessage::setUpdateNotificationVariableCommand(¬ification, + gp_id_t(owner->getObjectId(), receiver.dataId.localPoolId)); + ReturnValue_t result = hkQueue->sendMessage(receiver.destinationQueue, ¬ification); + if(result != HasReturnvaluesIF::RETURN_OK) { + status = result; + } + toReset = poolObj; + } - } - else { - LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, - receiver.dataId.sid); - if(dataSet == nullptr) { - printWarningOrError(sif::OutputTypes::OUT_WARNING, - "handleNotificationUpdate", DATASET_NOT_FOUND); - return DATASET_NOT_FOUND; - } - if(dataSet->hasChanged()) { - /* Prepare and send update notification */ - CommandMessage notification; - HousekeepingMessage::setUpdateNotificationSetCommand(¬ification, - receiver.dataId.sid); - ReturnValue_t result = hkQueue->sendMessage( - receiver.destinationQueue, ¬ification); - if(result != HasReturnvaluesIF::RETURN_OK) { - status = result; - } - toReset = dataSet; - } - } - if(toReset != nullptr) { - handleChangeResetLogic(receiver.dataType, receiver.dataId, toReset); - } - return HasReturnvaluesIF::RETURN_OK; + } + else { + LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, + receiver.dataId.sid); + if(dataSet == nullptr) { + printWarningOrError(sif::OutputTypes::OUT_WARNING, + "handleNotificationUpdate", DATASET_NOT_FOUND); + return DATASET_NOT_FOUND; + } + if(dataSet->hasChanged()) { + /* Prepare and send update notification */ + CommandMessage notification; + HousekeepingMessage::setUpdateNotificationSetCommand(¬ification, + receiver.dataId.sid); + ReturnValue_t result = hkQueue->sendMessage( + receiver.destinationQueue, ¬ification); + if(result != HasReturnvaluesIF::RETURN_OK) { + status = result; + } + toReset = dataSet; + } + } + if(toReset != nullptr) { + handleChangeResetLogic(receiver.dataType, receiver.dataId, toReset); + } + return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot( - HkReceiver& receiver, ReturnValue_t& status) { - MarkChangedIF* toReset = nullptr; - /* Check whether data has changed and send messages in case it has */ - if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) { - LocalPoolObjectBase* poolObj = HasLocalDpIFManagerAttorney::getPoolObjectHandle(owner, - receiver.dataId.localPoolId); - if(poolObj == nullptr) { - printWarningOrError(sif::OutputTypes::OUT_WARNING, - "handleNotificationSnapshot", POOLOBJECT_NOT_FOUND); - return POOLOBJECT_NOT_FOUND; - } + HkReceiver& receiver, ReturnValue_t& status) { + MarkChangedIF* toReset = nullptr; + /* Check whether data has changed and send messages in case it has */ + if(receiver.dataType == DataType::LOCAL_POOL_VARIABLE) { + LocalPoolObjectBase* poolObj = HasLocalDpIFManagerAttorney::getPoolObjectHandle(owner, + receiver.dataId.localPoolId); + if(poolObj == nullptr) { + printWarningOrError(sif::OutputTypes::OUT_WARNING, + "handleNotificationSnapshot", POOLOBJECT_NOT_FOUND); + return POOLOBJECT_NOT_FOUND; + } - if (not poolObj->hasChanged()) { - return HasReturnvaluesIF::RETURN_OK; - } + if (not poolObj->hasChanged()) { + return HasReturnvaluesIF::RETURN_OK; + } - /* Prepare and send update snapshot */ - timeval now; - Clock::getClock_timeval(&now); - CCSDSTime::CDS_short cds; - CCSDSTime::convertToCcsds(&cds, &now); - HousekeepingSnapshot updatePacket(reinterpret_cast(&cds), sizeof(cds), - HasLocalDpIFManagerAttorney::getPoolObjectHandle( - owner,receiver.dataId.localPoolId)); + /* Prepare and send update snapshot */ + timeval now; + Clock::getClock_timeval(&now); + CCSDSTime::CDS_short cds; + CCSDSTime::convertToCcsds(&cds, &now); + HousekeepingSnapshot updatePacket(reinterpret_cast(&cds), sizeof(cds), + HasLocalDpIFManagerAttorney::getPoolObjectHandle( + owner,receiver.dataId.localPoolId)); - store_address_t storeId; - ReturnValue_t result = addUpdateToStore(updatePacket, storeId); - if(result != HasReturnvaluesIF::RETURN_OK) { - return result; - } + store_address_t storeId; + ReturnValue_t result = addUpdateToStore(updatePacket, storeId); + if(result != HasReturnvaluesIF::RETURN_OK) { + return result; + } - CommandMessage notification; - HousekeepingMessage::setUpdateSnapshotVariableCommand(¬ification, - gp_id_t(owner->getObjectId(), receiver.dataId.localPoolId), storeId); - result = hkQueue->sendMessage(receiver.destinationQueue, - ¬ification); - if (result != HasReturnvaluesIF::RETURN_OK) { - status = result; - } - toReset = poolObj; - } - else { - LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, - receiver.dataId.sid); - if(dataSet == nullptr) { - printWarningOrError(sif::OutputTypes::OUT_WARNING, - "handleNotificationSnapshot", DATASET_NOT_FOUND); - return DATASET_NOT_FOUND; - } + CommandMessage notification; + HousekeepingMessage::setUpdateSnapshotVariableCommand(¬ification, + gp_id_t(owner->getObjectId(), receiver.dataId.localPoolId), storeId); + result = hkQueue->sendMessage(receiver.destinationQueue, + ¬ification); + if (result != HasReturnvaluesIF::RETURN_OK) { + status = result; + } + toReset = poolObj; + } + else { + LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, + receiver.dataId.sid); + if(dataSet == nullptr) { + printWarningOrError(sif::OutputTypes::OUT_WARNING, + "handleNotificationSnapshot", DATASET_NOT_FOUND); + return DATASET_NOT_FOUND; + } - if(not dataSet->hasChanged()) { - return HasReturnvaluesIF::RETURN_OK; - } + if(not dataSet->hasChanged()) { + return HasReturnvaluesIF::RETURN_OK; + } - /* Prepare and send update snapshot */ - timeval now; - Clock::getClock_timeval(&now); - CCSDSTime::CDS_short cds; - CCSDSTime::convertToCcsds(&cds, &now); - HousekeepingSnapshot updatePacket(reinterpret_cast(&cds), - sizeof(cds), HasLocalDpIFManagerAttorney::getDataSetHandle(owner, - receiver.dataId.sid)); + /* Prepare and send update snapshot */ + timeval now; + Clock::getClock_timeval(&now); + CCSDSTime::CDS_short cds; + CCSDSTime::convertToCcsds(&cds, &now); + HousekeepingSnapshot updatePacket(reinterpret_cast(&cds), + sizeof(cds), HasLocalDpIFManagerAttorney::getDataSetHandle(owner, + receiver.dataId.sid)); - store_address_t storeId; - ReturnValue_t result = addUpdateToStore(updatePacket, storeId); - if(result != HasReturnvaluesIF::RETURN_OK) { - return result; - } + store_address_t storeId; + ReturnValue_t result = addUpdateToStore(updatePacket, storeId); + if(result != HasReturnvaluesIF::RETURN_OK) { + return result; + } - CommandMessage notification; - HousekeepingMessage::setUpdateSnapshotSetCommand( - ¬ification, receiver.dataId.sid, storeId); - result = hkQueue->sendMessage(receiver.destinationQueue, ¬ification); - if(result != HasReturnvaluesIF::RETURN_OK) { - status = result; - } - toReset = dataSet; + CommandMessage notification; + HousekeepingMessage::setUpdateSnapshotSetCommand( + ¬ification, receiver.dataId.sid, storeId); + result = hkQueue->sendMessage(receiver.destinationQueue, ¬ification); + if(result != HasReturnvaluesIF::RETURN_OK) { + status = result; + } + toReset = dataSet; - } - if(toReset != nullptr) { - handleChangeResetLogic(receiver.dataType, - receiver.dataId, toReset); - } - return HasReturnvaluesIF::RETURN_OK; + } + if(toReset != nullptr) { + handleChangeResetLogic(receiver.dataType, + receiver.dataId, toReset); + } + return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t LocalDataPoolManager::addUpdateToStore( - HousekeepingSnapshot& updatePacket, store_address_t& storeId) { - size_t updatePacketSize = updatePacket.getSerializedSize(); - uint8_t *storePtr = nullptr; - ReturnValue_t result = ipcStore->getFreeElement(&storeId, - updatePacket.getSerializedSize(), &storePtr); - if (result != HasReturnvaluesIF::RETURN_OK) { - return result; - } - size_t serializedSize = 0; - result = updatePacket.serialize(&storePtr, &serializedSize, - updatePacketSize, SerializeIF::Endianness::MACHINE); - return result;; + HousekeepingSnapshot& updatePacket, store_address_t& storeId) { + size_t updatePacketSize = updatePacket.getSerializedSize(); + uint8_t *storePtr = nullptr; + ReturnValue_t result = ipcStore->getFreeElement(&storeId, + updatePacket.getSerializedSize(), &storePtr); + if (result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + size_t serializedSize = 0; + result = updatePacket.serialize(&storePtr, &serializedSize, + updatePacketSize, SerializeIF::Endianness::MACHINE); + return result;; } void LocalDataPoolManager::handleChangeResetLogic( - DataType type, DataId dataId, MarkChangedIF* toReset) { - if(hkUpdateResetList == nullptr) { - /* Config error */ - return; - } - HkUpdateResetList& listRef = *hkUpdateResetList; - for(auto& changeInfo: listRef) { - if(changeInfo.dataType != type) { - continue; - } - if((changeInfo.dataType == DataType::DATA_SET) and - (changeInfo.dataId.sid != dataId.sid)) { - continue; - } - if((changeInfo.dataType == DataType::LOCAL_POOL_VARIABLE) and - (changeInfo.dataId.localPoolId != dataId.localPoolId)) { - continue; - } + DataType type, DataId dataId, MarkChangedIF* toReset) { + if(hkUpdateResetList == nullptr) { + /* Config error */ + return; + } + HkUpdateResetList& listRef = *hkUpdateResetList; + for(auto& changeInfo: listRef) { + if(changeInfo.dataType != type) { + continue; + } + if((changeInfo.dataType == DataType::DATA_SET) and + (changeInfo.dataId.sid != dataId.sid)) { + continue; + } + if((changeInfo.dataType == DataType::LOCAL_POOL_VARIABLE) and + (changeInfo.dataId.localPoolId != dataId.localPoolId)) { + continue; + } - /* Only one update recipient, we can reset changes status immediately */ - if(changeInfo.updateCounter <= 1) { - toReset->setChanged(false); - } - /* All recipients have been notified, reset the changed flag */ - else if(changeInfo.currentUpdateCounter <= 1) { - toReset->setChanged(false); - changeInfo.currentUpdateCounter = 0; - } - /* Not all recipiens have been notified yet, decrement */ - else { - changeInfo.currentUpdateCounter--; - } - return; - } + /* Only one update recipient, we can reset changes status immediately */ + if(changeInfo.updateCounter <= 1) { + toReset->setChanged(false); + } + /* All recipients have been notified, reset the changed flag */ + else if(changeInfo.currentUpdateCounter <= 1) { + toReset->setChanged(false); + changeInfo.currentUpdateCounter = 0; + } + /* Not all recipiens have been notified yet, decrement */ + else { + changeInfo.currentUpdateCounter--; + } + return; + } } void LocalDataPoolManager::resetHkUpdateResetHelper() { - if(hkUpdateResetList == nullptr) { - return; - } + if(hkUpdateResetList == nullptr) { + return; + } - for(auto& changeInfo: *hkUpdateResetList) { - changeInfo.currentUpdateCounter = changeInfo.updateCounter; - } + for(auto& changeInfo: *hkUpdateResetList) { + changeInfo.currentUpdateCounter = changeInfo.updateCounter; + } } ReturnValue_t LocalDataPoolManager::subscribeForPeriodicPacket(sid_t sid, - bool enableReporting, float collectionInterval, bool isDiagnostics, - object_id_t packetDestination) { - AcceptsHkPacketsIF* hkReceiverObject = ObjectManager::instance()-> - get(packetDestination); - if(hkReceiverObject == nullptr) { - printWarningOrError(sif::OutputTypes::OUT_WARNING, - "subscribeForPeriodicPacket", QUEUE_OR_DESTINATION_INVALID); - return QUEUE_OR_DESTINATION_INVALID; - } + bool enableReporting, float collectionInterval, bool isDiagnostics, + object_id_t packetDestination) { + AcceptsHkPacketsIF* hkReceiverObject = ObjectManager::instance()-> + get(packetDestination); + if(hkReceiverObject == nullptr) { + printWarningOrError(sif::OutputTypes::OUT_WARNING, + "subscribeForPeriodicPacket", QUEUE_OR_DESTINATION_INVALID); + return QUEUE_OR_DESTINATION_INVALID; + } - struct HkReceiver hkReceiver; - hkReceiver.dataId.sid = sid; - hkReceiver.reportingType = ReportingType::PERIODIC; - hkReceiver.dataType = DataType::DATA_SET; - hkReceiver.destinationQueue = hkReceiverObject->getHkQueue(); + struct HkReceiver hkReceiver; + hkReceiver.dataId.sid = sid; + hkReceiver.reportingType = ReportingType::PERIODIC; + hkReceiver.dataType = DataType::DATA_SET; + hkReceiver.destinationQueue = hkReceiverObject->getHkQueue(); - LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid); - if(dataSet != nullptr) { - LocalPoolDataSetAttorney::setReportingEnabled(*dataSet, enableReporting); - LocalPoolDataSetAttorney::setDiagnostic(*dataSet, isDiagnostics); - LocalPoolDataSetAttorney::initializePeriodicHelper(*dataSet, collectionInterval, - owner->getPeriodicOperationFrequency()); - } + LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid); + if(dataSet != nullptr) { + LocalPoolDataSetAttorney::setReportingEnabled(*dataSet, enableReporting); + LocalPoolDataSetAttorney::setDiagnostic(*dataSet, isDiagnostics); + LocalPoolDataSetAttorney::initializePeriodicHelper(*dataSet, collectionInterval, + owner->getPeriodicOperationFrequency()); + } - hkReceivers.push_back(hkReceiver); - return HasReturnvaluesIF::RETURN_OK; + hkReceivers.push_back(hkReceiver); + return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t LocalDataPoolManager::subscribeForUpdatePacket(sid_t sid, - bool isDiagnostics, bool reportingEnabled, - object_id_t packetDestination) { - AcceptsHkPacketsIF* hkReceiverObject = - ObjectManager::instance()->get(packetDestination); - if(hkReceiverObject == nullptr) { - printWarningOrError(sif::OutputTypes::OUT_WARNING, - "subscribeForPeriodicPacket", QUEUE_OR_DESTINATION_INVALID); - return QUEUE_OR_DESTINATION_INVALID; - } + bool isDiagnostics, bool reportingEnabled, + object_id_t packetDestination) { + AcceptsHkPacketsIF* hkReceiverObject = + ObjectManager::instance()->get(packetDestination); + if(hkReceiverObject == nullptr) { + printWarningOrError(sif::OutputTypes::OUT_WARNING, + "subscribeForPeriodicPacket", QUEUE_OR_DESTINATION_INVALID); + return QUEUE_OR_DESTINATION_INVALID; + } - struct HkReceiver hkReceiver; - hkReceiver.dataId.sid = sid; - hkReceiver.reportingType = ReportingType::UPDATE_HK; - hkReceiver.dataType = DataType::DATA_SET; - hkReceiver.destinationQueue = hkReceiverObject->getHkQueue(); + struct HkReceiver hkReceiver; + hkReceiver.dataId.sid = sid; + hkReceiver.reportingType = ReportingType::UPDATE_HK; + hkReceiver.dataType = DataType::DATA_SET; + hkReceiver.destinationQueue = hkReceiverObject->getHkQueue(); - LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid); - if(dataSet != nullptr) { - LocalPoolDataSetAttorney::setReportingEnabled(*dataSet, true); - LocalPoolDataSetAttorney::setDiagnostic(*dataSet, isDiagnostics); - } + LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid); + if(dataSet != nullptr) { + LocalPoolDataSetAttorney::setReportingEnabled(*dataSet, true); + LocalPoolDataSetAttorney::setDiagnostic(*dataSet, isDiagnostics); + } - hkReceivers.push_back(hkReceiver); + hkReceivers.push_back(hkReceiver); - handleHkUpdateResetListInsertion(hkReceiver.dataType, hkReceiver.dataId); - return HasReturnvaluesIF::RETURN_OK; + handleHkUpdateResetListInsertion(hkReceiver.dataType, hkReceiver.dataId); + return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t LocalDataPoolManager::subscribeForSetUpdateMessage( - const uint32_t setId, object_id_t destinationObject, - MessageQueueId_t targetQueueId, bool generateSnapshot) { - struct HkReceiver hkReceiver; - hkReceiver.dataType = DataType::DATA_SET; - hkReceiver.dataId.sid = sid_t(owner->getObjectId(), setId); - hkReceiver.destinationQueue = targetQueueId; - hkReceiver.objectId = destinationObject; - if(generateSnapshot) { - hkReceiver.reportingType = ReportingType::UPDATE_SNAPSHOT; - } - else { - hkReceiver.reportingType = ReportingType::UPDATE_NOTIFICATION; - } + const uint32_t setId, object_id_t destinationObject, + MessageQueueId_t targetQueueId, bool generateSnapshot) { + struct HkReceiver hkReceiver; + hkReceiver.dataType = DataType::DATA_SET; + hkReceiver.dataId.sid = sid_t(owner->getObjectId(), setId); + hkReceiver.destinationQueue = targetQueueId; + hkReceiver.objectId = destinationObject; + if(generateSnapshot) { + hkReceiver.reportingType = ReportingType::UPDATE_SNAPSHOT; + } + else { + hkReceiver.reportingType = ReportingType::UPDATE_NOTIFICATION; + } - hkReceivers.push_back(hkReceiver); + hkReceivers.push_back(hkReceiver); - handleHkUpdateResetListInsertion(hkReceiver.dataType, hkReceiver.dataId); - return HasReturnvaluesIF::RETURN_OK; + handleHkUpdateResetListInsertion(hkReceiver.dataType, hkReceiver.dataId); + return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t LocalDataPoolManager::subscribeForVariableUpdateMessage( - const lp_id_t localPoolId, object_id_t destinationObject, - MessageQueueId_t targetQueueId, bool generateSnapshot) { - struct HkReceiver hkReceiver; - hkReceiver.dataType = DataType::LOCAL_POOL_VARIABLE; - hkReceiver.dataId.localPoolId = localPoolId; - hkReceiver.destinationQueue = targetQueueId; - hkReceiver.objectId = destinationObject; - if(generateSnapshot) { - hkReceiver.reportingType = ReportingType::UPDATE_SNAPSHOT; - } - else { - hkReceiver.reportingType = ReportingType::UPDATE_NOTIFICATION; - } + const lp_id_t localPoolId, object_id_t destinationObject, + MessageQueueId_t targetQueueId, bool generateSnapshot) { + struct HkReceiver hkReceiver; + hkReceiver.dataType = DataType::LOCAL_POOL_VARIABLE; + hkReceiver.dataId.localPoolId = localPoolId; + hkReceiver.destinationQueue = targetQueueId; + hkReceiver.objectId = destinationObject; + if(generateSnapshot) { + hkReceiver.reportingType = ReportingType::UPDATE_SNAPSHOT; + } + else { + hkReceiver.reportingType = ReportingType::UPDATE_NOTIFICATION; + } - hkReceivers.push_back(hkReceiver); + hkReceivers.push_back(hkReceiver); - handleHkUpdateResetListInsertion(hkReceiver.dataType, hkReceiver.dataId); - return HasReturnvaluesIF::RETURN_OK; + handleHkUpdateResetListInsertion(hkReceiver.dataType, hkReceiver.dataId); + return HasReturnvaluesIF::RETURN_OK; } void LocalDataPoolManager::handleHkUpdateResetListInsertion(DataType dataType, - DataId dataId) { - if(hkUpdateResetList == nullptr) { - hkUpdateResetList = new std::vector(); - } + DataId dataId) { + if(hkUpdateResetList == nullptr) { + hkUpdateResetList = new std::vector(); + } - for(auto& updateResetStruct: *hkUpdateResetList) { - if(dataType == DataType::DATA_SET) { - if(updateResetStruct.dataId.sid == dataId.sid) { - updateResetStruct.updateCounter++; - updateResetStruct.currentUpdateCounter++; - return; - } - } - else { - if(updateResetStruct.dataId.localPoolId == dataId.localPoolId) { - updateResetStruct.updateCounter++; - updateResetStruct.currentUpdateCounter++; - return; - } - } + for(auto& updateResetStruct: *hkUpdateResetList) { + if(dataType == DataType::DATA_SET) { + if(updateResetStruct.dataId.sid == dataId.sid) { + updateResetStruct.updateCounter++; + updateResetStruct.currentUpdateCounter++; + return; + } + } + else { + if(updateResetStruct.dataId.localPoolId == dataId.localPoolId) { + updateResetStruct.updateCounter++; + updateResetStruct.currentUpdateCounter++; + return; + } + } - } - HkUpdateResetHelper hkUpdateResetHelper; - hkUpdateResetHelper.currentUpdateCounter = 1; - hkUpdateResetHelper.updateCounter = 1; - hkUpdateResetHelper.dataType = dataType; - if(dataType == DataType::DATA_SET) { - hkUpdateResetHelper.dataId.sid = dataId.sid; - } - else { - hkUpdateResetHelper.dataId.localPoolId = dataId.localPoolId; - } - hkUpdateResetList->push_back(hkUpdateResetHelper); + } + HkUpdateResetHelper hkUpdateResetHelper; + hkUpdateResetHelper.currentUpdateCounter = 1; + hkUpdateResetHelper.updateCounter = 1; + hkUpdateResetHelper.dataType = dataType; + if(dataType == DataType::DATA_SET) { + hkUpdateResetHelper.dataId.sid = dataId.sid; + } + else { + hkUpdateResetHelper.dataId.localPoolId = dataId.localPoolId; + } + hkUpdateResetList->push_back(hkUpdateResetHelper); } ReturnValue_t LocalDataPoolManager::handleHousekeepingMessage( - CommandMessage* message) { - Command_t command = message->getCommand(); - sid_t sid = HousekeepingMessage::getSid(message); - ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; - switch(command) { - // Houskeeping interface handling. - case(HousekeepingMessage::ENABLE_PERIODIC_DIAGNOSTICS_GENERATION): { - result = togglePeriodicGeneration(sid, true, true); - break; - } + CommandMessage* message) { + Command_t command = message->getCommand(); + sid_t sid = HousekeepingMessage::getSid(message); + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + switch(command) { + // Houskeeping interface handling. + case(HousekeepingMessage::ENABLE_PERIODIC_DIAGNOSTICS_GENERATION): { + result = togglePeriodicGeneration(sid, true, true); + break; + } - case(HousekeepingMessage::DISABLE_PERIODIC_DIAGNOSTICS_GENERATION): { - result = togglePeriodicGeneration(sid, false, true); - break; - } + case(HousekeepingMessage::DISABLE_PERIODIC_DIAGNOSTICS_GENERATION): { + result = togglePeriodicGeneration(sid, false, true); + break; + } - case(HousekeepingMessage::ENABLE_PERIODIC_HK_REPORT_GENERATION): { - result = togglePeriodicGeneration(sid, true, false); - break; - } + case(HousekeepingMessage::ENABLE_PERIODIC_HK_REPORT_GENERATION): { + result = togglePeriodicGeneration(sid, true, false); + break; + } - case(HousekeepingMessage::DISABLE_PERIODIC_HK_REPORT_GENERATION): { - result = togglePeriodicGeneration(sid, false, false); - break; - } + case(HousekeepingMessage::DISABLE_PERIODIC_HK_REPORT_GENERATION): { + result = togglePeriodicGeneration(sid, false, false); + break; + } - case(HousekeepingMessage::REPORT_DIAGNOSTICS_REPORT_STRUCTURES): { - result = generateSetStructurePacket(sid, true); - if(result == HasReturnvaluesIF::RETURN_OK) { - return result; - } - break; - } - - case(HousekeepingMessage::REPORT_HK_REPORT_STRUCTURES): { - result = generateSetStructurePacket(sid, false); + case(HousekeepingMessage::REPORT_DIAGNOSTICS_REPORT_STRUCTURES): { + result = generateSetStructurePacket(sid, true); if(result == HasReturnvaluesIF::RETURN_OK) { return result; } break; - } - case(HousekeepingMessage::MODIFY_DIAGNOSTICS_REPORT_COLLECTION_INTERVAL): - case(HousekeepingMessage::MODIFY_PARAMETER_REPORT_COLLECTION_INTERVAL): { - float newCollIntvl = 0; - HousekeepingMessage::getCollectionIntervalModificationCommand(message, - &newCollIntvl); - if(command == HousekeepingMessage:: - MODIFY_DIAGNOSTICS_REPORT_COLLECTION_INTERVAL) { - result = changeCollectionInterval(sid, newCollIntvl, true); - } - else { - result = changeCollectionInterval(sid, newCollIntvl, false); - } - break; - } + } - case(HousekeepingMessage::GENERATE_ONE_PARAMETER_REPORT): - case(HousekeepingMessage::GENERATE_ONE_DIAGNOSTICS_REPORT): { - LocalPoolDataSetBase* dataSet =HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid); - if(command == HousekeepingMessage::GENERATE_ONE_PARAMETER_REPORT - and LocalPoolDataSetAttorney::isDiagnostics(*dataSet)) { - result = WRONG_HK_PACKET_TYPE; - break; - } - else if(command == HousekeepingMessage::GENERATE_ONE_DIAGNOSTICS_REPORT - and not LocalPoolDataSetAttorney::isDiagnostics(*dataSet)) { + case(HousekeepingMessage::REPORT_HK_REPORT_STRUCTURES): { + result = generateSetStructurePacket(sid, false); + if(result == HasReturnvaluesIF::RETURN_OK) { + return result; + } + break; + } + case(HousekeepingMessage::MODIFY_DIAGNOSTICS_REPORT_COLLECTION_INTERVAL): + case(HousekeepingMessage::MODIFY_PARAMETER_REPORT_COLLECTION_INTERVAL): { + float newCollIntvl = 0; + HousekeepingMessage::getCollectionIntervalModificationCommand(message, + &newCollIntvl); + if(command == HousekeepingMessage:: + MODIFY_DIAGNOSTICS_REPORT_COLLECTION_INTERVAL) { + result = changeCollectionInterval(sid, newCollIntvl, true); + } + else { + result = changeCollectionInterval(sid, newCollIntvl, false); + } + break; + } + + case(HousekeepingMessage::GENERATE_ONE_PARAMETER_REPORT): + case(HousekeepingMessage::GENERATE_ONE_DIAGNOSTICS_REPORT): { + LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid); + if(dataSet == nullptr) { + printWarningOrError(sif::OutputTypes::OUT_WARNING, "handleHousekeepingMessage", + DATASET_NOT_FOUND); + return DATASET_NOT_FOUND; + } + if(command == HousekeepingMessage::GENERATE_ONE_PARAMETER_REPORT + and LocalPoolDataSetAttorney::isDiagnostics(*dataSet)) { result = WRONG_HK_PACKET_TYPE; break; - } - return generateHousekeepingPacket(HousekeepingMessage::getSid(message), - dataSet, true); - } + } + else if(command == HousekeepingMessage::GENERATE_ONE_DIAGNOSTICS_REPORT + and not LocalPoolDataSetAttorney::isDiagnostics(*dataSet)) { + result = WRONG_HK_PACKET_TYPE; + break; + } + return generateHousekeepingPacket(HousekeepingMessage::getSid(message), + dataSet, true); + } - /* Notification handling */ - case(HousekeepingMessage::UPDATE_NOTIFICATION_SET): { - owner->handleChangedDataset(sid); - return HasReturnvaluesIF::RETURN_OK; - } - case(HousekeepingMessage::UPDATE_NOTIFICATION_VARIABLE): { - gp_id_t globPoolId = HousekeepingMessage::getUpdateNotificationVariableCommand(message); - owner->handleChangedPoolVariable(globPoolId); - return HasReturnvaluesIF::RETURN_OK; - } - case(HousekeepingMessage::UPDATE_SNAPSHOT_SET): { - store_address_t storeId; - HousekeepingMessage::getUpdateSnapshotSetCommand(message, &storeId); - bool clearMessage = true; - owner->handleChangedDataset(sid, storeId, &clearMessage); - if(clearMessage) { - message->clear(); - } - return HasReturnvaluesIF::RETURN_OK; - } - case(HousekeepingMessage::UPDATE_SNAPSHOT_VARIABLE): { - store_address_t storeId; - gp_id_t globPoolId = HousekeepingMessage::getUpdateSnapshotVariableCommand(message, - &storeId); - bool clearMessage = true; - owner->handleChangedPoolVariable(globPoolId, storeId, &clearMessage); - if(clearMessage) { - message->clear(); - } - return HasReturnvaluesIF::RETURN_OK; - } + /* Notification handling */ + case(HousekeepingMessage::UPDATE_NOTIFICATION_SET): { + owner->handleChangedDataset(sid); + return HasReturnvaluesIF::RETURN_OK; + } + case(HousekeepingMessage::UPDATE_NOTIFICATION_VARIABLE): { + gp_id_t globPoolId = HousekeepingMessage::getUpdateNotificationVariableCommand(message); + owner->handleChangedPoolVariable(globPoolId); + return HasReturnvaluesIF::RETURN_OK; + } + case(HousekeepingMessage::UPDATE_SNAPSHOT_SET): { + store_address_t storeId; + HousekeepingMessage::getUpdateSnapshotSetCommand(message, &storeId); + bool clearMessage = true; + owner->handleChangedDataset(sid, storeId, &clearMessage); + if(clearMessage) { + message->clear(); + } + return HasReturnvaluesIF::RETURN_OK; + } + case(HousekeepingMessage::UPDATE_SNAPSHOT_VARIABLE): { + store_address_t storeId; + gp_id_t globPoolId = HousekeepingMessage::getUpdateSnapshotVariableCommand(message, + &storeId); + bool clearMessage = true; + owner->handleChangedPoolVariable(globPoolId, storeId, &clearMessage); + if(clearMessage) { + message->clear(); + } + return HasReturnvaluesIF::RETURN_OK; + } - default: - return CommandMessageIF::UNKNOWN_COMMAND; - } + default: + return CommandMessageIF::UNKNOWN_COMMAND; + } - CommandMessage reply; - if(result != HasReturnvaluesIF::RETURN_OK) { - HousekeepingMessage::setHkRequestFailureReply(&reply, sid, result); - } - else { - HousekeepingMessage::setHkRequestSuccessReply(&reply, sid); - } - hkQueue->sendMessage(hkDestinationId, &reply); - return result; + CommandMessage reply; + if(result != HasReturnvaluesIF::RETURN_OK) { + HousekeepingMessage::setHkRequestFailureReply(&reply, sid, result); + } + else { + HousekeepingMessage::setHkRequestSuccessReply(&reply, sid); + } + hkQueue->sendMessage(hkDestinationId, &reply); + return result; } ReturnValue_t LocalDataPoolManager::printPoolEntry( - lp_id_t localPoolId) { - auto poolIter = localPoolMap.find(localPoolId); - if (poolIter == localPoolMap.end()) { - printWarningOrError(sif::OutputTypes::OUT_WARNING, "printPoolEntry", - localpool::POOL_ENTRY_NOT_FOUND); - return localpool::POOL_ENTRY_NOT_FOUND; - } - poolIter->second->print(); - return HasReturnvaluesIF::RETURN_OK; + lp_id_t localPoolId) { + auto poolIter = localPoolMap.find(localPoolId); + if (poolIter == localPoolMap.end()) { + printWarningOrError(sif::OutputTypes::OUT_WARNING, "printPoolEntry", + localpool::POOL_ENTRY_NOT_FOUND); + return localpool::POOL_ENTRY_NOT_FOUND; + } + poolIter->second->print(); + return HasReturnvaluesIF::RETURN_OK; } MutexIF* LocalDataPoolManager::getMutexHandle() { - return mutex; + return mutex; } HasLocalDataPoolIF* LocalDataPoolManager::getOwner() { - return owner; + return owner; } ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid, - LocalPoolDataSetBase* dataSet, bool forDownlink, - MessageQueueId_t destination) { - if(dataSet == nullptr) { - /* Configuration error. */ - printWarningOrError(sif::OutputTypes::OUT_WARNING, - "generateHousekeepingPacket", - DATASET_NOT_FOUND); - return DATASET_NOT_FOUND; - } + LocalPoolDataSetBase* dataSet, bool forDownlink, + MessageQueueId_t destination) { + if(dataSet == nullptr) { + /* Configuration error. */ + printWarningOrError(sif::OutputTypes::OUT_WARNING, + "generateHousekeepingPacket", + DATASET_NOT_FOUND); + return DATASET_NOT_FOUND; + } - store_address_t storeId; - HousekeepingPacketDownlink hkPacket(sid, dataSet); - size_t serializedSize = 0; - ReturnValue_t result = serializeHkPacketIntoStore(hkPacket, storeId, - forDownlink, &serializedSize); - if(result != HasReturnvaluesIF::RETURN_OK or serializedSize == 0) { - return result; - } + store_address_t storeId; + HousekeepingPacketDownlink hkPacket(sid, dataSet); + size_t serializedSize = 0; + ReturnValue_t result = serializeHkPacketIntoStore(hkPacket, storeId, + forDownlink, &serializedSize); + if(result != HasReturnvaluesIF::RETURN_OK or serializedSize == 0) { + return result; + } - /* Now we set a HK message and send it the HK packet destination. */ - CommandMessage hkMessage; - if(LocalPoolDataSetAttorney::isDiagnostics(*dataSet)) { - HousekeepingMessage::setHkDiagnosticsReply(&hkMessage, sid, storeId); - } - else { - HousekeepingMessage::setHkReportReply(&hkMessage, sid, storeId); - } + /* Now we set a HK message and send it the HK packet destination. */ + CommandMessage hkMessage; + if(LocalPoolDataSetAttorney::isDiagnostics(*dataSet)) { + HousekeepingMessage::setHkDiagnosticsReply(&hkMessage, sid, storeId); + } + else { + HousekeepingMessage::setHkReportReply(&hkMessage, sid, storeId); + } - if(hkQueue == nullptr) { - /* Error, no queue available to send packet with. */ - printWarningOrError(sif::OutputTypes::OUT_WARNING, - "generateHousekeepingPacket", - QUEUE_OR_DESTINATION_INVALID); - return QUEUE_OR_DESTINATION_INVALID; - } - if(destination == MessageQueueIF::NO_QUEUE) { - if(hkDestinationId == MessageQueueIF::NO_QUEUE) { - /* Error, all destinations invalid */ - printWarningOrError(sif::OutputTypes::OUT_WARNING, - "generateHousekeepingPacket", - QUEUE_OR_DESTINATION_INVALID); - } - destination = hkDestinationId; - } + if(hkQueue == nullptr) { + /* Error, no queue available to send packet with. */ + printWarningOrError(sif::OutputTypes::OUT_WARNING, + "generateHousekeepingPacket", + QUEUE_OR_DESTINATION_INVALID); + return QUEUE_OR_DESTINATION_INVALID; + } + if(destination == MessageQueueIF::NO_QUEUE) { + if(hkDestinationId == MessageQueueIF::NO_QUEUE) { + /* Error, all destinations invalid */ + printWarningOrError(sif::OutputTypes::OUT_WARNING, + "generateHousekeepingPacket", + QUEUE_OR_DESTINATION_INVALID); + } + destination = hkDestinationId; + } - return hkQueue->sendMessage(destination, &hkMessage); + return hkQueue->sendMessage(destination, &hkMessage); } ReturnValue_t LocalDataPoolManager::serializeHkPacketIntoStore( - HousekeepingPacketDownlink& hkPacket, - store_address_t& storeId, bool forDownlink, - size_t* serializedSize) { - uint8_t* dataPtr = nullptr; - const size_t maxSize = hkPacket.getSerializedSize(); - ReturnValue_t result = ipcStore->getFreeElement(&storeId, - maxSize, &dataPtr); - if(result != HasReturnvaluesIF::RETURN_OK) { - return result; - } + HousekeepingPacketDownlink& hkPacket, + store_address_t& storeId, bool forDownlink, + size_t* serializedSize) { + uint8_t* dataPtr = nullptr; + const size_t maxSize = hkPacket.getSerializedSize(); + ReturnValue_t result = ipcStore->getFreeElement(&storeId, + maxSize, &dataPtr); + if(result != HasReturnvaluesIF::RETURN_OK) { + return result; + } - if(forDownlink) { - return hkPacket.serialize(&dataPtr, serializedSize, maxSize, - SerializeIF::Endianness::BIG); - } - return hkPacket.serialize(&dataPtr, serializedSize, maxSize, - SerializeIF::Endianness::MACHINE); + if(forDownlink) { + return hkPacket.serialize(&dataPtr, serializedSize, maxSize, + SerializeIF::Endianness::BIG); + } + return hkPacket.serialize(&dataPtr, serializedSize, maxSize, + SerializeIF::Endianness::MACHINE); } void LocalDataPoolManager::setNonDiagnosticIntervalFactor( - uint8_t nonDiagInvlFactor) { - this->nonDiagnosticIntervalFactor = nonDiagInvlFactor; + uint8_t nonDiagInvlFactor) { + this->nonDiagnosticIntervalFactor = nonDiagInvlFactor; } void LocalDataPoolManager::performPeriodicHkGeneration(HkReceiver& receiver) { - sid_t sid = receiver.dataId.sid; - LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid); - if(dataSet == nullptr) { - printWarningOrError(sif::OutputTypes::OUT_WARNING, - "performPeriodicHkGeneration", - DATASET_NOT_FOUND); - return; - } + sid_t sid = receiver.dataId.sid; + LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid); + if(dataSet == nullptr) { + printWarningOrError(sif::OutputTypes::OUT_WARNING, + "performPeriodicHkGeneration", + DATASET_NOT_FOUND); + return; + } - if(not LocalPoolDataSetAttorney::getReportingEnabled(*dataSet)) { - return; - } + if(not LocalPoolDataSetAttorney::getReportingEnabled(*dataSet)) { + return; + } - PeriodicHousekeepingHelper* periodicHelper = - LocalPoolDataSetAttorney::getPeriodicHelper(*dataSet); + PeriodicHousekeepingHelper* periodicHelper = + LocalPoolDataSetAttorney::getPeriodicHelper(*dataSet); - if(periodicHelper == nullptr) { - /* Configuration error */ - return; - } + if(periodicHelper == nullptr) { + /* Configuration error */ + return; + } - if(not periodicHelper->checkOpNecessary()) { - return; - } + if(not periodicHelper->checkOpNecessary()) { + return; + } - ReturnValue_t result = generateHousekeepingPacket( - sid, dataSet, true); - if(result != HasReturnvaluesIF::RETURN_OK) { - /* Configuration error */ + ReturnValue_t result = generateHousekeepingPacket( + sid, dataSet, true); + if(result != HasReturnvaluesIF::RETURN_OK) { + /* Configuration error */ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "LocalDataPoolManager::performHkOperation: HK generation failed." << - std::endl; + sif::warning << "LocalDataPoolManager::performHkOperation: HK generation failed." << + std::endl; #else - sif::printWarning("LocalDataPoolManager::performHkOperation: HK generation failed.\n"); + sif::printWarning("LocalDataPoolManager::performHkOperation: HK generation failed.\n"); #endif - } + } } ReturnValue_t LocalDataPoolManager::togglePeriodicGeneration(sid_t sid, - bool enable, bool isDiagnostics) { - LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid); + bool enable, bool isDiagnostics) { + LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid); if(dataSet == nullptr) { printWarningOrError(sif::OutputTypes::OUT_WARNING, "togglePeriodicGeneration", DATASET_NOT_FOUND); return DATASET_NOT_FOUND; } - if((LocalPoolDataSetAttorney::isDiagnostics(*dataSet) and not isDiagnostics) or - (not LocalPoolDataSetAttorney::isDiagnostics(*dataSet) and isDiagnostics)) { - return WRONG_HK_PACKET_TYPE; - } + if((LocalPoolDataSetAttorney::isDiagnostics(*dataSet) and not isDiagnostics) or + (not LocalPoolDataSetAttorney::isDiagnostics(*dataSet) and isDiagnostics)) { + return WRONG_HK_PACKET_TYPE; + } - if((LocalPoolDataSetAttorney::getReportingEnabled(*dataSet) and enable) or - (not LocalPoolDataSetAttorney::getReportingEnabled(*dataSet) and not enable)) { - return REPORTING_STATUS_UNCHANGED; - } + if((LocalPoolDataSetAttorney::getReportingEnabled(*dataSet) and enable) or + (not LocalPoolDataSetAttorney::getReportingEnabled(*dataSet) and not enable)) { + return REPORTING_STATUS_UNCHANGED; + } - LocalPoolDataSetAttorney::setReportingEnabled(*dataSet, enable); - return HasReturnvaluesIF::RETURN_OK; + LocalPoolDataSetAttorney::setReportingEnabled(*dataSet, enable); + return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t LocalDataPoolManager::changeCollectionInterval(sid_t sid, - float newCollectionInterval, bool isDiagnostics) { - LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid); - if(dataSet == nullptr) { + float newCollectionInterval, bool isDiagnostics) { + LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid); + if(dataSet == nullptr) { printWarningOrError(sif::OutputTypes::OUT_WARNING, "changeCollectionInterval", DATASET_NOT_FOUND); - return DATASET_NOT_FOUND; - } + return DATASET_NOT_FOUND; + } - bool targetIsDiagnostics = LocalPoolDataSetAttorney::isDiagnostics(*dataSet); - if((targetIsDiagnostics and not isDiagnostics) or - (not targetIsDiagnostics and isDiagnostics)) { - return WRONG_HK_PACKET_TYPE; - } + bool targetIsDiagnostics = LocalPoolDataSetAttorney::isDiagnostics(*dataSet); + if((targetIsDiagnostics and not isDiagnostics) or + (not targetIsDiagnostics and isDiagnostics)) { + return WRONG_HK_PACKET_TYPE; + } - PeriodicHousekeepingHelper* periodicHelper = - LocalPoolDataSetAttorney::getPeriodicHelper(*dataSet); + PeriodicHousekeepingHelper* periodicHelper = + LocalPoolDataSetAttorney::getPeriodicHelper(*dataSet); - if(periodicHelper == nullptr) { - /* Configuration error, set might not have a corresponding pool manager */ - return PERIODIC_HELPER_INVALID; - } + if(periodicHelper == nullptr) { + /* Configuration error, set might not have a corresponding pool manager */ + return PERIODIC_HELPER_INVALID; + } - periodicHelper->changeCollectionInterval(newCollectionInterval); - return HasReturnvaluesIF::RETURN_OK; + periodicHelper->changeCollectionInterval(newCollectionInterval); + return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t LocalDataPoolManager::generateSetStructurePacket(sid_t sid, - bool isDiagnostics) { - /* Get and check dataset first. */ - LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid); - if(dataSet == nullptr) { - printWarningOrError(sif::OutputTypes::OUT_WARNING, - "performPeriodicHkGeneration", DATASET_NOT_FOUND); - return DATASET_NOT_FOUND; - } + bool isDiagnostics) { + /* Get and check dataset first. */ + LocalPoolDataSetBase* dataSet = HasLocalDpIFManagerAttorney::getDataSetHandle(owner, sid); + if(dataSet == nullptr) { + printWarningOrError(sif::OutputTypes::OUT_WARNING, + "performPeriodicHkGeneration", DATASET_NOT_FOUND); + return DATASET_NOT_FOUND; + } - bool targetIsDiagnostics = LocalPoolDataSetAttorney::isDiagnostics(*dataSet); - if((targetIsDiagnostics and not isDiagnostics) or - (not targetIsDiagnostics and isDiagnostics)) { - return WRONG_HK_PACKET_TYPE; - } + bool targetIsDiagnostics = LocalPoolDataSetAttorney::isDiagnostics(*dataSet); + if((targetIsDiagnostics and not isDiagnostics) or + (not targetIsDiagnostics and isDiagnostics)) { + return WRONG_HK_PACKET_TYPE; + } - bool valid = dataSet->isValid(); - bool reportingEnabled = LocalPoolDataSetAttorney::getReportingEnabled(*dataSet); - float collectionInterval = LocalPoolDataSetAttorney::getPeriodicHelper(*dataSet)-> - getCollectionIntervalInSeconds(); + bool valid = dataSet->isValid(); + bool reportingEnabled = LocalPoolDataSetAttorney::getReportingEnabled(*dataSet); + float collectionInterval = LocalPoolDataSetAttorney::getPeriodicHelper(*dataSet)-> + getCollectionIntervalInSeconds(); - // Generate set packet which can be serialized. - HousekeepingSetPacket setPacket(sid, - reportingEnabled, valid, collectionInterval, dataSet); - size_t expectedSize = setPacket.getSerializedSize(); - uint8_t* storePtr = nullptr; - store_address_t storeId; - ReturnValue_t result = ipcStore->getFreeElement(&storeId, - expectedSize,&storePtr); - if(result != HasReturnvaluesIF::RETURN_OK) { - printWarningOrError(sif::OutputTypes::OUT_ERROR, - "generateSetStructurePacket", HasReturnvaluesIF::RETURN_FAILED, - "Could not get free element from IPC store."); - return result; - } + // Generate set packet which can be serialized. + HousekeepingSetPacket setPacket(sid, + reportingEnabled, valid, collectionInterval, dataSet); + size_t expectedSize = setPacket.getSerializedSize(); + uint8_t* storePtr = nullptr; + store_address_t storeId; + ReturnValue_t result = ipcStore->getFreeElement(&storeId, + expectedSize,&storePtr); + if(result != HasReturnvaluesIF::RETURN_OK) { + printWarningOrError(sif::OutputTypes::OUT_ERROR, + "generateSetStructurePacket", HasReturnvaluesIF::RETURN_FAILED, + "Could not get free element from IPC store."); + return result; + } - // Serialize set packet into store. - size_t size = 0; - result = setPacket.serialize(&storePtr, &size, expectedSize, - SerializeIF::Endianness::BIG); - if(expectedSize != size) { - printWarningOrError(sif::OutputTypes::OUT_WARNING, - "generateSetStructurePacket", HasReturnvaluesIF::RETURN_FAILED, - "Expected size is not equal to serialized size"); - } + // Serialize set packet into store. + size_t size = 0; + result = setPacket.serialize(&storePtr, &size, expectedSize, + SerializeIF::Endianness::BIG); + if(expectedSize != size) { + printWarningOrError(sif::OutputTypes::OUT_WARNING, + "generateSetStructurePacket", HasReturnvaluesIF::RETURN_FAILED, + "Expected size is not equal to serialized size"); + } - // Send structure reporting reply. - CommandMessage reply; - if(isDiagnostics) { - HousekeepingMessage::setDiagnosticsStuctureReportReply(&reply, - sid, storeId); - } - else { - HousekeepingMessage::setHkStuctureReportReply(&reply, - sid, storeId); - } + // Send structure reporting reply. + CommandMessage reply; + if(isDiagnostics) { + HousekeepingMessage::setDiagnosticsStuctureReportReply(&reply, + sid, storeId); + } + else { + HousekeepingMessage::setHkStuctureReportReply(&reply, + sid, storeId); + } - hkQueue->reply(&reply); - return result; + hkQueue->reply(&reply); + return result; } void LocalDataPoolManager::clearReceiversList() { - /* Clear the vector completely and releases allocated memory. */ - HkReceivers().swap(hkReceivers); - /* Also clear the reset helper if it exists */ - if(hkUpdateResetList != nullptr) { - HkUpdateResetList().swap(*hkUpdateResetList); - } + /* Clear the vector completely and releases allocated memory. */ + HkReceivers().swap(hkReceivers); + /* Also clear the reset helper if it exists */ + if(hkUpdateResetList != nullptr) { + HkUpdateResetList().swap(*hkUpdateResetList); + } } MutexIF* LocalDataPoolManager::getLocalPoolMutex() { - return this->mutex; + return this->mutex; } object_id_t LocalDataPoolManager::getCreatorObjectId() const { - return owner->getObjectId(); + return owner->getObjectId(); } void LocalDataPoolManager::printWarningOrError(sif::OutputTypes outputType, - const char* functionName, ReturnValue_t error, const char* errorPrint) { + const char* functionName, ReturnValue_t error, const char* errorPrint) { #if FSFW_VERBOSE_LEVEL >= 1 - if(errorPrint == nullptr) { - if(error == DATASET_NOT_FOUND) { - errorPrint = "Dataset not found"; - } - else if(error == POOLOBJECT_NOT_FOUND) { - errorPrint = "Pool Object not found"; - } - else if(error == HasReturnvaluesIF::RETURN_FAILED) { - if(outputType == sif::OutputTypes::OUT_WARNING) { - errorPrint = "Generic Warning"; - } - else { - errorPrint = "Generic error"; - } - } - else if(error == QUEUE_OR_DESTINATION_INVALID) { - errorPrint = "Queue or destination not set"; - } - else if(error == localpool::POOL_ENTRY_TYPE_CONFLICT) { - errorPrint = "Pool entry type conflict"; - } - else if(error == localpool::POOL_ENTRY_NOT_FOUND) { - errorPrint = "Pool entry not found"; - } - else { - errorPrint = "Unknown error"; - } - } - object_id_t objectId = 0xffffffff; - if(owner != nullptr) { - objectId = owner->getObjectId(); - } + if(errorPrint == nullptr) { + if(error == DATASET_NOT_FOUND) { + errorPrint = "Dataset not found"; + } + else if(error == POOLOBJECT_NOT_FOUND) { + errorPrint = "Pool Object not found"; + } + else if(error == HasReturnvaluesIF::RETURN_FAILED) { + if(outputType == sif::OutputTypes::OUT_WARNING) { + errorPrint = "Generic Warning"; + } + else { + errorPrint = "Generic error"; + } + } + else if(error == QUEUE_OR_DESTINATION_INVALID) { + errorPrint = "Queue or destination not set"; + } + else if(error == localpool::POOL_ENTRY_TYPE_CONFLICT) { + errorPrint = "Pool entry type conflict"; + } + else if(error == localpool::POOL_ENTRY_NOT_FOUND) { + errorPrint = "Pool entry not found"; + } + else { + errorPrint = "Unknown error"; + } + } + object_id_t objectId = 0xffffffff; + if(owner != nullptr) { + objectId = owner->getObjectId(); + } - if(outputType == sif::OutputTypes::OUT_WARNING) { + if(outputType == sif::OutputTypes::OUT_WARNING) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "LocalDataPoolManager::" << functionName << ": Object ID 0x" << - std::setw(8) << std::setfill('0') << std::hex << objectId << " | " << errorPrint << - std::dec << std::setfill(' ') << std::endl; + sif::warning << "LocalDataPoolManager::" << functionName << ": Object ID 0x" << + std::setw(8) << std::setfill('0') << std::hex << objectId << " | " << errorPrint << + std::dec << std::setfill(' ') << std::endl; #else - sif::printWarning("LocalDataPoolManager::%s: Object ID 0x%08x | %s\n", - functionName, objectId, errorPrint); + sif::printWarning("LocalDataPoolManager::%s: Object ID 0x%08x | %s\n", + functionName, objectId, errorPrint); #endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ - } - else if(outputType == sif::OutputTypes::OUT_ERROR) { + } + else if(outputType == sif::OutputTypes::OUT_ERROR) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "LocalDataPoolManager::" << functionName << ": Object ID 0x" << - std::setw(8) << std::setfill('0') << std::hex << objectId << " | " << errorPrint << - std::dec << std::setfill(' ') << std::endl; + sif::error << "LocalDataPoolManager::" << functionName << ": Object ID 0x" << + std::setw(8) << std::setfill('0') << std::hex << objectId << " | " << errorPrint << + std::dec << std::setfill(' ') << std::endl; #else - sif::printError("LocalDataPoolManager::%s: Object ID 0x%08x | %s\n", - functionName, objectId, errorPrint); + sif::printError("LocalDataPoolManager::%s: Object ID 0x%08x | %s\n", + functionName, objectId, errorPrint); #endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ - } + } #endif /* #if FSFW_VERBOSE_LEVEL >= 1 */ } LocalDataPoolManager* LocalDataPoolManager::getPoolManagerHandle() { - return this; + return this; } diff --git a/serviceinterface/ServiceInterfaceBuffer.cpp b/serviceinterface/ServiceInterfaceBuffer.cpp index a6a2cb71..b85a43a4 100644 --- a/serviceinterface/ServiceInterfaceBuffer.cpp +++ b/serviceinterface/ServiceInterfaceBuffer.cpp @@ -35,7 +35,7 @@ ServiceInterfaceBuffer::ServiceInterfaceBuffer(std::string setMessage, colorPrefix = sif::ANSI_COLOR_GREEN; } else if(setMessage.find("WARNING") != std::string::npos) { - colorPrefix = sif::ANSI_COLOR_YELLOW; + colorPrefix = sif::ANSI_COLOR_MAGENTA; } else if(setMessage.find("ERROR") != std::string::npos) { colorPrefix = sif::ANSI_COLOR_RED; From 537a30a4de78bd0f86a60a4b73cb861cd38c1a7e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 13 Jun 2021 12:34:06 +0200 Subject: [PATCH 128/389] added pus a tc --- FSFW.h | 7 ++++++ tmtcpacket/pus/CMakeLists.txt | 3 ++- tmtcpacket/pus/TcPacketBase.h | 25 --------------------- tmtcpacket/pus/TcPacketPusA.cpp | 3 +++ tmtcpacket/pus/TcPacketPusA.h | 40 +++++++++++++++++++++++++++++++++ tmtcpacket/pus/TcPacketPusC.cpp | 4 ++++ tmtcpacket/pus/TcPacketPusC.h | 8 +++++++ 7 files changed, 64 insertions(+), 26 deletions(-) create mode 100644 FSFW.h create mode 100644 tmtcpacket/pus/TcPacketPusA.cpp create mode 100644 tmtcpacket/pus/TcPacketPusA.h create mode 100644 tmtcpacket/pus/TcPacketPusC.cpp create mode 100644 tmtcpacket/pus/TcPacketPusC.h diff --git a/FSFW.h b/FSFW.h new file mode 100644 index 00000000..df06ff3d --- /dev/null +++ b/FSFW.h @@ -0,0 +1,7 @@ +#ifndef FSFW_FSFW_H_ +#define FSFW_FSFW_H_ + +#include "FSFWConfig.h" + + +#endif /* FSFW_FSFW_H_ */ diff --git a/tmtcpacket/pus/CMakeLists.txt b/tmtcpacket/pus/CMakeLists.txt index cd4f49f1..2d22cb66 100644 --- a/tmtcpacket/pus/CMakeLists.txt +++ b/tmtcpacket/pus/CMakeLists.txt @@ -1,6 +1,7 @@ target_sources(${LIB_FSFW_NAME} - PRIVATE + PRIVATE TcPacketBase.cpp + TcPacketPusA.cpp TcPacketStored.cpp TmPacketBase.cpp TmPacketMinimal.cpp diff --git a/tmtcpacket/pus/TcPacketBase.h b/tmtcpacket/pus/TcPacketBase.h index 582a2214..451f9c3a 100644 --- a/tmtcpacket/pus/TcPacketBase.h +++ b/tmtcpacket/pus/TcPacketBase.h @@ -4,31 +4,6 @@ #include "../../tmtcpacket/SpacePacketBase.h" #include - -/** - * This struct defines a byte-wise structured PUS TC Data Field Header. - * Any optional fields in the header must be added or removed here. - * Currently, the Source Id field is present with one byte. - * @ingroup tmtcpackets - */ -struct PUSTcDataFieldHeader { - uint8_t version_type_ack; - uint8_t service_type; - uint8_t service_subtype; - uint8_t source_id; -}; - -/** - * This struct defines the data structure of a PUS Telecommand Packet when - * accessed via a pointer. - * @ingroup tmtcpackets - */ -struct TcPacketPointer { - CCSDSPrimaryHeader primary; - PUSTcDataFieldHeader dataField; - uint8_t appData; -}; - /** * This class is the basic data handler for any ECSS PUS Telecommand packet. * diff --git a/tmtcpacket/pus/TcPacketPusA.cpp b/tmtcpacket/pus/TcPacketPusA.cpp new file mode 100644 index 00000000..c9af38a6 --- /dev/null +++ b/tmtcpacket/pus/TcPacketPusA.cpp @@ -0,0 +1,3 @@ +#include "TcPacketPusA.h" + + diff --git a/tmtcpacket/pus/TcPacketPusA.h b/tmtcpacket/pus/TcPacketPusA.h new file mode 100644 index 00000000..9254ad32 --- /dev/null +++ b/tmtcpacket/pus/TcPacketPusA.h @@ -0,0 +1,40 @@ +#ifndef FSFW_TMTCPACKET_PUS_TCPACKETPUSA_H_ +#define FSFW_TMTCPACKET_PUS_TCPACKETPUSA_H_ + +#include "ccsds_header.h" +#include "TcPacketBase.h" + +#include + +/** + * This struct defines a byte-wise structured PUS TC A Data Field Header. + * Any optional fields in the header must be added or removed here. + * Currently, the Source Id field is present with one byte. + * @ingroup tmtcpackets + */ +struct PUSTcDataFieldHeader { + uint8_t version_type_ack; + uint8_t service_type; + uint8_t service_subtype; + uint8_t source_id; +}; + +/** + * This struct defines the data structure of a PUS Telecommand A packet when + * accessed via a pointer. + * @ingroup tmtcpackets + */ +struct TcPacketPointer { + CCSDSPrimaryHeader primary; + PUSTcDataFieldHeader dataField; + uint8_t appData; +}; + + +class TcPacketPusA: public TcPacketBase { +public: +private: +}; + + +#endif /* FSFW_TMTCPACKET_PUS_TCPACKETPUSA_H_ */ diff --git a/tmtcpacket/pus/TcPacketPusC.cpp b/tmtcpacket/pus/TcPacketPusC.cpp new file mode 100644 index 00000000..1f2946a8 --- /dev/null +++ b/tmtcpacket/pus/TcPacketPusC.cpp @@ -0,0 +1,4 @@ +#include "TcPacketPusC.h" + + + diff --git a/tmtcpacket/pus/TcPacketPusC.h b/tmtcpacket/pus/TcPacketPusC.h new file mode 100644 index 00000000..e965e752 --- /dev/null +++ b/tmtcpacket/pus/TcPacketPusC.h @@ -0,0 +1,8 @@ +#ifndef FSFW_TMTCPACKET_PUS_TCPACKETPUSC_H_ +#define FSFW_TMTCPACKET_PUS_TCPACKETPUSC_H_ + + + + + +#endif /* FSFW_TMTCPACKET_PUS_TCPACKETPUSC_H_ */ From 1b6759020aafce39adfbf4e99870f7e8552378b1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 13 Jun 2021 12:38:24 +0200 Subject: [PATCH 129/389] added getter function --- tmtcpacket/pus/TcPacketBase.cpp | 4 ++++ tmtcpacket/pus/TcPacketBase.h | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/tmtcpacket/pus/TcPacketBase.cpp b/tmtcpacket/pus/TcPacketBase.cpp index ca3e2a99..50130c83 100644 --- a/tmtcpacket/pus/TcPacketBase.cpp +++ b/tmtcpacket/pus/TcPacketBase.cpp @@ -23,6 +23,10 @@ uint8_t TcPacketBase::getSubService() { return tcData->dataField.service_subtype; } +uint8_t TcPacketBase::getSourceId() { + return tcData->dataField.source_id; +} + uint8_t TcPacketBase::getAcknowledgeFlags() { return tcData->dataField.version_type_ack & 0b00001111; } diff --git a/tmtcpacket/pus/TcPacketBase.h b/tmtcpacket/pus/TcPacketBase.h index 582a2214..f5073eba 100644 --- a/tmtcpacket/pus/TcPacketBase.h +++ b/tmtcpacket/pus/TcPacketBase.h @@ -108,6 +108,13 @@ public: * @return The packet's PUS Service Subtype. */ uint8_t getSubService(); + /** + * The source ID can be used to have an additional identifier, e.g. for different ground + * station. + * @return + */ + uint8_t getSourceId(); + /** * This is a getter for a pointer to the packet's Application data. * From d0f37b851b4de0fd71521cec5ff19ded413c2d3e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 13 Jun 2021 16:29:13 +0200 Subject: [PATCH 130/389] added pus c support for tc --- defaultcfg/fsfwconfig/FSFWConfig.h | 21 +++-- tcdistribution/CMakeLists.txt | 11 +-- tcdistribution/PUSDistributor.cpp | 7 +- tcdistribution/PUSDistributor.h | 8 +- tcdistribution/TcPacketCheck.cpp | 58 ++++++------ tcdistribution/TcPacketCheck.h | 84 ++++++++--------- tmtcpacket/CMakeLists.txt | 7 +- tmtcpacket/pus/CMakeLists.txt | 25 ++--- tmtcpacket/pus/TcPacketBase.cpp | 82 ++-------------- tmtcpacket/pus/TcPacketBase.h | 53 ++++------- tmtcpacket/pus/TcPacketPusA.cpp | 72 ++++++++++++++ tmtcpacket/pus/TcPacketPusA.h | 47 +++++++++- tmtcpacket/pus/TcPacketStored.cpp | 124 ------------------------- tmtcpacket/pus/TcPacketStored.h | 122 ++---------------------- tmtcpacket/pus/TcPacketStoredBase.cpp | 72 ++++++++++++++ tmtcpacket/pus/TcPacketStoredBase.h | 90 ++++++++++++++++++ tmtcpacket/pus/TcPacketStoredIF.h | 38 ++++++++ tmtcpacket/pus/TcPacketStoredPusA.cpp | 77 +++++++++++++++ tmtcpacket/pus/TcPacketStoredPusA.h | 53 +++++++++++ tmtcpacket/pus/TcPacketStoredPusC.cpp | 10 ++ tmtcpacket/pus/TmPacketBase.cpp | 15 +-- tmtcservices/CommandingServiceBase.cpp | 44 +++++---- tmtcservices/CommandingServiceBase.h | 7 +- tmtcservices/PusServiceBase.h | 6 +- tmtcservices/VerificationReporter.cpp | 22 +++-- 25 files changed, 667 insertions(+), 488 deletions(-) delete mode 100644 tmtcpacket/pus/TcPacketStored.cpp create mode 100644 tmtcpacket/pus/TcPacketStoredBase.cpp create mode 100644 tmtcpacket/pus/TcPacketStoredBase.h create mode 100644 tmtcpacket/pus/TcPacketStoredIF.h create mode 100644 tmtcpacket/pus/TcPacketStoredPusA.cpp create mode 100644 tmtcpacket/pus/TcPacketStoredPusA.h create mode 100644 tmtcpacket/pus/TcPacketStoredPusC.cpp diff --git a/defaultcfg/fsfwconfig/FSFWConfig.h b/defaultcfg/fsfwconfig/FSFWConfig.h index 1abdab4c..5518e33c 100644 --- a/defaultcfg/fsfwconfig/FSFWConfig.h +++ b/defaultcfg/fsfwconfig/FSFWConfig.h @@ -7,29 +7,30 @@ //! Used to determine whether C++ ostreams are used which can increase //! the binary size significantly. If this is disabled, //! the C stdio functions can be used alternatively -#define FSFW_CPP_OSTREAM_ENABLED 1 +#define FSFW_CPP_OSTREAM_ENABLED 1 //! More FSFW related printouts depending on level. Useful for development. -#define FSFW_VERBOSE_LEVEL 1 +#define FSFW_VERBOSE_LEVEL 1 //! Can be used to completely disable printouts, even the C stdio ones. #if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_VERBOSE_LEVEL == 0 - #define FSFW_DISABLE_PRINTOUT 0 + #define FSFW_DISABLE_PRINTOUT 0 #endif -#define FSFW_USE_PUS_C_TELEMETRY 1 +#define FSFW_USE_PUS_C_TELEMETRY 1 +#define FSFW_USE_PUS_C_TELECOMMANDS 1 //! Can be used to disable the ANSI color sequences for C stdio. -#define FSFW_COLORED_OUTPUT 1 +#define FSFW_COLORED_OUTPUT 1 //! If FSFW_OBJ_EVENT_TRANSLATION is set to one, //! additional output which requires the translation files translateObjects //! and translateEvents (and their compiled source files) -#define FSFW_OBJ_EVENT_TRANSLATION 0 +#define FSFW_OBJ_EVENT_TRANSLATION 0 #if FSFW_OBJ_EVENT_TRANSLATION == 1 //! Specify whether info events are printed too. -#define FSFW_DEBUG_INFO 1 +#define FSFW_DEBUG_INFO 1 #include "objects/translateObjects.h" #include "events/translateEvents.h" #else @@ -37,17 +38,17 @@ //! When using the newlib nano library, C99 support for stdio facilities //! will not be provided. This define should be set to 1 if this is the case. -#define FSFW_NO_C99_IO 1 +#define FSFW_NO_C99_IO 1 //! Specify whether a special mode store is used for Subsystem components. -#define FSFW_USE_MODESTORE 0 +#define FSFW_USE_MODESTORE 0 //! Defines if the real time scheduler for linux should be used. //! If set to 0, this will also disable priority settings for linux //! as most systems will not allow to set nice values without privileges //! For embedded linux system set this to 1. //! If set to 1 the binary needs "cap_sys_nice=eip" privileges to run -#define FSFW_USE_REALTIME_FOR_LINUX 1 +#define FSFW_USE_REALTIME_FOR_LINUX 1 namespace fsfwconfig { diff --git a/tcdistribution/CMakeLists.txt b/tcdistribution/CMakeLists.txt index 17dc186c..6f237076 100644 --- a/tcdistribution/CMakeLists.txt +++ b/tcdistribution/CMakeLists.txt @@ -1,7 +1,6 @@ -target_sources(${LIB_FSFW_NAME} - PRIVATE - CCSDSDistributor.cpp - PUSDistributor.cpp - TcDistributor.cpp - TcPacketCheck.cpp +target_sources(${LIB_FSFW_NAME} PRIVATE + CCSDSDistributor.cpp + PUSDistributor.cpp + TcDistributor.cpp + TcPacketCheck.cpp ) diff --git a/tcdistribution/PUSDistributor.cpp b/tcdistribution/PUSDistributor.cpp index 0fac9ba0..5c2f734b 100644 --- a/tcdistribution/PUSDistributor.cpp +++ b/tcdistribution/PUSDistributor.cpp @@ -3,7 +3,6 @@ #include "../objectmanager/ObjectManager.h" #include "../serviceinterface/ServiceInterface.h" -#include "../tmtcpacket/pus/TcPacketStored.h" #include "../tmtcservices/PusVerificationReport.h" #define PUS_DISTRIBUTOR_DEBUGGING 0 @@ -119,7 +118,11 @@ uint16_t PUSDistributor::getIdentifier() { } ReturnValue_t PUSDistributor::initialize() { - currentPacket = new TcPacketStored(); +#if FSFW_USE_PUS_C_TELECOMMANDS == 1 + currentPacket = new TcPacketStoredPusC(); +#else + currentPacket = new TcPacketStoredPusA(); +#endif if(currentPacket == nullptr) { // Should not happen, memory allocation failed! return ObjectManagerIF::CHILD_INIT_FAILED; diff --git a/tcdistribution/PUSDistributor.h b/tcdistribution/PUSDistributor.h index be3804ef..0c288451 100644 --- a/tcdistribution/PUSDistributor.h +++ b/tcdistribution/PUSDistributor.h @@ -5,6 +5,7 @@ #include "TcDistributor.h" #include "TcPacketCheck.h" +#include "../tmtcpacket/pus/TcPacketStored.h" #include "../returnvalues/HasReturnvaluesIF.h" #include "../tmtcservices/AcceptsTelecommandsIF.h" #include "../tmtcservices/VerificationReporter.h" @@ -51,7 +52,12 @@ protected: /** * The currently handled packet is stored here. */ - TcPacketStored* currentPacket = nullptr; +#if FSFW_USE_PUS_C_TELECOMMANDS == 1 + TcPacketStoredPusC* currentPacket = nullptr; +#else + TcPacketStoredPusA* currentPacket = nullptr; +#endif + /** * With this variable, the current check status is stored to generate * acceptance messages later. diff --git a/tcdistribution/TcPacketCheck.cpp b/tcdistribution/TcPacketCheck.cpp index 38ed04aa..e88305cc 100644 --- a/tcdistribution/TcPacketCheck.cpp +++ b/tcdistribution/TcPacketCheck.cpp @@ -1,39 +1,45 @@ #include "TcPacketCheck.h" #include "../globalfunctions/CRC.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "../tmtcpacket/pus/TcPacketBase.h" +#include "../tmtcpacket/pus/TcPacketStoredBase.h" +#include "../serviceinterface/ServiceInterface.h" #include "../storagemanager/StorageManagerIF.h" #include "../tmtcservices/VerificationCodes.h" -TcPacketCheck::TcPacketCheck( uint16_t setApid ) : apid(setApid) { +TcPacketCheck::TcPacketCheck(uint16_t setApid): apid(setApid) { } -ReturnValue_t TcPacketCheck::checkPacket( TcPacketStored* currentPacket ) { - uint16_t calculated_crc = CRC::crc16ccitt( currentPacket->getWholeData(), - currentPacket->getFullSize() ); - if ( calculated_crc != 0 ) { - return INCORRECT_CHECKSUM; - } - bool condition = (not currentPacket->hasSecondaryHeader()) or - (currentPacket->getPacketVersionNumber() != CCSDS_VERSION_NUMBER) or - (not currentPacket->isTelecommand()); - if ( condition ) { - return INCORRECT_PRIMARY_HEADER; - } - if ( currentPacket->getAPID() != this->apid ) - return ILLEGAL_APID; +ReturnValue_t TcPacketCheck::checkPacket(TcPacketStoredBase* currentPacket) { + TcPacketBase* tcPacketBase = currentPacket->getPacketBase(); + if(tcPacketBase == nullptr) { + return RETURN_FAILED; + } + uint16_t calculated_crc = CRC::crc16ccitt(tcPacketBase->getWholeData(), + tcPacketBase->getFullSize()); + if (calculated_crc != 0) { + return INCORRECT_CHECKSUM; + } + bool condition = (not tcPacketBase->hasSecondaryHeader()) or + (tcPacketBase->getPacketVersionNumber() != CCSDS_VERSION_NUMBER) or + (not tcPacketBase->isTelecommand()); + if (condition) { + return INCORRECT_PRIMARY_HEADER; + } + if (tcPacketBase->getAPID() != this->apid) + return ILLEGAL_APID; - if ( not currentPacket->isSizeCorrect() ) { - return INCOMPLETE_PACKET; - } - condition = (currentPacket->getSecondaryHeaderFlag() != CCSDS_SECONDARY_HEADER_FLAG) || - (currentPacket->getPusVersionNumber() != PUS_VERSION_NUMBER); - if ( condition ) { - return INCORRECT_SECONDARY_HEADER; - } - return RETURN_OK; + if (not currentPacket->isSizeCorrect()) { + return INCOMPLETE_PACKET; + } + condition = (tcPacketBase->getSecondaryHeaderFlag() != CCSDS_SECONDARY_HEADER_FLAG) || + (tcPacketBase->getPusVersionNumber() != PUS_VERSION_NUMBER); + if (condition) { + return INCORRECT_SECONDARY_HEADER; + } + return RETURN_OK; } uint16_t TcPacketCheck::getApid() const { - return apid; + return apid; } diff --git a/tcdistribution/TcPacketCheck.h b/tcdistribution/TcPacketCheck.h index 703bb1bb..f7422c19 100644 --- a/tcdistribution/TcPacketCheck.h +++ b/tcdistribution/TcPacketCheck.h @@ -2,9 +2,10 @@ #define FSFW_TCDISTRIBUTION_TCPACKETCHECK_H_ #include "../returnvalues/HasReturnvaluesIF.h" -#include "../tmtcpacket/pus/TcPacketStored.h" #include "../tmtcservices/PusVerificationReport.h" +class TcPacketStoredBase; + /** * This class performs a formal packet check for incoming PUS Telecommand Packets. * Currently, it only checks if the APID and CRC are correct. @@ -12,49 +13,48 @@ */ class TcPacketCheck : public HasReturnvaluesIF { protected: - /** - * Describes the version number a packet must have to pass. - */ - static constexpr uint8_t CCSDS_VERSION_NUMBER = 0; - /** - * Describes the secondary header a packet must have to pass. - */ - static constexpr uint8_t CCSDS_SECONDARY_HEADER_FLAG = 0; - /** - * Describes the TC Packet PUS Version Number a packet must have to pass. - */ - static constexpr uint8_t PUS_VERSION_NUMBER = 1; - /** - * The packet id each correct packet should have. - * It is composed of the APID and some static fields. - */ - uint16_t apid; + /** + * Describes the version number a packet must have to pass. + */ + static constexpr uint8_t CCSDS_VERSION_NUMBER = 0; + /** + * Describes the secondary header a packet must have to pass. + */ + static constexpr uint8_t CCSDS_SECONDARY_HEADER_FLAG = 0; + /** + * Describes the TC Packet PUS Version Number a packet must have to pass. + */ + static constexpr uint8_t PUS_VERSION_NUMBER = 1; + /** + * The packet id each correct packet should have. + * It is composed of the APID and some static fields. + */ + uint16_t apid; public: - static const uint8_t INTERFACE_ID = CLASS_ID::TC_PACKET_CHECK; - static const ReturnValue_t ILLEGAL_APID = MAKE_RETURN_CODE( 0 ); - static const ReturnValue_t INCOMPLETE_PACKET = MAKE_RETURN_CODE( 1 ); - static const ReturnValue_t INCORRECT_CHECKSUM = MAKE_RETURN_CODE( 2 ); - static const ReturnValue_t ILLEGAL_PACKET_TYPE = MAKE_RETURN_CODE( 3 ); - static const ReturnValue_t ILLEGAL_PACKET_SUBTYPE = MAKE_RETURN_CODE( 4 ); - static const ReturnValue_t INCORRECT_PRIMARY_HEADER = MAKE_RETURN_CODE( 5 ); - static const ReturnValue_t INCORRECT_SECONDARY_HEADER = MAKE_RETURN_CODE( 6 ); - /** - * The constructor only sets the APID attribute. - * @param set_apid The APID to set. - */ - TcPacketCheck( uint16_t setApid ); - /** - * This is the actual method to formally check a certain Telecommand Packet. - * The packet's Application Data can not be checked here. - * @param current_packet The packt to check - * @return - @c RETURN_OK on success. - * - @c INCORRECT_CHECKSUM if checksum is invalid. - * - @c ILLEGAL_APID if APID does not match. - */ - ReturnValue_t checkPacket( TcPacketStored* currentPacket ); + static const uint8_t INTERFACE_ID = CLASS_ID::TC_PACKET_CHECK; + static const ReturnValue_t ILLEGAL_APID = MAKE_RETURN_CODE( 0 ); + static const ReturnValue_t INCOMPLETE_PACKET = MAKE_RETURN_CODE( 1 ); + static const ReturnValue_t INCORRECT_CHECKSUM = MAKE_RETURN_CODE( 2 ); + static const ReturnValue_t ILLEGAL_PACKET_TYPE = MAKE_RETURN_CODE( 3 ); + static const ReturnValue_t ILLEGAL_PACKET_SUBTYPE = MAKE_RETURN_CODE( 4 ); + static const ReturnValue_t INCORRECT_PRIMARY_HEADER = MAKE_RETURN_CODE( 5 ); + static const ReturnValue_t INCORRECT_SECONDARY_HEADER = MAKE_RETURN_CODE( 6 ); + /** + * The constructor only sets the APID attribute. + * @param set_apid The APID to set. + */ + TcPacketCheck(uint16_t setApid); + /** + * This is the actual method to formally check a certain Telecommand Packet. + * The packet's Application Data can not be checked here. + * @param current_packet The packt to check + * @return - @c RETURN_OK on success. + * - @c INCORRECT_CHECKSUM if checksum is invalid. + * - @c ILLEGAL_APID if APID does not match. + */ + ReturnValue_t checkPacket(TcPacketStoredBase* currentPacket); - uint16_t getApid() const; + uint16_t getApid() const; }; - #endif /* FSFW_TCDISTRIBUTION_TCPACKETCHECK_H_ */ diff --git a/tmtcpacket/CMakeLists.txt b/tmtcpacket/CMakeLists.txt index fe3d2a4d..fdc884ec 100644 --- a/tmtcpacket/CMakeLists.txt +++ b/tmtcpacket/CMakeLists.txt @@ -1,7 +1,6 @@ -target_sources(${LIB_FSFW_NAME} - PRIVATE - SpacePacket.cpp - SpacePacketBase.cpp +target_sources(${LIB_FSFW_NAME} PRIVATE + SpacePacket.cpp + SpacePacketBase.cpp ) add_subdirectory(packetmatcher) diff --git a/tmtcpacket/pus/CMakeLists.txt b/tmtcpacket/pus/CMakeLists.txt index 2d22cb66..9340e3b1 100644 --- a/tmtcpacket/pus/CMakeLists.txt +++ b/tmtcpacket/pus/CMakeLists.txt @@ -1,13 +1,14 @@ -target_sources(${LIB_FSFW_NAME} - PRIVATE - TcPacketBase.cpp - TcPacketPusA.cpp - TcPacketStored.cpp - TmPacketBase.cpp - TmPacketMinimal.cpp - TmPacketStoredPusA.cpp - TmPacketStoredPusC.cpp - TmPacketPusA.cpp - TmPacketPusC.cpp - TmPacketStoredBase.cpp +target_sources(${LIB_FSFW_NAME} PRIVATE + TcPacketBase.cpp + TcPacketPusA.cpp + TcPacketStoredBase.cpp + TcPacketStoredPusA.cpp + + TmPacketBase.cpp + TmPacketMinimal.cpp + TmPacketStoredPusA.cpp + TmPacketStoredPusC.cpp + TmPacketPusA.cpp + TmPacketPusC.cpp + TmPacketStoredBase.cpp ) diff --git a/tmtcpacket/pus/TcPacketBase.cpp b/tmtcpacket/pus/TcPacketBase.cpp index ca3e2a99..a5b6f9ce 100644 --- a/tmtcpacket/pus/TcPacketBase.cpp +++ b/tmtcpacket/pus/TcPacketBase.cpp @@ -2,87 +2,19 @@ #include "../../globalfunctions/CRC.h" #include "../../globalfunctions/arrayprinter.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "../../serviceinterface/ServiceInterface.h" #include -TcPacketBase::TcPacketBase(const uint8_t* setData) : - SpacePacketBase(setData) { - tcData = reinterpret_cast(const_cast(setData)); -} +TcPacketBase::TcPacketBase(const uint8_t* setData): SpacePacketBase(setData) {} -TcPacketBase::~TcPacketBase() { - //Nothing to do. -} - -uint8_t TcPacketBase::getService() { - return tcData->dataField.service_type; -} - -uint8_t TcPacketBase::getSubService() { - return tcData->dataField.service_subtype; -} - -uint8_t TcPacketBase::getAcknowledgeFlags() { - return tcData->dataField.version_type_ack & 0b00001111; -} - -const uint8_t* TcPacketBase::getApplicationData() const { - return &tcData->appData; -} - -uint16_t TcPacketBase::getApplicationDataSize() { - return getPacketDataLength() - sizeof(tcData->dataField) - CRC_SIZE + 1; -} - -uint16_t TcPacketBase::getErrorControl() { - uint16_t size = getApplicationDataSize() + CRC_SIZE; - uint8_t* p_to_buffer = &tcData->appData; - return (p_to_buffer[size - 2] << 8) + p_to_buffer[size - 1]; -} - -void TcPacketBase::setErrorControl() { - uint32_t full_size = getFullSize(); - uint16_t crc = CRC::crc16ccitt(getWholeData(), full_size - CRC_SIZE); - uint32_t size = getApplicationDataSize(); - (&tcData->appData)[size] = (crc & 0XFF00) >> 8; // CRCH - (&tcData->appData)[size + 1] = (crc) & 0X00FF; // CRCL -} - -void TcPacketBase::setData(const uint8_t* pData) { - SpacePacketBase::setData(pData); - tcData = (TcPacketPointer*) pData; -} - -uint8_t TcPacketBase::getSecondaryHeaderFlag() { - return (tcData->dataField.version_type_ack & 0b10000000) >> 7; -} - -uint8_t TcPacketBase::getPusVersionNumber() { - return (tcData->dataField.version_type_ack & 0b01110000) >> 4; -} +TcPacketBase::~TcPacketBase() {} void TcPacketBase::print() { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << "TcPacketBase::print: " << std::endl; + sif::info << "TcPacketBase::print:" << std::endl; +#else + sif::printInfo("TcPacketBase::print:\n"); #endif - arrayprinter::print(getWholeData(), getFullSize()); -} - -void TcPacketBase::initializeTcPacket(uint16_t apid, uint16_t sequenceCount, - uint8_t ack, uint8_t service, uint8_t subservice) { - initSpacePacketHeader(true, true, apid, sequenceCount); - std::memset(&tcData->dataField, 0, sizeof(tcData->dataField)); - setPacketDataLength(sizeof(PUSTcDataFieldHeader) + CRC_SIZE - 1); - //Data Field Header: - //Set CCSDS_secondary_header_flag to 0 and version number to 001 - tcData->dataField.version_type_ack = 0b00010000; - tcData->dataField.version_type_ack |= (ack & 0x0F); - tcData->dataField.service_type = service; - tcData->dataField.service_subtype = subservice; -} - -size_t TcPacketBase::calculateFullPacketLength(size_t appDataLen) { - return sizeof(CCSDSPrimaryHeader) + sizeof(PUSTcDataFieldHeader) + - appDataLen + TcPacketBase::CRC_SIZE; + arrayprinter::print(getWholeData(), getFullSize()); } diff --git a/tmtcpacket/pus/TcPacketBase.h b/tmtcpacket/pus/TcPacketBase.h index 451f9c3a..80f9e505 100644 --- a/tmtcpacket/pus/TcPacketBase.h +++ b/tmtcpacket/pus/TcPacketBase.h @@ -16,9 +16,8 @@ * @ingroup tmtcpackets */ class TcPacketBase : public SpacePacketBase { + friend class TcPacketStoredBase; public: - static const uint16_t TC_PACKET_MIN_SIZE = (sizeof(CCSDSPrimaryHeader) + - sizeof(PUSTcDataFieldHeader) + 2); enum AckField { //! No acknowledgements are expected. @@ -54,7 +53,7 @@ public: * highest bit of the first byte of the Data Field Header. * @return the CCSDS Secondary Header Flag */ - uint8_t getSecondaryHeaderFlag(); + virtual uint8_t getSecondaryHeaderFlag() = 0; /** * This command returns the TC Packet PUS Version Number. * The version number of ECSS PUS 2003 is 1. @@ -62,7 +61,7 @@ public: * first byte. * @return */ - uint8_t getPusVersionNumber(); + virtual uint8_t getPusVersionNumber() = 0; /** * This is a getter for the packet's Ack field, which are the lowest four * bits of the first byte of the Data Field Header. @@ -70,19 +69,19 @@ public: * It is packed in a uint8_t variable. * @return The packet's PUS Ack field. */ - uint8_t getAcknowledgeFlags(); + virtual uint8_t getAcknowledgeFlags() = 0; /** * This is a getter for the packet's PUS Service ID, which is the second * byte of the Data Field Header. * @return The packet's PUS Service ID. */ - uint8_t getService(); + virtual uint8_t getService() const = 0; /** * This is a getter for the packet's PUS Service Subtype, which is the * third byte of the Data Field Header. * @return The packet's PUS Service Subtype. */ - uint8_t getSubService(); + virtual uint8_t getSubService() = 0; /** * This is a getter for a pointer to the packet's Application data. * @@ -90,7 +89,7 @@ public: * the packet's application data. * @return A pointer to the PUS Application Data. */ - const uint8_t* getApplicationData() const; + virtual const uint8_t* getApplicationData() const = 0; /** * This method calculates the size of the PUS Application data field. * @@ -99,7 +98,7 @@ public: * @return The size of the PUS Application Data (without Error Control * field) */ - uint16_t getApplicationDataSize(); + virtual uint16_t getApplicationDataSize() = 0; /** * This getter returns the Error Control Field of the packet. * @@ -108,44 +107,26 @@ public: * supposed to be a 16bit-CRC. * @return The PUS Error Control */ - uint16_t getErrorControl(); + virtual uint16_t getErrorControl() = 0; /** * With this method, the Error Control Field is updated to match the * current content of the packet. */ - void setErrorControl(); + virtual void setErrorControl() = 0; - /** - * This is a debugging helper method that prints the whole packet content - * to the screen. - */ - void print(); /** * Calculate full packet length from application data length. * @param appDataLen * @return */ - static size_t calculateFullPacketLength(size_t appDataLen); + virtual size_t calculateFullPacketLength(size_t appDataLen) = 0; + /** + * This is a debugging helper method that prints the whole packet content + * to the screen. + */ + void print(); protected: - /** - * A pointer to a structure which defines the data structure of - * the packet's data. - * - * To be hardware-safe, all elements are of byte size. - */ - TcPacketPointer* tcData; - - /** - * Initializes the Tc Packet header. - * @param apid APID used. - * @param sequenceCount Sequence Count in the primary header. - * @param ack Which acknowledeges are expected from the receiver. - * @param service PUS Service - * @param subservice PUS Subservice - */ - void initializeTcPacket(uint16_t apid, uint16_t sequenceCount, uint8_t ack, - uint8_t service, uint8_t subservice); /** * With this method, the packet data pointer can be redirected to another @@ -155,7 +136,7 @@ protected: * * @param p_data A pointer to another PUS Telecommand Packet. */ - void setData( const uint8_t* pData ); + void setData( const uint8_t* pData ) = 0; }; diff --git a/tmtcpacket/pus/TcPacketPusA.cpp b/tmtcpacket/pus/TcPacketPusA.cpp index c9af38a6..0ce767b4 100644 --- a/tmtcpacket/pus/TcPacketPusA.cpp +++ b/tmtcpacket/pus/TcPacketPusA.cpp @@ -1,3 +1,75 @@ #include "TcPacketPusA.h" +#include "../../globalfunctions/CRC.h" +#include +TcPacketPusA::TcPacketPusA(const uint8_t *setData): TcPacketBase(setData) { + tcData = reinterpret_cast(const_cast(setData)); +} + +uint8_t TcPacketPusA::getService() const { + return tcData->dataField.service_type; +} + +uint8_t TcPacketPusA::getSubService() { + return tcData->dataField.service_subtype; +} + +uint8_t TcPacketPusA::getAcknowledgeFlags() { + return tcData->dataField.version_type_ack & 0b00001111; +} + +const uint8_t* TcPacketPusA::getApplicationData() const { + return &tcData->appData; +} + +uint16_t TcPacketPusA::getApplicationDataSize() { + return getPacketDataLength() - sizeof(tcData->dataField) - CRC_SIZE + 1; +} + +uint16_t TcPacketPusA::getErrorControl() { + uint16_t size = getApplicationDataSize() + CRC_SIZE; + uint8_t* p_to_buffer = &tcData->appData; + return (p_to_buffer[size - 2] << 8) + p_to_buffer[size - 1]; +} + +void TcPacketPusA::setErrorControl() { + uint32_t full_size = getFullSize(); + uint16_t crc = CRC::crc16ccitt(getWholeData(), full_size - CRC_SIZE); + uint32_t size = getApplicationDataSize(); + (&tcData->appData)[size] = (crc & 0XFF00) >> 8; // CRCH + (&tcData->appData)[size + 1] = (crc) & 0X00FF; // CRCL +} + +void TcPacketPusA::setData(const uint8_t* pData) { + SpacePacketBase::setData(pData); + // This function is const-correct, but it was decided to keep the pointer non-const + // for convenience. Therefore, cast aways constness here and then cast to packet type. + tcData = reinterpret_cast(const_cast(pData)); +} + +uint8_t TcPacketPusA::getSecondaryHeaderFlag() { + return (tcData->dataField.version_type_ack & 0b10000000) >> 7; +} + +uint8_t TcPacketPusA::getPusVersionNumber() { + return (tcData->dataField.version_type_ack & 0b01110000) >> 4; +} + +void TcPacketPusA::initializeTcPacket(uint16_t apid, uint16_t sequenceCount, + uint8_t ack, uint8_t service, uint8_t subservice) { + initSpacePacketHeader(true, true, apid, sequenceCount); + std::memset(&tcData->dataField, 0, sizeof(tcData->dataField)); + setPacketDataLength(sizeof(PUSTcDataFieldHeader) + CRC_SIZE - 1); + // Data Field Header: + // Set CCSDS_secondary_header_flag to 0 and version number to 001 + tcData->dataField.version_type_ack = 0b00010000; + tcData->dataField.version_type_ack |= (ack & 0x0F); + tcData->dataField.service_type = service; + tcData->dataField.service_subtype = subservice; +} + +size_t TcPacketPusA::calculateFullPacketLength(size_t appDataLen) { + return sizeof(CCSDSPrimaryHeader) + sizeof(PUSTcDataFieldHeader) + + appDataLen + TcPacketBase::CRC_SIZE; +} diff --git a/tmtcpacket/pus/TcPacketPusA.h b/tmtcpacket/pus/TcPacketPusA.h index 9254ad32..0e61d829 100644 --- a/tmtcpacket/pus/TcPacketPusA.h +++ b/tmtcpacket/pus/TcPacketPusA.h @@ -1,7 +1,7 @@ #ifndef FSFW_TMTCPACKET_PUS_TCPACKETPUSA_H_ #define FSFW_TMTCPACKET_PUS_TCPACKETPUSA_H_ -#include "ccsds_header.h" +#include "../ccsds_header.h" #include "TcPacketBase.h" #include @@ -33,7 +33,50 @@ struct TcPacketPointer { class TcPacketPusA: public TcPacketBase { public: -private: + static const uint16_t TC_PACKET_MIN_SIZE = (sizeof(CCSDSPrimaryHeader) + + sizeof(PUSTcDataFieldHeader) + 2); + + /** + * Initialize a PUS A telecommand packet which already exists. You can also + * create an empty (invalid) object by passing nullptr as the data pointer + * @param setData + */ + TcPacketPusA(const uint8_t* setData); + + // Base class overrides + virtual uint8_t getSecondaryHeaderFlag() override; + virtual uint8_t getPusVersionNumber() override; + virtual uint8_t getAcknowledgeFlags() override; + virtual uint8_t getService() const override; + virtual uint8_t getSubService() override; + const uint8_t* getApplicationData() const override; + uint16_t getApplicationDataSize() override; + uint16_t getErrorControl() override; + void setErrorControl() override; + size_t calculateFullPacketLength(size_t appDataLen) override; + +protected: + + void setData(const uint8_t* pData) override; + + /** + * Initializes the Tc Packet header. + * @param apid APID used. + * @param sequenceCount Sequence Count in the primary header. + * @param ack Which acknowledeges are expected from the receiver. + * @param service PUS Service + * @param subservice PUS Subservice + */ + void initializeTcPacket(uint16_t apid, uint16_t sequenceCount, uint8_t ack, + uint8_t service, uint8_t subservice); + + /** + * A pointer to a structure which defines the data structure of + * the packet's data. + * + * To be hardware-safe, all elements are of byte size. + */ + TcPacketPointer* tcData = nullptr; }; diff --git a/tmtcpacket/pus/TcPacketStored.cpp b/tmtcpacket/pus/TcPacketStored.cpp deleted file mode 100644 index 36fa8d11..00000000 --- a/tmtcpacket/pus/TcPacketStored.cpp +++ /dev/null @@ -1,124 +0,0 @@ -#include "TcPacketStored.h" - -#include "../../objectmanager/ObjectManager.h" -#include "../../serviceinterface/ServiceInterface.h" - -#include - -StorageManagerIF* TcPacketStored::store = nullptr; - -TcPacketStored::TcPacketStored(store_address_t setAddress) : - TcPacketBase(nullptr), storeAddress(setAddress) { - setStoreAddress(storeAddress); -} - -TcPacketStored::TcPacketStored(uint16_t apid, uint8_t service, - uint8_t subservice, uint8_t sequenceCount, const uint8_t* data, - size_t size, uint8_t ack) : - TcPacketBase(nullptr) { - this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; - if (not this->checkAndSetStore()) { - return; - } - uint8_t* pData = nullptr; - ReturnValue_t returnValue = this->store->getFreeElement(&this->storeAddress, - (TC_PACKET_MIN_SIZE + size), &pData); - if (returnValue != this->store->RETURN_OK) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "TcPacketStored: Could not get free element from store!" - << std::endl; -#endif - return; - } - this->setData(pData); - initializeTcPacket(apid, sequenceCount, ack, service, subservice); - memcpy(&tcData->appData, data, size); - this->setPacketDataLength( - size + sizeof(PUSTcDataFieldHeader) + CRC_SIZE - 1); - this->setErrorControl(); -} - -ReturnValue_t TcPacketStored::getData(const uint8_t ** dataPtr, - size_t* dataSize) { - auto result = this->store->getData(storeAddress, dataPtr, dataSize); - if(result != HasReturnvaluesIF::RETURN_OK) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "TcPacketStored: Could not get data!" << std::endl; -#endif - } - return result; -} - -TcPacketStored::TcPacketStored(): TcPacketBase(nullptr) { - this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; - this->checkAndSetStore(); - -} - -ReturnValue_t TcPacketStored::deletePacket() { - ReturnValue_t result = this->store->deleteData(this->storeAddress); - this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; - this->setData(nullptr); - return result; -} - -bool TcPacketStored::checkAndSetStore() { - if (this->store == nullptr) { - this->store = ObjectManager::instance()->get(objects::TC_STORE); - if (this->store == nullptr) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "TcPacketStored::TcPacketStored: TC Store not found!" - << std::endl; -#endif - return false; - } - } - return true; -} - -void TcPacketStored::setStoreAddress(store_address_t setAddress) { - this->storeAddress = setAddress; - const uint8_t* tempData = nullptr; - size_t temp_size; - ReturnValue_t status = StorageManagerIF::RETURN_FAILED; - if (this->checkAndSetStore()) { - status = this->store->getData(this->storeAddress, &tempData, - &temp_size); - } - if (status == StorageManagerIF::RETURN_OK) { - this->setData(tempData); - } else { - this->setData(nullptr); - this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; - } -} - -store_address_t TcPacketStored::getStoreAddress() { - return this->storeAddress; -} - -bool TcPacketStored::isSizeCorrect() { - const uint8_t* temp_data = nullptr; - size_t temp_size; - ReturnValue_t status = this->store->getData(this->storeAddress, &temp_data, - &temp_size); - if (status == StorageManagerIF::RETURN_OK) { - if (this->getFullSize() == temp_size) { - return true; - } - } - return false; -} - -TcPacketStored::TcPacketStored(const uint8_t* data, uint32_t size) : - TcPacketBase(data) { - if (getFullSize() != size) { - return; - } - if (this->checkAndSetStore()) { - ReturnValue_t status = store->addData(&storeAddress, data, size); - if (status != HasReturnvaluesIF::RETURN_OK) { - this->setData(nullptr); - } - } -} diff --git a/tmtcpacket/pus/TcPacketStored.h b/tmtcpacket/pus/TcPacketStored.h index 1666107b..0b6ff0f4 100644 --- a/tmtcpacket/pus/TcPacketStored.h +++ b/tmtcpacket/pus/TcPacketStored.h @@ -1,117 +1,13 @@ -#ifndef TMTCPACKET_PUS_TCPACKETSTORED_H_ -#define TMTCPACKET_PUS_TCPACKETSTORED_H_ +#ifndef FSFW_TMTCPACKET_PUS_TCPACKETSTORED_H_ +#define FSFW_TMTCPACKET_PUS_TCPACKETSTORED_H_ -#include "TcPacketBase.h" -#include "../../storagemanager/StorageManagerIF.h" +#include -/** - * This class generates a ECSS PUS Telecommand packet within a given - * intermediate storage. - * As most packets are passed between tasks with the help of a storage - * anyway, it seems logical to create a Packet-In-Storage access class - * which saves the user almost all storage handling operation. - * Packets can both be newly created with the class and be "linked" to - * packets in a store with the help of a storeAddress. - * @ingroup tmtcpackets - */ -class TcPacketStored : public TcPacketBase { -public: - /** - * This is a default constructor which does not set the data pointer. - * However, it does try to set the packet store. - */ - TcPacketStored(); - /** - * With this constructor, the class instance is linked to an existing - * packet in the packet store. - * The packet content is neither checked nor changed with this call. If - * the packet could not be found, the data pointer is set to NULL. - */ - TcPacketStored( store_address_t setAddress ); - /** - * With this constructor, new space is allocated in the packet store and - * a new PUS Telecommand Packet is created there. - * Packet Application Data passed in data is copied into the packet. - * @param apid Sets the packet's APID field. - * @param service Sets the packet's Service ID field. - * This specifies the destination service. - * @param subservice Sets the packet's Service Subtype field. - * This specifies the destination sub-service. - * @param sequence_count Sets the packet's Source Sequence Count field. - * @param data The data to be copied to the Application Data Field. - * @param size The amount of data to be copied. - * @param ack Set's the packet's Ack field, which specifies - * number of verification packets returned - * for this command. - */ - TcPacketStored(uint16_t apid, uint8_t service, uint8_t subservice, - uint8_t sequence_count = 0, const uint8_t* data = nullptr, - size_t size = 0, uint8_t ack = TcPacketBase::ACK_ALL); - /** - * Another constructor to create a TcPacket from a raw packet stream. - * Takes the data and adds it unchecked to the TcStore. - * @param data Pointer to the complete TC Space Packet. - * @param Size size of the packet. - */ - TcPacketStored( const uint8_t* data, uint32_t size); - - /** - * Getter function for the raw data. - * @param dataPtr [out] Pointer to the data pointer to set - * @param dataSize [out] Address of size to set. - * @return -@c RETURN_OK if data was retrieved successfully. - */ - ReturnValue_t getData(const uint8_t ** dataPtr, - size_t* dataSize); - /** - * This is a getter for the current store address of the packet. - * @return The current store address. The (raw) value is - * @c StorageManagerIF::INVALID_ADDRESS if the packet is not linked. - */ - store_address_t getStoreAddress(); - /** - * With this call, the packet is deleted. - * It removes itself from the store and sets its data pointer to NULL. - * @return returncode from deleting the data. - */ - ReturnValue_t deletePacket(); - /** - * With this call, a packet can be linked to another store. This is useful - * if the packet is a class member and used for more than one packet. - * @param setAddress The new packet id to link to. - */ - void setStoreAddress( store_address_t setAddress ); - /** - * This method performs a size check. - * It reads the stored size and compares it with the size entered in the - * packet header. This class is the optimal place for such a check as it - * has access to both the header data and the store. - * @return true if size is correct, false if packet is not registered in - * store or size is incorrect. - */ - bool isSizeCorrect(); - -private: - /** - * This is a pointer to the store all instances of the class use. - * If the store is not yet set (i.e. @c store is NULL), every constructor - * call tries to set it and throws an error message in case of failures. - * The default store is objects::TC_STORE. - */ - static StorageManagerIF* store; - /** - * The address where the packet data of the object instance is stored. - */ - store_address_t storeAddress; - /** - * A helper method to check if a store is assigned to the class. - * If not, the method tries to retrieve the store from the global - * ObjectManager. - * @return @li @c true if the store is linked or could be created. - * @li @c false otherwise. - */ - bool checkAndSetStore(); -}; +#if FSFW_USE_PUS_C_TELECOMMANDS == 1 +#include "TcPacketStoredPusC.h" +#else +#include "TcPacketStoredPusA.h" +#endif -#endif /* TMTCPACKET_PUS_TCPACKETSTORED_H_ */ +#endif /* FSFW_TMTCPACKET_PUS_TCPACKETSTORED_H_ */ diff --git a/tmtcpacket/pus/TcPacketStoredBase.cpp b/tmtcpacket/pus/TcPacketStoredBase.cpp new file mode 100644 index 00000000..629562c0 --- /dev/null +++ b/tmtcpacket/pus/TcPacketStoredBase.cpp @@ -0,0 +1,72 @@ +#include "TcPacketStoredBase.h" + +#include "../../objectmanager/ObjectManager.h" +#include "../../serviceinterface/ServiceInterface.h" +#include "../../objectmanager/frameworkObjects.h" + +#include + +StorageManagerIF* TcPacketStoredBase::store = nullptr; + +TcPacketStoredBase::TcPacketStoredBase() { + this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; + this->checkAndSetStore(); + +} + +TcPacketStoredBase::~TcPacketStoredBase() { +} + +ReturnValue_t TcPacketStoredBase::getData(const uint8_t ** dataPtr, + size_t* dataSize) { + auto result = this->store->getData(storeAddress, dataPtr, dataSize); + if(result != HasReturnvaluesIF::RETURN_OK) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "TcPacketStoredBase: Could not get data!" << std::endl; +#else + sif::printWarning("TcPacketStoredBase: Could not get data!\n"); +#endif + } + return result; +} + + + +bool TcPacketStoredBase::checkAndSetStore() { + if (this->store == nullptr) { + this->store = ObjectManager::instance()->get(objects::TC_STORE); + if (this->store == nullptr) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "TcPacketStoredBase::TcPacketStoredBase: TC Store not found!" + << std::endl; +#endif + return false; + } + } + return true; +} + +void TcPacketStoredBase::setStoreAddress(store_address_t setAddress) { + this->storeAddress = setAddress; + const uint8_t* tempData = nullptr; + size_t tempSize; + ReturnValue_t status = StorageManagerIF::RETURN_FAILED; + if (this->checkAndSetStore()) { + status = this->store->getData(this->storeAddress, &tempData, &tempSize); + } + TcPacketBase* tcPacketBase = this->getPacketBase(); + if(tcPacketBase == nullptr) { + return; + } + if (status == StorageManagerIF::RETURN_OK) { + tcPacketBase->setData(tempData); + } + else { + tcPacketBase->setData(nullptr); + this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; + } +} + +store_address_t TcPacketStoredBase::getStoreAddress() { + return this->storeAddress; +} diff --git a/tmtcpacket/pus/TcPacketStoredBase.h b/tmtcpacket/pus/TcPacketStoredBase.h new file mode 100644 index 00000000..811123db --- /dev/null +++ b/tmtcpacket/pus/TcPacketStoredBase.h @@ -0,0 +1,90 @@ +#ifndef TMTCPACKET_PUS_TCPACKETSTORED_H_ +#define TMTCPACKET_PUS_TCPACKETSTORED_H_ + +#include +#include "../../storagemanager/StorageManagerIF.h" + +/** + * This class generates a ECSS PUS Telecommand packet within a given + * intermediate storage. + * As most packets are passed between tasks with the help of a storage + * anyway, it seems logical to create a Packet-In-Storage access class + * which saves the user almost all storage handling operation. + * Packets can both be newly created with the class and be "linked" to + * packets in a store with the help of a storeAddress. + * @ingroup tmtcpackets + */ +class TcPacketStoredBase: public TcPacketStoredIF { +public: + /** + * This is a default constructor which does not set the data pointer to initialize + * with an empty cached store address + */ + TcPacketStoredBase(); + /** + * Constructor to set to an existing store address. + * @param setAddress + */ + TcPacketStoredBase(store_address_t setAddress); + /** + * Another constructor to create a TcPacket from a raw packet stream. + * Takes the data and adds it unchecked to the TcStore. + * @param data Pointer to the complete TC Space Packet. + * @param Size size of the packet. + */ + TcPacketStoredBase(const uint8_t* data, uint32_t size); + + virtual~ TcPacketStoredBase(); + + /** + * Getter function for the raw data. + * @param dataPtr [out] Pointer to the data pointer to set + * @param dataSize [out] Address of size to set. + * @return -@c RETURN_OK if data was retrieved successfully. + */ + ReturnValue_t getData(const uint8_t ** dataPtr, size_t* dataSize) override; + + void setStoreAddress(store_address_t setAddress) override; + store_address_t getStoreAddress() override; + + /** + * With this call, the packet is deleted. + * It removes itself from the store and sets its data pointer to NULL. + * @return returncode from deleting the data. + */ + virtual ReturnValue_t deletePacket() = 0; + + /** + * This method performs a size check. + * It reads the stored size and compares it with the size entered in the + * packet header. This class is the optimal place for such a check as it + * has access to both the header data and the store. + * @return true if size is correct, false if packet is not registered in + * store or size is incorrect. + */ + virtual bool isSizeCorrect() = 0; + +protected: + /** + * This is a pointer to the store all instances of the class use. + * If the store is not yet set (i.e. @c store is NULL), every constructor + * call tries to set it and throws an error message in case of failures. + * The default store is objects::TC_STORE. + */ + static StorageManagerIF* store; + /** + * The address where the packet data of the object instance is stored. + */ + store_address_t storeAddress; + /** + * A helper method to check if a store is assigned to the class. + * If not, the method tries to retrieve the store from the global + * ObjectManager. + * @return @li @c true if the store is linked or could be created. + * @li @c false otherwise. + */ + bool checkAndSetStore(); +}; + + +#endif /* TMTCPACKET_PUS_TcPacketStoredBase_H_ */ diff --git a/tmtcpacket/pus/TcPacketStoredIF.h b/tmtcpacket/pus/TcPacketStoredIF.h new file mode 100644 index 00000000..8eb23004 --- /dev/null +++ b/tmtcpacket/pus/TcPacketStoredIF.h @@ -0,0 +1,38 @@ +#ifndef FSFW_TMTCPACKET_PUS_TCPACKETSTOREDIF_H_ +#define FSFW_TMTCPACKET_PUS_TCPACKETSTOREDIF_H_ + +#include "../../tmtcpacket/pus/TcPacketBase.h" +#include "../../storagemanager/storeAddress.h" +#include "../../returnvalues/HasReturnvaluesIF.h" + +class TcPacketStoredIF { +public: + virtual~TcPacketStoredIF() {}; + + /** + * With this call, the stored packet can be set to another packet in a store. This is useful + * if the packet is a class member and used for more than one packet. + * @param setAddress The new packet id to link to. + */ + virtual void setStoreAddress(store_address_t setAddress) = 0; + + virtual store_address_t getStoreAddress() = 0; + + /** + * Getter function for the raw data. + * @param dataPtr [out] Pointer to the data pointer to set + * @param dataSize [out] Address of size to set. + * @return -@c RETURN_OK if data was retrieved successfully. + */ + virtual ReturnValue_t getData(const uint8_t ** dataPtr, size_t* dataSize) = 0; + + /** + * Get packet base pointer which can be used to get access to PUS packet fields + * @return + */ + virtual TcPacketBase* getPacketBase() = 0; +}; + + + +#endif /* FSFW_TMTCPACKET_PUS_TCPACKETSTOREDIF_H_ */ diff --git a/tmtcpacket/pus/TcPacketStoredPusA.cpp b/tmtcpacket/pus/TcPacketStoredPusA.cpp new file mode 100644 index 00000000..7c706a1a --- /dev/null +++ b/tmtcpacket/pus/TcPacketStoredPusA.cpp @@ -0,0 +1,77 @@ +#include "TcPacketStoredPusA.h" + +#include + +TcPacketStoredPusA::TcPacketStoredPusA(uint16_t apid, uint8_t service, + uint8_t subservice, uint8_t sequenceCount, const uint8_t* data, + size_t size, uint8_t ack) : + TcPacketPusA(nullptr) { + this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; + if (not this->checkAndSetStore()) { + return; + } + uint8_t* pData = nullptr; + ReturnValue_t returnValue = this->store->getFreeElement(&this->storeAddress, + (TC_PACKET_MIN_SIZE + size), &pData); + if (returnValue != this->store->RETURN_OK) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "TcPacketStoredBase: Could not get free element from store!" + << std::endl; +#endif + return; + } + this->setData(pData); + initializeTcPacket(apid, sequenceCount, ack, service, subservice); + std::memcpy(&tcData->appData, data, size); + this->setPacketDataLength( + size + sizeof(PUSTcDataFieldHeader) + CRC_SIZE - 1); + this->setErrorControl(); +} + +TcPacketStoredPusA::TcPacketStoredPusA(): TcPacketStoredBase(), TcPacketPusA(nullptr) { +} + +TcPacketStoredPusA::TcPacketStoredPusA(store_address_t setAddress): TcPacketPusA(nullptr) { + TcPacketStoredBase::setStoreAddress(setAddress); +} + +TcPacketStoredPusA::TcPacketStoredPusA(const uint8_t* data, size_t size): TcPacketPusA(data) { + if (this->getFullSize() != size) { + return; + } + if (this->checkAndSetStore()) { + ReturnValue_t status = store->addData(&storeAddress, data, size); + if (status != HasReturnvaluesIF::RETURN_OK) { + this->setData(nullptr); + } + const uint8_t* storePtr = nullptr; + // Repoint base data pointer to the data in the store. + store->getData(storeAddress, &storePtr, &size); + this->setData(storePtr); + } +} + +ReturnValue_t TcPacketStoredPusA::deletePacket() { + ReturnValue_t result = this->store->deleteData(this->storeAddress); + this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; + this->setData(nullptr); + return result; +} + +TcPacketBase* TcPacketStoredPusA::getPacketBase() { + return this; +} + + +bool TcPacketStoredPusA::isSizeCorrect() { + const uint8_t* temp_data = nullptr; + size_t temp_size; + ReturnValue_t status = this->store->getData(this->storeAddress, &temp_data, + &temp_size); + if (status == StorageManagerIF::RETURN_OK) { + if (this->getFullSize() == temp_size) { + return true; + } + } + return false; +} diff --git a/tmtcpacket/pus/TcPacketStoredPusA.h b/tmtcpacket/pus/TcPacketStoredPusA.h new file mode 100644 index 00000000..fe1f64f7 --- /dev/null +++ b/tmtcpacket/pus/TcPacketStoredPusA.h @@ -0,0 +1,53 @@ +#ifndef FSFW_TMTCPACKET_PUS_TCPACKETSTOREDPUSA_H_ +#define FSFW_TMTCPACKET_PUS_TCPACKETSTOREDPUSA_H_ + +#include "TcPacketStoredBase.h" +#include "TcPacketPusA.h" + +class TcPacketStoredPusA: + public TcPacketStoredBase, + public TcPacketPusA { +public: + /** + * With this constructor, new space is allocated in the packet store and + * a new PUS Telecommand Packet is created there. + * Packet Application Data passed in data is copied into the packet. + * @param apid Sets the packet's APID field. + * @param service Sets the packet's Service ID field. + * This specifies the destination service. + * @param subservice Sets the packet's Service Subtype field. + * This specifies the destination sub-service. + * @param sequence_count Sets the packet's Source Sequence Count field. + * @param data The data to be copied to the Application Data Field. + * @param size The amount of data to be copied. + * @param ack Set's the packet's Ack field, which specifies + * number of verification packets returned + * for this command. + */ + TcPacketStoredPusA(uint16_t apid, uint8_t service, uint8_t subservice, + uint8_t sequence_count = 0, const uint8_t* data = nullptr, + size_t size = 0, uint8_t ack = TcPacketBase::ACK_ALL); + /** + * Create stored packet with existing data. + * @param data + * @param size + */ + TcPacketStoredPusA(const uint8_t* data, size_t size); + /** + * Create stored packet from existing packet in store + * @param setAddress + */ + TcPacketStoredPusA(store_address_t setAddress); + TcPacketStoredPusA(); + + ReturnValue_t deletePacket() override; + TcPacketBase* getPacketBase() override; + +private: + + bool isSizeCorrect() override; +}; + + + +#endif /* FSFW_TMTCPACKET_PUS_TCPACKETSTOREDPUSA_H_ */ diff --git a/tmtcpacket/pus/TcPacketStoredPusC.cpp b/tmtcpacket/pus/TcPacketStoredPusC.cpp new file mode 100644 index 00000000..f568d139 --- /dev/null +++ b/tmtcpacket/pus/TcPacketStoredPusC.cpp @@ -0,0 +1,10 @@ +/* + * TcPacketStoredPusC.cpp + * + * Created on: Jun 13, 2021 + * Author: rmueller + */ + + + + diff --git a/tmtcpacket/pus/TmPacketBase.cpp b/tmtcpacket/pus/TmPacketBase.cpp index acd69b65..b144db1b 100644 --- a/tmtcpacket/pus/TmPacketBase.cpp +++ b/tmtcpacket/pus/TmPacketBase.cpp @@ -44,13 +44,6 @@ ReturnValue_t TmPacketBase::getPacketTime(timeval* timestamp) const { &tempSize, getTimestampSize()); } -void TmPacketBase::print() { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << "TmPacketBase::print: " << std::endl; -#endif - arrayprinter::print(getWholeData(), getFullSize()); -} - bool TmPacketBase::checkAndSetStamper() { if (timeStamper == NULL) { timeStamper = ObjectManager::instance()->get(timeStamperId); @@ -66,3 +59,11 @@ bool TmPacketBase::checkAndSetStamper() { return true; } +void TmPacketBase::print() { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TmPacketBase::print:" << std::endl; +#else + sif::printInfo("TmPacketBase::print:\n"); +#endif + arrayprinter::print(getWholeData(), getFullSize()); +} diff --git a/tmtcservices/CommandingServiceBase.cpp b/tmtcservices/CommandingServiceBase.cpp index 863cba4f..0ede27dc 100644 --- a/tmtcservices/CommandingServiceBase.cpp +++ b/tmtcservices/CommandingServiceBase.cpp @@ -246,7 +246,11 @@ void CommandingServiceBase::handleRequestQueue() { TmTcMessage message; ReturnValue_t result; store_address_t address; - TcPacketStored packet; +#if FSFW_USE_PUS_C_TELECOMMANDS == 1 + TcPacketStoredPusC packet; +#else + TcPacketStoredPusA packet; +#endif MessageQueueId_t queue; object_id_t objectId; for (result = requestQueue->receiveMessage(&message); result == RETURN_OK; @@ -351,14 +355,18 @@ ReturnValue_t CommandingServiceBase::sendTmPacket(uint8_t subservice, } -void CommandingServiceBase::startExecution(TcPacketStored *storedPacket, +void CommandingServiceBase::startExecution(TcPacketStoredBase *storedPacket, CommandMapIter iter) { ReturnValue_t result = RETURN_OK; CommandMessage command; - iter->second.subservice = storedPacket->getSubService(); + TcPacketBase* tcPacketBase = storedPacket->getPacketBase(); + if(tcPacketBase == nullptr) { + return; + } + iter->second.subservice = tcPacketBase->getSubService(); result = prepareCommand(&command, iter->second.subservice, - storedPacket->getApplicationData(), - storedPacket->getApplicationDataSize(), &iter->second.state, + tcPacketBase->getApplicationData(), + tcPacketBase->getApplicationDataSize(), &iter->second.state, iter->second.objectId); ReturnValue_t sendResult = RETURN_OK; @@ -371,12 +379,12 @@ void CommandingServiceBase::startExecution(TcPacketStored *storedPacket, if (sendResult == RETURN_OK) { Clock::getUptime(&iter->second.uptimeOfStart); iter->second.step = 0; - iter->second.subservice = storedPacket->getSubService(); + iter->second.subservice = tcPacketBase->getSubService(); iter->second.command = command.getCommand(); - iter->second.tcInfo.ackFlags = storedPacket->getAcknowledgeFlags(); - iter->second.tcInfo.tcPacketId = storedPacket->getPacketId(); + iter->second.tcInfo.ackFlags = tcPacketBase->getAcknowledgeFlags(); + iter->second.tcInfo.tcPacketId = tcPacketBase->getPacketId(); iter->second.tcInfo.tcSequenceControl = - storedPacket->getPacketSequenceControl(); + tcPacketBase->getPacketSequenceControl(); acceptPacket(tc_verification::START_SUCCESS, storedPacket); } else { command.clearCommandMessage(); @@ -392,7 +400,7 @@ void CommandingServiceBase::startExecution(TcPacketStored *storedPacket, } if (sendResult == RETURN_OK) { verificationReporter.sendSuccessReport(tc_verification::START_SUCCESS, - storedPacket); + storedPacket->getPacketBase()); acceptPacket(tc_verification::COMPLETION_SUCCESS, storedPacket); checkAndExecuteFifo(iter); } else { @@ -409,16 +417,16 @@ void CommandingServiceBase::startExecution(TcPacketStored *storedPacket, } -void CommandingServiceBase::rejectPacket(uint8_t report_id, - TcPacketStored* packet, ReturnValue_t error_code) { - verificationReporter.sendFailureReport(report_id, packet, error_code); +void CommandingServiceBase::rejectPacket(uint8_t reportId, + TcPacketStoredBase* packet, ReturnValue_t errorCode) { + verificationReporter.sendFailureReport(reportId, packet->getPacketBase(), errorCode); packet->deletePacket(); } void CommandingServiceBase::acceptPacket(uint8_t reportId, - TcPacketStored* packet) { - verificationReporter.sendSuccessReport(reportId, packet); + TcPacketStoredBase* packet) { + verificationReporter.sendSuccessReport(reportId, packet->getPacketBase()); packet->deletePacket(); } @@ -428,7 +436,11 @@ void CommandingServiceBase::checkAndExecuteFifo(CommandMapIter& iter) { if (iter->second.fifo.retrieve(&address) != RETURN_OK) { commandMap.erase(&iter); } else { - TcPacketStored newPacket(address); +#if FSFW_USE_PUS_C_TELECOMMANDS == 1 + TcPacketStoredPusC newPacket(address); +#else + TcPacketStoredPusA newPacket(address); +#endif startExecution(&newPacket, iter); } } diff --git a/tmtcservices/CommandingServiceBase.h b/tmtcservices/CommandingServiceBase.h index e10f2ddd..46191bd5 100644 --- a/tmtcservices/CommandingServiceBase.h +++ b/tmtcservices/CommandingServiceBase.h @@ -1,6 +1,7 @@ #ifndef FSFW_TMTCSERVICES_COMMANDINGSERVICEBASE_H_ #define FSFW_TMTCSERVICES_COMMANDINGSERVICEBASE_H_ +#include #include "AcceptsTelecommandsIF.h" #include "VerificationReporter.h" @@ -351,12 +352,12 @@ private: */ void handleRequestQueue(); - void rejectPacket(uint8_t reportId, TcPacketStored* packet, + void rejectPacket(uint8_t reportId, TcPacketStoredBase* packet, ReturnValue_t errorCode); - void acceptPacket(uint8_t reportId, TcPacketStored* packet); + void acceptPacket(uint8_t reportId, TcPacketStoredBase* packet); - void startExecution(TcPacketStored *storedPacket, CommandMapIter iter); + void startExecution(TcPacketStoredBase *storedPacket, CommandMapIter iter); void handleCommandMessage(CommandMessage* reply); void handleReplyHandlerResult(ReturnValue_t result, CommandMapIter iter, diff --git a/tmtcservices/PusServiceBase.h b/tmtcservices/PusServiceBase.h index 4d3d99bc..f48612b1 100644 --- a/tmtcservices/PusServiceBase.h +++ b/tmtcservices/PusServiceBase.h @@ -141,7 +141,11 @@ protected: * The current Telecommand to be processed. * It is deleted after handleRequest was executed. */ - TcPacketStored currentPacket; +#if FSFW_USE_PUS_C_TELECOMMANDS == 1 + TcPacketStoredPusC currentPacket; +#else + TcPacketStoredPusA currentPacket; +#endif static object_id_t packetSource; diff --git a/tmtcservices/VerificationReporter.cpp b/tmtcservices/VerificationReporter.cpp index 998cbfb6..74e0719c 100644 --- a/tmtcservices/VerificationReporter.cpp +++ b/tmtcservices/VerificationReporter.cpp @@ -17,14 +17,17 @@ VerificationReporter::VerificationReporter() : VerificationReporter::~VerificationReporter() {} void VerificationReporter::sendSuccessReport(uint8_t set_report_id, - TcPacketBase* current_packet, uint8_t set_step) { + TcPacketBase* currentPacket, uint8_t set_step) { if (acknowledgeQueue == MessageQueueIF::NO_QUEUE) { this->initialize(); } + if(currentPacket == nullptr) { + return; + } PusVerificationMessage message(set_report_id, - current_packet->getAcknowledgeFlags(), - current_packet->getPacketId(), - current_packet->getPacketSequenceControl(), 0, set_step); + currentPacket->getAcknowledgeFlags(), + currentPacket->getPacketId(), + currentPacket->getPacketSequenceControl(), 0, set_step); ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, &message); if (status != HasReturnvaluesIF::RETURN_OK) { @@ -56,15 +59,18 @@ void VerificationReporter::sendSuccessReport(uint8_t set_report_id, } void VerificationReporter::sendFailureReport(uint8_t report_id, - TcPacketBase* current_packet, ReturnValue_t error_code, uint8_t step, + TcPacketBase* currentPacket, ReturnValue_t error_code, uint8_t step, uint32_t parameter1, uint32_t parameter2) { if (acknowledgeQueue == MessageQueueIF::NO_QUEUE) { this->initialize(); } + if(currentPacket == nullptr) { + return; + } PusVerificationMessage message(report_id, - current_packet->getAcknowledgeFlags(), - current_packet->getPacketId(), - current_packet->getPacketSequenceControl(), error_code, step, + currentPacket->getAcknowledgeFlags(), + currentPacket->getPacketId(), + currentPacket->getPacketSequenceControl(), error_code, step, parameter1, parameter2); ReturnValue_t status = MessageQueueSenderIF::sendMessage(acknowledgeQueue, &message); From 8dc66784a8aacff57bf6bb45f8061b1730e4a20d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 13 Jun 2021 16:59:28 +0200 Subject: [PATCH 131/389] tiny changes --- tmtcpacket/pus/TcPacketStoredPusC.cpp | 10 +--------- tmtcpacket/pus/TcPacketStoredPusC.h | 8 ++++++++ 2 files changed, 9 insertions(+), 9 deletions(-) create mode 100644 tmtcpacket/pus/TcPacketStoredPusC.h diff --git a/tmtcpacket/pus/TcPacketStoredPusC.cpp b/tmtcpacket/pus/TcPacketStoredPusC.cpp index f568d139..0ff2376a 100644 --- a/tmtcpacket/pus/TcPacketStoredPusC.cpp +++ b/tmtcpacket/pus/TcPacketStoredPusC.cpp @@ -1,10 +1,2 @@ -/* - * TcPacketStoredPusC.cpp - * - * Created on: Jun 13, 2021 - * Author: rmueller - */ - - - +#include "TcPacketStoredPusC.h" diff --git a/tmtcpacket/pus/TcPacketStoredPusC.h b/tmtcpacket/pus/TcPacketStoredPusC.h new file mode 100644 index 00000000..e8ced948 --- /dev/null +++ b/tmtcpacket/pus/TcPacketStoredPusC.h @@ -0,0 +1,8 @@ +#ifndef FSFW_TMTCPACKET_PUS_TCPACKETSTOREDPUSC_H_ +#define FSFW_TMTCPACKET_PUS_TCPACKETSTOREDPUSC_H_ + + + + + +#endif /* FSFW_TMTCPACKET_PUS_TCPACKETSTOREDPUSC_H_ */ From 40a8c9a495f8f0a51f029dbd673defb6f6822d4f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 13 Jun 2021 17:58:44 +0200 Subject: [PATCH 132/389] srv 20 fixes --- pus/Service20ParameterManagement.cpp | 3 +++ pus/servicepackets/Service20Packets.h | 7 +++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pus/Service20ParameterManagement.cpp b/pus/Service20ParameterManagement.cpp index 8ebc6db0..c4e4b5eb 100644 --- a/pus/Service20ParameterManagement.cpp +++ b/pus/Service20ParameterManagement.cpp @@ -133,6 +133,9 @@ ReturnValue_t Service20ParameterManagement::prepareLoadCommand( store_address_t storeAddress; size_t parameterDataLen = tcDataLen - sizeof(object_id_t) - sizeof(ParameterId_t) - sizeof(uint32_t); + if(parameterDataLen == 0) { + return CommandingServiceBase::INVALID_TC; + } ReturnValue_t result = IPCStore->getFreeElement(&storeAddress, parameterDataLen, &storePointer); if(result != HasReturnvaluesIF::RETURN_OK) { diff --git a/pus/servicepackets/Service20Packets.h b/pus/servicepackets/Service20Packets.h index 33bd153d..6c7eb6f5 100644 --- a/pus/servicepackets/Service20Packets.h +++ b/pus/servicepackets/Service20Packets.h @@ -27,12 +27,11 @@ public: ParameterCommand(uint8_t* storePointer, size_t parameterDataLen): parameterBuffer(storePointer, parameterDataLen) { #if FSFW_VERBOSE_LEVEL >= 1 - if(parameterDataLen < sizeof(object_id_t) + sizeof(ParameterId_t) + 4) { + if(parameterDataLen == 0) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "ParameterCommand: Parameter data length is less than 12!" - << std::endl; + sif::warning << "ParameterCommand: Parameter data length is 0" << std::endl; #else - sif::printWarning("ParameterCommand: Parameter data length is less than 12!\n"); + sif::printWarning("ParameterCommand: Parameter data length is 0!\n"); #endif } #endif /* FSFW_VERBOSE_LEVEL >= 1 */ From 56d2af9d2578775dfee495aca1016a8610a3125a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Jun 2021 10:19:01 +0200 Subject: [PATCH 133/389] cleaned up a bit --- pus/Service17Test.cpp | 2 +- pus/Service1TelecommandVerification.cpp | 2 +- pus/Service5EventReporting.cpp | 2 +- tcdistribution/PUSDistributor.cpp | 6 +-- tcdistribution/PUSDistributor.h | 8 +--- tcdistribution/TcPacketCheck.cpp | 4 +- tmstorage/TmStorePackets.h | 2 +- tmtcpacket/packetmatcher/ApidMatcher.h | 2 +- tmtcpacket/packetmatcher/PacketMatchTree.h | 2 +- tmtcpacket/packetmatcher/ServiceMatcher.h | 2 +- tmtcpacket/packetmatcher/SubserviceMatcher.h | 2 +- tmtcpacket/pus/CMakeLists.txt | 16 +------ tmtcpacket/pus/TcPacketPusC.cpp | 4 -- tmtcpacket/pus/TcPacketPusC.h | 8 ---- tmtcpacket/pus/TcPacketStored.h | 13 ----- tmtcpacket/pus/TcPacketStoredPusC.cpp | 2 - tmtcpacket/pus/TcPacketStoredPusC.h | 8 ---- tmtcpacket/pus/tc.h | 7 +++ tmtcpacket/pus/tc/CMakeLists.txt | 6 +++ tmtcpacket/pus/{ => tc}/TcPacketBase.cpp | 6 +-- tmtcpacket/pus/{ => tc}/TcPacketBase.h | 2 +- .../{TcPacketPusA.cpp => tc/TcPacketPus.cpp} | 48 +++++++++---------- .../pus/{TcPacketPusA.h => tc/TcPacketPus.h} | 19 +++++--- .../pus/{ => tc}/TcPacketStoredBase.cpp | 6 +-- tmtcpacket/pus/{ => tc}/TcPacketStoredBase.h | 4 +- tmtcpacket/pus/{ => tc}/TcPacketStoredIF.h | 6 +-- .../TcPacketStoredPus.cpp} | 18 +++---- .../TcPacketStoredPus.h} | 14 +++--- tmtcpacket/pus/tm.h | 16 +++++++ tmtcpacket/pus/tm/CMakeLists.txt | 9 ++++ tmtcpacket/pus/{ => tm}/TmPacketBase.cpp | 10 ++-- tmtcpacket/pus/{ => tm}/TmPacketBase.h | 8 ++-- tmtcpacket/pus/{ => tm}/TmPacketMinimal.cpp | 7 +-- tmtcpacket/pus/{ => tm}/TmPacketMinimal.h | 4 +- tmtcpacket/pus/{ => tm}/TmPacketPusA.cpp | 10 ++-- tmtcpacket/pus/{ => tm}/TmPacketPusA.h | 8 ++-- tmtcpacket/pus/{ => tm}/TmPacketPusC.cpp | 10 ++-- tmtcpacket/pus/{ => tm}/TmPacketPusC.h | 8 ++-- tmtcpacket/pus/{ => tm}/TmPacketStored.h | 0 .../pus/{ => tm}/TmPacketStoredBase.cpp | 6 +-- tmtcpacket/pus/{ => tm}/TmPacketStoredBase.h | 12 ++--- .../pus/{ => tm}/TmPacketStoredPusA.cpp | 4 +- tmtcpacket/pus/{ => tm}/TmPacketStoredPusA.h | 0 .../pus/{ => tm}/TmPacketStoredPusC.cpp | 4 +- tmtcpacket/pus/{ => tm}/TmPacketStoredPusC.h | 4 +- tmtcservices/CommandingServiceBase.cpp | 16 ++----- tmtcservices/CommandingServiceBase.h | 2 +- tmtcservices/PusServiceBase.h | 8 +--- tmtcservices/PusVerificationReport.h | 2 +- 49 files changed, 173 insertions(+), 196 deletions(-) delete mode 100644 tmtcpacket/pus/TcPacketPusC.cpp delete mode 100644 tmtcpacket/pus/TcPacketPusC.h delete mode 100644 tmtcpacket/pus/TcPacketStored.h delete mode 100644 tmtcpacket/pus/TcPacketStoredPusC.cpp delete mode 100644 tmtcpacket/pus/TcPacketStoredPusC.h create mode 100644 tmtcpacket/pus/tc.h create mode 100644 tmtcpacket/pus/tc/CMakeLists.txt rename tmtcpacket/pus/{ => tc}/TcPacketBase.cpp (72%) rename tmtcpacket/pus/{ => tc}/TcPacketBase.h (98%) rename tmtcpacket/pus/{TcPacketPusA.cpp => tc/TcPacketPus.cpp} (54%) rename tmtcpacket/pus/{TcPacketPusA.h => tc/TcPacketPus.h} (87%) rename tmtcpacket/pus/{ => tc}/TcPacketStoredBase.cpp (92%) rename tmtcpacket/pus/{ => tc}/TcPacketStoredBase.h (96%) rename tmtcpacket/pus/{ => tc}/TcPacketStoredIF.h (88%) rename tmtcpacket/pus/{TcPacketStoredPusA.cpp => tc/TcPacketStoredPus.cpp} (78%) rename tmtcpacket/pus/{TcPacketStoredPusA.h => tc/TcPacketStoredPus.h} (84%) create mode 100644 tmtcpacket/pus/tm.h create mode 100644 tmtcpacket/pus/tm/CMakeLists.txt rename tmtcpacket/pus/{ => tm}/TmPacketBase.cpp (88%) rename tmtcpacket/pus/{ => tm}/TmPacketBase.h (96%) rename tmtcpacket/pus/{ => tm}/TmPacketMinimal.cpp (93%) rename tmtcpacket/pus/{ => tm}/TmPacketMinimal.h (96%) rename tmtcpacket/pus/{ => tm}/TmPacketPusA.cpp (90%) rename tmtcpacket/pus/{ => tm}/TmPacketPusA.h (95%) rename tmtcpacket/pus/{ => tm}/TmPacketPusC.cpp (90%) rename tmtcpacket/pus/{ => tm}/TmPacketPusC.h (95%) rename tmtcpacket/pus/{ => tm}/TmPacketStored.h (100%) rename tmtcpacket/pus/{ => tm}/TmPacketStoredBase.cpp (94%) rename tmtcpacket/pus/{ => tm}/TmPacketStoredBase.h (91%) rename tmtcpacket/pus/{ => tm}/TmPacketStoredPusA.cpp (95%) rename tmtcpacket/pus/{ => tm}/TmPacketStoredPusA.h (100%) rename tmtcpacket/pus/{ => tm}/TmPacketStoredPusC.cpp (96%) rename tmtcpacket/pus/{ => tm}/TmPacketStoredPusC.h (96%) diff --git a/pus/Service17Test.cpp b/pus/Service17Test.cpp index daed987a..37258cc1 100644 --- a/pus/Service17Test.cpp +++ b/pus/Service17Test.cpp @@ -3,7 +3,7 @@ #include "../serviceinterface/ServiceInterface.h" #include "../objectmanager/SystemObject.h" -#include "../tmtcpacket/pus/TmPacketStored.h" +#include "../tmtcpacket/pus/tm/TmPacketStored.h" Service17Test::Service17Test(object_id_t objectId, diff --git a/pus/Service1TelecommandVerification.cpp b/pus/Service1TelecommandVerification.cpp index bef7b6b1..8aec6902 100644 --- a/pus/Service1TelecommandVerification.cpp +++ b/pus/Service1TelecommandVerification.cpp @@ -4,7 +4,7 @@ #include "../ipc/QueueFactory.h" #include "../objectmanager/ObjectManager.h" #include "../tmtcservices/PusVerificationReport.h" -#include "../tmtcpacket/pus/TmPacketStored.h" +#include "../tmtcpacket/pus/tm/TmPacketStored.h" #include "../serviceinterface/ServiceInterfaceStream.h" #include "../tmtcservices/AcceptsTelemetryIF.h" diff --git a/pus/Service5EventReporting.cpp b/pus/Service5EventReporting.cpp index 272cc203..0c139f3a 100644 --- a/pus/Service5EventReporting.cpp +++ b/pus/Service5EventReporting.cpp @@ -5,7 +5,7 @@ #include "../objectmanager/ObjectManager.h" #include "../events/EventManagerIF.h" #include "../ipc/QueueFactory.h" -#include "../tmtcpacket/pus/TmPacketStored.h" +#include "../tmtcpacket/pus/tm/TmPacketStored.h" Service5EventReporting::Service5EventReporting(object_id_t objectId, diff --git a/tcdistribution/PUSDistributor.cpp b/tcdistribution/PUSDistributor.cpp index 5c2f734b..955a8093 100644 --- a/tcdistribution/PUSDistributor.cpp +++ b/tcdistribution/PUSDistributor.cpp @@ -118,11 +118,7 @@ uint16_t PUSDistributor::getIdentifier() { } ReturnValue_t PUSDistributor::initialize() { -#if FSFW_USE_PUS_C_TELECOMMANDS == 1 - currentPacket = new TcPacketStoredPusC(); -#else - currentPacket = new TcPacketStoredPusA(); -#endif + currentPacket = new TcPacketStoredPus(); if(currentPacket == nullptr) { // Should not happen, memory allocation failed! return ObjectManagerIF::CHILD_INIT_FAILED; diff --git a/tcdistribution/PUSDistributor.h b/tcdistribution/PUSDistributor.h index 0c288451..c6f863f0 100644 --- a/tcdistribution/PUSDistributor.h +++ b/tcdistribution/PUSDistributor.h @@ -5,7 +5,7 @@ #include "TcDistributor.h" #include "TcPacketCheck.h" -#include "../tmtcpacket/pus/TcPacketStored.h" +#include "../tmtcpacket/pus/tc.h" #include "../returnvalues/HasReturnvaluesIF.h" #include "../tmtcservices/AcceptsTelecommandsIF.h" #include "../tmtcservices/VerificationReporter.h" @@ -52,11 +52,7 @@ protected: /** * The currently handled packet is stored here. */ -#if FSFW_USE_PUS_C_TELECOMMANDS == 1 - TcPacketStoredPusC* currentPacket = nullptr; -#else - TcPacketStoredPusA* currentPacket = nullptr; -#endif + TcPacketStoredPus* currentPacket = nullptr; /** * With this variable, the current check status is stored to generate diff --git a/tcdistribution/TcPacketCheck.cpp b/tcdistribution/TcPacketCheck.cpp index e88305cc..dce0a458 100644 --- a/tcdistribution/TcPacketCheck.cpp +++ b/tcdistribution/TcPacketCheck.cpp @@ -1,8 +1,8 @@ #include "TcPacketCheck.h" #include "../globalfunctions/CRC.h" -#include "../tmtcpacket/pus/TcPacketBase.h" -#include "../tmtcpacket/pus/TcPacketStoredBase.h" +#include "../tmtcpacket/pus/tc/TcPacketBase.h" +#include "../tmtcpacket/pus/tc/TcPacketStoredBase.h" #include "../serviceinterface/ServiceInterface.h" #include "../storagemanager/StorageManagerIF.h" #include "../tmtcservices/VerificationCodes.h" diff --git a/tmstorage/TmStorePackets.h b/tmstorage/TmStorePackets.h index 3abd0c1c..53a5d8d6 100644 --- a/tmstorage/TmStorePackets.h +++ b/tmstorage/TmStorePackets.h @@ -5,7 +5,7 @@ #include "../serialize/SerializeElement.h" #include "../serialize/SerialLinkedListAdapter.h" #include "../serialize/SerialBufferAdapter.h" -#include "../tmtcpacket/pus/TmPacketMinimal.h" +#include "../tmtcpacket/pus/tm/TmPacketMinimal.h" #include "../timemanager/TimeStamperIF.h" #include "../timemanager/CCSDSTime.h" #include "../globalfunctions/timevalOperations.h" diff --git a/tmtcpacket/packetmatcher/ApidMatcher.h b/tmtcpacket/packetmatcher/ApidMatcher.h index 4f196ac9..64f73dbf 100644 --- a/tmtcpacket/packetmatcher/ApidMatcher.h +++ b/tmtcpacket/packetmatcher/ApidMatcher.h @@ -3,7 +3,7 @@ #include "../../globalfunctions/matching/SerializeableMatcherIF.h" #include "../../serialize/SerializeAdapter.h" -#include "../../tmtcpacket/pus/TmPacketMinimal.h" +#include "../../tmtcpacket/pus/tm/TmPacketMinimal.h" class ApidMatcher: public SerializeableMatcherIF { private: diff --git a/tmtcpacket/packetmatcher/PacketMatchTree.h b/tmtcpacket/packetmatcher/PacketMatchTree.h index 54fc856c..735f0566 100644 --- a/tmtcpacket/packetmatcher/PacketMatchTree.h +++ b/tmtcpacket/packetmatcher/PacketMatchTree.h @@ -4,7 +4,7 @@ #include "../../container/PlacementFactory.h" #include "../../globalfunctions/matching/MatchTree.h" #include "../../storagemanager/LocalPool.h" -#include "../../tmtcpacket/pus/TmPacketMinimal.h" +#include "../../tmtcpacket/pus/tm/TmPacketMinimal.h" class PacketMatchTree: public MatchTree, public HasReturnvaluesIF { public: diff --git a/tmtcpacket/packetmatcher/ServiceMatcher.h b/tmtcpacket/packetmatcher/ServiceMatcher.h index eba23d75..57f491f3 100644 --- a/tmtcpacket/packetmatcher/ServiceMatcher.h +++ b/tmtcpacket/packetmatcher/ServiceMatcher.h @@ -3,7 +3,7 @@ #include "../../globalfunctions/matching/SerializeableMatcherIF.h" #include "../../serialize/SerializeAdapter.h" -#include "../../tmtcpacket/pus/TmPacketMinimal.h" +#include "../pus/tm/TmPacketMinimal.h" class ServiceMatcher: public SerializeableMatcherIF { private: diff --git a/tmtcpacket/packetmatcher/SubserviceMatcher.h b/tmtcpacket/packetmatcher/SubserviceMatcher.h index a9b6def8..80681b5d 100644 --- a/tmtcpacket/packetmatcher/SubserviceMatcher.h +++ b/tmtcpacket/packetmatcher/SubserviceMatcher.h @@ -3,7 +3,7 @@ #include "../../globalfunctions/matching/SerializeableMatcherIF.h" #include "../../serialize/SerializeAdapter.h" -#include "../../tmtcpacket/pus/TmPacketMinimal.h" +#include "../pus/tm/TmPacketMinimal.h" class SubServiceMatcher: public SerializeableMatcherIF { public: diff --git a/tmtcpacket/pus/CMakeLists.txt b/tmtcpacket/pus/CMakeLists.txt index 9340e3b1..32c80dd3 100644 --- a/tmtcpacket/pus/CMakeLists.txt +++ b/tmtcpacket/pus/CMakeLists.txt @@ -1,14 +1,2 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - TcPacketBase.cpp - TcPacketPusA.cpp - TcPacketStoredBase.cpp - TcPacketStoredPusA.cpp - - TmPacketBase.cpp - TmPacketMinimal.cpp - TmPacketStoredPusA.cpp - TmPacketStoredPusC.cpp - TmPacketPusA.cpp - TmPacketPusC.cpp - TmPacketStoredBase.cpp -) +add_subdirectory(tm) +add_subdirectory(tc) diff --git a/tmtcpacket/pus/TcPacketPusC.cpp b/tmtcpacket/pus/TcPacketPusC.cpp deleted file mode 100644 index 1f2946a8..00000000 --- a/tmtcpacket/pus/TcPacketPusC.cpp +++ /dev/null @@ -1,4 +0,0 @@ -#include "TcPacketPusC.h" - - - diff --git a/tmtcpacket/pus/TcPacketPusC.h b/tmtcpacket/pus/TcPacketPusC.h deleted file mode 100644 index e965e752..00000000 --- a/tmtcpacket/pus/TcPacketPusC.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef FSFW_TMTCPACKET_PUS_TCPACKETPUSC_H_ -#define FSFW_TMTCPACKET_PUS_TCPACKETPUSC_H_ - - - - - -#endif /* FSFW_TMTCPACKET_PUS_TCPACKETPUSC_H_ */ diff --git a/tmtcpacket/pus/TcPacketStored.h b/tmtcpacket/pus/TcPacketStored.h deleted file mode 100644 index 0b6ff0f4..00000000 --- a/tmtcpacket/pus/TcPacketStored.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef FSFW_TMTCPACKET_PUS_TCPACKETSTORED_H_ -#define FSFW_TMTCPACKET_PUS_TCPACKETSTORED_H_ - -#include - -#if FSFW_USE_PUS_C_TELECOMMANDS == 1 -#include "TcPacketStoredPusC.h" -#else -#include "TcPacketStoredPusA.h" -#endif - - -#endif /* FSFW_TMTCPACKET_PUS_TCPACKETSTORED_H_ */ diff --git a/tmtcpacket/pus/TcPacketStoredPusC.cpp b/tmtcpacket/pus/TcPacketStoredPusC.cpp deleted file mode 100644 index 0ff2376a..00000000 --- a/tmtcpacket/pus/TcPacketStoredPusC.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#include "TcPacketStoredPusC.h" - diff --git a/tmtcpacket/pus/TcPacketStoredPusC.h b/tmtcpacket/pus/TcPacketStoredPusC.h deleted file mode 100644 index e8ced948..00000000 --- a/tmtcpacket/pus/TcPacketStoredPusC.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef FSFW_TMTCPACKET_PUS_TCPACKETSTOREDPUSC_H_ -#define FSFW_TMTCPACKET_PUS_TCPACKETSTOREDPUSC_H_ - - - - - -#endif /* FSFW_TMTCPACKET_PUS_TCPACKETSTOREDPUSC_H_ */ diff --git a/tmtcpacket/pus/tc.h b/tmtcpacket/pus/tc.h new file mode 100644 index 00000000..156e49fe --- /dev/null +++ b/tmtcpacket/pus/tc.h @@ -0,0 +1,7 @@ +#ifndef FSFW_TMTCPACKET_PUS_TC_H_ +#define FSFW_TMTCPACKET_PUS_TC_H_ + +#include "tc/TcPacketStoredPus.h" +#include "tc/TcPacketPus.h" + +#endif /* FSFW_TMTCPACKET_PUS_TC_H_ */ diff --git a/tmtcpacket/pus/tc/CMakeLists.txt b/tmtcpacket/pus/tc/CMakeLists.txt new file mode 100644 index 00000000..723b7943 --- /dev/null +++ b/tmtcpacket/pus/tc/CMakeLists.txt @@ -0,0 +1,6 @@ +target_sources(${LIB_FSFW_NAME} PRIVATE + TcPacketBase.cpp + TcPacketPus.cpp + TcPacketStoredBase.cpp + TcPacketStoredPus.cpp +) diff --git a/tmtcpacket/pus/TcPacketBase.cpp b/tmtcpacket/pus/tc/TcPacketBase.cpp similarity index 72% rename from tmtcpacket/pus/TcPacketBase.cpp rename to tmtcpacket/pus/tc/TcPacketBase.cpp index a5b6f9ce..dd576fec 100644 --- a/tmtcpacket/pus/TcPacketBase.cpp +++ b/tmtcpacket/pus/tc/TcPacketBase.cpp @@ -1,8 +1,8 @@ #include "TcPacketBase.h" -#include "../../globalfunctions/CRC.h" -#include "../../globalfunctions/arrayprinter.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "../../../globalfunctions/CRC.h" +#include "../../../globalfunctions/arrayprinter.h" +#include "../../../serviceinterface/ServiceInterface.h" #include diff --git a/tmtcpacket/pus/TcPacketBase.h b/tmtcpacket/pus/tc/TcPacketBase.h similarity index 98% rename from tmtcpacket/pus/TcPacketBase.h rename to tmtcpacket/pus/tc/TcPacketBase.h index 606975e2..f29f9b35 100644 --- a/tmtcpacket/pus/TcPacketBase.h +++ b/tmtcpacket/pus/tc/TcPacketBase.h @@ -1,7 +1,7 @@ #ifndef TMTCPACKET_PUS_TCPACKETBASE_H_ #define TMTCPACKET_PUS_TCPACKETBASE_H_ -#include "../../tmtcpacket/SpacePacketBase.h" +#include "../../../tmtcpacket/SpacePacketBase.h" #include /** diff --git a/tmtcpacket/pus/TcPacketPusA.cpp b/tmtcpacket/pus/tc/TcPacketPus.cpp similarity index 54% rename from tmtcpacket/pus/TcPacketPusA.cpp rename to tmtcpacket/pus/tc/TcPacketPus.cpp index 0ce767b4..7a184f3c 100644 --- a/tmtcpacket/pus/TcPacketPusA.cpp +++ b/tmtcpacket/pus/tc/TcPacketPus.cpp @@ -1,39 +1,39 @@ -#include "TcPacketPusA.h" -#include "../../globalfunctions/CRC.h" +#include "TcPacketPus.h" +#include "../../../globalfunctions/CRC.h" #include -TcPacketPusA::TcPacketPusA(const uint8_t *setData): TcPacketBase(setData) { +TcPacketPus::TcPacketPus(const uint8_t *setData): TcPacketBase(setData) { tcData = reinterpret_cast(const_cast(setData)); } -uint8_t TcPacketPusA::getService() const { - return tcData->dataField.service_type; +uint8_t TcPacketPus::getService() const { + return tcData->dataField.serviceType; } -uint8_t TcPacketPusA::getSubService() { - return tcData->dataField.service_subtype; +uint8_t TcPacketPus::getSubService() { + return tcData->dataField.serviceSubtype; } -uint8_t TcPacketPusA::getAcknowledgeFlags() { - return tcData->dataField.version_type_ack & 0b00001111; +uint8_t TcPacketPus::getAcknowledgeFlags() { + return tcData->dataField.versionTypeAck & 0b00001111; } -const uint8_t* TcPacketPusA::getApplicationData() const { +const uint8_t* TcPacketPus::getApplicationData() const { return &tcData->appData; } -uint16_t TcPacketPusA::getApplicationDataSize() { +uint16_t TcPacketPus::getApplicationDataSize() { return getPacketDataLength() - sizeof(tcData->dataField) - CRC_SIZE + 1; } -uint16_t TcPacketPusA::getErrorControl() { +uint16_t TcPacketPus::getErrorControl() { uint16_t size = getApplicationDataSize() + CRC_SIZE; uint8_t* p_to_buffer = &tcData->appData; return (p_to_buffer[size - 2] << 8) + p_to_buffer[size - 1]; } -void TcPacketPusA::setErrorControl() { +void TcPacketPus::setErrorControl() { uint32_t full_size = getFullSize(); uint16_t crc = CRC::crc16ccitt(getWholeData(), full_size - CRC_SIZE); uint32_t size = getApplicationDataSize(); @@ -41,35 +41,35 @@ void TcPacketPusA::setErrorControl() { (&tcData->appData)[size + 1] = (crc) & 0X00FF; // CRCL } -void TcPacketPusA::setData(const uint8_t* pData) { +void TcPacketPus::setData(const uint8_t* pData) { SpacePacketBase::setData(pData); // This function is const-correct, but it was decided to keep the pointer non-const // for convenience. Therefore, cast aways constness here and then cast to packet type. tcData = reinterpret_cast(const_cast(pData)); } -uint8_t TcPacketPusA::getSecondaryHeaderFlag() { - return (tcData->dataField.version_type_ack & 0b10000000) >> 7; +uint8_t TcPacketPus::getSecondaryHeaderFlag() { + return (tcData->dataField.versionTypeAck & 0b10000000) >> 7; } -uint8_t TcPacketPusA::getPusVersionNumber() { - return (tcData->dataField.version_type_ack & 0b01110000) >> 4; +uint8_t TcPacketPus::getPusVersionNumber() { + return (tcData->dataField.versionTypeAck & 0b01110000) >> 4; } -void TcPacketPusA::initializeTcPacket(uint16_t apid, uint16_t sequenceCount, +void TcPacketPus::initializeTcPacket(uint16_t apid, uint16_t sequenceCount, uint8_t ack, uint8_t service, uint8_t subservice) { initSpacePacketHeader(true, true, apid, sequenceCount); std::memset(&tcData->dataField, 0, sizeof(tcData->dataField)); setPacketDataLength(sizeof(PUSTcDataFieldHeader) + CRC_SIZE - 1); // Data Field Header: // Set CCSDS_secondary_header_flag to 0 and version number to 001 - tcData->dataField.version_type_ack = 0b00010000; - tcData->dataField.version_type_ack |= (ack & 0x0F); - tcData->dataField.service_type = service; - tcData->dataField.service_subtype = subservice; + tcData->dataField.versionTypeAck = 0b00010000; + tcData->dataField.versionTypeAck |= (ack & 0x0F); + tcData->dataField.serviceType = service; + tcData->dataField.serviceSubtype = subservice; } -size_t TcPacketPusA::calculateFullPacketLength(size_t appDataLen) { +size_t TcPacketPus::calculateFullPacketLength(size_t appDataLen) { return sizeof(CCSDSPrimaryHeader) + sizeof(PUSTcDataFieldHeader) + appDataLen + TcPacketBase::CRC_SIZE; } diff --git a/tmtcpacket/pus/TcPacketPusA.h b/tmtcpacket/pus/tc/TcPacketPus.h similarity index 87% rename from tmtcpacket/pus/TcPacketPusA.h rename to tmtcpacket/pus/tc/TcPacketPus.h index 0e61d829..fb8483c5 100644 --- a/tmtcpacket/pus/TcPacketPusA.h +++ b/tmtcpacket/pus/tc/TcPacketPus.h @@ -1,7 +1,8 @@ #ifndef FSFW_TMTCPACKET_PUS_TCPACKETPUSA_H_ #define FSFW_TMTCPACKET_PUS_TCPACKETPUSA_H_ -#include "../ccsds_header.h" +#include "../../../FSFW.h" +#include "../../ccsds_header.h" #include "TcPacketBase.h" #include @@ -13,10 +14,14 @@ * @ingroup tmtcpackets */ struct PUSTcDataFieldHeader { - uint8_t version_type_ack; - uint8_t service_type; - uint8_t service_subtype; - uint8_t source_id; + uint8_t versionTypeAck; + uint8_t serviceType; + uint8_t serviceSubtype; +#if FSFW_USE_PUS_C_TELECOMMANDS == 1 + uint16_t sourceId; +#else + uint8_t sourceId; +#endif }; /** @@ -31,7 +36,7 @@ struct TcPacketPointer { }; -class TcPacketPusA: public TcPacketBase { +class TcPacketPus: public TcPacketBase { public: static const uint16_t TC_PACKET_MIN_SIZE = (sizeof(CCSDSPrimaryHeader) + sizeof(PUSTcDataFieldHeader) + 2); @@ -41,7 +46,7 @@ public: * create an empty (invalid) object by passing nullptr as the data pointer * @param setData */ - TcPacketPusA(const uint8_t* setData); + TcPacketPus(const uint8_t* setData); // Base class overrides virtual uint8_t getSecondaryHeaderFlag() override; diff --git a/tmtcpacket/pus/TcPacketStoredBase.cpp b/tmtcpacket/pus/tc/TcPacketStoredBase.cpp similarity index 92% rename from tmtcpacket/pus/TcPacketStoredBase.cpp rename to tmtcpacket/pus/tc/TcPacketStoredBase.cpp index 629562c0..daae35f5 100644 --- a/tmtcpacket/pus/TcPacketStoredBase.cpp +++ b/tmtcpacket/pus/tc/TcPacketStoredBase.cpp @@ -1,8 +1,8 @@ #include "TcPacketStoredBase.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../objectmanager/frameworkObjects.h" +#include "../../../objectmanager/ObjectManager.h" +#include "../../../serviceinterface/ServiceInterface.h" +#include "../../../objectmanager/frameworkObjects.h" #include diff --git a/tmtcpacket/pus/TcPacketStoredBase.h b/tmtcpacket/pus/tc/TcPacketStoredBase.h similarity index 96% rename from tmtcpacket/pus/TcPacketStoredBase.h rename to tmtcpacket/pus/tc/TcPacketStoredBase.h index 811123db..b7d73531 100644 --- a/tmtcpacket/pus/TcPacketStoredBase.h +++ b/tmtcpacket/pus/tc/TcPacketStoredBase.h @@ -1,8 +1,8 @@ #ifndef TMTCPACKET_PUS_TCPACKETSTORED_H_ #define TMTCPACKET_PUS_TCPACKETSTORED_H_ -#include -#include "../../storagemanager/StorageManagerIF.h" +#include "TcPacketStoredIF.h" +#include "../../../storagemanager/StorageManagerIF.h" /** * This class generates a ECSS PUS Telecommand packet within a given diff --git a/tmtcpacket/pus/TcPacketStoredIF.h b/tmtcpacket/pus/tc/TcPacketStoredIF.h similarity index 88% rename from tmtcpacket/pus/TcPacketStoredIF.h rename to tmtcpacket/pus/tc/TcPacketStoredIF.h index 8eb23004..3d356725 100644 --- a/tmtcpacket/pus/TcPacketStoredIF.h +++ b/tmtcpacket/pus/tc/TcPacketStoredIF.h @@ -1,9 +1,9 @@ #ifndef FSFW_TMTCPACKET_PUS_TCPACKETSTOREDIF_H_ #define FSFW_TMTCPACKET_PUS_TCPACKETSTOREDIF_H_ -#include "../../tmtcpacket/pus/TcPacketBase.h" -#include "../../storagemanager/storeAddress.h" -#include "../../returnvalues/HasReturnvaluesIF.h" +#include "TcPacketBase.h" +#include "../../../storagemanager/storeAddress.h" +#include "../../../returnvalues/HasReturnvaluesIF.h" class TcPacketStoredIF { public: diff --git a/tmtcpacket/pus/TcPacketStoredPusA.cpp b/tmtcpacket/pus/tc/TcPacketStoredPus.cpp similarity index 78% rename from tmtcpacket/pus/TcPacketStoredPusA.cpp rename to tmtcpacket/pus/tc/TcPacketStoredPus.cpp index 7c706a1a..f098ce2b 100644 --- a/tmtcpacket/pus/TcPacketStoredPusA.cpp +++ b/tmtcpacket/pus/tc/TcPacketStoredPus.cpp @@ -1,11 +1,11 @@ -#include "TcPacketStoredPusA.h" +#include "TcPacketStoredPus.h" #include -TcPacketStoredPusA::TcPacketStoredPusA(uint16_t apid, uint8_t service, +TcPacketStoredPus::TcPacketStoredPus(uint16_t apid, uint8_t service, uint8_t subservice, uint8_t sequenceCount, const uint8_t* data, size_t size, uint8_t ack) : - TcPacketPusA(nullptr) { + TcPacketPus(nullptr) { this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; if (not this->checkAndSetStore()) { return; @@ -28,14 +28,14 @@ TcPacketStoredPusA::TcPacketStoredPusA(uint16_t apid, uint8_t service, this->setErrorControl(); } -TcPacketStoredPusA::TcPacketStoredPusA(): TcPacketStoredBase(), TcPacketPusA(nullptr) { +TcPacketStoredPus::TcPacketStoredPus(): TcPacketStoredBase(), TcPacketPus(nullptr) { } -TcPacketStoredPusA::TcPacketStoredPusA(store_address_t setAddress): TcPacketPusA(nullptr) { +TcPacketStoredPus::TcPacketStoredPus(store_address_t setAddress): TcPacketPus(nullptr) { TcPacketStoredBase::setStoreAddress(setAddress); } -TcPacketStoredPusA::TcPacketStoredPusA(const uint8_t* data, size_t size): TcPacketPusA(data) { +TcPacketStoredPus::TcPacketStoredPus(const uint8_t* data, size_t size): TcPacketPus(data) { if (this->getFullSize() != size) { return; } @@ -51,19 +51,19 @@ TcPacketStoredPusA::TcPacketStoredPusA(const uint8_t* data, size_t size): TcPack } } -ReturnValue_t TcPacketStoredPusA::deletePacket() { +ReturnValue_t TcPacketStoredPus::deletePacket() { ReturnValue_t result = this->store->deleteData(this->storeAddress); this->storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; this->setData(nullptr); return result; } -TcPacketBase* TcPacketStoredPusA::getPacketBase() { +TcPacketBase* TcPacketStoredPus::getPacketBase() { return this; } -bool TcPacketStoredPusA::isSizeCorrect() { +bool TcPacketStoredPus::isSizeCorrect() { const uint8_t* temp_data = nullptr; size_t temp_size; ReturnValue_t status = this->store->getData(this->storeAddress, &temp_data, diff --git a/tmtcpacket/pus/TcPacketStoredPusA.h b/tmtcpacket/pus/tc/TcPacketStoredPus.h similarity index 84% rename from tmtcpacket/pus/TcPacketStoredPusA.h rename to tmtcpacket/pus/tc/TcPacketStoredPus.h index fe1f64f7..8b318733 100644 --- a/tmtcpacket/pus/TcPacketStoredPusA.h +++ b/tmtcpacket/pus/tc/TcPacketStoredPus.h @@ -2,11 +2,11 @@ #define FSFW_TMTCPACKET_PUS_TCPACKETSTOREDPUSA_H_ #include "TcPacketStoredBase.h" -#include "TcPacketPusA.h" +#include "TcPacketPus.h" -class TcPacketStoredPusA: +class TcPacketStoredPus: public TcPacketStoredBase, - public TcPacketPusA { + public TcPacketPus { public: /** * With this constructor, new space is allocated in the packet store and @@ -24,7 +24,7 @@ public: * number of verification packets returned * for this command. */ - TcPacketStoredPusA(uint16_t apid, uint8_t service, uint8_t subservice, + TcPacketStoredPus(uint16_t apid, uint8_t service, uint8_t subservice, uint8_t sequence_count = 0, const uint8_t* data = nullptr, size_t size = 0, uint8_t ack = TcPacketBase::ACK_ALL); /** @@ -32,13 +32,13 @@ public: * @param data * @param size */ - TcPacketStoredPusA(const uint8_t* data, size_t size); + TcPacketStoredPus(const uint8_t* data, size_t size); /** * Create stored packet from existing packet in store * @param setAddress */ - TcPacketStoredPusA(store_address_t setAddress); - TcPacketStoredPusA(); + TcPacketStoredPus(store_address_t setAddress); + TcPacketStoredPus(); ReturnValue_t deletePacket() override; TcPacketBase* getPacketBase() override; diff --git a/tmtcpacket/pus/tm.h b/tmtcpacket/pus/tm.h new file mode 100644 index 00000000..591ada7c --- /dev/null +++ b/tmtcpacket/pus/tm.h @@ -0,0 +1,16 @@ +#ifndef FSFW_TMTCPACKET_PUS_TM_H_ +#define FSFW_TMTCPACKET_PUS_TM_H_ + +#include "../../FSFW.h" + +#if FSFW_USE_PUS_C_TELEMETRY == 1 +#include "tm/TmPacketPusC.h" +#include "tm/TmPacketStoredPusC.h" +#else +#include "tm/TmPacketPusA.h" +#include "tm/TmPacketStoredPusA.h" +#endif + +#include "tm/TmPacketMinimal.h" + +#endif /* FSFW_TMTCPACKET_PUS_TM_H_ */ diff --git a/tmtcpacket/pus/tm/CMakeLists.txt b/tmtcpacket/pus/tm/CMakeLists.txt new file mode 100644 index 00000000..ace87820 --- /dev/null +++ b/tmtcpacket/pus/tm/CMakeLists.txt @@ -0,0 +1,9 @@ +target_sources(${LIB_FSFW_NAME} PRIVATE + TmPacketStoredPusA.cpp + TmPacketStoredPusC.cpp + TmPacketPusA.cpp + TmPacketPusC.cpp + TmPacketStoredBase.cpp + TmPacketBase.cpp + TmPacketMinimal.cpp +) diff --git a/tmtcpacket/pus/TmPacketBase.cpp b/tmtcpacket/pus/tm/TmPacketBase.cpp similarity index 88% rename from tmtcpacket/pus/TmPacketBase.cpp rename to tmtcpacket/pus/tm/TmPacketBase.cpp index b144db1b..91ec7d58 100644 --- a/tmtcpacket/pus/TmPacketBase.cpp +++ b/tmtcpacket/pus/tm/TmPacketBase.cpp @@ -1,10 +1,10 @@ #include "TmPacketBase.h" -#include "../../globalfunctions/CRC.h" -#include "../../globalfunctions/arrayprinter.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../timemanager/CCSDSTime.h" +#include "../../../globalfunctions/CRC.h" +#include "../../../globalfunctions/arrayprinter.h" +#include "../../../objectmanager/ObjectManager.h" +#include "../../../serviceinterface/ServiceInterface.h" +#include "../../../timemanager/CCSDSTime.h" #include diff --git a/tmtcpacket/pus/TmPacketBase.h b/tmtcpacket/pus/tm/TmPacketBase.h similarity index 96% rename from tmtcpacket/pus/TmPacketBase.h rename to tmtcpacket/pus/tm/TmPacketBase.h index 6925e99b..9f534f29 100644 --- a/tmtcpacket/pus/TmPacketBase.h +++ b/tmtcpacket/pus/tm/TmPacketBase.h @@ -1,10 +1,10 @@ #ifndef TMTCPACKET_PUS_TMPACKETBASE_H_ #define TMTCPACKET_PUS_TMPACKETBASE_H_ -#include "../SpacePacketBase.h" -#include "../../timemanager/TimeStamperIF.h" -#include "../../timemanager/Clock.h" -#include "../../objectmanager/SystemObjectIF.h" +#include "../../SpacePacketBase.h" +#include "../../../timemanager/TimeStamperIF.h" +#include "../../../timemanager/Clock.h" +#include "../../../objectmanager/SystemObjectIF.h" namespace Factory{ void setStaticFrameworkObjectIds(); diff --git a/tmtcpacket/pus/TmPacketMinimal.cpp b/tmtcpacket/pus/tm/TmPacketMinimal.cpp similarity index 93% rename from tmtcpacket/pus/TmPacketMinimal.cpp rename to tmtcpacket/pus/tm/TmPacketMinimal.cpp index 18e9dda1..3f785cde 100644 --- a/tmtcpacket/pus/TmPacketMinimal.cpp +++ b/tmtcpacket/pus/tm/TmPacketMinimal.cpp @@ -1,7 +1,8 @@ #include "TmPacketMinimal.h" -#include -#include -#include "PacketTimestampInterpreterIF.h" +#include "../PacketTimestampInterpreterIF.h" + +#include +#include TmPacketMinimal::TmPacketMinimal(const uint8_t* set_data) : SpacePacketBase( set_data ) { this->tm_data = (TmPacketMinimalPointer*)set_data; diff --git a/tmtcpacket/pus/TmPacketMinimal.h b/tmtcpacket/pus/tm/TmPacketMinimal.h similarity index 96% rename from tmtcpacket/pus/TmPacketMinimal.h rename to tmtcpacket/pus/tm/TmPacketMinimal.h index 728acb15..08daa584 100644 --- a/tmtcpacket/pus/TmPacketMinimal.h +++ b/tmtcpacket/pus/tm/TmPacketMinimal.h @@ -2,8 +2,8 @@ #define FRAMEWORK_TMTCPACKET_PUS_TMPACKETMINIMAL_H_ -#include "../../tmtcpacket/SpacePacketBase.h" -#include "../../returnvalues/HasReturnvaluesIF.h" +#include "../../SpacePacketBase.h" +#include "../../../returnvalues/HasReturnvaluesIF.h" struct timeval; class PacketTimestampInterpreterIF; diff --git a/tmtcpacket/pus/TmPacketPusA.cpp b/tmtcpacket/pus/tm/TmPacketPusA.cpp similarity index 90% rename from tmtcpacket/pus/TmPacketPusA.cpp rename to tmtcpacket/pus/tm/TmPacketPusA.cpp index d96f6aa7..bdc0a815 100644 --- a/tmtcpacket/pus/TmPacketPusA.cpp +++ b/tmtcpacket/pus/tm/TmPacketPusA.cpp @@ -1,11 +1,11 @@ #include "TmPacketPusA.h" #include "TmPacketBase.h" -#include "../../globalfunctions/CRC.h" -#include "../../globalfunctions/arrayprinter.h" -#include "../../objectmanager/ObjectManagerIF.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" -#include "../../timemanager/CCSDSTime.h" +#include "../../../globalfunctions/CRC.h" +#include "../../../globalfunctions/arrayprinter.h" +#include "../../../objectmanager/ObjectManagerIF.h" +#include "../../../serviceinterface/ServiceInterfaceStream.h" +#include "../../../timemanager/CCSDSTime.h" #include diff --git a/tmtcpacket/pus/TmPacketPusA.h b/tmtcpacket/pus/tm/TmPacketPusA.h similarity index 95% rename from tmtcpacket/pus/TmPacketPusA.h rename to tmtcpacket/pus/tm/TmPacketPusA.h index dd9a5d09..486b68f3 100644 --- a/tmtcpacket/pus/TmPacketPusA.h +++ b/tmtcpacket/pus/tm/TmPacketPusA.h @@ -2,10 +2,10 @@ #define FSFW_TMTCPACKET_PUS_TMPACKETPUSA_H_ #include "TmPacketBase.h" -#include "../SpacePacketBase.h" -#include "../../timemanager/TimeStamperIF.h" -#include "../../timemanager/Clock.h" -#include "../../objectmanager/SystemObjectIF.h" +#include "../../SpacePacketBase.h" +#include "../../../timemanager/TimeStamperIF.h" +#include "../../../timemanager/Clock.h" +#include "../../../objectmanager/SystemObjectIF.h" namespace Factory{ void setStaticFrameworkObjectIds(); diff --git a/tmtcpacket/pus/TmPacketPusC.cpp b/tmtcpacket/pus/tm/TmPacketPusC.cpp similarity index 90% rename from tmtcpacket/pus/TmPacketPusC.cpp rename to tmtcpacket/pus/tm/TmPacketPusC.cpp index ca2bccdb..5090aaeb 100644 --- a/tmtcpacket/pus/TmPacketPusC.cpp +++ b/tmtcpacket/pus/tm/TmPacketPusC.cpp @@ -1,11 +1,11 @@ #include "TmPacketPusC.h" #include "TmPacketBase.h" -#include "../../globalfunctions/CRC.h" -#include "../../globalfunctions/arrayprinter.h" -#include "../../objectmanager/ObjectManagerIF.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" -#include "../../timemanager/CCSDSTime.h" +#include "../../../globalfunctions/CRC.h" +#include "../../../globalfunctions/arrayprinter.h" +#include "../../../objectmanager/ObjectManagerIF.h" +#include "../../../serviceinterface/ServiceInterfaceStream.h" +#include "../../../timemanager/CCSDSTime.h" #include diff --git a/tmtcpacket/pus/TmPacketPusC.h b/tmtcpacket/pus/tm/TmPacketPusC.h similarity index 95% rename from tmtcpacket/pus/TmPacketPusC.h rename to tmtcpacket/pus/tm/TmPacketPusC.h index fdc27548..97e5a9a5 100644 --- a/tmtcpacket/pus/TmPacketPusC.h +++ b/tmtcpacket/pus/tm/TmPacketPusC.h @@ -2,10 +2,10 @@ #define FSFW_TMTCPACKET_PUS_TMPACKETPUSC_H_ #include "TmPacketBase.h" -#include "../SpacePacketBase.h" -#include "../../timemanager/TimeStamperIF.h" -#include "../../timemanager/Clock.h" -#include "../../objectmanager/SystemObjectIF.h" +#include "../../SpacePacketBase.h" +#include "../../../timemanager/TimeStamperIF.h" +#include "../../../timemanager/Clock.h" +#include "../../../objectmanager/SystemObjectIF.h" namespace Factory{ void setStaticFrameworkObjectIds(); diff --git a/tmtcpacket/pus/TmPacketStored.h b/tmtcpacket/pus/tm/TmPacketStored.h similarity index 100% rename from tmtcpacket/pus/TmPacketStored.h rename to tmtcpacket/pus/tm/TmPacketStored.h diff --git a/tmtcpacket/pus/TmPacketStoredBase.cpp b/tmtcpacket/pus/tm/TmPacketStoredBase.cpp similarity index 94% rename from tmtcpacket/pus/TmPacketStoredBase.cpp rename to tmtcpacket/pus/tm/TmPacketStoredBase.cpp index eeaa938d..ba8b15d1 100644 --- a/tmtcpacket/pus/TmPacketStoredBase.cpp +++ b/tmtcpacket/pus/tm/TmPacketStoredBase.cpp @@ -1,8 +1,8 @@ #include "TmPacketStoredBase.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../tmtcservices/TmTcMessage.h" +#include "../../../objectmanager/ObjectManager.h" +#include "../../../serviceinterface/ServiceInterface.h" +#include "../../../tmtcservices/TmTcMessage.h" #include diff --git a/tmtcpacket/pus/TmPacketStoredBase.h b/tmtcpacket/pus/tm/TmPacketStoredBase.h similarity index 91% rename from tmtcpacket/pus/TmPacketStoredBase.h rename to tmtcpacket/pus/tm/TmPacketStoredBase.h index dd7e31eb..1bc092dd 100644 --- a/tmtcpacket/pus/TmPacketStoredBase.h +++ b/tmtcpacket/pus/tm/TmPacketStoredBase.h @@ -1,15 +1,15 @@ #ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTOREDBASE_H_ #define FSFW_TMTCPACKET_PUS_TMPACKETSTOREDBASE_H_ +#include "../../../FSFW.h" #include "TmPacketBase.h" #include "TmPacketStoredBase.h" -#include +#include "TmPacketPusA.h" -#include "../../tmtcpacket/pus/TmPacketPusA.h" -#include "../../serialize/SerializeIF.h" -#include "../../storagemanager/StorageManagerIF.h" -#include "../../internalError/InternalErrorReporterIF.h" -#include "../../ipc/MessageQueueSenderIF.h" +#include "../../../serialize/SerializeIF.h" +#include "../../../storagemanager/StorageManagerIF.h" +#include "../../../internalError/InternalErrorReporterIF.h" +#include "../../../ipc/MessageQueueSenderIF.h" /** * This class generates a ECSS PUS Telemetry packet within a given diff --git a/tmtcpacket/pus/TmPacketStoredPusA.cpp b/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp similarity index 95% rename from tmtcpacket/pus/TmPacketStoredPusA.cpp rename to tmtcpacket/pus/tm/TmPacketStoredPusA.cpp index 68102b62..02fb77ef 100644 --- a/tmtcpacket/pus/TmPacketStoredPusA.cpp +++ b/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp @@ -1,7 +1,7 @@ #include "TmPacketStoredPusA.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../tmtcservices/TmTcMessage.h" +#include "../../../serviceinterface/ServiceInterface.h" +#include "../../../tmtcservices/TmTcMessage.h" #include diff --git a/tmtcpacket/pus/TmPacketStoredPusA.h b/tmtcpacket/pus/tm/TmPacketStoredPusA.h similarity index 100% rename from tmtcpacket/pus/TmPacketStoredPusA.h rename to tmtcpacket/pus/tm/TmPacketStoredPusA.h diff --git a/tmtcpacket/pus/TmPacketStoredPusC.cpp b/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp similarity index 96% rename from tmtcpacket/pus/TmPacketStoredPusC.cpp rename to tmtcpacket/pus/tm/TmPacketStoredPusC.cpp index 7f774411..6f8f7fa2 100644 --- a/tmtcpacket/pus/TmPacketStoredPusC.cpp +++ b/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp @@ -1,7 +1,7 @@ #include "TmPacketStoredPusC.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../tmtcservices/TmTcMessage.h" +#include "../../../serviceinterface/ServiceInterface.h" +#include "../../../tmtcservices/TmTcMessage.h" #include diff --git a/tmtcpacket/pus/TmPacketStoredPusC.h b/tmtcpacket/pus/tm/TmPacketStoredPusC.h similarity index 96% rename from tmtcpacket/pus/TmPacketStoredPusC.h rename to tmtcpacket/pus/tm/TmPacketStoredPusC.h index 883dc0ff..35c66083 100644 --- a/tmtcpacket/pus/TmPacketStoredPusC.h +++ b/tmtcpacket/pus/tm/TmPacketStoredPusC.h @@ -1,8 +1,8 @@ #ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTOREDPUSC_H_ #define FSFW_TMTCPACKET_PUS_TMPACKETSTOREDPUSC_H_ -#include -#include +#include "TmPacketPusC.h" +#include "TmPacketStoredBase.h" /** * This class generates a ECSS PUS C Telemetry packet within a given diff --git a/tmtcservices/CommandingServiceBase.cpp b/tmtcservices/CommandingServiceBase.cpp index 0ede27dc..b416ffbe 100644 --- a/tmtcservices/CommandingServiceBase.cpp +++ b/tmtcservices/CommandingServiceBase.cpp @@ -6,8 +6,8 @@ #include "../tcdistribution/PUSDistributorIF.h" #include "../objectmanager/ObjectManager.h" #include "../ipc/QueueFactory.h" -#include "../tmtcpacket/pus/TcPacketStored.h" -#include "../tmtcpacket/pus/TmPacketStored.h" +#include "../tmtcpacket/pus/tc.h" +#include "../tmtcpacket/pus/tm.h" #include "../serviceinterface/ServiceInterface.h" object_id_t CommandingServiceBase::defaultPacketSource = objects::NO_OBJECT; @@ -246,11 +246,7 @@ void CommandingServiceBase::handleRequestQueue() { TmTcMessage message; ReturnValue_t result; store_address_t address; -#if FSFW_USE_PUS_C_TELECOMMANDS == 1 - TcPacketStoredPusC packet; -#else - TcPacketStoredPusA packet; -#endif + TcPacketStoredPus packet; MessageQueueId_t queue; object_id_t objectId; for (result = requestQueue->receiveMessage(&message); result == RETURN_OK; @@ -436,11 +432,7 @@ void CommandingServiceBase::checkAndExecuteFifo(CommandMapIter& iter) { if (iter->second.fifo.retrieve(&address) != RETURN_OK) { commandMap.erase(&iter); } else { -#if FSFW_USE_PUS_C_TELECOMMANDS == 1 - TcPacketStoredPusC newPacket(address); -#else - TcPacketStoredPusA newPacket(address); -#endif + TcPacketStoredPus newPacket(address); startExecution(&newPacket, iter); } } diff --git a/tmtcservices/CommandingServiceBase.h b/tmtcservices/CommandingServiceBase.h index 46191bd5..4ee4a21a 100644 --- a/tmtcservices/CommandingServiceBase.h +++ b/tmtcservices/CommandingServiceBase.h @@ -1,7 +1,6 @@ #ifndef FSFW_TMTCSERVICES_COMMANDINGSERVICEBASE_H_ #define FSFW_TMTCSERVICES_COMMANDINGSERVICEBASE_H_ -#include #include "AcceptsTelecommandsIF.h" #include "VerificationReporter.h" @@ -17,6 +16,7 @@ #include class TcPacketStored; +class TcPacketStoredBase; namespace Factory{ void setStaticFrameworkObjectIds(); diff --git a/tmtcservices/PusServiceBase.h b/tmtcservices/PusServiceBase.h index f48612b1..6cde6fb4 100644 --- a/tmtcservices/PusServiceBase.h +++ b/tmtcservices/PusServiceBase.h @@ -9,7 +9,7 @@ #include "../objectmanager/SystemObject.h" #include "../returnvalues/HasReturnvaluesIF.h" #include "../tasks/ExecutableObjectIF.h" -#include "../tmtcpacket/pus/TcPacketStored.h" +#include "../tmtcpacket/pus/tc.h" #include "../ipc/MessageQueueIF.h" namespace Factory{ @@ -141,11 +141,7 @@ protected: * The current Telecommand to be processed. * It is deleted after handleRequest was executed. */ -#if FSFW_USE_PUS_C_TELECOMMANDS == 1 - TcPacketStoredPusC currentPacket; -#else - TcPacketStoredPusA currentPacket; -#endif + TcPacketStoredPus currentPacket; static object_id_t packetSource; diff --git a/tmtcservices/PusVerificationReport.h b/tmtcservices/PusVerificationReport.h index 9dce95ac..0e1732ef 100644 --- a/tmtcservices/PusVerificationReport.h +++ b/tmtcservices/PusVerificationReport.h @@ -4,7 +4,7 @@ #include "VerificationCodes.h" #include "../ipc/MessageQueueMessage.h" -#include "../tmtcpacket/pus/TcPacketBase.h" +#include "../tmtcpacket/pus/tc/TcPacketBase.h" #include "../returnvalues/HasReturnvaluesIF.h" class PusVerificationMessage: public MessageQueueMessage { From b1e3a1b2b586809e45b0a741f9e62fc1d2125093 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Jun 2021 11:16:56 +0200 Subject: [PATCH 134/389] const correctness --- tmtcpacket/SpacePacketBase.cpp | 2 +- tmtcpacket/SpacePacketBase.h | 6 ++-- tmtcpacket/pus/tc/TcPacketBase.h | 16 +++++----- tmtcpacket/pus/tc/TcPacketPus.cpp | 44 +++++++++++++++----------- tmtcpacket/pus/tc/TcPacketPus.h | 20 ++++++------ tmtcservices/CommandingServiceBase.cpp | 1 + 6 files changed, 51 insertions(+), 38 deletions(-) diff --git a/tmtcpacket/SpacePacketBase.cpp b/tmtcpacket/SpacePacketBase.cpp index e13af8d0..14198027 100644 --- a/tmtcpacket/SpacePacketBase.cpp +++ b/tmtcpacket/SpacePacketBase.cpp @@ -72,7 +72,7 @@ void SpacePacketBase::setPacketSequenceCount( uint16_t new_count) { this->data->header.sequence_control_l = ( (new_count%LIMIT_SEQUENCE_COUNT) & 0x00FF ); } -uint16_t SpacePacketBase::getPacketDataLength( void ) { +uint16_t SpacePacketBase::getPacketDataLength() const { return ( (this->data->header.packet_length_h) << 8 ) + this->data->header.packet_length_l; } diff --git a/tmtcpacket/SpacePacketBase.h b/tmtcpacket/SpacePacketBase.h index 19cbd074..13cb3130 100644 --- a/tmtcpacket/SpacePacketBase.h +++ b/tmtcpacket/SpacePacketBase.h @@ -138,9 +138,11 @@ public: * Returns the packet data length, which is the fifth and sixth byte of the * CCSDS Primary Header. The packet data length is the size of every kind * of data \b after the CCSDS Primary Header \b -1. - * @return The CCSDS packet data length. + * @return + * The CCSDS packet data length. uint16_t is sufficient, + * because this is limit in CCSDS standard */ - uint16_t getPacketDataLength( void ); //uint16_t is sufficient, because this is limit in CCSDS standard + uint16_t getPacketDataLength(void) const; /** * Sets the packet data length, which is the fifth and sixth byte of the * CCSDS Primary Header. diff --git a/tmtcpacket/pus/tc/TcPacketBase.h b/tmtcpacket/pus/tc/TcPacketBase.h index f29f9b35..68f08896 100644 --- a/tmtcpacket/pus/tc/TcPacketBase.h +++ b/tmtcpacket/pus/tc/TcPacketBase.h @@ -53,7 +53,7 @@ public: * highest bit of the first byte of the Data Field Header. * @return the CCSDS Secondary Header Flag */ - virtual uint8_t getSecondaryHeaderFlag() = 0; + virtual uint8_t getSecondaryHeaderFlag() const = 0; /** * This command returns the TC Packet PUS Version Number. * The version number of ECSS PUS 2003 is 1. @@ -61,7 +61,7 @@ public: * first byte. * @return */ - virtual uint8_t getPusVersionNumber() = 0; + virtual uint8_t getPusVersionNumber() const = 0; /** * This is a getter for the packet's Ack field, which are the lowest four * bits of the first byte of the Data Field Header. @@ -69,7 +69,7 @@ public: * It is packed in a uint8_t variable. * @return The packet's PUS Ack field. */ - virtual uint8_t getAcknowledgeFlags() = 0; + virtual uint8_t getAcknowledgeFlags() const = 0; /** * This is a getter for the packet's PUS Service ID, which is the second * byte of the Data Field Header. @@ -81,13 +81,13 @@ public: * third byte of the Data Field Header. * @return The packet's PUS Service Subtype. */ - virtual uint8_t getSubService() = 0; + virtual uint8_t getSubService() const = 0; /** * The source ID can be used to have an additional identifier, e.g. for different ground * station. * @return */ - uint8_t getSourceId(); + virtual uint16_t getSourceId() const = 0; /** * This is a getter for a pointer to the packet's Application data. @@ -105,7 +105,7 @@ public: * @return The size of the PUS Application Data (without Error Control * field) */ - virtual uint16_t getApplicationDataSize() = 0; + virtual uint16_t getApplicationDataSize() const = 0; /** * This getter returns the Error Control Field of the packet. * @@ -114,7 +114,7 @@ public: * supposed to be a 16bit-CRC. * @return The PUS Error Control */ - virtual uint16_t getErrorControl() = 0; + virtual uint16_t getErrorControl() const = 0; /** * With this method, the Error Control Field is updated to match the * current content of the packet. @@ -126,7 +126,7 @@ public: * @param appDataLen * @return */ - virtual size_t calculateFullPacketLength(size_t appDataLen) = 0; + virtual size_t calculateFullPacketLength(size_t appDataLen) const = 0; /** * This is a debugging helper method that prints the whole packet content diff --git a/tmtcpacket/pus/tc/TcPacketPus.cpp b/tmtcpacket/pus/tc/TcPacketPus.cpp index 7a184f3c..1df61c07 100644 --- a/tmtcpacket/pus/tc/TcPacketPus.cpp +++ b/tmtcpacket/pus/tc/TcPacketPus.cpp @@ -7,15 +7,28 @@ TcPacketPus::TcPacketPus(const uint8_t *setData): TcPacketBase(setData) { tcData = reinterpret_cast(const_cast(setData)); } +void TcPacketPus::initializeTcPacket(uint16_t apid, uint16_t sequenceCount, + uint8_t ack, uint8_t service, uint8_t subservice) { + initSpacePacketHeader(true, true, apid, sequenceCount); + std::memset(&tcData->dataField, 0, sizeof(tcData->dataField)); + setPacketDataLength(sizeof(PUSTcDataFieldHeader) + CRC_SIZE - 1); + // Data Field Header: + // Set CCSDS_secondary_header_flag to 0 and version number to 001 + tcData->dataField.versionTypeAck = 0b00010000; + tcData->dataField.versionTypeAck |= (ack & 0x0F); + tcData->dataField.serviceType = service; + tcData->dataField.serviceSubtype = subservice; +} + uint8_t TcPacketPus::getService() const { return tcData->dataField.serviceType; } -uint8_t TcPacketPus::getSubService() { +uint8_t TcPacketPus::getSubService() const { return tcData->dataField.serviceSubtype; } -uint8_t TcPacketPus::getAcknowledgeFlags() { +uint8_t TcPacketPus::getAcknowledgeFlags() const { return tcData->dataField.versionTypeAck & 0b00001111; } @@ -23,11 +36,11 @@ const uint8_t* TcPacketPus::getApplicationData() const { return &tcData->appData; } -uint16_t TcPacketPus::getApplicationDataSize() { +uint16_t TcPacketPus::getApplicationDataSize() const { return getPacketDataLength() - sizeof(tcData->dataField) - CRC_SIZE + 1; } -uint16_t TcPacketPus::getErrorControl() { +uint16_t TcPacketPus::getErrorControl() const { uint16_t size = getApplicationDataSize() + CRC_SIZE; uint8_t* p_to_buffer = &tcData->appData; return (p_to_buffer[size - 2] << 8) + p_to_buffer[size - 1]; @@ -48,28 +61,23 @@ void TcPacketPus::setData(const uint8_t* pData) { tcData = reinterpret_cast(const_cast(pData)); } -uint8_t TcPacketPus::getSecondaryHeaderFlag() { +uint8_t TcPacketPus::getSecondaryHeaderFlag() const { return (tcData->dataField.versionTypeAck & 0b10000000) >> 7; } -uint8_t TcPacketPus::getPusVersionNumber() { +uint8_t TcPacketPus::getPusVersionNumber() const { return (tcData->dataField.versionTypeAck & 0b01110000) >> 4; } -void TcPacketPus::initializeTcPacket(uint16_t apid, uint16_t sequenceCount, - uint8_t ack, uint8_t service, uint8_t subservice) { - initSpacePacketHeader(true, true, apid, sequenceCount); - std::memset(&tcData->dataField, 0, sizeof(tcData->dataField)); - setPacketDataLength(sizeof(PUSTcDataFieldHeader) + CRC_SIZE - 1); - // Data Field Header: - // Set CCSDS_secondary_header_flag to 0 and version number to 001 - tcData->dataField.versionTypeAck = 0b00010000; - tcData->dataField.versionTypeAck |= (ack & 0x0F); - tcData->dataField.serviceType = service; - tcData->dataField.serviceSubtype = subservice; +uint16_t TcPacketPus::getSourceId() const { +#if FSFW_USE_PUS_C_TELECOMMANDS == 1 + return (tcData->dataField.sourceIdH << 8) | tcData->dataField.sourceIdL; +#else + return tcData->dataField.sourceId; +#endif } -size_t TcPacketPus::calculateFullPacketLength(size_t appDataLen) { +size_t TcPacketPus::calculateFullPacketLength(size_t appDataLen) const { return sizeof(CCSDSPrimaryHeader) + sizeof(PUSTcDataFieldHeader) + appDataLen + TcPacketBase::CRC_SIZE; } diff --git a/tmtcpacket/pus/tc/TcPacketPus.h b/tmtcpacket/pus/tc/TcPacketPus.h index fb8483c5..b50b868d 100644 --- a/tmtcpacket/pus/tc/TcPacketPus.h +++ b/tmtcpacket/pus/tc/TcPacketPus.h @@ -18,7 +18,8 @@ struct PUSTcDataFieldHeader { uint8_t serviceType; uint8_t serviceSubtype; #if FSFW_USE_PUS_C_TELECOMMANDS == 1 - uint16_t sourceId; + uint8_t sourceIdH; + uint8_t sourceIdL; #else uint8_t sourceId; #endif @@ -49,16 +50,17 @@ public: TcPacketPus(const uint8_t* setData); // Base class overrides - virtual uint8_t getSecondaryHeaderFlag() override; - virtual uint8_t getPusVersionNumber() override; - virtual uint8_t getAcknowledgeFlags() override; - virtual uint8_t getService() const override; - virtual uint8_t getSubService() override; + uint8_t getSecondaryHeaderFlag() const override; + uint8_t getPusVersionNumber() const override; + uint8_t getAcknowledgeFlags() const override; + uint8_t getService() const override; + uint8_t getSubService() const override; + uint16_t getSourceId() const override; const uint8_t* getApplicationData() const override; - uint16_t getApplicationDataSize() override; - uint16_t getErrorControl() override; + uint16_t getApplicationDataSize() const override; + uint16_t getErrorControl() const override; void setErrorControl() override; - size_t calculateFullPacketLength(size_t appDataLen) override; + size_t calculateFullPacketLength(size_t appDataLen) const override; protected: diff --git a/tmtcservices/CommandingServiceBase.cpp b/tmtcservices/CommandingServiceBase.cpp index b416ffbe..307a2a98 100644 --- a/tmtcservices/CommandingServiceBase.cpp +++ b/tmtcservices/CommandingServiceBase.cpp @@ -259,6 +259,7 @@ void CommandingServiceBase::handleRequestQueue() { rejectPacket(tc_verification::START_FAILURE, &packet, INVALID_SUBSERVICE); continue; } + result = getMessageQueueAndObject(packet.getSubService(), packet.getApplicationData(), packet.getApplicationDataSize(), &queue, &objectId); From 7cf4aa0d5a8cc707721785e9a55f1fd0e2eaf652 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 14 Jun 2021 11:44:39 +0200 Subject: [PATCH 135/389] fixes for pus tc c --- tcdistribution/TcPacketCheck.cpp | 1 + tcdistribution/TcPacketCheck.h | 6 ++++++ tmtcpacket/pus/tc/TcPacketPus.cpp | 9 +++++++++ 3 files changed, 16 insertions(+) diff --git a/tcdistribution/TcPacketCheck.cpp b/tcdistribution/TcPacketCheck.cpp index dce0a458..b3a025a4 100644 --- a/tcdistribution/TcPacketCheck.cpp +++ b/tcdistribution/TcPacketCheck.cpp @@ -32,6 +32,7 @@ ReturnValue_t TcPacketCheck::checkPacket(TcPacketStoredBase* currentPacket) { if (not currentPacket->isSizeCorrect()) { return INCOMPLETE_PACKET; } + condition = (tcPacketBase->getSecondaryHeaderFlag() != CCSDS_SECONDARY_HEADER_FLAG) || (tcPacketBase->getPusVersionNumber() != PUS_VERSION_NUMBER); if (condition) { diff --git a/tcdistribution/TcPacketCheck.h b/tcdistribution/TcPacketCheck.h index f7422c19..7106b7e4 100644 --- a/tcdistribution/TcPacketCheck.h +++ b/tcdistribution/TcPacketCheck.h @@ -1,6 +1,7 @@ #ifndef FSFW_TCDISTRIBUTION_TCPACKETCHECK_H_ #define FSFW_TCDISTRIBUTION_TCPACKETCHECK_H_ +#include "../FSFW.h" #include "../returnvalues/HasReturnvaluesIF.h" #include "../tmtcservices/PusVerificationReport.h" @@ -24,7 +25,12 @@ protected: /** * Describes the TC Packet PUS Version Number a packet must have to pass. */ +#if FSFW_USE_PUS_C_TELECOMMANDS == 1 + static constexpr uint8_t PUS_VERSION_NUMBER = 2; +#else static constexpr uint8_t PUS_VERSION_NUMBER = 1; +#endif + /** * The packet id each correct packet should have. * It is composed of the APID and some static fields. diff --git a/tmtcpacket/pus/tc/TcPacketPus.cpp b/tmtcpacket/pus/tc/TcPacketPus.cpp index 1df61c07..334da4e7 100644 --- a/tmtcpacket/pus/tc/TcPacketPus.cpp +++ b/tmtcpacket/pus/tc/TcPacketPus.cpp @@ -62,11 +62,20 @@ void TcPacketPus::setData(const uint8_t* pData) { } uint8_t TcPacketPus::getSecondaryHeaderFlag() const { +#if FSFW_USE_PUS_C_TELECOMMANDS == 1 + // Does not exist for PUS C + return 0; +#else return (tcData->dataField.versionTypeAck & 0b10000000) >> 7; +#endif } uint8_t TcPacketPus::getPusVersionNumber() const { +#if FSFW_USE_PUS_C_TELECOMMANDS == 1 + return (tcData->dataField.versionTypeAck & 0b11110000) >> 4; +#else return (tcData->dataField.versionTypeAck & 0b01110000) >> 4; +#endif } uint16_t TcPacketPus::getSourceId() const { From 99b007f37e13d10fd3d994e6fccd6d06bcbaea8a Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 14 Jun 2021 14:37:38 +0200 Subject: [PATCH 136/389] added deletions --- memory/GenericFileSystemMessage.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/memory/GenericFileSystemMessage.cpp b/memory/GenericFileSystemMessage.cpp index e4edc7ac..005f4ede 100644 --- a/memory/GenericFileSystemMessage.cpp +++ b/memory/GenericFileSystemMessage.cpp @@ -1,5 +1,7 @@ #include "GenericFileSystemMessage.h" +#include "../objectmanager/ObjectManager.h" +#include "../storagemanager/StorageManagerIF.h" void GenericFileSystemMessage::setCreateFileCommand(CommandMessage* message, store_address_t storeId) { @@ -132,5 +134,28 @@ bool GenericFileSystemMessage::getReadReply(const CommandMessage *message, } ReturnValue_t GenericFileSystemMessage::clear(CommandMessage* message) { + switch(message->getCommand()) { + case(CMD_CREATE_FILE): + case(CMD_DELETE_FILE): + case(CMD_CREATE_DIRECTORY): + case(CMD_REPORT_FILE_ATTRIBUTES): + case(REPLY_REPORT_FILE_ATTRIBUTES): + case(CMD_LOCK_FILE): + case(CMD_UNLOCK_FILE): + case(CMD_COPY_FILE): + case(REPLY_READ_FROM_FILE): + case(CMD_READ_FROM_FILE): + case(CMD_APPEND_TO_FILE): + case(CMD_FINISH_APPEND_TO_FILE): + case(REPLY_READ_FINISHED_STOP): + case(REPLY_FINISH_APPEND): { + store_address_t storeId = GenericFileSystemMessage::getStoreId(message); + auto ipcStore = ObjectManager::instance()->get(objects::IPC_STORE); + if(ipcStore == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } + return ipcStore->deleteData(storeId); + } + } return HasReturnvaluesIF::RETURN_OK; } From a7068acca76d6e65a7f9f18bb566b2d8a330dcf3 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 14 Jun 2021 14:38:09 +0200 Subject: [PATCH 137/389] updated generic file system message --- memory/GenericFileSystemMessage.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/memory/GenericFileSystemMessage.cpp b/memory/GenericFileSystemMessage.cpp index e4edc7ac..005f4ede 100644 --- a/memory/GenericFileSystemMessage.cpp +++ b/memory/GenericFileSystemMessage.cpp @@ -1,5 +1,7 @@ #include "GenericFileSystemMessage.h" +#include "../objectmanager/ObjectManager.h" +#include "../storagemanager/StorageManagerIF.h" void GenericFileSystemMessage::setCreateFileCommand(CommandMessage* message, store_address_t storeId) { @@ -132,5 +134,28 @@ bool GenericFileSystemMessage::getReadReply(const CommandMessage *message, } ReturnValue_t GenericFileSystemMessage::clear(CommandMessage* message) { + switch(message->getCommand()) { + case(CMD_CREATE_FILE): + case(CMD_DELETE_FILE): + case(CMD_CREATE_DIRECTORY): + case(CMD_REPORT_FILE_ATTRIBUTES): + case(REPLY_REPORT_FILE_ATTRIBUTES): + case(CMD_LOCK_FILE): + case(CMD_UNLOCK_FILE): + case(CMD_COPY_FILE): + case(REPLY_READ_FROM_FILE): + case(CMD_READ_FROM_FILE): + case(CMD_APPEND_TO_FILE): + case(CMD_FINISH_APPEND_TO_FILE): + case(REPLY_READ_FINISHED_STOP): + case(REPLY_FINISH_APPEND): { + store_address_t storeId = GenericFileSystemMessage::getStoreId(message); + auto ipcStore = ObjectManager::instance()->get(objects::IPC_STORE); + if(ipcStore == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } + return ipcStore->deleteData(storeId); + } + } return HasReturnvaluesIF::RETURN_OK; } From eead2a8a49733cd7f0c79d273432d7d978506c24 Mon Sep 17 00:00:00 2001 From: Steffen Gaisser Date: Mon, 14 Jun 2021 14:40:40 +0200 Subject: [PATCH 138/389] Moved leap second management --- osal/FreeRTOS/Clock.cpp | 68 ------------------------------- osal/host/Clock.cpp | 68 ------------------------------- osal/linux/Clock.cpp | 68 ------------------------------- osal/rtems/Clock.cpp | 62 ---------------------------- timemanager/Clock.h | 90 ++++++++++++++++++++++++++++++++--------- 5 files changed, 71 insertions(+), 285 deletions(-) diff --git a/osal/FreeRTOS/Clock.cpp b/osal/FreeRTOS/Clock.cpp index c15971fe..66207d75 100644 --- a/osal/FreeRTOS/Clock.cpp +++ b/osal/FreeRTOS/Clock.cpp @@ -134,71 +134,3 @@ ReturnValue_t Clock::convertTimevalToJD2000(timeval time, double* JD2000) { / 3600.; return HasReturnvaluesIF::RETURN_OK; } - -ReturnValue_t Clock::convertUTCToTT(timeval utc, timeval* tt) { - //SHOULDDO: works not for dates in the past (might have less leap seconds) - if (timeMutex == nullptr) { - return HasReturnvaluesIF::RETURN_FAILED; - } - - uint16_t leapSeconds; - ReturnValue_t result = getLeapSeconds(&leapSeconds); - if (result != HasReturnvaluesIF::RETURN_OK) { - return result; - } - timeval leapSeconds_timeval = { 0, 0 }; - leapSeconds_timeval.tv_sec = leapSeconds; - - //initial offset between UTC and TAI - timeval UTCtoTAI1972 = { 10, 0 }; - - timeval TAItoTT = { 32, 184000 }; - - *tt = utc + leapSeconds_timeval + UTCtoTAI1972 + TAItoTT; - - return HasReturnvaluesIF::RETURN_OK; -} - -ReturnValue_t Clock::setLeapSeconds(const uint16_t leapSeconds_) { - if (checkOrCreateClockMutex() != HasReturnvaluesIF::RETURN_OK) { - return HasReturnvaluesIF::RETURN_FAILED; - } - ReturnValue_t result = timeMutex->lockMutex(MutexIF::TimeoutType::BLOCKING); - if (result != HasReturnvaluesIF::RETURN_OK) { - return result; - } - - leapSeconds = leapSeconds_; - - result = timeMutex->unlockMutex(); - return result; -} - -ReturnValue_t Clock::getLeapSeconds(uint16_t* leapSeconds_) { - if (timeMutex == NULL) { - return HasReturnvaluesIF::RETURN_FAILED; - } - ReturnValue_t result = timeMutex->lockMutex(MutexIF::TimeoutType::BLOCKING); - if (result != HasReturnvaluesIF::RETURN_OK) { - return result; - } - - *leapSeconds_ = leapSeconds; - - result = timeMutex->unlockMutex(); - return result; -} - -ReturnValue_t Clock::checkOrCreateClockMutex() { - if (timeMutex == NULL) { - MutexFactory* mutexFactory = MutexFactory::instance(); - if (mutexFactory == NULL) { - return HasReturnvaluesIF::RETURN_FAILED; - } - timeMutex = mutexFactory->createMutex(); - if (timeMutex == NULL) { - return HasReturnvaluesIF::RETURN_FAILED; - } - } - return HasReturnvaluesIF::RETURN_OK; -} diff --git a/osal/host/Clock.cpp b/osal/host/Clock.cpp index c097f619..219d3e96 100644 --- a/osal/host/Clock.cpp +++ b/osal/host/Clock.cpp @@ -170,71 +170,3 @@ ReturnValue_t Clock::convertTimevalToJD2000(timeval time, double* JD2000) { / 3600.; return HasReturnvaluesIF::RETURN_OK; } - -ReturnValue_t Clock::convertUTCToTT(timeval utc, timeval* tt) { - //SHOULDDO: works not for dates in the past (might have less leap seconds) - if (timeMutex == NULL) { - return HasReturnvaluesIF::RETURN_FAILED; - } - - uint16_t leapSeconds; - ReturnValue_t result = getLeapSeconds(&leapSeconds); - if (result != HasReturnvaluesIF::RETURN_OK) { - return result; - } - timeval leapSeconds_timeval = { 0, 0 }; - leapSeconds_timeval.tv_sec = leapSeconds; - - //initial offset between UTC and TAI - timeval UTCtoTAI1972 = { 10, 0 }; - - timeval TAItoTT = { 32, 184000 }; - - *tt = utc + leapSeconds_timeval + UTCtoTAI1972 + TAItoTT; - - return HasReturnvaluesIF::RETURN_OK; -} - -ReturnValue_t Clock::setLeapSeconds(const uint16_t leapSeconds_) { - if(checkOrCreateClockMutex()!=HasReturnvaluesIF::RETURN_OK){ - return HasReturnvaluesIF::RETURN_FAILED; - } - ReturnValue_t result = timeMutex->lockMutex(); - if (result != HasReturnvaluesIF::RETURN_OK) { - return result; - } - - leapSeconds = leapSeconds_; - - result = timeMutex->unlockMutex(); - return result; -} - -ReturnValue_t Clock::getLeapSeconds(uint16_t* leapSeconds_) { - if(timeMutex == nullptr){ - return HasReturnvaluesIF::RETURN_FAILED; - } - ReturnValue_t result = timeMutex->lockMutex(); - if (result != HasReturnvaluesIF::RETURN_OK) { - return result; - } - - *leapSeconds_ = leapSeconds; - - result = timeMutex->unlockMutex(); - return result; -} - -ReturnValue_t Clock::checkOrCreateClockMutex(){ - if(timeMutex == nullptr){ - MutexFactory* mutexFactory = MutexFactory::instance(); - if (mutexFactory == nullptr) { - return HasReturnvaluesIF::RETURN_FAILED; - } - timeMutex = mutexFactory->createMutex(); - if (timeMutex == nullptr) { - return HasReturnvaluesIF::RETURN_FAILED; - } - } - return HasReturnvaluesIF::RETURN_OK; -} diff --git a/osal/linux/Clock.cpp b/osal/linux/Clock.cpp index 35cbfae0..960d9c0d 100644 --- a/osal/linux/Clock.cpp +++ b/osal/linux/Clock.cpp @@ -153,71 +153,3 @@ ReturnValue_t Clock::convertTimevalToJD2000(timeval time, double* JD2000) { / 3600.; return HasReturnvaluesIF::RETURN_OK; } - -ReturnValue_t Clock::convertUTCToTT(timeval utc, timeval* tt) { - //SHOULDDO: works not for dates in the past (might have less leap seconds) - if (timeMutex == NULL) { - return HasReturnvaluesIF::RETURN_FAILED; - } - - uint16_t leapSeconds; - ReturnValue_t result = getLeapSeconds(&leapSeconds); - if (result != HasReturnvaluesIF::RETURN_OK) { - return result; - } - timeval leapSeconds_timeval = { 0, 0 }; - leapSeconds_timeval.tv_sec = leapSeconds; - - //initial offset between UTC and TAI - timeval UTCtoTAI1972 = { 10, 0 }; - - timeval TAItoTT = { 32, 184000 }; - - *tt = utc + leapSeconds_timeval + UTCtoTAI1972 + TAItoTT; - - return HasReturnvaluesIF::RETURN_OK; -} - -ReturnValue_t Clock::setLeapSeconds(const uint16_t leapSeconds_) { - if(checkOrCreateClockMutex()!=HasReturnvaluesIF::RETURN_OK){ - return HasReturnvaluesIF::RETURN_FAILED; - } - ReturnValue_t result = timeMutex->lockMutex(MutexIF::TimeoutType::BLOCKING); - if (result != HasReturnvaluesIF::RETURN_OK) { - return result; - } - - leapSeconds = leapSeconds_; - - result = timeMutex->unlockMutex(); - return result; -} - -ReturnValue_t Clock::getLeapSeconds(uint16_t* leapSeconds_) { - if(timeMutex==NULL){ - return HasReturnvaluesIF::RETURN_FAILED; - } - ReturnValue_t result = timeMutex->lockMutex(MutexIF::TimeoutType::BLOCKING); - if (result != HasReturnvaluesIF::RETURN_OK) { - return result; - } - - *leapSeconds_ = leapSeconds; - - result = timeMutex->unlockMutex(); - return result; -} - -ReturnValue_t Clock::checkOrCreateClockMutex(){ - if(timeMutex == nullptr){ - MutexFactory* mutexFactory = MutexFactory::instance(); - if (mutexFactory == nullptr) { - return HasReturnvaluesIF::RETURN_FAILED; - } - timeMutex = mutexFactory->createMutex(); - if (timeMutex == nullptr) { - return HasReturnvaluesIF::RETURN_FAILED; - } - } - return HasReturnvaluesIF::RETURN_OK; -} diff --git a/osal/rtems/Clock.cpp b/osal/rtems/Clock.cpp index b80786f7..ae720c36 100644 --- a/osal/rtems/Clock.cpp +++ b/osal/rtems/Clock.cpp @@ -154,65 +154,3 @@ ReturnValue_t Clock::convertTimevalToJD2000(timeval time, double* JD2000) { / 3600.; return HasReturnvaluesIF::RETURN_OK; } - -ReturnValue_t Clock::convertUTCToTT(timeval utc, timeval* tt) { - //SHOULDDO: works not for dates in the past (might have less leap seconds) - if (timeMutex == nullptr) { - return HasReturnvaluesIF::RETURN_FAILED; - } - - uint16_t leapSeconds; - ReturnValue_t result = getLeapSeconds(&leapSeconds); - if (result != HasReturnvaluesIF::RETURN_OK) { - return result; - } - timeval leapSeconds_timeval = { 0, 0 }; - leapSeconds_timeval.tv_sec = leapSeconds; - - //initial offset between UTC and TAI - timeval UTCtoTAI1972 = { 10, 0 }; - - timeval TAItoTT = { 32, 184000 }; - - *tt = utc + leapSeconds_timeval + UTCtoTAI1972 + TAItoTT; - - return HasReturnvaluesIF::RETURN_OK; -} - -ReturnValue_t Clock::setLeapSeconds(const uint16_t leapSeconds_) { - if(checkOrCreateClockMutex()!=HasReturnvaluesIF::RETURN_OK){ - return HasReturnvaluesIF::RETURN_FAILED; - } - MutexGuard helper(timeMutex); - - - leapSeconds = leapSeconds_; - - - return HasReturnvaluesIF::RETURN_OK; -} - -ReturnValue_t Clock::getLeapSeconds(uint16_t* leapSeconds_) { - if(timeMutex==nullptr){ - return HasReturnvaluesIF::RETURN_FAILED; - } - MutexGuard helper(timeMutex); - - *leapSeconds_ = leapSeconds; - - return HasReturnvaluesIF::RETURN_OK; -} - -ReturnValue_t Clock::checkOrCreateClockMutex(){ - if(timeMutex==nullptr){ - MutexFactory* mutexFactory = MutexFactory::instance(); - if (mutexFactory == nullptr) { - return HasReturnvaluesIF::RETURN_FAILED; - } - timeMutex = mutexFactory->createMutex(); - if (timeMutex == nullptr) { - return HasReturnvaluesIF::RETURN_FAILED; - } - } - return HasReturnvaluesIF::RETURN_OK; -} diff --git a/timemanager/Clock.h b/timemanager/Clock.h index 6400d284..2ac48384 100644 --- a/timemanager/Clock.h +++ b/timemanager/Clock.h @@ -41,14 +41,14 @@ public: * @return -@c RETURN_OK on success. Otherwise, the OS failure code * is returned. */ - static ReturnValue_t setClock(const TimeOfDay_t* time); + static ReturnValue_t setClock(const TimeOfDay_t *time); /** * This system call sets the system time. * To set the time, it uses a timeval struct. * @param time The struct with the time settings to set. * @return -@c RETURN_OK on success. Otherwise, the OS failure code is returned. */ - static ReturnValue_t setClock(const timeval* time); + static ReturnValue_t setClock(const timeval *time); /** * This system call returns the current system clock in timeval format. * The timval format has the fields @c tv_sec with seconds and @c tv_usec with @@ -56,7 +56,7 @@ public: * @param time A pointer to a timeval struct where the current time is stored. * @return @c RETURN_OK on success. Otherwise, the OS failure code is returned. */ - static ReturnValue_t getClock_timeval(timeval* time); + static ReturnValue_t getClock_timeval(timeval *time); /** * Get the time since boot in a timeval struct @@ -66,7 +66,7 @@ public: * * @deprecated, I do not think this should be able to fail, use timeval getUptime() */ - static ReturnValue_t getUptime(timeval* uptime); + static ReturnValue_t getUptime(timeval *uptime); static timeval getUptime(); @@ -79,7 +79,7 @@ public: * @param ms uptime in ms * @return RETURN_OK on success. Otherwise, the OS failure code is returned. */ - static ReturnValue_t getUptime(uint32_t* uptimeMs); + static ReturnValue_t getUptime(uint32_t *uptimeMs); /** * Returns the time in microseconds since an OS-defined epoch. @@ -89,7 +89,7 @@ public: * - @c RETURN_OK on success. * - Otherwise, the OS failure code is returned. */ - static ReturnValue_t getClock_usecs(uint64_t* time); + static ReturnValue_t getClock_usecs(uint64_t *time); /** * Returns the time in a TimeOfDay_t struct. * @param time A pointer to a TimeOfDay_t struct. @@ -97,7 +97,7 @@ public: * - @c RETURN_OK on success. * - Otherwise, the OS failure code is returned. */ - static ReturnValue_t getDateAndTime(TimeOfDay_t* time); + static ReturnValue_t getDateAndTime(TimeOfDay_t *time); /** * Converts a time of day struct to POSIX seconds. @@ -107,8 +107,8 @@ public: * - @c RETURN_OK on success. * - Otherwise, the OS failure code is returned. */ - static ReturnValue_t convertTimeOfDayToTimeval(const TimeOfDay_t* from, - timeval* to); + static ReturnValue_t convertTimeOfDayToTimeval(const TimeOfDay_t *from, + timeval *to); /** * Converts a time represented as seconds and subseconds since unix @@ -118,12 +118,14 @@ public: * @param[out] JD2000 days since J2000 * @return @c RETURN_OK */ - static ReturnValue_t convertTimevalToJD2000(timeval time, double* JD2000); + static ReturnValue_t convertTimevalToJD2000(timeval time, double *JD2000); /** * Calculates and adds the offset between UTC and TT * * Depends on the leap seconds to be set correctly. + * Therefore, it does not work for historic + * dates as only the current leap seconds are known. * * @param utc timeval, corresponding to UTC time * @param[out] tt timeval, corresponding to Terrestial Time @@ -131,7 +133,28 @@ public: * - @c RETURN_OK on success * - @c RETURN_FAILED if leapSeconds are not set */ - static ReturnValue_t convertUTCToTT(timeval utc, timeval* tt); + static ReturnValue_t Clock::convertUTCToTT(timeval utc, timeval *tt) { + if (timeMutex == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } + + uint16_t leapSeconds; + ReturnValue_t result = getLeapSeconds(&leapSeconds); + if (result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + timeval leapSeconds_timeval = { 0, 0 }; + leapSeconds_timeval.tv_sec = leapSeconds; + + //initial offset between UTC and TAI + timeval UTCtoTAI1972 = { 10, 0 }; + + timeval TAItoTT = { 32, 184000 }; + + *tt = utc + leapSeconds_timeval + UTCtoTAI1972 + TAItoTT; + + return HasReturnvaluesIF::RETURN_OK; + } /** * Set the Leap Seconds since 1972 @@ -139,34 +162,63 @@ public: * @param leapSeconds_ * @return * - @c RETURN_OK on success. - * - Otherwise, the OS failure code is returned. */ - static ReturnValue_t setLeapSeconds(const uint16_t leapSeconds_); + static ReturnValue_t Clock::setLeapSeconds(const uint16_t leapSeconds_) { + if (checkOrCreateClockMutex() != HasReturnvaluesIF::RETURN_OK) { + return HasReturnvaluesIF::RETURN_FAILED; + } + MutexGuard helper(timeMutex); + + leapSeconds = leapSeconds_; + + return HasReturnvaluesIF::RETURN_OK; + } /** * Get the Leap Seconds since 1972 * - * Must be set before! + * Setter must be called before * * @param[out] leapSeconds_ * @return * - @c RETURN_OK on success. - * - Otherwise, the OS failure code is returned. + * - @c RETURN_FAILED on error */ static ReturnValue_t getLeapSeconds(uint16_t *leapSeconds_); + ReturnValue_t Clock::getLeapSeconds(uint16_t *leapSeconds_) { + if (timeMutex == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } + MutexGuard helper(timeMutex); + *leapSeconds_ = leapSeconds; + + return HasReturnvaluesIF::RETURN_OK; + } + +private: /** * Function to check and create the Mutex for the clock * @return * - @c RETURN_OK on success. * - Otherwise @c RETURN_FAILED if not able to create one */ - static ReturnValue_t checkOrCreateClockMutex(); + static ReturnValue_t Clock::checkOrCreateClockMutex() { + if (timeMutex == nullptr) { + MutexFactory *mutexFactory = MutexFactory::instance(); + if (mutexFactory == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } + timeMutex = mutexFactory->createMutex(); + if (timeMutex == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + return HasReturnvaluesIF::RETURN_OK; + } -private: - static MutexIF* timeMutex; + static MutexIF *timeMutex; static uint16_t leapSeconds; }; - #endif /* FSFW_TIMEMANAGER_CLOCK_H_ */ From af99303eac5f6f98383c01538a9c9d18a1413537 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 14 Jun 2021 15:05:40 +0200 Subject: [PATCH 139/389] indentation --- memory/GenericFileSystemMessage.cpp | 46 ++++++++++++++--------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/memory/GenericFileSystemMessage.cpp b/memory/GenericFileSystemMessage.cpp index 005f4ede..b0e1a9ec 100644 --- a/memory/GenericFileSystemMessage.cpp +++ b/memory/GenericFileSystemMessage.cpp @@ -134,28 +134,28 @@ bool GenericFileSystemMessage::getReadReply(const CommandMessage *message, } ReturnValue_t GenericFileSystemMessage::clear(CommandMessage* message) { - switch(message->getCommand()) { - case(CMD_CREATE_FILE): - case(CMD_DELETE_FILE): - case(CMD_CREATE_DIRECTORY): - case(CMD_REPORT_FILE_ATTRIBUTES): - case(REPLY_REPORT_FILE_ATTRIBUTES): - case(CMD_LOCK_FILE): - case(CMD_UNLOCK_FILE): - case(CMD_COPY_FILE): - case(REPLY_READ_FROM_FILE): - case(CMD_READ_FROM_FILE): - case(CMD_APPEND_TO_FILE): - case(CMD_FINISH_APPEND_TO_FILE): - case(REPLY_READ_FINISHED_STOP): - case(REPLY_FINISH_APPEND): { - store_address_t storeId = GenericFileSystemMessage::getStoreId(message); - auto ipcStore = ObjectManager::instance()->get(objects::IPC_STORE); - if(ipcStore == nullptr) { - return HasReturnvaluesIF::RETURN_FAILED; - } - return ipcStore->deleteData(storeId); - } - } + switch(message->getCommand()) { + case(CMD_CREATE_FILE): + case(CMD_DELETE_FILE): + case(CMD_CREATE_DIRECTORY): + case(CMD_REPORT_FILE_ATTRIBUTES): + case(REPLY_REPORT_FILE_ATTRIBUTES): + case(CMD_LOCK_FILE): + case(CMD_UNLOCK_FILE): + case(CMD_COPY_FILE): + case(REPLY_READ_FROM_FILE): + case(CMD_READ_FROM_FILE): + case(CMD_APPEND_TO_FILE): + case(CMD_FINISH_APPEND_TO_FILE): + case(REPLY_READ_FINISHED_STOP): + case(REPLY_FINISH_APPEND): { + store_address_t storeId = GenericFileSystemMessage::getStoreId(message); + auto ipcStore = ObjectManager::instance()->get(objects::IPC_STORE); + if(ipcStore == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } + return ipcStore->deleteData(storeId); + } + } return HasReturnvaluesIF::RETURN_OK; } From 5f27fe63922a1a9458714de75f8cb7bec93abd46 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 14 Jun 2021 15:06:26 +0200 Subject: [PATCH 140/389] indentation --- memory/GenericFileSystemMessage.cpp | 46 ++++++++++++++--------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/memory/GenericFileSystemMessage.cpp b/memory/GenericFileSystemMessage.cpp index 005f4ede..b0e1a9ec 100644 --- a/memory/GenericFileSystemMessage.cpp +++ b/memory/GenericFileSystemMessage.cpp @@ -134,28 +134,28 @@ bool GenericFileSystemMessage::getReadReply(const CommandMessage *message, } ReturnValue_t GenericFileSystemMessage::clear(CommandMessage* message) { - switch(message->getCommand()) { - case(CMD_CREATE_FILE): - case(CMD_DELETE_FILE): - case(CMD_CREATE_DIRECTORY): - case(CMD_REPORT_FILE_ATTRIBUTES): - case(REPLY_REPORT_FILE_ATTRIBUTES): - case(CMD_LOCK_FILE): - case(CMD_UNLOCK_FILE): - case(CMD_COPY_FILE): - case(REPLY_READ_FROM_FILE): - case(CMD_READ_FROM_FILE): - case(CMD_APPEND_TO_FILE): - case(CMD_FINISH_APPEND_TO_FILE): - case(REPLY_READ_FINISHED_STOP): - case(REPLY_FINISH_APPEND): { - store_address_t storeId = GenericFileSystemMessage::getStoreId(message); - auto ipcStore = ObjectManager::instance()->get(objects::IPC_STORE); - if(ipcStore == nullptr) { - return HasReturnvaluesIF::RETURN_FAILED; - } - return ipcStore->deleteData(storeId); - } - } + switch(message->getCommand()) { + case(CMD_CREATE_FILE): + case(CMD_DELETE_FILE): + case(CMD_CREATE_DIRECTORY): + case(CMD_REPORT_FILE_ATTRIBUTES): + case(REPLY_REPORT_FILE_ATTRIBUTES): + case(CMD_LOCK_FILE): + case(CMD_UNLOCK_FILE): + case(CMD_COPY_FILE): + case(REPLY_READ_FROM_FILE): + case(CMD_READ_FROM_FILE): + case(CMD_APPEND_TO_FILE): + case(CMD_FINISH_APPEND_TO_FILE): + case(REPLY_READ_FINISHED_STOP): + case(REPLY_FINISH_APPEND): { + store_address_t storeId = GenericFileSystemMessage::getStoreId(message); + auto ipcStore = ObjectManager::instance()->get(objects::IPC_STORE); + if(ipcStore == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } + return ipcStore->deleteData(storeId); + } + } return HasReturnvaluesIF::RETURN_OK; } From aa33ff2f486f74797ed20e6b631907af7d250c2c Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 14 Jun 2021 15:14:57 +0200 Subject: [PATCH 141/389] max tm packet size now configurable --- defaultcfg/fsfwconfig/FSFWConfig.h | 2 + tmtcpacket/packetmatcher/ApidMatcher.h | 54 ++-- tmtcpacket/packetmatcher/PacketMatchTree.cpp | 319 +++++++++---------- tmtcpacket/packetmatcher/PacketMatchTree.h | 46 +-- tmtcpacket/packetmatcher/ServiceMatcher.h | 50 +-- tmtcpacket/packetmatcher/SubserviceMatcher.h | 54 ++-- tmtcpacket/pus/tc/TcPacketBase.h | 206 ++++++------ tmtcpacket/pus/tc/TcPacketStoredBase.cpp | 34 +- tmtcpacket/pus/tc/TcPacketStoredBase.h | 46 +-- tmtcpacket/pus/tm/TmPacketBase.cpp | 4 +- tmtcpacket/pus/tm/TmPacketPusA.h | 5 +- tmtcpacket/pus/tm/TmPacketPusC.h | 3 +- 12 files changed, 409 insertions(+), 414 deletions(-) diff --git a/defaultcfg/fsfwconfig/FSFWConfig.h b/defaultcfg/fsfwconfig/FSFWConfig.h index 5518e33c..adf9912f 100644 --- a/defaultcfg/fsfwconfig/FSFWConfig.h +++ b/defaultcfg/fsfwconfig/FSFWConfig.h @@ -68,6 +68,8 @@ static constexpr uint8_t FSFW_CSB_FIFO_DEPTH = 6; static constexpr size_t FSFW_PRINT_BUFFER_SIZE = 124; +static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048; + } #endif /* CONFIG_FSFWCONFIG_H_ */ diff --git a/tmtcpacket/packetmatcher/ApidMatcher.h b/tmtcpacket/packetmatcher/ApidMatcher.h index 64f73dbf..33db7151 100644 --- a/tmtcpacket/packetmatcher/ApidMatcher.h +++ b/tmtcpacket/packetmatcher/ApidMatcher.h @@ -1,5 +1,5 @@ -#ifndef FRAMEWORK_TMTCPACKET_PACKETMATCHER_APIDMATCHER_H_ -#define FRAMEWORK_TMTCPACKET_PACKETMATCHER_APIDMATCHER_H_ +#ifndef FSFW_TMTCPACKET_PACKETMATCHER_APIDMATCHER_H_ +#define FSFW_TMTCPACKET_PACKETMATCHER_APIDMATCHER_H_ #include "../../globalfunctions/matching/SerializeableMatcherIF.h" #include "../../serialize/SerializeAdapter.h" @@ -7,32 +7,32 @@ class ApidMatcher: public SerializeableMatcherIF { private: - uint16_t apid; + uint16_t apid; public: - ApidMatcher(uint16_t setApid) : - apid(setApid) { - } - ApidMatcher(TmPacketMinimal* test) : - apid(test->getAPID()) { - } - bool match(TmPacketMinimal* packet) { - if (packet->getAPID() == apid) { - return true; - } else { - return false; - } - } - ReturnValue_t serialize(uint8_t** buffer, size_t* size, - size_t maxSize, Endianness streamEndianness) const { - return SerializeAdapter::serialize(&apid, buffer, size, maxSize, streamEndianness); - } - size_t getSerializedSize() const { - return SerializeAdapter::getSerializedSize(&apid); - } - ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size, - Endianness streamEndianness) { - return SerializeAdapter::deSerialize(&apid, buffer, size, streamEndianness); - } + ApidMatcher(uint16_t setApid) : + apid(setApid) { + } + ApidMatcher(TmPacketMinimal* test) : + apid(test->getAPID()) { + } + bool match(TmPacketMinimal* packet) { + if (packet->getAPID() == apid) { + return true; + } else { + return false; + } + } + ReturnValue_t serialize(uint8_t** buffer, size_t* size, + size_t maxSize, Endianness streamEndianness) const { + return SerializeAdapter::serialize(&apid, buffer, size, maxSize, streamEndianness); + } + size_t getSerializedSize() const { + return SerializeAdapter::getSerializedSize(&apid); + } + ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size, + Endianness streamEndianness) { + return SerializeAdapter::deSerialize(&apid, buffer, size, streamEndianness); + } }; diff --git a/tmtcpacket/packetmatcher/PacketMatchTree.cpp b/tmtcpacket/packetmatcher/PacketMatchTree.cpp index ac72b3e7..05e176ef 100644 --- a/tmtcpacket/packetmatcher/PacketMatchTree.cpp +++ b/tmtcpacket/packetmatcher/PacketMatchTree.cpp @@ -5,197 +5,194 @@ // This should be configurable.. const LocalPool::LocalPoolConfig PacketMatchTree::poolConfig = { - {10, sizeof(ServiceMatcher)}, - {20, sizeof(SubServiceMatcher)}, - {2, sizeof(ApidMatcher)}, - {40, sizeof(PacketMatchTree::Node)} + {10, sizeof(ServiceMatcher)}, + {20, sizeof(SubServiceMatcher)}, + {2, sizeof(ApidMatcher)}, + {40, sizeof(PacketMatchTree::Node)} }; -PacketMatchTree::PacketMatchTree(Node* root) : - MatchTree(root, 2), - factoryBackend(0, poolConfig, false, true), - factory(&factoryBackend) { +PacketMatchTree::PacketMatchTree(Node* root): MatchTree(root, 2), + factoryBackend(0, poolConfig, false, true), + factory(&factoryBackend) { } -PacketMatchTree::PacketMatchTree(iterator root) : - MatchTree(root.element, 2), - factoryBackend(0, poolConfig, false, true), - factory(&factoryBackend) { +PacketMatchTree::PacketMatchTree(iterator root): MatchTree(root.element, 2), + factoryBackend(0, poolConfig, false, true), + factory(&factoryBackend) { } -PacketMatchTree::PacketMatchTree() : - MatchTree((Node*) NULL, 2), - factoryBackend(0, poolConfig, false, true), - factory(&factoryBackend) { +PacketMatchTree::PacketMatchTree(): MatchTree((Node*) NULL, 2), + factoryBackend(0, poolConfig, false, true), + factory(&factoryBackend) { } PacketMatchTree::~PacketMatchTree() { } ReturnValue_t PacketMatchTree::addMatch(uint16_t apid, uint8_t type, - uint8_t subtype) { - //We assume adding APID is always requested. - TmPacketMinimal::TmPacketMinimalPointer data; - data.data_field.service_type = type; - data.data_field.service_subtype = subtype; - TmPacketMinimal testPacket((uint8_t*) &data); - testPacket.setAPID(apid); - iterator lastTest; - iterator rollback; - ReturnValue_t result = findOrInsertMatch( - this->begin(), &testPacket, &lastTest); - if (result == NEW_NODE_CREATED) { - rollback = lastTest; - } else if (result != RETURN_OK) { - return result; - } - if (type == 0) { - //Check if lastTest has no children, otherwise, delete them, - //as a more general check is requested. - if (lastTest.left() != this->end()) { - removeElementAndAllChildren(lastTest.left()); - } - return RETURN_OK; - } - //Type insertion required. - result = findOrInsertMatch( - lastTest.left(), &testPacket, &lastTest); - if (result == NEW_NODE_CREATED) { - if (rollback == this->end()) { - rollback = lastTest; - } - } else if (result != RETURN_OK) { - if (rollback != this->end()) { - removeElementAndAllChildren(rollback); - } - return result; - } - if (subtype == 0) { - if (lastTest.left() != this->end()) { - //See above - removeElementAndAllChildren(lastTest.left()); - } - return RETURN_OK; - } - //Subtype insertion required. - result = findOrInsertMatch( - lastTest.left(), &testPacket, &lastTest); - if (result == NEW_NODE_CREATED) { - return RETURN_OK; - } else if (result != RETURN_OK) { - if (rollback != this->end()) { - removeElementAndAllChildren(rollback); - } - return result; - } - return RETURN_OK; + uint8_t subtype) { + //We assume adding APID is always requested. + TmPacketMinimal::TmPacketMinimalPointer data; + data.data_field.service_type = type; + data.data_field.service_subtype = subtype; + TmPacketMinimal testPacket((uint8_t*) &data); + testPacket.setAPID(apid); + iterator lastTest; + iterator rollback; + ReturnValue_t result = findOrInsertMatch( + this->begin(), &testPacket, &lastTest); + if (result == NEW_NODE_CREATED) { + rollback = lastTest; + } else if (result != RETURN_OK) { + return result; + } + if (type == 0) { + //Check if lastTest has no children, otherwise, delete them, + //as a more general check is requested. + if (lastTest.left() != this->end()) { + removeElementAndAllChildren(lastTest.left()); + } + return RETURN_OK; + } + //Type insertion required. + result = findOrInsertMatch( + lastTest.left(), &testPacket, &lastTest); + if (result == NEW_NODE_CREATED) { + if (rollback == this->end()) { + rollback = lastTest; + } + } else if (result != RETURN_OK) { + if (rollback != this->end()) { + removeElementAndAllChildren(rollback); + } + return result; + } + if (subtype == 0) { + if (lastTest.left() != this->end()) { + //See above + removeElementAndAllChildren(lastTest.left()); + } + return RETURN_OK; + } + //Subtype insertion required. + result = findOrInsertMatch( + lastTest.left(), &testPacket, &lastTest); + if (result == NEW_NODE_CREATED) { + return RETURN_OK; + } else if (result != RETURN_OK) { + if (rollback != this->end()) { + removeElementAndAllChildren(rollback); + } + return result; + } + return RETURN_OK; } template ReturnValue_t PacketMatchTree::findOrInsertMatch(iterator startAt, VALUE_T test, - iterator* lastTest) { - bool attachToBranch = AND; - iterator iter = startAt; - while (iter != this->end()) { - bool isMatch = iter->match(test); - attachToBranch = OR; - *lastTest = iter; - if (isMatch) { - return RETURN_OK; - } else { - //Go down OR branch. - iter = iter.right(); - } - } - //Only reached if nothing was found. - SerializeableMatcherIF* newContent = factory.generate( - test); - if (newContent == NULL) { - return FULL; - } - Node* newNode = factory.generate(newContent); - if (newNode == NULL) { - //Need to make sure partially generated content is deleted, otherwise, that's a leak. - factory.destroy(static_cast(newContent)); - return FULL; - } - *lastTest = insert(attachToBranch, *lastTest, newNode); - if (*lastTest == end()) { - //This actaully never fails, so creating a dedicated returncode seems an overshoot. - return RETURN_FAILED; - } - return NEW_NODE_CREATED; + iterator* lastTest) { + bool attachToBranch = AND; + iterator iter = startAt; + while (iter != this->end()) { + bool isMatch = iter->match(test); + attachToBranch = OR; + *lastTest = iter; + if (isMatch) { + return RETURN_OK; + } else { + //Go down OR branch. + iter = iter.right(); + } + } + //Only reached if nothing was found. + SerializeableMatcherIF* newContent = factory.generate( + test); + if (newContent == NULL) { + return FULL; + } + Node* newNode = factory.generate(newContent); + if (newNode == NULL) { + //Need to make sure partially generated content is deleted, otherwise, that's a leak. + factory.destroy(static_cast(newContent)); + return FULL; + } + *lastTest = insert(attachToBranch, *lastTest, newNode); + if (*lastTest == end()) { + //This actaully never fails, so creating a dedicated returncode seems an overshoot. + return RETURN_FAILED; + } + return NEW_NODE_CREATED; } ReturnValue_t PacketMatchTree::removeMatch(uint16_t apid, uint8_t type, - uint8_t subtype) { - TmPacketMinimal::TmPacketMinimalPointer data; - data.data_field.service_type = type; - data.data_field.service_subtype = subtype; - TmPacketMinimal testPacket((uint8_t*) &data); - testPacket.setAPID(apid); - iterator foundElement = findMatch(begin(), &testPacket); - if (foundElement == this->end()) { - return NO_MATCH; - } - if (type == 0) { - if (foundElement.left() == end()) { - return removeElementAndReconnectChildren(foundElement); - } else { - return TOO_GENERAL_REQUEST; - } - } - //Go down AND branch. Will abort if empty. - foundElement = findMatch(foundElement.left(), &testPacket); - if (foundElement == this->end()) { - return NO_MATCH; - } - if (subtype == 0) { - if (foundElement.left() == end()) { - return removeElementAndReconnectChildren(foundElement); - } else { - return TOO_GENERAL_REQUEST; - } - } - //Again, go down AND branch. - foundElement = findMatch(foundElement.left(), &testPacket); - if (foundElement == end()) { - return NO_MATCH; - } - return removeElementAndReconnectChildren(foundElement); + uint8_t subtype) { + TmPacketMinimal::TmPacketMinimalPointer data; + data.data_field.service_type = type; + data.data_field.service_subtype = subtype; + TmPacketMinimal testPacket((uint8_t*) &data); + testPacket.setAPID(apid); + iterator foundElement = findMatch(begin(), &testPacket); + if (foundElement == this->end()) { + return NO_MATCH; + } + if (type == 0) { + if (foundElement.left() == end()) { + return removeElementAndReconnectChildren(foundElement); + } else { + return TOO_GENERAL_REQUEST; + } + } + //Go down AND branch. Will abort if empty. + foundElement = findMatch(foundElement.left(), &testPacket); + if (foundElement == this->end()) { + return NO_MATCH; + } + if (subtype == 0) { + if (foundElement.left() == end()) { + return removeElementAndReconnectChildren(foundElement); + } else { + return TOO_GENERAL_REQUEST; + } + } + //Again, go down AND branch. + foundElement = findMatch(foundElement.left(), &testPacket); + if (foundElement == end()) { + return NO_MATCH; + } + return removeElementAndReconnectChildren(foundElement); } PacketMatchTree::iterator PacketMatchTree::findMatch(iterator startAt, - TmPacketMinimal* test) { - iterator iter = startAt; - while (iter != end()) { - bool isMatch = iter->match(test); - if (isMatch) { - break; - } else { - iter = iter.right(); //next OR element - } - } - return iter; + TmPacketMinimal* test) { + iterator iter = startAt; + while (iter != end()) { + bool isMatch = iter->match(test); + if (isMatch) { + break; + } else { + iter = iter.right(); //next OR element + } + } + return iter; } ReturnValue_t PacketMatchTree::initialize() { - return factoryBackend.initialize(); + return factoryBackend.initialize(); } ReturnValue_t PacketMatchTree::changeMatch(bool addToMatch, uint16_t apid, - uint8_t type, uint8_t subtype) { - if (addToMatch) { - return addMatch(apid, type, subtype); - } else { - return removeMatch(apid, type, subtype); - } + uint8_t type, uint8_t subtype) { + if (addToMatch) { + return addMatch(apid, type, subtype); + } else { + return removeMatch(apid, type, subtype); + } } ReturnValue_t PacketMatchTree::cleanUpElement(iterator position) { - factory.destroy(position.element->value); - //Go on anyway, there's nothing we can do. - //SHOULDDO: Throw event, or write debug message? - return factory.destroy(position.element); + factory.destroy(position.element->value); + //Go on anyway, there's nothing we can do. + //SHOULDDO: Throw event, or write debug message? + return factory.destroy(position.element); } diff --git a/tmtcpacket/packetmatcher/PacketMatchTree.h b/tmtcpacket/packetmatcher/PacketMatchTree.h index 735f0566..a40b5099 100644 --- a/tmtcpacket/packetmatcher/PacketMatchTree.h +++ b/tmtcpacket/packetmatcher/PacketMatchTree.h @@ -1,5 +1,5 @@ -#ifndef FRAMEWORK_TMTCPACKET_PACKETMATCHER_PACKETMATCHTREE_H_ -#define FRAMEWORK_TMTCPACKET_PACKETMATCHER_PACKETMATCHTREE_H_ +#ifndef FSFW_TMTCPACKET_PACKETMATCHER_PACKETMATCHTREE_H_ +#define FSFW_TMTCPACKET_PACKETMATCHER_PACKETMATCHTREE_H_ #include "../../container/PlacementFactory.h" #include "../../globalfunctions/matching/MatchTree.h" @@ -8,29 +8,29 @@ class PacketMatchTree: public MatchTree, public HasReturnvaluesIF { public: - PacketMatchTree(Node* root); - PacketMatchTree(iterator root); - PacketMatchTree(); - virtual ~PacketMatchTree(); - ReturnValue_t changeMatch(bool addToMatch, uint16_t apid, uint8_t type = 0, - uint8_t subtype = 0); - ReturnValue_t addMatch(uint16_t apid, uint8_t type = 0, - uint8_t subtype = 0); - ReturnValue_t removeMatch(uint16_t apid, uint8_t type = 0, - uint8_t subtype = 0); - ReturnValue_t initialize(); + PacketMatchTree(Node* root); + PacketMatchTree(iterator root); + PacketMatchTree(); + virtual ~PacketMatchTree(); + ReturnValue_t changeMatch(bool addToMatch, uint16_t apid, uint8_t type = 0, + uint8_t subtype = 0); + ReturnValue_t addMatch(uint16_t apid, uint8_t type = 0, + uint8_t subtype = 0); + ReturnValue_t removeMatch(uint16_t apid, uint8_t type = 0, + uint8_t subtype = 0); + ReturnValue_t initialize(); protected: - ReturnValue_t cleanUpElement(iterator position); + ReturnValue_t cleanUpElement(iterator position); private: - static const uint8_t N_POOLS = 4; - LocalPool factoryBackend; - PlacementFactory factory; - static const LocalPool::LocalPoolConfig poolConfig; - static const uint16_t POOL_SIZES[N_POOLS]; - static const uint16_t N_ELEMENTS[N_POOLS]; - template - ReturnValue_t findOrInsertMatch(iterator startAt, VALUE_T test, iterator* lastTest); - iterator findMatch(iterator startAt, TmPacketMinimal* test); + static const uint8_t N_POOLS = 4; + LocalPool factoryBackend; + PlacementFactory factory; + static const LocalPool::LocalPoolConfig poolConfig; + static const uint16_t POOL_SIZES[N_POOLS]; + static const uint16_t N_ELEMENTS[N_POOLS]; + template + ReturnValue_t findOrInsertMatch(iterator startAt, VALUE_T test, iterator* lastTest); + iterator findMatch(iterator startAt, TmPacketMinimal* test); }; #endif /* FRAMEWORK_TMTCPACKET_PACKETMATCHER_PACKETMATCHTREE_H_ */ diff --git a/tmtcpacket/packetmatcher/ServiceMatcher.h b/tmtcpacket/packetmatcher/ServiceMatcher.h index 57f491f3..67d09d2b 100644 --- a/tmtcpacket/packetmatcher/ServiceMatcher.h +++ b/tmtcpacket/packetmatcher/ServiceMatcher.h @@ -7,32 +7,32 @@ class ServiceMatcher: public SerializeableMatcherIF { private: - uint8_t service; + uint8_t service; public: - ServiceMatcher(uint8_t setService) : - service(setService) { - } - ServiceMatcher(TmPacketMinimal* test) : - service(test->getService()) { - } - bool match(TmPacketMinimal* packet) { - if (packet->getService() == service) { - return true; - } else { - return false; - } - } - ReturnValue_t serialize(uint8_t** buffer, size_t* size, - size_t maxSize, Endianness streamEndianness) const { - return SerializeAdapter::serialize(&service, buffer, size, maxSize, streamEndianness); - } - size_t getSerializedSize() const { - return SerializeAdapter::getSerializedSize(&service); - } - ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size, - Endianness streamEndianness) { - return SerializeAdapter::deSerialize(&service, buffer, size, streamEndianness); - } + ServiceMatcher(uint8_t setService) : + service(setService) { + } + ServiceMatcher(TmPacketMinimal* test) : + service(test->getService()) { + } + bool match(TmPacketMinimal* packet) { + if (packet->getService() == service) { + return true; + } else { + return false; + } + } + ReturnValue_t serialize(uint8_t** buffer, size_t* size, + size_t maxSize, Endianness streamEndianness) const { + return SerializeAdapter::serialize(&service, buffer, size, maxSize, streamEndianness); + } + size_t getSerializedSize() const { + return SerializeAdapter::getSerializedSize(&service); + } + ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size, + Endianness streamEndianness) { + return SerializeAdapter::deSerialize(&service, buffer, size, streamEndianness); + } }; diff --git a/tmtcpacket/packetmatcher/SubserviceMatcher.h b/tmtcpacket/packetmatcher/SubserviceMatcher.h index 80681b5d..e570b452 100644 --- a/tmtcpacket/packetmatcher/SubserviceMatcher.h +++ b/tmtcpacket/packetmatcher/SubserviceMatcher.h @@ -1,5 +1,5 @@ -#ifndef FRAMEWORK_TMTCPACKET_PACKETMATCHER_SUBSERVICEMATCHER_H_ -#define FRAMEWORK_TMTCPACKET_PACKETMATCHER_SUBSERVICEMATCHER_H_ +#ifndef FSFW_TMTCPACKET_PACKETMATCHER_SUBSERVICEMATCHER_H_ +#define FSFW_TMTCPACKET_PACKETMATCHER_SUBSERVICEMATCHER_H_ #include "../../globalfunctions/matching/SerializeableMatcherIF.h" #include "../../serialize/SerializeAdapter.h" @@ -7,32 +7,32 @@ class SubServiceMatcher: public SerializeableMatcherIF { public: - SubServiceMatcher(uint8_t subService) : - subService(subService) { - } - SubServiceMatcher(TmPacketMinimal* test) : - subService(test->getSubService()) { - } - bool match(TmPacketMinimal* packet) { - if (packet->getSubService() == subService) { - return true; - } else { - return false; - } - } - ReturnValue_t serialize(uint8_t** buffer, size_t* size, - size_t maxSize, Endianness streamEndianness) const { - return SerializeAdapter::serialize(&subService, buffer, size, maxSize, streamEndianness); - } - size_t getSerializedSize() const { - return SerializeAdapter::getSerializedSize(&subService); - } - ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size, - Endianness streamEndianness) { - return SerializeAdapter::deSerialize(&subService, buffer, size, streamEndianness); - } + SubServiceMatcher(uint8_t subService) : + subService(subService) { + } + SubServiceMatcher(TmPacketMinimal* test) : + subService(test->getSubService()) { + } + bool match(TmPacketMinimal* packet) { + if (packet->getSubService() == subService) { + return true; + } else { + return false; + } + } + ReturnValue_t serialize(uint8_t** buffer, size_t* size, + size_t maxSize, Endianness streamEndianness) const { + return SerializeAdapter::serialize(&subService, buffer, size, maxSize, streamEndianness); + } + size_t getSerializedSize() const { + return SerializeAdapter::getSerializedSize(&subService); + } + ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size, + Endianness streamEndianness) { + return SerializeAdapter::deSerialize(&subService, buffer, size, streamEndianness); + } private: - uint8_t subService; + uint8_t subService; }; diff --git a/tmtcpacket/pus/tc/TcPacketBase.h b/tmtcpacket/pus/tc/TcPacketBase.h index 68f08896..e2872246 100644 --- a/tmtcpacket/pus/tc/TcPacketBase.h +++ b/tmtcpacket/pus/tc/TcPacketBase.h @@ -19,114 +19,114 @@ class TcPacketBase : public SpacePacketBase { friend class TcPacketStoredBase; public: - enum AckField { - //! No acknowledgements are expected. - ACK_NONE = 0b0000, - //! Acknowledgements on acceptance are expected. - ACK_ACCEPTANCE = 0b0001, - //! Acknowledgements on start are expected. - ACK_START = 0b0010, - //! Acknowledgements on step are expected. - ACK_STEP = 0b0100, - //! Acknowledfgement on completion are expected. - ACK_COMPLETION = 0b1000 - }; + enum AckField { + //! No acknowledgements are expected. + ACK_NONE = 0b0000, + //! Acknowledgements on acceptance are expected. + ACK_ACCEPTANCE = 0b0001, + //! Acknowledgements on start are expected. + ACK_START = 0b0010, + //! Acknowledgements on step are expected. + ACK_STEP = 0b0100, + //! Acknowledfgement on completion are expected. + ACK_COMPLETION = 0b1000 + }; - static constexpr uint8_t ACK_ALL = ACK_ACCEPTANCE | ACK_START | ACK_STEP | - ACK_COMPLETION; + static constexpr uint8_t ACK_ALL = ACK_ACCEPTANCE | ACK_START | ACK_STEP | + ACK_COMPLETION; - /** - * This is the default constructor. - * It sets its internal data pointer to the address passed and also - * forwards the data pointer to the parent SpacePacketBase class. - * @param setData The position where the packet data lies. - */ - TcPacketBase( const uint8_t* setData ); - /** - * This is the empty default destructor. - */ - virtual ~TcPacketBase(); + /** + * This is the default constructor. + * It sets its internal data pointer to the address passed and also + * forwards the data pointer to the parent SpacePacketBase class. + * @param setData The position where the packet data lies. + */ + TcPacketBase( const uint8_t* setData ); + /** + * This is the empty default destructor. + */ + virtual ~TcPacketBase(); - /** - * This command returns the CCSDS Secondary Header Flag. - * It shall always be zero for PUS Packets. This is the - * highest bit of the first byte of the Data Field Header. - * @return the CCSDS Secondary Header Flag - */ - virtual uint8_t getSecondaryHeaderFlag() const = 0; - /** - * This command returns the TC Packet PUS Version Number. - * The version number of ECSS PUS 2003 is 1. - * It consists of the second to fourth highest bits of the - * first byte. - * @return - */ - virtual uint8_t getPusVersionNumber() const = 0; - /** - * This is a getter for the packet's Ack field, which are the lowest four - * bits of the first byte of the Data Field Header. - * - * It is packed in a uint8_t variable. - * @return The packet's PUS Ack field. - */ - virtual uint8_t getAcknowledgeFlags() const = 0; - /** - * This is a getter for the packet's PUS Service ID, which is the second - * byte of the Data Field Header. - * @return The packet's PUS Service ID. - */ - virtual uint8_t getService() const = 0; - /** - * This is a getter for the packet's PUS Service Subtype, which is the - * third byte of the Data Field Header. - * @return The packet's PUS Service Subtype. - */ - virtual uint8_t getSubService() const = 0; - /** - * The source ID can be used to have an additional identifier, e.g. for different ground - * station. - * @return - */ - virtual uint16_t getSourceId() const = 0; + /** + * This command returns the CCSDS Secondary Header Flag. + * It shall always be zero for PUS Packets. This is the + * highest bit of the first byte of the Data Field Header. + * @return the CCSDS Secondary Header Flag + */ + virtual uint8_t getSecondaryHeaderFlag() const = 0; + /** + * This command returns the TC Packet PUS Version Number. + * The version number of ECSS PUS 2003 is 1. + * It consists of the second to fourth highest bits of the + * first byte. + * @return + */ + virtual uint8_t getPusVersionNumber() const = 0; + /** + * This is a getter for the packet's Ack field, which are the lowest four + * bits of the first byte of the Data Field Header. + * + * It is packed in a uint8_t variable. + * @return The packet's PUS Ack field. + */ + virtual uint8_t getAcknowledgeFlags() const = 0; + /** + * This is a getter for the packet's PUS Service ID, which is the second + * byte of the Data Field Header. + * @return The packet's PUS Service ID. + */ + virtual uint8_t getService() const = 0; + /** + * This is a getter for the packet's PUS Service Subtype, which is the + * third byte of the Data Field Header. + * @return The packet's PUS Service Subtype. + */ + virtual uint8_t getSubService() const = 0; + /** + * The source ID can be used to have an additional identifier, e.g. for different ground + * station. + * @return + */ + virtual uint16_t getSourceId() const = 0; - /** - * This is a getter for a pointer to the packet's Application data. - * - * These are the bytes that follow after the Data Field Header. They form - * the packet's application data. - * @return A pointer to the PUS Application Data. - */ - virtual const uint8_t* getApplicationData() const = 0; - /** - * This method calculates the size of the PUS Application data field. - * - * It takes the information stored in the CCSDS Packet Data Length field - * and subtracts the Data Field Header size and the CRC size. - * @return The size of the PUS Application Data (without Error Control - * field) - */ - virtual uint16_t getApplicationDataSize() const = 0; - /** - * This getter returns the Error Control Field of the packet. - * - * The field is placed after any possible Application Data. If no - * Application Data is present there's still an Error Control field. It is - * supposed to be a 16bit-CRC. - * @return The PUS Error Control - */ - virtual uint16_t getErrorControl() const = 0; - /** - * With this method, the Error Control Field is updated to match the - * current content of the packet. - */ - virtual void setErrorControl() = 0; + /** + * This is a getter for a pointer to the packet's Application data. + * + * These are the bytes that follow after the Data Field Header. They form + * the packet's application data. + * @return A pointer to the PUS Application Data. + */ + virtual const uint8_t* getApplicationData() const = 0; + /** + * This method calculates the size of the PUS Application data field. + * + * It takes the information stored in the CCSDS Packet Data Length field + * and subtracts the Data Field Header size and the CRC size. + * @return The size of the PUS Application Data (without Error Control + * field) + */ + virtual uint16_t getApplicationDataSize() const = 0; + /** + * This getter returns the Error Control Field of the packet. + * + * The field is placed after any possible Application Data. If no + * Application Data is present there's still an Error Control field. It is + * supposed to be a 16bit-CRC. + * @return The PUS Error Control + */ + virtual uint16_t getErrorControl() const = 0; + /** + * With this method, the Error Control Field is updated to match the + * current content of the packet. + */ + virtual void setErrorControl() = 0; - /** - * Calculate full packet length from application data length. - * @param appDataLen - * @return - */ - virtual size_t calculateFullPacketLength(size_t appDataLen) const = 0; + /** + * Calculate full packet length from application data length. + * @param appDataLen + * @return + */ + virtual size_t calculateFullPacketLength(size_t appDataLen) const = 0; /** * This is a debugging helper method that prints the whole packet content diff --git a/tmtcpacket/pus/tc/TcPacketStoredBase.cpp b/tmtcpacket/pus/tc/TcPacketStoredBase.cpp index daae35f5..cf980e68 100644 --- a/tmtcpacket/pus/tc/TcPacketStoredBase.cpp +++ b/tmtcpacket/pus/tc/TcPacketStoredBase.cpp @@ -18,32 +18,32 @@ TcPacketStoredBase::~TcPacketStoredBase() { } ReturnValue_t TcPacketStoredBase::getData(const uint8_t ** dataPtr, - size_t* dataSize) { - auto result = this->store->getData(storeAddress, dataPtr, dataSize); - if(result != HasReturnvaluesIF::RETURN_OK) { + size_t* dataSize) { + auto result = this->store->getData(storeAddress, dataPtr, dataSize); + if(result != HasReturnvaluesIF::RETURN_OK) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "TcPacketStoredBase: Could not get data!" << std::endl; + sif::warning << "TcPacketStoredBase: Could not get data!" << std::endl; #else - sif::printWarning("TcPacketStoredBase: Could not get data!\n"); + sif::printWarning("TcPacketStoredBase: Could not get data!\n"); #endif - } - return result; + } + return result; } bool TcPacketStoredBase::checkAndSetStore() { - if (this->store == nullptr) { - this->store = ObjectManager::instance()->get(objects::TC_STORE); - if (this->store == nullptr) { + if (this->store == nullptr) { + this->store = ObjectManager::instance()->get(objects::TC_STORE); + if (this->store == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "TcPacketStoredBase::TcPacketStoredBase: TC Store not found!" - << std::endl; + sif::error << "TcPacketStoredBase::TcPacketStoredBase: TC Store not found!" + << std::endl; #endif - return false; - } - } - return true; + return false; + } + } + return true; } void TcPacketStoredBase::setStoreAddress(store_address_t setAddress) { @@ -68,5 +68,5 @@ void TcPacketStoredBase::setStoreAddress(store_address_t setAddress) { } store_address_t TcPacketStoredBase::getStoreAddress() { - return this->storeAddress; + return this->storeAddress; } diff --git a/tmtcpacket/pus/tc/TcPacketStoredBase.h b/tmtcpacket/pus/tc/TcPacketStoredBase.h index b7d73531..1e1681f6 100644 --- a/tmtcpacket/pus/tc/TcPacketStoredBase.h +++ b/tmtcpacket/pus/tc/TcPacketStoredBase.h @@ -34,35 +34,35 @@ public: */ TcPacketStoredBase(const uint8_t* data, uint32_t size); - virtual~ TcPacketStoredBase(); + virtual~ TcPacketStoredBase(); - /** - * Getter function for the raw data. - * @param dataPtr [out] Pointer to the data pointer to set - * @param dataSize [out] Address of size to set. - * @return -@c RETURN_OK if data was retrieved successfully. - */ - ReturnValue_t getData(const uint8_t ** dataPtr, size_t* dataSize) override; + /** + * Getter function for the raw data. + * @param dataPtr [out] Pointer to the data pointer to set + * @param dataSize [out] Address of size to set. + * @return -@c RETURN_OK if data was retrieved successfully. + */ + ReturnValue_t getData(const uint8_t ** dataPtr, size_t* dataSize) override; void setStoreAddress(store_address_t setAddress) override; store_address_t getStoreAddress() override; - /** - * With this call, the packet is deleted. - * It removes itself from the store and sets its data pointer to NULL. - * @return returncode from deleting the data. - */ - virtual ReturnValue_t deletePacket() = 0; + /** + * With this call, the packet is deleted. + * It removes itself from the store and sets its data pointer to NULL. + * @return returncode from deleting the data. + */ + virtual ReturnValue_t deletePacket() = 0; - /** - * This method performs a size check. - * It reads the stored size and compares it with the size entered in the - * packet header. This class is the optimal place for such a check as it - * has access to both the header data and the store. - * @return true if size is correct, false if packet is not registered in - * store or size is incorrect. - */ - virtual bool isSizeCorrect() = 0; + /** + * This method performs a size check. + * It reads the stored size and compares it with the size entered in the + * packet header. This class is the optimal place for such a check as it + * has access to both the header data and the store. + * @return true if size is correct, false if packet is not registered in + * store or size is incorrect. + */ + virtual bool isSizeCorrect() = 0; protected: /** diff --git a/tmtcpacket/pus/tm/TmPacketBase.cpp b/tmtcpacket/pus/tm/TmPacketBase.cpp index 91ec7d58..3dd1749f 100644 --- a/tmtcpacket/pus/tm/TmPacketBase.cpp +++ b/tmtcpacket/pus/tm/TmPacketBase.cpp @@ -11,9 +11,7 @@ TimeStamperIF* TmPacketBase::timeStamper = nullptr; object_id_t TmPacketBase::timeStamperId = objects::NO_OBJECT; -TmPacketBase::TmPacketBase(uint8_t* setData): - SpacePacketBase(setData) { -} +TmPacketBase::TmPacketBase(uint8_t* setData): SpacePacketBase(setData) {} TmPacketBase::~TmPacketBase() { //Nothing to do. diff --git a/tmtcpacket/pus/tm/TmPacketPusA.h b/tmtcpacket/pus/tm/TmPacketPusA.h index 486b68f3..49f26b34 100644 --- a/tmtcpacket/pus/tm/TmPacketPusA.h +++ b/tmtcpacket/pus/tm/TmPacketPusA.h @@ -23,7 +23,7 @@ struct PUSTmDataFieldHeaderPusA { uint8_t service_type; uint8_t service_subtype; uint8_t subcounter; -// uint8_t destination; + // uint8_t destination; uint8_t time[TimeStamperIF::MISSION_TIMESTAMP_SIZE]; }; @@ -51,8 +51,7 @@ public: static const uint32_t TM_PACKET_MIN_SIZE = (sizeof(CCSDSPrimaryHeader) + sizeof(PUSTmDataFieldHeaderPusA) + 2); //! Maximum size of a TM Packet in this mission. - //! TODO: Make this dependant on a config variable. - static const uint32_t MISSION_TM_PACKET_MAX_SIZE = 2048; + static const uint32_t MISSION_TM_PACKET_MAX_SIZE = fsfwconfig::FSFW_MAX_TM_PACKET_SIZE; /** * This is the default constructor. diff --git a/tmtcpacket/pus/tm/TmPacketPusC.h b/tmtcpacket/pus/tm/TmPacketPusC.h index 97e5a9a5..2a6d3bf6 100644 --- a/tmtcpacket/pus/tm/TmPacketPusC.h +++ b/tmtcpacket/pus/tm/TmPacketPusC.h @@ -53,8 +53,7 @@ public: static const uint32_t TM_PACKET_MIN_SIZE = (sizeof(CCSDSPrimaryHeader) + sizeof(PUSTmDataFieldHeaderPusC) + 2); //! Maximum size of a TM Packet in this mission. - //! TODO: Make this dependant on a config variable. - static const uint32_t MISSION_TM_PACKET_MAX_SIZE = 2048; + static const uint32_t MISSION_TM_PACKET_MAX_SIZE = fsfwconfig::FSFW_MAX_TM_PACKET_SIZE; /** * This is the default constructor. From 105a498b93d563126cf25cb373fa337915c09436 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Mon, 14 Jun 2021 15:24:26 +0200 Subject: [PATCH 142/389] added way to set source ID --- tmtcpacket/pus/tc/TcPacketPus.cpp | 8 +++++++- tmtcpacket/pus/tc/TcPacketPus.h | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tmtcpacket/pus/tc/TcPacketPus.cpp b/tmtcpacket/pus/tc/TcPacketPus.cpp index 334da4e7..d2b19206 100644 --- a/tmtcpacket/pus/tc/TcPacketPus.cpp +++ b/tmtcpacket/pus/tc/TcPacketPus.cpp @@ -8,7 +8,7 @@ TcPacketPus::TcPacketPus(const uint8_t *setData): TcPacketBase(setData) { } void TcPacketPus::initializeTcPacket(uint16_t apid, uint16_t sequenceCount, - uint8_t ack, uint8_t service, uint8_t subservice) { + uint8_t ack, uint8_t service, uint8_t subservice, uint16_t sourceId) { initSpacePacketHeader(true, true, apid, sequenceCount); std::memset(&tcData->dataField, 0, sizeof(tcData->dataField)); setPacketDataLength(sizeof(PUSTcDataFieldHeader) + CRC_SIZE - 1); @@ -18,6 +18,12 @@ void TcPacketPus::initializeTcPacket(uint16_t apid, uint16_t sequenceCount, tcData->dataField.versionTypeAck |= (ack & 0x0F); tcData->dataField.serviceType = service; tcData->dataField.serviceSubtype = subservice; +#if FSFW_USE_PUS_C_TELECOMMANDS == 1 + tcData->dataField.sourceIdH = (sourceId >> 8) | 0xff; + tcData->dataField.sourceIdL = sourceId & 0xff; +#else + tcData->dataField.sourceId = sourceId; +#endif } uint8_t TcPacketPus::getService() const { diff --git a/tmtcpacket/pus/tc/TcPacketPus.h b/tmtcpacket/pus/tc/TcPacketPus.h index b50b868d..7a28a957 100644 --- a/tmtcpacket/pus/tc/TcPacketPus.h +++ b/tmtcpacket/pus/tc/TcPacketPus.h @@ -75,7 +75,7 @@ protected: * @param subservice PUS Subservice */ void initializeTcPacket(uint16_t apid, uint16_t sequenceCount, uint8_t ack, - uint8_t service, uint8_t subservice); + uint8_t service, uint8_t subservice, uint16_t sourceId = 0); /** * A pointer to a structure which defines the data structure of From 4b248740f326b3329c417f3050e0f1cb9c472fd5 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 15 Jun 2021 13:32:11 +0200 Subject: [PATCH 143/389] added HAL gpio class ID --- returnvalues/FwClassIds.h | 1 + 1 file changed, 1 insertion(+) diff --git a/returnvalues/FwClassIds.h b/returnvalues/FwClassIds.h index 60cb33ac..af32f9a7 100644 --- a/returnvalues/FwClassIds.h +++ b/returnvalues/FwClassIds.h @@ -75,6 +75,7 @@ enum: uint8_t { HAL_SPI, //HSPI HAL_UART, //HURT HAL_I2C, //HI2C + HAL_GPIO, //HGIO FW_CLASS_ID_COUNT // [EXPORT] : [END] }; From c371cf485130178fa9ebd8ba1d7f8cfd8debd1ea Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 15 Jun 2021 14:21:46 +0200 Subject: [PATCH 144/389] changelog update --- CHANGELOG | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index add8e1a5..09b8db6a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,16 @@ +## Changes from ASTP 1.0.0 to 1.1.0 + +### PUS + +- Added PUS C support + +### Configuration + +- Additional configuration option fsfwconfig::FSFW_MAX_TM_PACKET_SIZE which + need to be specified in FSFWConfig.h + + + ## Changes from ASTP 0.0.1 to 1.0.0 ### Host OSAL From aa1bfcbb967465658ff50a0d73bb9500e792b78e Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 15 Jun 2021 14:52:56 +0200 Subject: [PATCH 145/389] DHB update --- devicehandlers/DeviceHandlerBase.cpp | 27 +++++++++++++-------------- devicehandlers/DeviceHandlerBase.h | 2 +- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/devicehandlers/DeviceHandlerBase.cpp b/devicehandlers/DeviceHandlerBase.cpp index 43660616..2a453a37 100644 --- a/devicehandlers/DeviceHandlerBase.cpp +++ b/devicehandlers/DeviceHandlerBase.cpp @@ -226,16 +226,15 @@ ReturnValue_t DeviceHandlerBase::initialize() { } void DeviceHandlerBase::decrementDeviceReplyMap() { - for (std::map::iterator iter = - deviceReplyMap.begin(); iter != deviceReplyMap.end(); iter++) { - if (iter->second.delayCycles != 0) { - iter->second.delayCycles--; - if (iter->second.delayCycles == 0) { - if (iter->second.periodic) { - iter->second.delayCycles = iter->second.maxDelayCycles; + for (auto pair: deviceReplyMap) { + if (pair.second.delayCycles != 0) { + pair.second.delayCycles--; + if (pair.second.delayCycles == 0) { + if (pair.second.periodic) { + pair.second.delayCycles = pair.second.maxDelayCycles; } - replyToReply(iter, TIMEOUT); - missedReply(iter->first); + replyToReply(pair.first, pair.second, TIMEOUT); + missedReply(pair.first); } } } @@ -584,16 +583,16 @@ void DeviceHandlerBase::replyToCommand(ReturnValue_t status, } } -void DeviceHandlerBase::replyToReply(DeviceReplyMap::iterator iter, +void DeviceHandlerBase::replyToReply(DeviceCommandId_t command, DeviceReplyInfo& replyInfo, ReturnValue_t status) { // No need to check if iter exists, as this is checked by callers. // If someone else uses the method, add check. - if (iter->second.command == deviceCommandMap.end()) { + if (replyInfo.command == deviceCommandMap.end()) { //Is most likely periodic reply. Silent return. return; } // Check if more replies are expected. If so, do nothing. - DeviceCommandInfo* info = &(iter->second.command->second); + DeviceCommandInfo* info = &replyInfo.command->second; if (--info->expectedReplies == 0) { // Check if it was transition or internal command. // Don't send any replies in that case. @@ -602,7 +601,7 @@ void DeviceHandlerBase::replyToReply(DeviceReplyMap::iterator iter, if(status == HasReturnvaluesIF::RETURN_OK) { success = true; } - actionHelper.finish(success, info->sendReplyTo, iter->first, status); + actionHelper.finish(success, info->sendReplyTo, command, status); } info->isExecuting = false; } @@ -801,7 +800,7 @@ void DeviceHandlerBase::handleReply(const uint8_t* receivedData, replyRawReplyIfnotWiretapped(receivedData, foundLen); triggerEvent(DEVICE_INTERPRETING_REPLY_FAILED, result, foundId); } - replyToReply(iter, result); + replyToReply(iter->first, iter->second, result); } else { /* Other completion failure messages are created by timeout. diff --git a/devicehandlers/DeviceHandlerBase.h b/devicehandlers/DeviceHandlerBase.h index 496c08ff..5141800f 100644 --- a/devicehandlers/DeviceHandlerBase.h +++ b/devicehandlers/DeviceHandlerBase.h @@ -1195,7 +1195,7 @@ private: * @foundLen the length of the packet */ void handleReply(const uint8_t *data, DeviceCommandId_t id, uint32_t foundLen); - void replyToReply(DeviceReplyMap::iterator iter, ReturnValue_t status); + void replyToReply(DeviceCommandId_t command, DeviceReplyInfo& replyInfo, ReturnValue_t status); /** * Build and send a command to the device. From 1c7c532ef6c237938aac18069e8595c2a8162fc4 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 15 Jun 2021 15:01:02 +0200 Subject: [PATCH 146/389] DHB update --- devicehandlers/DeviceHandlerBase.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/devicehandlers/DeviceHandlerBase.cpp b/devicehandlers/DeviceHandlerBase.cpp index 2a453a37..dfa9f947 100644 --- a/devicehandlers/DeviceHandlerBase.cpp +++ b/devicehandlers/DeviceHandlerBase.cpp @@ -226,15 +226,15 @@ ReturnValue_t DeviceHandlerBase::initialize() { } void DeviceHandlerBase::decrementDeviceReplyMap() { - for (auto pair: deviceReplyMap) { - if (pair.second.delayCycles != 0) { - pair.second.delayCycles--; - if (pair.second.delayCycles == 0) { - if (pair.second.periodic) { - pair.second.delayCycles = pair.second.maxDelayCycles; + for (auto replyPair: deviceReplyMap) { + if (replyPair.second.delayCycles != 0) { + replyPair.second.delayCycles--; + if (replyPair.second.delayCycles == 0) { + if (replyPair.second.periodic) { + replyPair.second.delayCycles = replyPair.second.maxDelayCycles; } - replyToReply(pair.first, pair.second, TIMEOUT); - missedReply(pair.first); + replyToReply(replyPair.first, replyPair.second, TIMEOUT); + missedReply(replyPair.first); } } } From cc5c8ca698615bdb426d41d6eef11afff6450ac0 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 15 Jun 2021 15:04:40 +0200 Subject: [PATCH 147/389] type --- devicehandlers/DeviceHandlerBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devicehandlers/DeviceHandlerBase.cpp b/devicehandlers/DeviceHandlerBase.cpp index dfa9f947..e0062a81 100644 --- a/devicehandlers/DeviceHandlerBase.cpp +++ b/devicehandlers/DeviceHandlerBase.cpp @@ -226,7 +226,7 @@ ReturnValue_t DeviceHandlerBase::initialize() { } void DeviceHandlerBase::decrementDeviceReplyMap() { - for (auto replyPair: deviceReplyMap) { + for (std::pair& replyPair: deviceReplyMap) { if (replyPair.second.delayCycles != 0) { replyPair.second.delayCycles--; if (replyPair.second.delayCycles == 0) { From 03e1a3e945c860f4a69d2e74aebff31228e8e5b4 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Tue, 15 Jun 2021 15:08:18 +0200 Subject: [PATCH 148/389] const correctness --- devicehandlers/DeviceHandlerBase.cpp | 2 +- devicehandlers/DeviceHandlerBase.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/devicehandlers/DeviceHandlerBase.cpp b/devicehandlers/DeviceHandlerBase.cpp index e0062a81..2a3f9d66 100644 --- a/devicehandlers/DeviceHandlerBase.cpp +++ b/devicehandlers/DeviceHandlerBase.cpp @@ -583,7 +583,7 @@ void DeviceHandlerBase::replyToCommand(ReturnValue_t status, } } -void DeviceHandlerBase::replyToReply(DeviceCommandId_t command, DeviceReplyInfo& replyInfo, +void DeviceHandlerBase::replyToReply(const DeviceCommandId_t command, DeviceReplyInfo& replyInfo, ReturnValue_t status) { // No need to check if iter exists, as this is checked by callers. // If someone else uses the method, add check. diff --git a/devicehandlers/DeviceHandlerBase.h b/devicehandlers/DeviceHandlerBase.h index 5141800f..c278985e 100644 --- a/devicehandlers/DeviceHandlerBase.h +++ b/devicehandlers/DeviceHandlerBase.h @@ -1195,7 +1195,8 @@ private: * @foundLen the length of the packet */ void handleReply(const uint8_t *data, DeviceCommandId_t id, uint32_t foundLen); - void replyToReply(DeviceCommandId_t command, DeviceReplyInfo& replyInfo, ReturnValue_t status); + void replyToReply(const DeviceCommandId_t command, DeviceReplyInfo& replyInfo, + ReturnValue_t status); /** * Build and send a command to the device. From 0cde65f5a1ccc7f18074cb8ede32f702b0256802 Mon Sep 17 00:00:00 2001 From: Steffen Gaisser Date: Tue, 15 Jun 2021 15:33:52 +0200 Subject: [PATCH 149/389] Added some precautions in DHB::replyToReply --- devicehandlers/DeviceHandlerBase.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/devicehandlers/DeviceHandlerBase.cpp b/devicehandlers/DeviceHandlerBase.cpp index 2a3f9d66..5665b101 100644 --- a/devicehandlers/DeviceHandlerBase.cpp +++ b/devicehandlers/DeviceHandlerBase.cpp @@ -591,9 +591,20 @@ void DeviceHandlerBase::replyToReply(const DeviceCommandId_t command, DeviceRepl //Is most likely periodic reply. Silent return. return; } - // Check if more replies are expected. If so, do nothing. DeviceCommandInfo* info = &replyInfo.command->second; - if (--info->expectedReplies == 0) { + if (info == nullptr){ + printWarningOrError(sif::OutputTypes::OUT_ERROR, + "replyToReply", HasReturnvaluesIF::RETURN_FAILED, + "Command pointer not found"); + return; + } + + if (info->expectedReplies > 0){ + // Check before to avoid underflow + info->expectedReplies--; + } + // Check if more replies are expected. If so, do nothing. + if (info->expectedReplies == 0) { // Check if it was transition or internal command. // Don't send any replies in that case. if (info->sendReplyTo != NO_COMMANDER) { From ecb03b8a6db9e8e7fcf673f424104055af5247d6 Mon Sep 17 00:00:00 2001 From: Steffen Gaisser Date: Tue, 15 Jun 2021 15:59:20 +0200 Subject: [PATCH 150/389] Moved Code to own cpp --- timemanager/CMakeLists.txt | 1 + timemanager/Clock.h | 60 +++----------------------------- timemanager/ClockCommon.cpp | 68 +++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 56 deletions(-) create mode 100644 timemanager/ClockCommon.cpp diff --git a/timemanager/CMakeLists.txt b/timemanager/CMakeLists.txt index 3367775f..70dd41fa 100644 --- a/timemanager/CMakeLists.txt +++ b/timemanager/CMakeLists.txt @@ -5,4 +5,5 @@ target_sources(${LIB_FSFW_NAME} Stopwatch.cpp TimeMessage.cpp TimeStamper.cpp + ClockCommon.cpp ) diff --git a/timemanager/Clock.h b/timemanager/Clock.h index 2ac48384..5750e3d8 100644 --- a/timemanager/Clock.h +++ b/timemanager/Clock.h @@ -133,28 +133,7 @@ public: * - @c RETURN_OK on success * - @c RETURN_FAILED if leapSeconds are not set */ - static ReturnValue_t Clock::convertUTCToTT(timeval utc, timeval *tt) { - if (timeMutex == nullptr) { - return HasReturnvaluesIF::RETURN_FAILED; - } - - uint16_t leapSeconds; - ReturnValue_t result = getLeapSeconds(&leapSeconds); - if (result != HasReturnvaluesIF::RETURN_OK) { - return result; - } - timeval leapSeconds_timeval = { 0, 0 }; - leapSeconds_timeval.tv_sec = leapSeconds; - - //initial offset between UTC and TAI - timeval UTCtoTAI1972 = { 10, 0 }; - - timeval TAItoTT = { 32, 184000 }; - - *tt = utc + leapSeconds_timeval + UTCtoTAI1972 + TAItoTT; - - return HasReturnvaluesIF::RETURN_OK; - } + static ReturnValue_t Clock::convertUTCToTT(timeval utc, timeval *tt); /** * Set the Leap Seconds since 1972 @@ -163,16 +142,7 @@ public: * @return * - @c RETURN_OK on success. */ - static ReturnValue_t Clock::setLeapSeconds(const uint16_t leapSeconds_) { - if (checkOrCreateClockMutex() != HasReturnvaluesIF::RETURN_OK) { - return HasReturnvaluesIF::RETURN_FAILED; - } - MutexGuard helper(timeMutex); - - leapSeconds = leapSeconds_; - - return HasReturnvaluesIF::RETURN_OK; - } + static ReturnValue_t Clock::setLeapSeconds(const uint16_t leapSeconds_); /** * Get the Leap Seconds since 1972 @@ -184,17 +154,7 @@ public: * - @c RETURN_OK on success. * - @c RETURN_FAILED on error */ - static ReturnValue_t getLeapSeconds(uint16_t *leapSeconds_); - ReturnValue_t Clock::getLeapSeconds(uint16_t *leapSeconds_) { - if (timeMutex == nullptr) { - return HasReturnvaluesIF::RETURN_FAILED; - } - MutexGuard helper(timeMutex); - - *leapSeconds_ = leapSeconds; - - return HasReturnvaluesIF::RETURN_OK; - } + static ReturnValue_t Clock::getLeapSeconds(uint16_t *leapSeconds_); private: /** @@ -203,19 +163,7 @@ private: * - @c RETURN_OK on success. * - Otherwise @c RETURN_FAILED if not able to create one */ - static ReturnValue_t Clock::checkOrCreateClockMutex() { - if (timeMutex == nullptr) { - MutexFactory *mutexFactory = MutexFactory::instance(); - if (mutexFactory == nullptr) { - return HasReturnvaluesIF::RETURN_FAILED; - } - timeMutex = mutexFactory->createMutex(); - if (timeMutex == nullptr) { - return HasReturnvaluesIF::RETURN_FAILED; - } - } - return HasReturnvaluesIF::RETURN_OK; - } + static ReturnValue_t Clock::checkOrCreateClockMutex(); static MutexIF *timeMutex; static uint16_t leapSeconds; diff --git a/timemanager/ClockCommon.cpp b/timemanager/ClockCommon.cpp new file mode 100644 index 00000000..62be4375 --- /dev/null +++ b/timemanager/ClockCommon.cpp @@ -0,0 +1,68 @@ +/* + * ClockCommon.cpp + * + * Created on: Jun 15, 2021 + * Author: steffen + */ + +#include "Clock.h" +#include "../ipc/MutexGuard.h" + +ReturnValue_t Clock::convertUTCToTT(timeval utc, timeval *tt) { + if (timeMutex == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } + + uint16_t leapSeconds; + ReturnValue_t result = getLeapSeconds(&leapSeconds); + if (result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + timeval leapSeconds_timeval = { 0, 0 }; + leapSeconds_timeval.tv_sec = leapSeconds; + + //initial offset between UTC and TAI + timeval UTCtoTAI1972 = { 10, 0 }; + + timeval TAItoTT = { 32, 184000 }; + + *tt = utc + leapSeconds_timeval + UTCtoTAI1972 + TAItoTT; + + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t Clock::setLeapSeconds(const uint16_t leapSeconds_) { + if (checkOrCreateClockMutex() != HasReturnvaluesIF::RETURN_OK) { + return HasReturnvaluesIF::RETURN_FAILED; + } + MutexGuard helper(timeMutex); + + leapSeconds = leapSeconds_; + + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t Clock::getLeapSeconds(uint16_t *leapSeconds_) { + if (timeMutex == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } + MutexGuard helper(timeMutex); + + *leapSeconds_ = leapSeconds; + + return HasReturnvaluesIF::RETURN_OK; +} + +static ReturnValue_t Clock::checkOrCreateClockMutex() { + if (timeMutex == nullptr) { + MutexFactory *mutexFactory = MutexFactory::instance(); + if (mutexFactory == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } + timeMutex = mutexFactory->createMutex(); + if (timeMutex == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + return HasReturnvaluesIF::RETURN_OK; +} From 717971f69c67ece165f19ea4e2c11b2825e9c942 Mon Sep 17 00:00:00 2001 From: Steffen Gaisser Date: Tue, 15 Jun 2021 16:01:28 +0200 Subject: [PATCH 151/389] Fixed wrong namespace qualifier --- timemanager/Clock.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/timemanager/Clock.h b/timemanager/Clock.h index 5750e3d8..6a76c86d 100644 --- a/timemanager/Clock.h +++ b/timemanager/Clock.h @@ -133,7 +133,7 @@ public: * - @c RETURN_OK on success * - @c RETURN_FAILED if leapSeconds are not set */ - static ReturnValue_t Clock::convertUTCToTT(timeval utc, timeval *tt); + static ReturnValue_t convertUTCToTT(timeval utc, timeval *tt); /** * Set the Leap Seconds since 1972 @@ -142,7 +142,7 @@ public: * @return * - @c RETURN_OK on success. */ - static ReturnValue_t Clock::setLeapSeconds(const uint16_t leapSeconds_); + static ReturnValue_t setLeapSeconds(const uint16_t leapSeconds_); /** * Get the Leap Seconds since 1972 @@ -154,7 +154,7 @@ public: * - @c RETURN_OK on success. * - @c RETURN_FAILED on error */ - static ReturnValue_t Clock::getLeapSeconds(uint16_t *leapSeconds_); + static ReturnValue_t getLeapSeconds(uint16_t *leapSeconds_); private: /** @@ -163,7 +163,7 @@ private: * - @c RETURN_OK on success. * - Otherwise @c RETURN_FAILED if not able to create one */ - static ReturnValue_t Clock::checkOrCreateClockMutex(); + static ReturnValue_t checkOrCreateClockMutex(); static MutexIF *timeMutex; static uint16_t leapSeconds; From dbfcf8b271d8e37d5645288d00e8ec26e8d3eb81 Mon Sep 17 00:00:00 2001 From: Steffen Gaisser Date: Tue, 15 Jun 2021 16:03:11 +0200 Subject: [PATCH 152/389] Removed old check --- timemanager/ClockCommon.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/timemanager/ClockCommon.cpp b/timemanager/ClockCommon.cpp index 62be4375..efec0937 100644 --- a/timemanager/ClockCommon.cpp +++ b/timemanager/ClockCommon.cpp @@ -9,10 +9,6 @@ #include "../ipc/MutexGuard.h" ReturnValue_t Clock::convertUTCToTT(timeval utc, timeval *tt) { - if (timeMutex == nullptr) { - return HasReturnvaluesIF::RETURN_FAILED; - } - uint16_t leapSeconds; ReturnValue_t result = getLeapSeconds(&leapSeconds); if (result != HasReturnvaluesIF::RETURN_OK) { From ee89a2f00d8bf7c36f63ecea1a8a1a3305adea3d Mon Sep 17 00:00:00 2001 From: Steffen Gaisser Date: Tue, 15 Jun 2021 16:05:12 +0200 Subject: [PATCH 153/389] Removed author tag --- timemanager/ClockCommon.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/timemanager/ClockCommon.cpp b/timemanager/ClockCommon.cpp index efec0937..8b75f3e5 100644 --- a/timemanager/ClockCommon.cpp +++ b/timemanager/ClockCommon.cpp @@ -1,10 +1,3 @@ -/* - * ClockCommon.cpp - * - * Created on: Jun 15, 2021 - * Author: steffen - */ - #include "Clock.h" #include "../ipc/MutexGuard.h" From 2ccc0dbb0075d3c90068a565ef55436affb3de71 Mon Sep 17 00:00:00 2001 From: Steffen Gaisser Date: Tue, 15 Jun 2021 16:12:25 +0200 Subject: [PATCH 154/389] Removed wrong static --- timemanager/ClockCommon.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/timemanager/ClockCommon.cpp b/timemanager/ClockCommon.cpp index 8b75f3e5..e56d4953 100644 --- a/timemanager/ClockCommon.cpp +++ b/timemanager/ClockCommon.cpp @@ -42,7 +42,7 @@ ReturnValue_t Clock::getLeapSeconds(uint16_t *leapSeconds_) { return HasReturnvaluesIF::RETURN_OK; } -static ReturnValue_t Clock::checkOrCreateClockMutex() { +ReturnValue_t Clock::checkOrCreateClockMutex() { if (timeMutex == nullptr) { MutexFactory *mutexFactory = MutexFactory::instance(); if (mutexFactory == nullptr) { From bd7c13ff7e187bb5590f597d87cd2a76c2650497 Mon Sep 17 00:00:00 2001 From: Steffen Gaisser Date: Tue, 15 Jun 2021 16:47:24 +0200 Subject: [PATCH 155/389] NO_COMMANDER was not using NO_QUEUE in DHB --- devicehandlers/DeviceHandlerBase.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devicehandlers/DeviceHandlerBase.h b/devicehandlers/DeviceHandlerBase.h index c278985e..53bd1e65 100644 --- a/devicehandlers/DeviceHandlerBase.h +++ b/devicehandlers/DeviceHandlerBase.h @@ -667,7 +667,7 @@ protected: static const ReturnValue_t CHILD_TIMEOUT = MAKE_RETURN_CODE(0xE0); static const ReturnValue_t SWITCH_FAILED = MAKE_RETURN_CODE(0xE1); - static const MessageQueueId_t NO_COMMANDER = 0; + static const MessageQueueId_t NO_COMMANDER = MessageQueueIF::NO_QUEUE; //! Pointer to the raw packet that will be sent. uint8_t *rawPacket = nullptr; From 47af5260a2341249bc00cdba095f96efa5a509dc Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Thu, 17 Jun 2021 12:04:39 +0200 Subject: [PATCH 156/389] added missing include --- tmtcpacket/pus/tc/TcPacketStoredPus.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tmtcpacket/pus/tc/TcPacketStoredPus.cpp b/tmtcpacket/pus/tc/TcPacketStoredPus.cpp index f098ce2b..426aafdb 100644 --- a/tmtcpacket/pus/tc/TcPacketStoredPus.cpp +++ b/tmtcpacket/pus/tc/TcPacketStoredPus.cpp @@ -1,5 +1,7 @@ #include "TcPacketStoredPus.h" +#include "../../../serviceinterface/ServiceInterface.h" + #include TcPacketStoredPus::TcPacketStoredPus(uint16_t apid, uint8_t service, From c0c4a3190f1e54d4b5982656f5cc52218928d6ca Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 21 Jun 2021 12:46:32 +0200 Subject: [PATCH 157/389] cleaned up some event descriptions --- datalinklayer/DataLinkLayer.h | 13 +++++++++---- devicehandlers/DeviceHandlerIF.h | 3 ++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/datalinklayer/DataLinkLayer.h b/datalinklayer/DataLinkLayer.h index 27e69006..aa203785 100644 --- a/datalinklayer/DataLinkLayer.h +++ b/datalinklayer/DataLinkLayer.h @@ -21,11 +21,16 @@ public: static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::SYSTEM_1; //! [EXPORT] : [COMMENT] A RF available signal was detected. P1: raw RFA state, P2: 0 static const Event RF_AVAILABLE = MAKE_EVENT(0, severity::INFO); - static const Event RF_LOST = MAKE_EVENT(1, severity::INFO); //!< A previously found RF available signal was lost. P1: raw RFA state, P2: 0 - static const Event BIT_LOCK = MAKE_EVENT(2, severity::INFO); //!< A Bit Lock signal. Was detected. P1: raw BLO state, P2: 0 - static const Event BIT_LOCK_LOST = MAKE_EVENT(3, severity::INFO); //!< A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0 + //! [EXPORT] : [COMMENT] A previously found RF available signal was lost. + //! P1: raw RFA state, P2: 0 + static const Event RF_LOST = MAKE_EVENT(1, severity::INFO); + //! [EXPORT] : [COMMENT] A Bit Lock signal. Was detected. P1: raw BLO state, P2: 0 + static const Event BIT_LOCK = MAKE_EVENT(2, severity::INFO); + //! [EXPORT] : [COMMENT] A previously found Bit Lock signal was lost. P1: raw BLO state, P2: 0 + static const Event BIT_LOCK_LOST = MAKE_EVENT(3, severity::INFO); // static const Event RF_CHAIN_LOST = MAKE_EVENT(4, severity::INFO); //!< The CCSDS Board detected that either bit lock or RF available or both are lost. No parameters. - static const Event FRAME_PROCESSING_FAILED = MAKE_EVENT(5, severity::LOW); //!< The CCSDS Board could not interpret a TC + //! [EXPORT] : [COMMENT] The CCSDS Board could not interpret a TC + static const Event FRAME_PROCESSING_FAILED = MAKE_EVENT(5, severity::LOW); /** * The Constructor sets the passed parameters and nothing else. * @param set_frame_buffer The buffer in which incoming frame candidates are stored. diff --git a/devicehandlers/DeviceHandlerIF.h b/devicehandlers/DeviceHandlerIF.h index fc31cce0..1933c571 100644 --- a/devicehandlers/DeviceHandlerIF.h +++ b/devicehandlers/DeviceHandlerIF.h @@ -104,7 +104,8 @@ public: static const Event DEVICE_MISSED_REPLY = MAKE_EVENT(5, severity::LOW); static const Event DEVICE_UNKNOWN_REPLY = MAKE_EVENT(6, severity::LOW); static const Event DEVICE_UNREQUESTED_REPLY = MAKE_EVENT(7, severity::LOW); - static const Event INVALID_DEVICE_COMMAND = MAKE_EVENT(8, severity::LOW); //!< Indicates a SW bug in child class. + //! [EXPORT] : [COMMENT] Indicates a SW bug in child class. + static const Event INVALID_DEVICE_COMMAND = MAKE_EVENT(8, severity::LOW); static const Event MONITORING_LIMIT_EXCEEDED = MAKE_EVENT(9, severity::LOW); static const Event MONITORING_AMBIGUOUS = MAKE_EVENT(10, severity::HIGH); From b52644dd2af39901f442ac30833f27cbddc4b9df Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 21 Jun 2021 14:50:19 +0200 Subject: [PATCH 158/389] tiny form fix --- osal/linux/PeriodicPosixTask.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osal/linux/PeriodicPosixTask.cpp b/osal/linux/PeriodicPosixTask.cpp index 1cba22ee..c0152bec 100644 --- a/osal/linux/PeriodicPosixTask.cpp +++ b/osal/linux/PeriodicPosixTask.cpp @@ -32,7 +32,7 @@ ReturnValue_t PeriodicPosixTask::addComponent(object_id_t object) { sif::error << "PeriodicTask::addComponent: Invalid object. Make sure" << " it implements ExecutableObjectIF!" << std::endl; #else - sif::printError("PeriodicTask::addComponent: Invalid object. Make sure it" + sif::printError("PeriodicTask::addComponent: Invalid object. Make sure it " "implements ExecutableObjectIF!\n"); #endif return HasReturnvaluesIF::RETURN_FAILED; From c2b8507d2947c48e2a2cd19b71640471f436bc5c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 5 Jul 2021 12:09:14 +0200 Subject: [PATCH 159/389] small tweak --- timemanager/CMakeLists.txt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/timemanager/CMakeLists.txt b/timemanager/CMakeLists.txt index 70dd41fa..00467772 100644 --- a/timemanager/CMakeLists.txt +++ b/timemanager/CMakeLists.txt @@ -1,9 +1,8 @@ -target_sources(${LIB_FSFW_NAME} - PRIVATE - CCSDSTime.cpp - Countdown.cpp - Stopwatch.cpp - TimeMessage.cpp - TimeStamper.cpp - ClockCommon.cpp +target_sources(${LIB_FSFW_NAME} PRIVATE + CCSDSTime.cpp + Countdown.cpp + Stopwatch.cpp + TimeMessage.cpp + TimeStamper.cpp + ClockCommon.cpp ) From 5e960f118fb42188ca0f482393e6b29223730af0 Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" <–meierj@irs.uni-stuttgart.de> Date: Tue, 6 Jul 2021 18:17:24 +0200 Subject: [PATCH 160/389] renamed freertos includes --- defaultcfg/fsfwconfig/objects/FsfwFactory.cpp | 2 +- osal/FreeRTOS/BinSemaphUsingTask.h | 4 ++-- osal/FreeRTOS/BinarySemaphore.h | 4 ++-- osal/FreeRTOS/Clock.cpp | 4 ++-- osal/FreeRTOS/CountingSemaphUsingTask.h | 4 ++-- osal/FreeRTOS/CountingSemaphore.cpp | 2 +- osal/FreeRTOS/FixedTimeslotTask.h | 4 ++-- osal/FreeRTOS/FreeRTOSTaskIF.h | 4 ++-- osal/FreeRTOS/MessageQueue.h | 4 ++-- osal/FreeRTOS/Mutex.h | 4 ++-- osal/FreeRTOS/PeriodicTask.h | 4 ++-- osal/FreeRTOS/QueueMapManager.h | 4 ++-- osal/FreeRTOS/TaskManagement.h | 4 ++-- osal/FreeRTOS/Timekeeper.h | 4 ++-- unittest/tests/mocks/MessageQueueMockBase.h | 2 +- unittest/user/unittest/core/CatchFactory.cpp | 2 +- 16 files changed, 28 insertions(+), 28 deletions(-) diff --git a/defaultcfg/fsfwconfig/objects/FsfwFactory.cpp b/defaultcfg/fsfwconfig/objects/FsfwFactory.cpp index 428adf1d..08ad41ec 100644 --- a/defaultcfg/fsfwconfig/objects/FsfwFactory.cpp +++ b/defaultcfg/fsfwconfig/objects/FsfwFactory.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/osal/FreeRTOS/BinSemaphUsingTask.h b/osal/FreeRTOS/BinSemaphUsingTask.h index ec434853..895ccefb 100644 --- a/osal/FreeRTOS/BinSemaphUsingTask.h +++ b/osal/FreeRTOS/BinSemaphUsingTask.h @@ -4,8 +4,8 @@ #include "../../returnvalues/HasReturnvaluesIF.h" #include "../../tasks/SemaphoreIF.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" #if (tskKERNEL_VERSION_MAJOR == 8 && tskKERNEL_VERSION_MINOR > 2) || \ tskKERNEL_VERSION_MAJOR > 8 diff --git a/osal/FreeRTOS/BinarySemaphore.h b/osal/FreeRTOS/BinarySemaphore.h index 8969d503..2335292b 100644 --- a/osal/FreeRTOS/BinarySemaphore.h +++ b/osal/FreeRTOS/BinarySemaphore.h @@ -4,8 +4,8 @@ #include "../../returnvalues/HasReturnvaluesIF.h" #include "../../tasks/SemaphoreIF.h" -#include -#include +#include "FreeRTOS.h" +#include "semphr.h" /** * @brief OS Tool to achieve synchronization of between tasks or between diff --git a/osal/FreeRTOS/Clock.cpp b/osal/FreeRTOS/Clock.cpp index 66207d75..a81f6985 100644 --- a/osal/FreeRTOS/Clock.cpp +++ b/osal/FreeRTOS/Clock.cpp @@ -3,8 +3,8 @@ #include "../../timemanager/Clock.h" #include "../../globalfunctions/timevalOperations.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" #include #include diff --git a/osal/FreeRTOS/CountingSemaphUsingTask.h b/osal/FreeRTOS/CountingSemaphUsingTask.h index 45915b6b..9ac99c31 100644 --- a/osal/FreeRTOS/CountingSemaphUsingTask.h +++ b/osal/FreeRTOS/CountingSemaphUsingTask.h @@ -4,8 +4,8 @@ #include "CountingSemaphUsingTask.h" #include "../../tasks/SemaphoreIF.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" #if (tskKERNEL_VERSION_MAJOR == 8 && tskKERNEL_VERSION_MINOR > 2) || \ tskKERNEL_VERSION_MAJOR > 8 diff --git a/osal/FreeRTOS/CountingSemaphore.cpp b/osal/FreeRTOS/CountingSemaphore.cpp index 40884d27..7158731d 100644 --- a/osal/FreeRTOS/CountingSemaphore.cpp +++ b/osal/FreeRTOS/CountingSemaphore.cpp @@ -3,7 +3,7 @@ #include "../../serviceinterface/ServiceInterfaceStream.h" -#include +#include "semphr.h" // Make sure #define configUSE_COUNTING_SEMAPHORES 1 is set in // free FreeRTOSConfig.h file. diff --git a/osal/FreeRTOS/FixedTimeslotTask.h b/osal/FreeRTOS/FixedTimeslotTask.h index f2245ba4..7494581c 100644 --- a/osal/FreeRTOS/FixedTimeslotTask.h +++ b/osal/FreeRTOS/FixedTimeslotTask.h @@ -6,8 +6,8 @@ #include "../../tasks/FixedTimeslotTaskIF.h" #include "../../tasks/Typedef.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" class FixedTimeslotTask: public FixedTimeslotTaskIF, public FreeRTOSTaskIF { public: diff --git a/osal/FreeRTOS/FreeRTOSTaskIF.h b/osal/FreeRTOS/FreeRTOSTaskIF.h index 2a2d9494..08f0df25 100644 --- a/osal/FreeRTOS/FreeRTOSTaskIF.h +++ b/osal/FreeRTOS/FreeRTOSTaskIF.h @@ -1,8 +1,8 @@ #ifndef FSFW_OSAL_FREERTOS_FREERTOSTASKIF_H_ #define FSFW_OSAL_FREERTOS_FREERTOSTASKIF_H_ -#include -#include +#include "FreeRTOS.h" +#include "task.h" class FreeRTOSTaskIF { public: diff --git a/osal/FreeRTOS/MessageQueue.h b/osal/FreeRTOS/MessageQueue.h index be74d4fe..49b40647 100644 --- a/osal/FreeRTOS/MessageQueue.h +++ b/osal/FreeRTOS/MessageQueue.h @@ -7,8 +7,8 @@ #include "../../ipc/MessageQueueIF.h" #include "../../ipc/MessageQueueMessageIF.h" -#include -#include +#include "FreeRTOS.h" +#include "queue.h" #include /** diff --git a/osal/FreeRTOS/Mutex.h b/osal/FreeRTOS/Mutex.h index 156d431c..877359d8 100644 --- a/osal/FreeRTOS/Mutex.h +++ b/osal/FreeRTOS/Mutex.h @@ -3,8 +3,8 @@ #include "../../ipc/MutexIF.h" -#include -#include +#include "FreeRTOS.h" +#include "semphr.h" /** * @brief OS component to implement MUTual EXclusion diff --git a/osal/FreeRTOS/PeriodicTask.h b/osal/FreeRTOS/PeriodicTask.h index 36ef568f..04d40fcf 100644 --- a/osal/FreeRTOS/PeriodicTask.h +++ b/osal/FreeRTOS/PeriodicTask.h @@ -6,8 +6,8 @@ #include "../../tasks/PeriodicTaskIF.h" #include "../../tasks/Typedef.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" #include diff --git a/osal/FreeRTOS/QueueMapManager.h b/osal/FreeRTOS/QueueMapManager.h index 91a839f0..07ca8b9e 100644 --- a/osal/FreeRTOS/QueueMapManager.h +++ b/osal/FreeRTOS/QueueMapManager.h @@ -5,8 +5,8 @@ #include "../../ipc/messageQueueDefinitions.h" #include "../../ipc/MessageQueueIF.h" -#include "freertos/FreeRTOS.h" -#include "freertos/queue.h" +#include "FreeRTOS.h" +#include "queue.h" #include diff --git a/osal/FreeRTOS/TaskManagement.h b/osal/FreeRTOS/TaskManagement.h index b9aece48..b7caaa19 100644 --- a/osal/FreeRTOS/TaskManagement.h +++ b/osal/FreeRTOS/TaskManagement.h @@ -3,8 +3,8 @@ #include "../../returnvalues/HasReturnvaluesIF.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" #include diff --git a/osal/FreeRTOS/Timekeeper.h b/osal/FreeRTOS/Timekeeper.h index 7d583f7d..d4d0bc07 100644 --- a/osal/FreeRTOS/Timekeeper.h +++ b/osal/FreeRTOS/Timekeeper.h @@ -3,8 +3,8 @@ #include "../../timemanager/Clock.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" /** diff --git a/unittest/tests/mocks/MessageQueueMockBase.h b/unittest/tests/mocks/MessageQueueMockBase.h index 3000f7fb..86958d53 100644 --- a/unittest/tests/mocks/MessageQueueMockBase.h +++ b/unittest/tests/mocks/MessageQueueMockBase.h @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include diff --git a/unittest/user/unittest/core/CatchFactory.cpp b/unittest/user/unittest/core/CatchFactory.cpp index 9afb4fdd..ff591b8e 100644 --- a/unittest/user/unittest/core/CatchFactory.cpp +++ b/unittest/user/unittest/core/CatchFactory.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include From eef2fd3b7ac764f06ed5d9a3c97c894d92a515fa Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 8 Jul 2021 12:22:25 +0200 Subject: [PATCH 161/389] minor tweaks --- memory/HasFileSystemIF.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/memory/HasFileSystemIF.h b/memory/HasFileSystemIF.h index 73c93410..ff4cbc9c 100644 --- a/memory/HasFileSystemIF.h +++ b/memory/HasFileSystemIF.h @@ -36,9 +36,8 @@ public: //! [EXPORT] : P1: Sequence number missing static constexpr ReturnValue_t SEQUENCE_PACKET_MISSING_READ = MAKE_RETURN_CODE(16); - - virtual ~HasFileSystemIF() {} + /** * Function to get the MessageQueueId_t of the implementing object * @return MessageQueueId_t of the object From 323577cdc69ee2d863e6e61cebd71a8aa75c6d2b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 12 Jul 2021 17:23:03 +0200 Subject: [PATCH 162/389] file system API update Added functions to create and remove folders --- memory/HasFileSystemIF.h | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/memory/HasFileSystemIF.h b/memory/HasFileSystemIF.h index ff4cbc9c..de7bd947 100644 --- a/memory/HasFileSystemIF.h +++ b/memory/HasFileSystemIF.h @@ -45,7 +45,7 @@ public: virtual MessageQueueId_t getCommandQueue() const = 0; /** - * Generic function to append to file. + * @brief Generic function to append to file. * @param dirname Directory of the file * @param filename The filename of the file * @param data The data to write to the file @@ -62,12 +62,12 @@ public: uint16_t packetNumber, void* args = nullptr) = 0; /** - * Generic function to create a new file. + * @brief Generic function to create a new file. * @param repositoryPath * @param filename * @param data * @param size - * @param args Any other arguments which an implementation might require. + * @param args Any other arguments which an implementation might require * @return */ virtual ReturnValue_t createFile(const char* repositoryPath, @@ -75,14 +75,29 @@ public: size_t size = 0, void* args = nullptr) = 0; /** - * Generic function to delete a file. + * @brief Generic function to delete a file. * @param repositoryPath * @param filename - * @param args + * @param args Any other arguments which an implementation might require * @return */ virtual ReturnValue_t deleteFile(const char* repositoryPath, const char* filename, void* args = nullptr) = 0; + + /** + * @brief Generic function to create a directory + * @param repositoryPath + * @param args Any other arguments which an implementation might require + * @return + */ + virtual ReturnValue_t createDirectory(const char* repositoryPath, void* args = nullptr) = 0; + + /** + * @brief Generic function to remove a directory + * @param repositoryPath + * @param args Any other arguments which an implementation might require + */ + virtual ReturnValue_t removeDirectory(const char* repositoryPath, void* args = nullptr) = 0; }; From da8a4470734808bed4d872e47c192af694382c41 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 12 Jul 2021 17:39:15 +0200 Subject: [PATCH 163/389] delete directory: recursive option --- memory/GenericFileSystemMessage.cpp | 9 ++++++++- memory/GenericFileSystemMessage.h | 4 +++- memory/HasFileSystemIF.h | 3 ++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/memory/GenericFileSystemMessage.cpp b/memory/GenericFileSystemMessage.cpp index b0e1a9ec..c35ead3c 100644 --- a/memory/GenericFileSystemMessage.cpp +++ b/memory/GenericFileSystemMessage.cpp @@ -34,8 +34,9 @@ void GenericFileSystemMessage::setReportFileAttributesReply(CommandMessage *mess } void GenericFileSystemMessage::setDeleteDirectoryCommand(CommandMessage* message, - store_address_t storeId) { + store_address_t storeId, bool deleteRecursively) { message->setCommand(CMD_DELETE_DIRECTORY); + message->setParameter(deleteRecursively); message->setParameter2(storeId.raw); } @@ -133,6 +134,12 @@ bool GenericFileSystemMessage::getReadReply(const CommandMessage *message, return message->getParameter(); } +store_address_t GenericFileSystemMessage::getDeleteDirectoryCommand(const CommandMessage *message, + bool &deleteRecursively) { + deleteRecursively = message->getParameter(); + return getStoreId(message); +} + ReturnValue_t GenericFileSystemMessage::clear(CommandMessage* message) { switch(message->getCommand()) { case(CMD_CREATE_FILE): diff --git a/memory/GenericFileSystemMessage.h b/memory/GenericFileSystemMessage.h index 6351dab9..fcd2075d 100644 --- a/memory/GenericFileSystemMessage.h +++ b/memory/GenericFileSystemMessage.h @@ -79,7 +79,9 @@ public: static void setCreateDirectoryCommand(CommandMessage* message, store_address_t storeId); static void setDeleteDirectoryCommand(CommandMessage* message, - store_address_t storeId); + store_address_t storeId, bool deleteRecursively); + static store_address_t getDeleteDirectoryCommand(const CommandMessage* message, + bool& deleteRecursively); static void setSuccessReply(CommandMessage* message); static void setFailureReply(CommandMessage* message, diff --git a/memory/HasFileSystemIF.h b/memory/HasFileSystemIF.h index de7bd947..ec941f59 100644 --- a/memory/HasFileSystemIF.h +++ b/memory/HasFileSystemIF.h @@ -97,7 +97,8 @@ public: * @param repositoryPath * @param args Any other arguments which an implementation might require */ - virtual ReturnValue_t removeDirectory(const char* repositoryPath, void* args = nullptr) = 0; + virtual ReturnValue_t removeDirectory(const char* repositoryPath, + bool deleteRecurively = false, void* args = nullptr) = 0; }; From c9156e12198a5b0c190b91eb98bc9fbf9f59c6a5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 12 Jul 2021 22:34:59 +0200 Subject: [PATCH 164/389] some cmake fixes for FreeRTOS --- CMakeLists.txt | 6 +++--- osal/FreeRTOS/CMakeLists.txt | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ba73a3f..4ff504f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,12 +43,12 @@ endif() set(FSFW_OSAL_DEFINITION FSFW_HOST) -if(${OS_FSFW} STREQUAL host) +if(OS_FSFW MATCHES host) set(OS_FSFW_NAME "Host") -elseif(${OS_FSFW} STREQUAL linux) +elseif(OS_FSFW MATCHES linux) set(OS_FSFW_NAME "Linux") set(FSFW_OSAL_DEFINITION FSFW_LINUX) -elseif(${OS_FSFW} STREQUAL freertos) +elseif(OS_FSFW MATCHES freertos) set(OS_FSFW_NAME "FreeRTOS") set(FSFW_OSAL_DEFINITION FSFW_FREERTOS) target_link_libraries(${LIB_FSFW_NAME} PRIVATE diff --git a/osal/FreeRTOS/CMakeLists.txt b/osal/FreeRTOS/CMakeLists.txt index 4da24a71..40bdcd0f 100644 --- a/osal/FreeRTOS/CMakeLists.txt +++ b/osal/FreeRTOS/CMakeLists.txt @@ -22,10 +22,11 @@ target_sources(${LIB_FSFW_NAME} # FreeRTOS as a static library and set LIB_OS_NAME to the target name of the # library. if(NOT LIB_OS_NAME) - message(FATAL_ERROR - "FreeRTOS needs to be linked as a target and " - "LIB_OS_NAME needs to be set to the target" + message(STATUS + "LIB_OS_NAME is empty. Make sure to include the FreeRTOS header path properly." ) +else() + target_link_libraries(${LIB_FSFW_NAME} PRIVATE + ${LIB_OS_NAME} + ) endif() - -target_link_libraries(${LIB_FSWFW_NAME} ${LIB_OS_NAME}) \ No newline at end of file From 8035af28b98b30ad0179b861d66848c06c859f7f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 12 Jul 2021 22:42:07 +0200 Subject: [PATCH 165/389] using include structure as used in kernel --- osal/FreeRTOS/BinSemaphUsingTask.h | 4 ++-- osal/FreeRTOS/BinarySemaphore.h | 4 ++-- osal/FreeRTOS/Clock.cpp | 4 ++-- osal/FreeRTOS/CountingSemaphUsingTask.h | 4 ++-- osal/FreeRTOS/CountingSemaphore.cpp | 3 ++- osal/FreeRTOS/FixedTimeslotTask.h | 4 ++-- osal/FreeRTOS/FreeRTOSTaskIF.h | 4 ++-- osal/FreeRTOS/MessageQueue.h | 7 ++++--- osal/FreeRTOS/Mutex.h | 4 ++-- osal/FreeRTOS/QueueMapManager.h | 4 ++-- osal/FreeRTOS/TaskManagement.h | 8 ++++---- osal/FreeRTOS/Timekeeper.cpp | 2 +- osal/FreeRTOS/Timekeeper.h | 4 ++-- 13 files changed, 29 insertions(+), 27 deletions(-) diff --git a/osal/FreeRTOS/BinSemaphUsingTask.h b/osal/FreeRTOS/BinSemaphUsingTask.h index ec434853..895ccefb 100644 --- a/osal/FreeRTOS/BinSemaphUsingTask.h +++ b/osal/FreeRTOS/BinSemaphUsingTask.h @@ -4,8 +4,8 @@ #include "../../returnvalues/HasReturnvaluesIF.h" #include "../../tasks/SemaphoreIF.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" #if (tskKERNEL_VERSION_MAJOR == 8 && tskKERNEL_VERSION_MINOR > 2) || \ tskKERNEL_VERSION_MAJOR > 8 diff --git a/osal/FreeRTOS/BinarySemaphore.h b/osal/FreeRTOS/BinarySemaphore.h index 8969d503..2335292b 100644 --- a/osal/FreeRTOS/BinarySemaphore.h +++ b/osal/FreeRTOS/BinarySemaphore.h @@ -4,8 +4,8 @@ #include "../../returnvalues/HasReturnvaluesIF.h" #include "../../tasks/SemaphoreIF.h" -#include -#include +#include "FreeRTOS.h" +#include "semphr.h" /** * @brief OS Tool to achieve synchronization of between tasks or between diff --git a/osal/FreeRTOS/Clock.cpp b/osal/FreeRTOS/Clock.cpp index 66207d75..a81f6985 100644 --- a/osal/FreeRTOS/Clock.cpp +++ b/osal/FreeRTOS/Clock.cpp @@ -3,8 +3,8 @@ #include "../../timemanager/Clock.h" #include "../../globalfunctions/timevalOperations.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" #include #include diff --git a/osal/FreeRTOS/CountingSemaphUsingTask.h b/osal/FreeRTOS/CountingSemaphUsingTask.h index 45915b6b..9ac99c31 100644 --- a/osal/FreeRTOS/CountingSemaphUsingTask.h +++ b/osal/FreeRTOS/CountingSemaphUsingTask.h @@ -4,8 +4,8 @@ #include "CountingSemaphUsingTask.h" #include "../../tasks/SemaphoreIF.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" #if (tskKERNEL_VERSION_MAJOR == 8 && tskKERNEL_VERSION_MINOR > 2) || \ tskKERNEL_VERSION_MAJOR > 8 diff --git a/osal/FreeRTOS/CountingSemaphore.cpp b/osal/FreeRTOS/CountingSemaphore.cpp index 40884d27..148803a6 100644 --- a/osal/FreeRTOS/CountingSemaphore.cpp +++ b/osal/FreeRTOS/CountingSemaphore.cpp @@ -3,7 +3,8 @@ #include "../../serviceinterface/ServiceInterfaceStream.h" -#include +#include "FreeRTOS.h" +#include "semphr.h" // Make sure #define configUSE_COUNTING_SEMAPHORES 1 is set in // free FreeRTOSConfig.h file. diff --git a/osal/FreeRTOS/FixedTimeslotTask.h b/osal/FreeRTOS/FixedTimeslotTask.h index f2245ba4..7494581c 100644 --- a/osal/FreeRTOS/FixedTimeslotTask.h +++ b/osal/FreeRTOS/FixedTimeslotTask.h @@ -6,8 +6,8 @@ #include "../../tasks/FixedTimeslotTaskIF.h" #include "../../tasks/Typedef.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" class FixedTimeslotTask: public FixedTimeslotTaskIF, public FreeRTOSTaskIF { public: diff --git a/osal/FreeRTOS/FreeRTOSTaskIF.h b/osal/FreeRTOS/FreeRTOSTaskIF.h index 2a2d9494..08f0df25 100644 --- a/osal/FreeRTOS/FreeRTOSTaskIF.h +++ b/osal/FreeRTOS/FreeRTOSTaskIF.h @@ -1,8 +1,8 @@ #ifndef FSFW_OSAL_FREERTOS_FREERTOSTASKIF_H_ #define FSFW_OSAL_FREERTOS_FREERTOSTASKIF_H_ -#include -#include +#include "FreeRTOS.h" +#include "task.h" class FreeRTOSTaskIF { public: diff --git a/osal/FreeRTOS/MessageQueue.h b/osal/FreeRTOS/MessageQueue.h index be74d4fe..58324cc6 100644 --- a/osal/FreeRTOS/MessageQueue.h +++ b/osal/FreeRTOS/MessageQueue.h @@ -6,10 +6,11 @@ #include "../../internalError/InternalErrorReporterIF.h" #include "../../ipc/MessageQueueIF.h" #include "../../ipc/MessageQueueMessageIF.h" +#include "../../ipc/MessageQueueMessage.h" + +#include "FreeRTOS.h" +#include "queue.h" -#include -#include -#include /** * @brief This class manages sending and receiving of diff --git a/osal/FreeRTOS/Mutex.h b/osal/FreeRTOS/Mutex.h index 156d431c..877359d8 100644 --- a/osal/FreeRTOS/Mutex.h +++ b/osal/FreeRTOS/Mutex.h @@ -3,8 +3,8 @@ #include "../../ipc/MutexIF.h" -#include -#include +#include "FreeRTOS.h" +#include "semphr.h" /** * @brief OS component to implement MUTual EXclusion diff --git a/osal/FreeRTOS/QueueMapManager.h b/osal/FreeRTOS/QueueMapManager.h index 91a839f0..07ca8b9e 100644 --- a/osal/FreeRTOS/QueueMapManager.h +++ b/osal/FreeRTOS/QueueMapManager.h @@ -5,8 +5,8 @@ #include "../../ipc/messageQueueDefinitions.h" #include "../../ipc/MessageQueueIF.h" -#include "freertos/FreeRTOS.h" -#include "freertos/queue.h" +#include "FreeRTOS.h" +#include "queue.h" #include diff --git a/osal/FreeRTOS/TaskManagement.h b/osal/FreeRTOS/TaskManagement.h index b9aece48..9aa10797 100644 --- a/osal/FreeRTOS/TaskManagement.h +++ b/osal/FreeRTOS/TaskManagement.h @@ -1,10 +1,10 @@ -#ifndef FRAMEWORK_OSAL_FREERTOS_TASKMANAGEMENT_H_ -#define FRAMEWORK_OSAL_FREERTOS_TASKMANAGEMENT_H_ +#ifndef FSFW_OSAL_FREERTOS_TASKMANAGEMENT_H_ +#define FSFW_OSAL_FREERTOS_TASKMANAGEMENT_H_ #include "../../returnvalues/HasReturnvaluesIF.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" #include diff --git a/osal/FreeRTOS/Timekeeper.cpp b/osal/FreeRTOS/Timekeeper.cpp index d986d832..1031f0c4 100644 --- a/osal/FreeRTOS/Timekeeper.cpp +++ b/osal/FreeRTOS/Timekeeper.cpp @@ -1,6 +1,6 @@ #include "Timekeeper.h" -#include +#include "FreeRTOSConfig.h" Timekeeper * Timekeeper::myinstance = nullptr; diff --git a/osal/FreeRTOS/Timekeeper.h b/osal/FreeRTOS/Timekeeper.h index 7d583f7d..d4d0bc07 100644 --- a/osal/FreeRTOS/Timekeeper.h +++ b/osal/FreeRTOS/Timekeeper.h @@ -3,8 +3,8 @@ #include "../../timemanager/Clock.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" /** From afebe15dc2ff194d1a111f3ddf45d0e20ba0d436 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 12 Jul 2021 23:01:17 +0200 Subject: [PATCH 166/389] last replacement --- osal/FreeRTOS/PeriodicTask.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osal/FreeRTOS/PeriodicTask.h b/osal/FreeRTOS/PeriodicTask.h index 36ef568f..04d40fcf 100644 --- a/osal/FreeRTOS/PeriodicTask.h +++ b/osal/FreeRTOS/PeriodicTask.h @@ -6,8 +6,8 @@ #include "../../tasks/PeriodicTaskIF.h" #include "../../tasks/Typedef.h" -#include -#include +#include "FreeRTOS.h" +#include "task.h" #include From ff63a3438410e4bed2f7c02e6f4a460135f32d00 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 12 Jul 2021 23:32:24 +0200 Subject: [PATCH 167/389] include improvements --- osal/FreeRTOS/SemaphoreFactory.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/osal/FreeRTOS/SemaphoreFactory.cpp b/osal/FreeRTOS/SemaphoreFactory.cpp index df005f6a..614af75d 100644 --- a/osal/FreeRTOS/SemaphoreFactory.cpp +++ b/osal/FreeRTOS/SemaphoreFactory.cpp @@ -1,9 +1,10 @@ -#include "../../osal/FreeRTOS/BinarySemaphore.h" -#include "../../osal/FreeRTOS/BinSemaphUsingTask.h" -#include "../../osal/FreeRTOS/CountingSemaphore.h" -#include "../../osal/FreeRTOS/CountingSemaphUsingTask.h" +#include "BinarySemaphore.h" +#include "BinSemaphUsingTask.h" +#include "CountingSemaphore.h" +#include "CountingSemaphUsingTask.h" + #include "../../tasks/SemaphoreFactory.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "../../serviceinterface/ServiceInterface.h" SemaphoreFactory* SemaphoreFactory::factoryInstance = nullptr; From 5adb5cce95929854396240e03229c0c610314286 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 13 Jul 2021 16:35:57 +0200 Subject: [PATCH 168/389] restructuring fsfw --- {action => core/inc/fsfw/action}/ActionHelper.h | 0 {action => core/inc/fsfw/action}/ActionMessage.h | 0 .../inc/fsfw/action}/CommandActionHelper.h | 0 {action => core/inc/fsfw/action}/CommandsActionsIF.h | 0 {action => core/inc/fsfw/action}/HasActionsIF.h | 0 .../inc/fsfw/action}/SimpleActionHelper.h | 0 {container => core/inc/fsfw/container}/ArrayList.h | 0 {container => core/inc/fsfw/container}/BinaryTree.h | 0 {container => core/inc/fsfw/container}/DynamicFIFO.h | 0 {container => core/inc/fsfw/container}/FIFO.h | 0 {container => core/inc/fsfw/container}/FIFOBase.h | 0 {container => core/inc/fsfw/container}/FIFOBase.tpp | 0 .../inc/fsfw/container}/FixedArrayList.h | 0 {container => core/inc/fsfw/container}/FixedMap.h | 0 .../inc/fsfw/container}/FixedOrderedMultimap.h | 0 .../inc/fsfw/container}/FixedOrderedMultimap.tpp | 0 .../inc/fsfw/container}/HybridIterator.h | 0 .../inc/fsfw/container}/IndexedRingMemoryArray.h | 0 .../inc/fsfw/container}/PlacementFactory.h | 0 .../inc/fsfw/container}/RingBufferBase.h | 0 .../inc/fsfw/container}/SharedRingBuffer.h | 0 .../inc/fsfw/container}/SimpleRingBuffer.h | 0 .../inc/fsfw/container}/SinglyLinkedList.h | 0 {container => core/inc/fsfw/container}/group.h | 0 .../inc/fsfw/controller}/ControllerBase.h | 0 .../inc/fsfw/controller}/ExtendedControllerBase.h | 0 {datapool => core/inc/fsfw/datapool}/DataSetIF.h | 0 .../inc/fsfw/datapool}/HkSwitchHelper.h | 0 .../inc/fsfw/datapool}/PoolDataSetBase.h | 0 {datapool => core/inc/fsfw/datapool}/PoolDataSetIF.h | 0 {datapool => core/inc/fsfw/datapool}/PoolEntry.h | 0 {datapool => core/inc/fsfw/datapool}/PoolEntryIF.h | 0 {datapool => core/inc/fsfw/datapool}/PoolReadGuard.h | 0 {datapool => core/inc/fsfw/datapool}/PoolVarList.h | 0 .../inc/fsfw/datapool}/PoolVariableIF.h | 0 {datapool => core/inc/fsfw/datapool}/ReadCommitIF.h | 0 .../inc/fsfw/datapool}/ReadCommitIFAttorney.h | 0 .../inc/fsfw/datapool}/SharedDataSetIF.h | 0 core/inc/fsfw/datapoollocal.h | 12 ++++++++++++ .../inc/fsfw/datapoollocal}/AccessLocalPoolF.h | 0 .../inc/fsfw/datapoollocal}/HasLocalDataPoolIF.h | 0 .../inc/fsfw/datapoollocal}/LocalDataPoolManager.h | 0 .../inc/fsfw/datapoollocal}/LocalDataSet.h | 0 .../inc/fsfw/datapoollocal}/LocalPoolDataSetBase.h | 0 .../inc/fsfw/datapoollocal}/LocalPoolObjectBase.h | 0 .../inc/fsfw/datapoollocal}/LocalPoolVariable.h | 0 .../inc/fsfw/datapoollocal}/LocalPoolVariable.tpp | 0 .../inc/fsfw/datapoollocal}/LocalPoolVector.h | 0 .../inc/fsfw/datapoollocal}/LocalPoolVector.tpp | 0 .../inc/fsfw/datapoollocal}/MarkChangedIF.h | 0 .../datapoollocal}/ProvidesDataPoolSubscriptionIF.h | 0 .../inc/fsfw/datapoollocal}/SharedLocalDataSet.h | 0 .../inc/fsfw/datapoollocal}/StaticLocalDataSet.h | 0 .../inc/fsfw/datapoollocal}/localPoolDefinitions.h | 0 {action => core/src/action}/ActionHelper.cpp | 0 {action => core/src/action}/ActionMessage.cpp | 0 {action => core/src/action}/CMakeLists.txt | 0 {action => core/src/action}/CommandActionHelper.cpp | 0 {action => core/src/action}/SimpleActionHelper.cpp | 0 {container => core/src/container}/CMakeLists.txt | 0 .../src/container}/SharedRingBuffer.cpp | 0 .../src/container}/SimpleRingBuffer.cpp | 0 {controller => core/src/controller}/CMakeLists.txt | 0 .../src/controller}/ControllerBase.cpp | 0 .../src/controller}/ExtendedControllerBase.cpp | 0 {datapool => core/src/datapool}/CMakeLists.txt | 0 {datapool => core/src/datapool}/HkSwitchHelper.cpp | 0 {datapool => core/src/datapool}/PoolDataSetBase.cpp | 0 {datapool => core/src/datapool}/PoolEntry.cpp | 0 .../src/datapoollocal}/CMakeLists.txt | 0 .../src/datapoollocal}/LocalDataPoolManager.cpp | 0 .../src/datapoollocal}/LocalDataSet.cpp | 0 .../src/datapoollocal}/LocalPoolDataSetBase.cpp | 0 .../src/datapoollocal}/LocalPoolObjectBase.cpp | 0 .../src/datapoollocal}/SharedLocalDataSet.cpp | 0 .../src/datapoollocal}/internal/CMakeLists.txt | 0 .../internal/HasLocalDpIFManagerAttorney.cpp | 0 .../internal/HasLocalDpIFManagerAttorney.h | 0 .../internal/HasLocalDpIFUserAttorney.cpp | 0 .../internal/HasLocalDpIFUserAttorney.h | 0 .../datapoollocal}/internal/LocalDpManagerAttorney.h | 0 .../internal/LocalPoolDataSetAttorney.h | 0 datapoollocal/datapoollocal.h | 12 ------------ .../fsfw/coordinates}/CoordinateTransformations.h | 0 .../inc/fsfw/coordinates}/Jgm3Model.h | 0 .../inc/fsfw/coordinates}/Sgp4Propagator.h | 0 .../inc/fsfw/datalinklayer}/BCFrame.h | 0 .../inc/fsfw/datalinklayer}/CCSDSReturnValuesIF.h | 0 {datalinklayer => opt/inc/fsfw/datalinklayer}/Clcw.h | 0 .../inc/fsfw/datalinklayer}/ClcwIF.h | 0 .../inc/fsfw/datalinklayer}/DataLinkLayer.h | 0 .../inc/fsfw/datalinklayer}/Farm1StateIF.h | 0 .../inc/fsfw/datalinklayer}/Farm1StateLockout.h | 0 .../inc/fsfw/datalinklayer}/Farm1StateOpen.h | 0 .../inc/fsfw/datalinklayer}/Farm1StateWait.h | 0 .../inc/fsfw/datalinklayer}/MapPacketExtraction.h | 0 .../inc/fsfw/datalinklayer}/MapPacketExtractionIF.h | 0 .../inc/fsfw/datalinklayer}/TcTransferFrame.h | 0 .../inc/fsfw/datalinklayer}/TcTransferFrameLocal.h | 0 .../fsfw/datalinklayer}/VirtualChannelReception.h | 0 .../fsfw/datalinklayer}/VirtualChannelReceptionIF.h | 0 {coordinates => opt/src/coordinates}/CMakeLists.txt | 0 .../src/coordinates}/CoordinateTransformations.cpp | 0 .../src/coordinates}/Sgp4Propagator.cpp | 0 .../src/datalinklayer}/CMakeLists.txt | 0 {datalinklayer => opt/src/datalinklayer}/Clcw.cpp | 0 .../src/datalinklayer}/DataLinkLayer.cpp | 0 .../src/datalinklayer}/Farm1StateLockout.cpp | 0 .../src/datalinklayer}/Farm1StateOpen.cpp | 0 .../src/datalinklayer}/Farm1StateWait.cpp | 0 .../src/datalinklayer}/MapPacketExtraction.cpp | 0 .../src/datalinklayer}/TcTransferFrame.cpp | 0 .../src/datalinklayer}/TcTransferFrameLocal.cpp | 0 .../src/datalinklayer}/VirtualChannelReception.cpp | 0 114 files changed, 12 insertions(+), 12 deletions(-) rename {action => core/inc/fsfw/action}/ActionHelper.h (100%) rename {action => core/inc/fsfw/action}/ActionMessage.h (100%) rename {action => core/inc/fsfw/action}/CommandActionHelper.h (100%) rename {action => core/inc/fsfw/action}/CommandsActionsIF.h (100%) rename {action => core/inc/fsfw/action}/HasActionsIF.h (100%) rename {action => core/inc/fsfw/action}/SimpleActionHelper.h (100%) rename {container => core/inc/fsfw/container}/ArrayList.h (100%) rename {container => core/inc/fsfw/container}/BinaryTree.h (100%) rename {container => core/inc/fsfw/container}/DynamicFIFO.h (100%) rename {container => core/inc/fsfw/container}/FIFO.h (100%) rename {container => core/inc/fsfw/container}/FIFOBase.h (100%) rename {container => core/inc/fsfw/container}/FIFOBase.tpp (100%) rename {container => core/inc/fsfw/container}/FixedArrayList.h (100%) rename {container => core/inc/fsfw/container}/FixedMap.h (100%) rename {container => core/inc/fsfw/container}/FixedOrderedMultimap.h (100%) rename {container => core/inc/fsfw/container}/FixedOrderedMultimap.tpp (100%) rename {container => core/inc/fsfw/container}/HybridIterator.h (100%) rename {container => core/inc/fsfw/container}/IndexedRingMemoryArray.h (100%) rename {container => core/inc/fsfw/container}/PlacementFactory.h (100%) rename {container => core/inc/fsfw/container}/RingBufferBase.h (100%) rename {container => core/inc/fsfw/container}/SharedRingBuffer.h (100%) rename {container => core/inc/fsfw/container}/SimpleRingBuffer.h (100%) rename {container => core/inc/fsfw/container}/SinglyLinkedList.h (100%) rename {container => core/inc/fsfw/container}/group.h (100%) rename {controller => core/inc/fsfw/controller}/ControllerBase.h (100%) rename {controller => core/inc/fsfw/controller}/ExtendedControllerBase.h (100%) rename {datapool => core/inc/fsfw/datapool}/DataSetIF.h (100%) rename {datapool => core/inc/fsfw/datapool}/HkSwitchHelper.h (100%) rename {datapool => core/inc/fsfw/datapool}/PoolDataSetBase.h (100%) rename {datapool => core/inc/fsfw/datapool}/PoolDataSetIF.h (100%) rename {datapool => core/inc/fsfw/datapool}/PoolEntry.h (100%) rename {datapool => core/inc/fsfw/datapool}/PoolEntryIF.h (100%) rename {datapool => core/inc/fsfw/datapool}/PoolReadGuard.h (100%) rename {datapool => core/inc/fsfw/datapool}/PoolVarList.h (100%) rename {datapool => core/inc/fsfw/datapool}/PoolVariableIF.h (100%) rename {datapool => core/inc/fsfw/datapool}/ReadCommitIF.h (100%) rename {datapool => core/inc/fsfw/datapool}/ReadCommitIFAttorney.h (100%) rename {datapool => core/inc/fsfw/datapool}/SharedDataSetIF.h (100%) create mode 100644 core/inc/fsfw/datapoollocal.h rename {datapoollocal => core/inc/fsfw/datapoollocal}/AccessLocalPoolF.h (100%) rename {datapoollocal => core/inc/fsfw/datapoollocal}/HasLocalDataPoolIF.h (100%) rename {datapoollocal => core/inc/fsfw/datapoollocal}/LocalDataPoolManager.h (100%) rename {datapoollocal => core/inc/fsfw/datapoollocal}/LocalDataSet.h (100%) rename {datapoollocal => core/inc/fsfw/datapoollocal}/LocalPoolDataSetBase.h (100%) rename {datapoollocal => core/inc/fsfw/datapoollocal}/LocalPoolObjectBase.h (100%) rename {datapoollocal => core/inc/fsfw/datapoollocal}/LocalPoolVariable.h (100%) rename {datapoollocal => core/inc/fsfw/datapoollocal}/LocalPoolVariable.tpp (100%) rename {datapoollocal => core/inc/fsfw/datapoollocal}/LocalPoolVector.h (100%) rename {datapoollocal => core/inc/fsfw/datapoollocal}/LocalPoolVector.tpp (100%) rename {datapoollocal => core/inc/fsfw/datapoollocal}/MarkChangedIF.h (100%) rename {datapoollocal => core/inc/fsfw/datapoollocal}/ProvidesDataPoolSubscriptionIF.h (100%) rename {datapoollocal => core/inc/fsfw/datapoollocal}/SharedLocalDataSet.h (100%) rename {datapoollocal => core/inc/fsfw/datapoollocal}/StaticLocalDataSet.h (100%) rename {datapoollocal => core/inc/fsfw/datapoollocal}/localPoolDefinitions.h (100%) rename {action => core/src/action}/ActionHelper.cpp (100%) rename {action => core/src/action}/ActionMessage.cpp (100%) rename {action => core/src/action}/CMakeLists.txt (100%) rename {action => core/src/action}/CommandActionHelper.cpp (100%) rename {action => core/src/action}/SimpleActionHelper.cpp (100%) rename {container => core/src/container}/CMakeLists.txt (100%) rename {container => core/src/container}/SharedRingBuffer.cpp (100%) rename {container => core/src/container}/SimpleRingBuffer.cpp (100%) rename {controller => core/src/controller}/CMakeLists.txt (100%) rename {controller => core/src/controller}/ControllerBase.cpp (100%) rename {controller => core/src/controller}/ExtendedControllerBase.cpp (100%) rename {datapool => core/src/datapool}/CMakeLists.txt (100%) rename {datapool => core/src/datapool}/HkSwitchHelper.cpp (100%) rename {datapool => core/src/datapool}/PoolDataSetBase.cpp (100%) rename {datapool => core/src/datapool}/PoolEntry.cpp (100%) rename {datapoollocal => core/src/datapoollocal}/CMakeLists.txt (100%) rename {datapoollocal => core/src/datapoollocal}/LocalDataPoolManager.cpp (100%) rename {datapoollocal => core/src/datapoollocal}/LocalDataSet.cpp (100%) rename {datapoollocal => core/src/datapoollocal}/LocalPoolDataSetBase.cpp (100%) rename {datapoollocal => core/src/datapoollocal}/LocalPoolObjectBase.cpp (100%) rename {datapoollocal => core/src/datapoollocal}/SharedLocalDataSet.cpp (100%) rename {datapoollocal => core/src/datapoollocal}/internal/CMakeLists.txt (100%) rename {datapoollocal => core/src/datapoollocal}/internal/HasLocalDpIFManagerAttorney.cpp (100%) rename {datapoollocal => core/src/datapoollocal}/internal/HasLocalDpIFManagerAttorney.h (100%) rename {datapoollocal => core/src/datapoollocal}/internal/HasLocalDpIFUserAttorney.cpp (100%) rename {datapoollocal => core/src/datapoollocal}/internal/HasLocalDpIFUserAttorney.h (100%) rename {datapoollocal => core/src/datapoollocal}/internal/LocalDpManagerAttorney.h (100%) rename {datapoollocal => core/src/datapoollocal}/internal/LocalPoolDataSetAttorney.h (100%) delete mode 100644 datapoollocal/datapoollocal.h rename {coordinates => opt/inc/fsfw/coordinates}/CoordinateTransformations.h (100%) rename {coordinates => opt/inc/fsfw/coordinates}/Jgm3Model.h (100%) rename {coordinates => opt/inc/fsfw/coordinates}/Sgp4Propagator.h (100%) rename {datalinklayer => opt/inc/fsfw/datalinklayer}/BCFrame.h (100%) rename {datalinklayer => opt/inc/fsfw/datalinklayer}/CCSDSReturnValuesIF.h (100%) rename {datalinklayer => opt/inc/fsfw/datalinklayer}/Clcw.h (100%) rename {datalinklayer => opt/inc/fsfw/datalinklayer}/ClcwIF.h (100%) rename {datalinklayer => opt/inc/fsfw/datalinklayer}/DataLinkLayer.h (100%) rename {datalinklayer => opt/inc/fsfw/datalinklayer}/Farm1StateIF.h (100%) rename {datalinklayer => opt/inc/fsfw/datalinklayer}/Farm1StateLockout.h (100%) rename {datalinklayer => opt/inc/fsfw/datalinklayer}/Farm1StateOpen.h (100%) rename {datalinklayer => opt/inc/fsfw/datalinklayer}/Farm1StateWait.h (100%) rename {datalinklayer => opt/inc/fsfw/datalinklayer}/MapPacketExtraction.h (100%) rename {datalinklayer => opt/inc/fsfw/datalinklayer}/MapPacketExtractionIF.h (100%) rename {datalinklayer => opt/inc/fsfw/datalinklayer}/TcTransferFrame.h (100%) rename {datalinklayer => opt/inc/fsfw/datalinklayer}/TcTransferFrameLocal.h (100%) rename {datalinklayer => opt/inc/fsfw/datalinklayer}/VirtualChannelReception.h (100%) rename {datalinklayer => opt/inc/fsfw/datalinklayer}/VirtualChannelReceptionIF.h (100%) rename {coordinates => opt/src/coordinates}/CMakeLists.txt (100%) rename {coordinates => opt/src/coordinates}/CoordinateTransformations.cpp (100%) rename {coordinates => opt/src/coordinates}/Sgp4Propagator.cpp (100%) rename {datalinklayer => opt/src/datalinklayer}/CMakeLists.txt (100%) rename {datalinklayer => opt/src/datalinklayer}/Clcw.cpp (100%) rename {datalinklayer => opt/src/datalinklayer}/DataLinkLayer.cpp (100%) rename {datalinklayer => opt/src/datalinklayer}/Farm1StateLockout.cpp (100%) rename {datalinklayer => opt/src/datalinklayer}/Farm1StateOpen.cpp (100%) rename {datalinklayer => opt/src/datalinklayer}/Farm1StateWait.cpp (100%) rename {datalinklayer => opt/src/datalinklayer}/MapPacketExtraction.cpp (100%) rename {datalinklayer => opt/src/datalinklayer}/TcTransferFrame.cpp (100%) rename {datalinklayer => opt/src/datalinklayer}/TcTransferFrameLocal.cpp (100%) rename {datalinklayer => opt/src/datalinklayer}/VirtualChannelReception.cpp (100%) diff --git a/action/ActionHelper.h b/core/inc/fsfw/action/ActionHelper.h similarity index 100% rename from action/ActionHelper.h rename to core/inc/fsfw/action/ActionHelper.h diff --git a/action/ActionMessage.h b/core/inc/fsfw/action/ActionMessage.h similarity index 100% rename from action/ActionMessage.h rename to core/inc/fsfw/action/ActionMessage.h diff --git a/action/CommandActionHelper.h b/core/inc/fsfw/action/CommandActionHelper.h similarity index 100% rename from action/CommandActionHelper.h rename to core/inc/fsfw/action/CommandActionHelper.h diff --git a/action/CommandsActionsIF.h b/core/inc/fsfw/action/CommandsActionsIF.h similarity index 100% rename from action/CommandsActionsIF.h rename to core/inc/fsfw/action/CommandsActionsIF.h diff --git a/action/HasActionsIF.h b/core/inc/fsfw/action/HasActionsIF.h similarity index 100% rename from action/HasActionsIF.h rename to core/inc/fsfw/action/HasActionsIF.h diff --git a/action/SimpleActionHelper.h b/core/inc/fsfw/action/SimpleActionHelper.h similarity index 100% rename from action/SimpleActionHelper.h rename to core/inc/fsfw/action/SimpleActionHelper.h diff --git a/container/ArrayList.h b/core/inc/fsfw/container/ArrayList.h similarity index 100% rename from container/ArrayList.h rename to core/inc/fsfw/container/ArrayList.h diff --git a/container/BinaryTree.h b/core/inc/fsfw/container/BinaryTree.h similarity index 100% rename from container/BinaryTree.h rename to core/inc/fsfw/container/BinaryTree.h diff --git a/container/DynamicFIFO.h b/core/inc/fsfw/container/DynamicFIFO.h similarity index 100% rename from container/DynamicFIFO.h rename to core/inc/fsfw/container/DynamicFIFO.h diff --git a/container/FIFO.h b/core/inc/fsfw/container/FIFO.h similarity index 100% rename from container/FIFO.h rename to core/inc/fsfw/container/FIFO.h diff --git a/container/FIFOBase.h b/core/inc/fsfw/container/FIFOBase.h similarity index 100% rename from container/FIFOBase.h rename to core/inc/fsfw/container/FIFOBase.h diff --git a/container/FIFOBase.tpp b/core/inc/fsfw/container/FIFOBase.tpp similarity index 100% rename from container/FIFOBase.tpp rename to core/inc/fsfw/container/FIFOBase.tpp diff --git a/container/FixedArrayList.h b/core/inc/fsfw/container/FixedArrayList.h similarity index 100% rename from container/FixedArrayList.h rename to core/inc/fsfw/container/FixedArrayList.h diff --git a/container/FixedMap.h b/core/inc/fsfw/container/FixedMap.h similarity index 100% rename from container/FixedMap.h rename to core/inc/fsfw/container/FixedMap.h diff --git a/container/FixedOrderedMultimap.h b/core/inc/fsfw/container/FixedOrderedMultimap.h similarity index 100% rename from container/FixedOrderedMultimap.h rename to core/inc/fsfw/container/FixedOrderedMultimap.h diff --git a/container/FixedOrderedMultimap.tpp b/core/inc/fsfw/container/FixedOrderedMultimap.tpp similarity index 100% rename from container/FixedOrderedMultimap.tpp rename to core/inc/fsfw/container/FixedOrderedMultimap.tpp diff --git a/container/HybridIterator.h b/core/inc/fsfw/container/HybridIterator.h similarity index 100% rename from container/HybridIterator.h rename to core/inc/fsfw/container/HybridIterator.h diff --git a/container/IndexedRingMemoryArray.h b/core/inc/fsfw/container/IndexedRingMemoryArray.h similarity index 100% rename from container/IndexedRingMemoryArray.h rename to core/inc/fsfw/container/IndexedRingMemoryArray.h diff --git a/container/PlacementFactory.h b/core/inc/fsfw/container/PlacementFactory.h similarity index 100% rename from container/PlacementFactory.h rename to core/inc/fsfw/container/PlacementFactory.h diff --git a/container/RingBufferBase.h b/core/inc/fsfw/container/RingBufferBase.h similarity index 100% rename from container/RingBufferBase.h rename to core/inc/fsfw/container/RingBufferBase.h diff --git a/container/SharedRingBuffer.h b/core/inc/fsfw/container/SharedRingBuffer.h similarity index 100% rename from container/SharedRingBuffer.h rename to core/inc/fsfw/container/SharedRingBuffer.h diff --git a/container/SimpleRingBuffer.h b/core/inc/fsfw/container/SimpleRingBuffer.h similarity index 100% rename from container/SimpleRingBuffer.h rename to core/inc/fsfw/container/SimpleRingBuffer.h diff --git a/container/SinglyLinkedList.h b/core/inc/fsfw/container/SinglyLinkedList.h similarity index 100% rename from container/SinglyLinkedList.h rename to core/inc/fsfw/container/SinglyLinkedList.h diff --git a/container/group.h b/core/inc/fsfw/container/group.h similarity index 100% rename from container/group.h rename to core/inc/fsfw/container/group.h diff --git a/controller/ControllerBase.h b/core/inc/fsfw/controller/ControllerBase.h similarity index 100% rename from controller/ControllerBase.h rename to core/inc/fsfw/controller/ControllerBase.h diff --git a/controller/ExtendedControllerBase.h b/core/inc/fsfw/controller/ExtendedControllerBase.h similarity index 100% rename from controller/ExtendedControllerBase.h rename to core/inc/fsfw/controller/ExtendedControllerBase.h diff --git a/datapool/DataSetIF.h b/core/inc/fsfw/datapool/DataSetIF.h similarity index 100% rename from datapool/DataSetIF.h rename to core/inc/fsfw/datapool/DataSetIF.h diff --git a/datapool/HkSwitchHelper.h b/core/inc/fsfw/datapool/HkSwitchHelper.h similarity index 100% rename from datapool/HkSwitchHelper.h rename to core/inc/fsfw/datapool/HkSwitchHelper.h diff --git a/datapool/PoolDataSetBase.h b/core/inc/fsfw/datapool/PoolDataSetBase.h similarity index 100% rename from datapool/PoolDataSetBase.h rename to core/inc/fsfw/datapool/PoolDataSetBase.h diff --git a/datapool/PoolDataSetIF.h b/core/inc/fsfw/datapool/PoolDataSetIF.h similarity index 100% rename from datapool/PoolDataSetIF.h rename to core/inc/fsfw/datapool/PoolDataSetIF.h diff --git a/datapool/PoolEntry.h b/core/inc/fsfw/datapool/PoolEntry.h similarity index 100% rename from datapool/PoolEntry.h rename to core/inc/fsfw/datapool/PoolEntry.h diff --git a/datapool/PoolEntryIF.h b/core/inc/fsfw/datapool/PoolEntryIF.h similarity index 100% rename from datapool/PoolEntryIF.h rename to core/inc/fsfw/datapool/PoolEntryIF.h diff --git a/datapool/PoolReadGuard.h b/core/inc/fsfw/datapool/PoolReadGuard.h similarity index 100% rename from datapool/PoolReadGuard.h rename to core/inc/fsfw/datapool/PoolReadGuard.h diff --git a/datapool/PoolVarList.h b/core/inc/fsfw/datapool/PoolVarList.h similarity index 100% rename from datapool/PoolVarList.h rename to core/inc/fsfw/datapool/PoolVarList.h diff --git a/datapool/PoolVariableIF.h b/core/inc/fsfw/datapool/PoolVariableIF.h similarity index 100% rename from datapool/PoolVariableIF.h rename to core/inc/fsfw/datapool/PoolVariableIF.h diff --git a/datapool/ReadCommitIF.h b/core/inc/fsfw/datapool/ReadCommitIF.h similarity index 100% rename from datapool/ReadCommitIF.h rename to core/inc/fsfw/datapool/ReadCommitIF.h diff --git a/datapool/ReadCommitIFAttorney.h b/core/inc/fsfw/datapool/ReadCommitIFAttorney.h similarity index 100% rename from datapool/ReadCommitIFAttorney.h rename to core/inc/fsfw/datapool/ReadCommitIFAttorney.h diff --git a/datapool/SharedDataSetIF.h b/core/inc/fsfw/datapool/SharedDataSetIF.h similarity index 100% rename from datapool/SharedDataSetIF.h rename to core/inc/fsfw/datapool/SharedDataSetIF.h diff --git a/core/inc/fsfw/datapoollocal.h b/core/inc/fsfw/datapoollocal.h new file mode 100644 index 00000000..73024a5c --- /dev/null +++ b/core/inc/fsfw/datapoollocal.h @@ -0,0 +1,12 @@ +#ifndef FSFW_DATAPOOLLOCAL_DATAPOOLLOCAL_H_ +#define FSFW_DATAPOOLLOCAL_DATAPOOLLOCAL_H_ + +/* Collected related headers */ +#include "datapoollocal/LocalPoolVariable.h" +#include "datapoollocal/LocalPoolVector.h" +#include "datapoollocal/StaticLocalDataSet.h" +#include "datapoollocal/LocalDataSet.h" +#include "datapoollocal/SharedLocalDataSet.h" + + +#endif /* FSFW_DATAPOOLLOCAL_DATAPOOLLOCAL_H_ */ diff --git a/datapoollocal/AccessLocalPoolF.h b/core/inc/fsfw/datapoollocal/AccessLocalPoolF.h similarity index 100% rename from datapoollocal/AccessLocalPoolF.h rename to core/inc/fsfw/datapoollocal/AccessLocalPoolF.h diff --git a/datapoollocal/HasLocalDataPoolIF.h b/core/inc/fsfw/datapoollocal/HasLocalDataPoolIF.h similarity index 100% rename from datapoollocal/HasLocalDataPoolIF.h rename to core/inc/fsfw/datapoollocal/HasLocalDataPoolIF.h diff --git a/datapoollocal/LocalDataPoolManager.h b/core/inc/fsfw/datapoollocal/LocalDataPoolManager.h similarity index 100% rename from datapoollocal/LocalDataPoolManager.h rename to core/inc/fsfw/datapoollocal/LocalDataPoolManager.h diff --git a/datapoollocal/LocalDataSet.h b/core/inc/fsfw/datapoollocal/LocalDataSet.h similarity index 100% rename from datapoollocal/LocalDataSet.h rename to core/inc/fsfw/datapoollocal/LocalDataSet.h diff --git a/datapoollocal/LocalPoolDataSetBase.h b/core/inc/fsfw/datapoollocal/LocalPoolDataSetBase.h similarity index 100% rename from datapoollocal/LocalPoolDataSetBase.h rename to core/inc/fsfw/datapoollocal/LocalPoolDataSetBase.h diff --git a/datapoollocal/LocalPoolObjectBase.h b/core/inc/fsfw/datapoollocal/LocalPoolObjectBase.h similarity index 100% rename from datapoollocal/LocalPoolObjectBase.h rename to core/inc/fsfw/datapoollocal/LocalPoolObjectBase.h diff --git a/datapoollocal/LocalPoolVariable.h b/core/inc/fsfw/datapoollocal/LocalPoolVariable.h similarity index 100% rename from datapoollocal/LocalPoolVariable.h rename to core/inc/fsfw/datapoollocal/LocalPoolVariable.h diff --git a/datapoollocal/LocalPoolVariable.tpp b/core/inc/fsfw/datapoollocal/LocalPoolVariable.tpp similarity index 100% rename from datapoollocal/LocalPoolVariable.tpp rename to core/inc/fsfw/datapoollocal/LocalPoolVariable.tpp diff --git a/datapoollocal/LocalPoolVector.h b/core/inc/fsfw/datapoollocal/LocalPoolVector.h similarity index 100% rename from datapoollocal/LocalPoolVector.h rename to core/inc/fsfw/datapoollocal/LocalPoolVector.h diff --git a/datapoollocal/LocalPoolVector.tpp b/core/inc/fsfw/datapoollocal/LocalPoolVector.tpp similarity index 100% rename from datapoollocal/LocalPoolVector.tpp rename to core/inc/fsfw/datapoollocal/LocalPoolVector.tpp diff --git a/datapoollocal/MarkChangedIF.h b/core/inc/fsfw/datapoollocal/MarkChangedIF.h similarity index 100% rename from datapoollocal/MarkChangedIF.h rename to core/inc/fsfw/datapoollocal/MarkChangedIF.h diff --git a/datapoollocal/ProvidesDataPoolSubscriptionIF.h b/core/inc/fsfw/datapoollocal/ProvidesDataPoolSubscriptionIF.h similarity index 100% rename from datapoollocal/ProvidesDataPoolSubscriptionIF.h rename to core/inc/fsfw/datapoollocal/ProvidesDataPoolSubscriptionIF.h diff --git a/datapoollocal/SharedLocalDataSet.h b/core/inc/fsfw/datapoollocal/SharedLocalDataSet.h similarity index 100% rename from datapoollocal/SharedLocalDataSet.h rename to core/inc/fsfw/datapoollocal/SharedLocalDataSet.h diff --git a/datapoollocal/StaticLocalDataSet.h b/core/inc/fsfw/datapoollocal/StaticLocalDataSet.h similarity index 100% rename from datapoollocal/StaticLocalDataSet.h rename to core/inc/fsfw/datapoollocal/StaticLocalDataSet.h diff --git a/datapoollocal/localPoolDefinitions.h b/core/inc/fsfw/datapoollocal/localPoolDefinitions.h similarity index 100% rename from datapoollocal/localPoolDefinitions.h rename to core/inc/fsfw/datapoollocal/localPoolDefinitions.h diff --git a/action/ActionHelper.cpp b/core/src/action/ActionHelper.cpp similarity index 100% rename from action/ActionHelper.cpp rename to core/src/action/ActionHelper.cpp diff --git a/action/ActionMessage.cpp b/core/src/action/ActionMessage.cpp similarity index 100% rename from action/ActionMessage.cpp rename to core/src/action/ActionMessage.cpp diff --git a/action/CMakeLists.txt b/core/src/action/CMakeLists.txt similarity index 100% rename from action/CMakeLists.txt rename to core/src/action/CMakeLists.txt diff --git a/action/CommandActionHelper.cpp b/core/src/action/CommandActionHelper.cpp similarity index 100% rename from action/CommandActionHelper.cpp rename to core/src/action/CommandActionHelper.cpp diff --git a/action/SimpleActionHelper.cpp b/core/src/action/SimpleActionHelper.cpp similarity index 100% rename from action/SimpleActionHelper.cpp rename to core/src/action/SimpleActionHelper.cpp diff --git a/container/CMakeLists.txt b/core/src/container/CMakeLists.txt similarity index 100% rename from container/CMakeLists.txt rename to core/src/container/CMakeLists.txt diff --git a/container/SharedRingBuffer.cpp b/core/src/container/SharedRingBuffer.cpp similarity index 100% rename from container/SharedRingBuffer.cpp rename to core/src/container/SharedRingBuffer.cpp diff --git a/container/SimpleRingBuffer.cpp b/core/src/container/SimpleRingBuffer.cpp similarity index 100% rename from container/SimpleRingBuffer.cpp rename to core/src/container/SimpleRingBuffer.cpp diff --git a/controller/CMakeLists.txt b/core/src/controller/CMakeLists.txt similarity index 100% rename from controller/CMakeLists.txt rename to core/src/controller/CMakeLists.txt diff --git a/controller/ControllerBase.cpp b/core/src/controller/ControllerBase.cpp similarity index 100% rename from controller/ControllerBase.cpp rename to core/src/controller/ControllerBase.cpp diff --git a/controller/ExtendedControllerBase.cpp b/core/src/controller/ExtendedControllerBase.cpp similarity index 100% rename from controller/ExtendedControllerBase.cpp rename to core/src/controller/ExtendedControllerBase.cpp diff --git a/datapool/CMakeLists.txt b/core/src/datapool/CMakeLists.txt similarity index 100% rename from datapool/CMakeLists.txt rename to core/src/datapool/CMakeLists.txt diff --git a/datapool/HkSwitchHelper.cpp b/core/src/datapool/HkSwitchHelper.cpp similarity index 100% rename from datapool/HkSwitchHelper.cpp rename to core/src/datapool/HkSwitchHelper.cpp diff --git a/datapool/PoolDataSetBase.cpp b/core/src/datapool/PoolDataSetBase.cpp similarity index 100% rename from datapool/PoolDataSetBase.cpp rename to core/src/datapool/PoolDataSetBase.cpp diff --git a/datapool/PoolEntry.cpp b/core/src/datapool/PoolEntry.cpp similarity index 100% rename from datapool/PoolEntry.cpp rename to core/src/datapool/PoolEntry.cpp diff --git a/datapoollocal/CMakeLists.txt b/core/src/datapoollocal/CMakeLists.txt similarity index 100% rename from datapoollocal/CMakeLists.txt rename to core/src/datapoollocal/CMakeLists.txt diff --git a/datapoollocal/LocalDataPoolManager.cpp b/core/src/datapoollocal/LocalDataPoolManager.cpp similarity index 100% rename from datapoollocal/LocalDataPoolManager.cpp rename to core/src/datapoollocal/LocalDataPoolManager.cpp diff --git a/datapoollocal/LocalDataSet.cpp b/core/src/datapoollocal/LocalDataSet.cpp similarity index 100% rename from datapoollocal/LocalDataSet.cpp rename to core/src/datapoollocal/LocalDataSet.cpp diff --git a/datapoollocal/LocalPoolDataSetBase.cpp b/core/src/datapoollocal/LocalPoolDataSetBase.cpp similarity index 100% rename from datapoollocal/LocalPoolDataSetBase.cpp rename to core/src/datapoollocal/LocalPoolDataSetBase.cpp diff --git a/datapoollocal/LocalPoolObjectBase.cpp b/core/src/datapoollocal/LocalPoolObjectBase.cpp similarity index 100% rename from datapoollocal/LocalPoolObjectBase.cpp rename to core/src/datapoollocal/LocalPoolObjectBase.cpp diff --git a/datapoollocal/SharedLocalDataSet.cpp b/core/src/datapoollocal/SharedLocalDataSet.cpp similarity index 100% rename from datapoollocal/SharedLocalDataSet.cpp rename to core/src/datapoollocal/SharedLocalDataSet.cpp diff --git a/datapoollocal/internal/CMakeLists.txt b/core/src/datapoollocal/internal/CMakeLists.txt similarity index 100% rename from datapoollocal/internal/CMakeLists.txt rename to core/src/datapoollocal/internal/CMakeLists.txt diff --git a/datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp b/core/src/datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp similarity index 100% rename from datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp rename to core/src/datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp diff --git a/datapoollocal/internal/HasLocalDpIFManagerAttorney.h b/core/src/datapoollocal/internal/HasLocalDpIFManagerAttorney.h similarity index 100% rename from datapoollocal/internal/HasLocalDpIFManagerAttorney.h rename to core/src/datapoollocal/internal/HasLocalDpIFManagerAttorney.h diff --git a/datapoollocal/internal/HasLocalDpIFUserAttorney.cpp b/core/src/datapoollocal/internal/HasLocalDpIFUserAttorney.cpp similarity index 100% rename from datapoollocal/internal/HasLocalDpIFUserAttorney.cpp rename to core/src/datapoollocal/internal/HasLocalDpIFUserAttorney.cpp diff --git a/datapoollocal/internal/HasLocalDpIFUserAttorney.h b/core/src/datapoollocal/internal/HasLocalDpIFUserAttorney.h similarity index 100% rename from datapoollocal/internal/HasLocalDpIFUserAttorney.h rename to core/src/datapoollocal/internal/HasLocalDpIFUserAttorney.h diff --git a/datapoollocal/internal/LocalDpManagerAttorney.h b/core/src/datapoollocal/internal/LocalDpManagerAttorney.h similarity index 100% rename from datapoollocal/internal/LocalDpManagerAttorney.h rename to core/src/datapoollocal/internal/LocalDpManagerAttorney.h diff --git a/datapoollocal/internal/LocalPoolDataSetAttorney.h b/core/src/datapoollocal/internal/LocalPoolDataSetAttorney.h similarity index 100% rename from datapoollocal/internal/LocalPoolDataSetAttorney.h rename to core/src/datapoollocal/internal/LocalPoolDataSetAttorney.h diff --git a/datapoollocal/datapoollocal.h b/datapoollocal/datapoollocal.h deleted file mode 100644 index c5c47078..00000000 --- a/datapoollocal/datapoollocal.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef FSFW_DATAPOOLLOCAL_DATAPOOLLOCAL_H_ -#define FSFW_DATAPOOLLOCAL_DATAPOOLLOCAL_H_ - -/* Collected related headers */ -#include "LocalPoolVariable.h" -#include "LocalPoolVector.h" -#include "StaticLocalDataSet.h" -#include "LocalDataSet.h" -#include "SharedLocalDataSet.h" - - -#endif /* FSFW_DATAPOOLLOCAL_DATAPOOLLOCAL_H_ */ diff --git a/coordinates/CoordinateTransformations.h b/opt/inc/fsfw/coordinates/CoordinateTransformations.h similarity index 100% rename from coordinates/CoordinateTransformations.h rename to opt/inc/fsfw/coordinates/CoordinateTransformations.h diff --git a/coordinates/Jgm3Model.h b/opt/inc/fsfw/coordinates/Jgm3Model.h similarity index 100% rename from coordinates/Jgm3Model.h rename to opt/inc/fsfw/coordinates/Jgm3Model.h diff --git a/coordinates/Sgp4Propagator.h b/opt/inc/fsfw/coordinates/Sgp4Propagator.h similarity index 100% rename from coordinates/Sgp4Propagator.h rename to opt/inc/fsfw/coordinates/Sgp4Propagator.h diff --git a/datalinklayer/BCFrame.h b/opt/inc/fsfw/datalinklayer/BCFrame.h similarity index 100% rename from datalinklayer/BCFrame.h rename to opt/inc/fsfw/datalinklayer/BCFrame.h diff --git a/datalinklayer/CCSDSReturnValuesIF.h b/opt/inc/fsfw/datalinklayer/CCSDSReturnValuesIF.h similarity index 100% rename from datalinklayer/CCSDSReturnValuesIF.h rename to opt/inc/fsfw/datalinklayer/CCSDSReturnValuesIF.h diff --git a/datalinklayer/Clcw.h b/opt/inc/fsfw/datalinklayer/Clcw.h similarity index 100% rename from datalinklayer/Clcw.h rename to opt/inc/fsfw/datalinklayer/Clcw.h diff --git a/datalinklayer/ClcwIF.h b/opt/inc/fsfw/datalinklayer/ClcwIF.h similarity index 100% rename from datalinklayer/ClcwIF.h rename to opt/inc/fsfw/datalinklayer/ClcwIF.h diff --git a/datalinklayer/DataLinkLayer.h b/opt/inc/fsfw/datalinklayer/DataLinkLayer.h similarity index 100% rename from datalinklayer/DataLinkLayer.h rename to opt/inc/fsfw/datalinklayer/DataLinkLayer.h diff --git a/datalinklayer/Farm1StateIF.h b/opt/inc/fsfw/datalinklayer/Farm1StateIF.h similarity index 100% rename from datalinklayer/Farm1StateIF.h rename to opt/inc/fsfw/datalinklayer/Farm1StateIF.h diff --git a/datalinklayer/Farm1StateLockout.h b/opt/inc/fsfw/datalinklayer/Farm1StateLockout.h similarity index 100% rename from datalinklayer/Farm1StateLockout.h rename to opt/inc/fsfw/datalinklayer/Farm1StateLockout.h diff --git a/datalinklayer/Farm1StateOpen.h b/opt/inc/fsfw/datalinklayer/Farm1StateOpen.h similarity index 100% rename from datalinklayer/Farm1StateOpen.h rename to opt/inc/fsfw/datalinklayer/Farm1StateOpen.h diff --git a/datalinklayer/Farm1StateWait.h b/opt/inc/fsfw/datalinklayer/Farm1StateWait.h similarity index 100% rename from datalinklayer/Farm1StateWait.h rename to opt/inc/fsfw/datalinklayer/Farm1StateWait.h diff --git a/datalinklayer/MapPacketExtraction.h b/opt/inc/fsfw/datalinklayer/MapPacketExtraction.h similarity index 100% rename from datalinklayer/MapPacketExtraction.h rename to opt/inc/fsfw/datalinklayer/MapPacketExtraction.h diff --git a/datalinklayer/MapPacketExtractionIF.h b/opt/inc/fsfw/datalinklayer/MapPacketExtractionIF.h similarity index 100% rename from datalinklayer/MapPacketExtractionIF.h rename to opt/inc/fsfw/datalinklayer/MapPacketExtractionIF.h diff --git a/datalinklayer/TcTransferFrame.h b/opt/inc/fsfw/datalinklayer/TcTransferFrame.h similarity index 100% rename from datalinklayer/TcTransferFrame.h rename to opt/inc/fsfw/datalinklayer/TcTransferFrame.h diff --git a/datalinklayer/TcTransferFrameLocal.h b/opt/inc/fsfw/datalinklayer/TcTransferFrameLocal.h similarity index 100% rename from datalinklayer/TcTransferFrameLocal.h rename to opt/inc/fsfw/datalinklayer/TcTransferFrameLocal.h diff --git a/datalinklayer/VirtualChannelReception.h b/opt/inc/fsfw/datalinklayer/VirtualChannelReception.h similarity index 100% rename from datalinklayer/VirtualChannelReception.h rename to opt/inc/fsfw/datalinklayer/VirtualChannelReception.h diff --git a/datalinklayer/VirtualChannelReceptionIF.h b/opt/inc/fsfw/datalinklayer/VirtualChannelReceptionIF.h similarity index 100% rename from datalinklayer/VirtualChannelReceptionIF.h rename to opt/inc/fsfw/datalinklayer/VirtualChannelReceptionIF.h diff --git a/coordinates/CMakeLists.txt b/opt/src/coordinates/CMakeLists.txt similarity index 100% rename from coordinates/CMakeLists.txt rename to opt/src/coordinates/CMakeLists.txt diff --git a/coordinates/CoordinateTransformations.cpp b/opt/src/coordinates/CoordinateTransformations.cpp similarity index 100% rename from coordinates/CoordinateTransformations.cpp rename to opt/src/coordinates/CoordinateTransformations.cpp diff --git a/coordinates/Sgp4Propagator.cpp b/opt/src/coordinates/Sgp4Propagator.cpp similarity index 100% rename from coordinates/Sgp4Propagator.cpp rename to opt/src/coordinates/Sgp4Propagator.cpp diff --git a/datalinklayer/CMakeLists.txt b/opt/src/datalinklayer/CMakeLists.txt similarity index 100% rename from datalinklayer/CMakeLists.txt rename to opt/src/datalinklayer/CMakeLists.txt diff --git a/datalinklayer/Clcw.cpp b/opt/src/datalinklayer/Clcw.cpp similarity index 100% rename from datalinklayer/Clcw.cpp rename to opt/src/datalinklayer/Clcw.cpp diff --git a/datalinklayer/DataLinkLayer.cpp b/opt/src/datalinklayer/DataLinkLayer.cpp similarity index 100% rename from datalinklayer/DataLinkLayer.cpp rename to opt/src/datalinklayer/DataLinkLayer.cpp diff --git a/datalinklayer/Farm1StateLockout.cpp b/opt/src/datalinklayer/Farm1StateLockout.cpp similarity index 100% rename from datalinklayer/Farm1StateLockout.cpp rename to opt/src/datalinklayer/Farm1StateLockout.cpp diff --git a/datalinklayer/Farm1StateOpen.cpp b/opt/src/datalinklayer/Farm1StateOpen.cpp similarity index 100% rename from datalinklayer/Farm1StateOpen.cpp rename to opt/src/datalinklayer/Farm1StateOpen.cpp diff --git a/datalinklayer/Farm1StateWait.cpp b/opt/src/datalinklayer/Farm1StateWait.cpp similarity index 100% rename from datalinklayer/Farm1StateWait.cpp rename to opt/src/datalinklayer/Farm1StateWait.cpp diff --git a/datalinklayer/MapPacketExtraction.cpp b/opt/src/datalinklayer/MapPacketExtraction.cpp similarity index 100% rename from datalinklayer/MapPacketExtraction.cpp rename to opt/src/datalinklayer/MapPacketExtraction.cpp diff --git a/datalinklayer/TcTransferFrame.cpp b/opt/src/datalinklayer/TcTransferFrame.cpp similarity index 100% rename from datalinklayer/TcTransferFrame.cpp rename to opt/src/datalinklayer/TcTransferFrame.cpp diff --git a/datalinklayer/TcTransferFrameLocal.cpp b/opt/src/datalinklayer/TcTransferFrameLocal.cpp similarity index 100% rename from datalinklayer/TcTransferFrameLocal.cpp rename to opt/src/datalinklayer/TcTransferFrameLocal.cpp diff --git a/datalinklayer/VirtualChannelReception.cpp b/opt/src/datalinklayer/VirtualChannelReception.cpp similarity index 100% rename from datalinklayer/VirtualChannelReception.cpp rename to opt/src/datalinklayer/VirtualChannelReception.cpp From bdb8b0a75700edbd24b383b354311803298b00c1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 13 Jul 2021 18:40:52 +0200 Subject: [PATCH 169/389] restructure repository --- fsfw.mk | 75 ------------------ FSFW.h => inc/fsfw/FSFW.h | 0 FSFWVersion.h => inc/fsfw/FSFWVersion.h | 0 {core/inc => inc}/fsfw/action/ActionHelper.h | 0 {core/inc => inc}/fsfw/action/ActionMessage.h | 0 .../fsfw/action/CommandActionHelper.h | 0 .../fsfw/action/CommandsActionsIF.h | 0 {core/inc => inc}/fsfw/action/HasActionsIF.h | 0 .../fsfw/action/SimpleActionHelper.h | 0 {core/inc => inc}/fsfw/container/ArrayList.h | 0 {core/inc => inc}/fsfw/container/BinaryTree.h | 0 .../inc => inc}/fsfw/container/DynamicFIFO.h | 0 {core/inc => inc}/fsfw/container/FIFO.h | 0 {core/inc => inc}/fsfw/container/FIFOBase.h | 0 {core/inc => inc}/fsfw/container/FIFOBase.tpp | 0 .../fsfw/container/FixedArrayList.h | 0 {core/inc => inc}/fsfw/container/FixedMap.h | 0 .../fsfw/container/FixedOrderedMultimap.h | 0 .../fsfw/container/FixedOrderedMultimap.tpp | 0 .../fsfw/container/HybridIterator.h | 0 .../fsfw/container/IndexedRingMemoryArray.h | 0 .../fsfw/container/PlacementFactory.h | 0 .../fsfw/container/RingBufferBase.h | 0 .../fsfw/container/SharedRingBuffer.h | 0 .../fsfw/container/SimpleRingBuffer.h | 0 .../fsfw/container/SinglyLinkedList.h | 0 {core/inc => inc}/fsfw/container/group.h | 0 .../fsfw/controller/ControllerBase.h | 0 .../fsfw/controller/ExtendedControllerBase.h | 0 .../coordinates/CoordinateTransformations.h | 0 {opt/inc => inc}/fsfw/coordinates/Jgm3Model.h | 0 .../fsfw/coordinates/Sgp4Propagator.h | 0 {opt/inc => inc}/fsfw/datalinklayer/BCFrame.h | 0 .../fsfw/datalinklayer/CCSDSReturnValuesIF.h | 0 {opt/inc => inc}/fsfw/datalinklayer/Clcw.h | 0 {opt/inc => inc}/fsfw/datalinklayer/ClcwIF.h | 0 .../fsfw/datalinklayer/DataLinkLayer.h | 0 .../fsfw/datalinklayer/Farm1StateIF.h | 0 .../fsfw/datalinklayer/Farm1StateLockout.h | 0 .../fsfw/datalinklayer/Farm1StateOpen.h | 0 .../fsfw/datalinklayer/Farm1StateWait.h | 0 .../fsfw/datalinklayer/MapPacketExtraction.h | 0 .../datalinklayer/MapPacketExtractionIF.h | 0 .../fsfw/datalinklayer/TcTransferFrame.h | 0 .../fsfw/datalinklayer/TcTransferFrameLocal.h | 0 .../datalinklayer/VirtualChannelReception.h | 0 .../datalinklayer/VirtualChannelReceptionIF.h | 0 {core/inc => inc}/fsfw/datapool/DataSetIF.h | 0 .../fsfw/datapool/HkSwitchHelper.h | 0 .../fsfw/datapool/PoolDataSetBase.h | 0 .../inc => inc}/fsfw/datapool/PoolDataSetIF.h | 0 {core/inc => inc}/fsfw/datapool/PoolEntry.h | 0 {core/inc => inc}/fsfw/datapool/PoolEntryIF.h | 0 .../inc => inc}/fsfw/datapool/PoolReadGuard.h | 0 {core/inc => inc}/fsfw/datapool/PoolVarList.h | 0 .../fsfw/datapool/PoolVariableIF.h | 0 .../inc => inc}/fsfw/datapool/ReadCommitIF.h | 0 .../fsfw/datapool/ReadCommitIFAttorney.h | 0 .../fsfw/datapool/SharedDataSetIF.h | 0 {core/inc => inc}/fsfw/datapoollocal.h | 0 .../fsfw/datapoollocal/AccessLocalPoolF.h | 0 .../fsfw/datapoollocal/HasLocalDataPoolIF.h | 0 .../fsfw/datapoollocal/LocalDataPoolManager.h | 0 .../fsfw/datapoollocal/LocalDataSet.h | 0 .../fsfw/datapoollocal/LocalPoolDataSetBase.h | 0 .../fsfw/datapoollocal/LocalPoolObjectBase.h | 0 .../fsfw/datapoollocal/LocalPoolVariable.h | 0 .../fsfw/datapoollocal/LocalPoolVariable.tpp | 0 .../fsfw/datapoollocal/LocalPoolVector.h | 0 .../fsfw/datapoollocal/LocalPoolVector.tpp | 0 .../fsfw/datapoollocal/MarkChangedIF.h | 0 .../ProvidesDataPoolSubscriptionIF.h | 0 .../fsfw/datapoollocal/SharedLocalDataSet.h | 0 .../fsfw/datapoollocal/StaticLocalDataSet.h | 0 .../fsfw/datapoollocal/localPoolDefinitions.h | 0 .../AcceptsDeviceResponsesIF.h | 0 .../fsfw/devicehandlers}/AssemblyBase.h | 0 .../fsfw/devicehandlers}/CMakeLists.txt | 0 .../fsfw/devicehandlers}/ChildHandlerBase.h | 0 .../fsfw/devicehandlers}/ChildHandlerFDIR.h | 0 .../fsfw/devicehandlers}/CookieIF.h | 0 .../devicehandlers}/DeviceCommunicationIF.h | 0 .../fsfw/devicehandlers}/DeviceHandlerBase.h | 0 .../DeviceHandlerFailureIsolation.h | 0 .../fsfw/devicehandlers}/DeviceHandlerIF.h | 0 .../devicehandlers}/DeviceHandlerMessage.h | 0 .../devicehandlers}/DeviceHandlerThermalSet.h | 0 .../DeviceTmReportingWrapper.h | 0 .../fsfw/devicehandlers}/HealthDevice.h | 0 {events => inc/fsfw/events}/Event.h | 0 {events => inc/fsfw/events}/EventManager.h | 0 {events => inc/fsfw/events}/EventManagerIF.h | 0 {events => inc/fsfw/events}/EventMessage.h | 0 .../fsfw/events}/EventReportingProxyIF.h | 0 .../fsfw/events}/eventmatching/CMakeLists.txt | 0 .../eventmatching/EventIdRangeMatcher.cpp | 0 .../eventmatching/EventIdRangeMatcher.h | 0 .../events}/eventmatching/EventMatchTree.cpp | 0 .../events}/eventmatching/EventMatchTree.h | 0 .../eventmatching/EventRangeMatcherBase.h | 0 .../eventmatching/ReporterRangeMatcher.cpp | 0 .../eventmatching/ReporterRangeMatcher.h | 0 .../eventmatching/SeverityRangeMatcher.cpp | 0 .../eventmatching/SeverityRangeMatcher.h | 0 .../events}/eventmatching/eventmatching.h | 0 .../fsfw/events}/fwSubsystemIdRanges.h | 0 {fdir => inc/fsfw/fdir}/ConfirmsFailuresIF.h | 0 {fdir => inc/fsfw/fdir}/EventCorrelation.h | 0 .../fsfw/fdir}/FailureIsolationBase.h | 0 {fdir => inc/fsfw/fdir}/FaultCounter.h | 0 .../fsfw/globalfunctions}/AsciiConverter.h | 0 .../fsfw/globalfunctions}/CRC.h | 0 .../fsfw/globalfunctions}/DleEncoder.h | 0 .../PeriodicOperationDivider.h | 0 .../fsfw/globalfunctions}/Type.h | 0 .../fsfw/globalfunctions}/arrayprinter.h | 0 .../fsfw/globalfunctions}/bitutility.h | 0 .../fsfw/globalfunctions}/constants.h | 0 .../globalfunctions}/matching/BinaryMatcher.h | 0 .../matching/DecimalMatcher.h | 0 .../globalfunctions}/matching/MatchTree.h | 0 .../globalfunctions}/matching/MatcherIF.h | 0 .../globalfunctions}/matching/RangeMatcher.h | 0 .../matching/SerializeableMatcherIF.h | 0 .../globalfunctions}/math/MatrixOperations.h | 0 .../math/QuaternionOperations.h | 0 .../globalfunctions}/math/VectorOperations.h | 0 .../fsfw/globalfunctions}/sign.h | 0 .../fsfw/globalfunctions}/timevalOperations.h | 0 {health => inc/fsfw/health}/HasHealthIF.h | 0 {health => inc/fsfw/health}/HealthHelper.h | 0 {health => inc/fsfw/health}/HealthMessage.h | 0 {health => inc/fsfw/health}/HealthTable.h | 0 {health => inc/fsfw/health}/HealthTableIF.h | 0 {health => inc/fsfw/health}/ManagesHealthIF.h | 0 .../fsfw/housekeeping}/AcceptsHkPacketsIF.h | 0 .../fsfw/housekeeping}/CMakeLists.txt | 0 .../fsfw/housekeeping}/HousekeepingMessage.h | 0 .../HousekeepingPacketDownlink.h | 0 .../housekeeping}/HousekeepingSetPacket.h | 0 .../fsfw/housekeeping}/HousekeepingSnapshot.h | 0 .../PeriodicHousekeepingHelper.h | 0 .../internalError}/InternalErrorDataset.h | 0 .../internalError}/InternalErrorReporter.h | 0 .../internalError}/InternalErrorReporterIF.h | 0 {ipc => inc/fsfw/ipc}/CommandMessage.h | 0 {ipc => inc/fsfw/ipc}/CommandMessageCleaner.h | 0 {ipc => inc/fsfw/ipc}/CommandMessageIF.h | 0 {ipc => inc/fsfw/ipc}/FwMessageTypes.h | 0 {ipc => inc/fsfw/ipc}/MessageQueueIF.h | 0 {ipc => inc/fsfw/ipc}/MessageQueueMessage.h | 0 {ipc => inc/fsfw/ipc}/MessageQueueMessageIF.h | 0 {ipc => inc/fsfw/ipc}/MessageQueueSenderIF.h | 0 {ipc => inc/fsfw/ipc}/MutexFactory.h | 0 {ipc => inc/fsfw/ipc}/MutexGuard.h | 0 {ipc => inc/fsfw/ipc}/MutexIF.h | 0 {ipc => inc/fsfw/ipc}/QueueFactory.h | 0 .../fsfw/ipc}/messageQueueDefinitions.h | 0 .../fsfw/memory}/AcceptsMemoryMessagesIF.h | 0 .../fsfw/memory}/GenericFileSystemMessage.h | 0 {memory => inc/fsfw/memory}/HasFileSystemIF.h | 0 {memory => inc/fsfw/memory}/HasMemoryIF.h | 0 {memory => inc/fsfw/memory}/MemoryHelper.h | 0 {memory => inc/fsfw/memory}/MemoryMessage.h | 0 {modes => inc/fsfw/modes}/HasModesIF.h | 0 {modes => inc/fsfw/modes}/ModeHelper.h | 0 {modes => inc/fsfw/modes}/ModeMessage.h | 0 .../fsfw/monitoring}/AbsLimitMonitor.h | 0 .../fsfw/monitoring}/HasMonitorsIF.h | 0 .../fsfw/monitoring}/LimitMonitor.h | 0 .../fsfw/monitoring}/LimitViolationReporter.h | 0 .../fsfw/monitoring}/MonitorBase.h | 0 .../fsfw/monitoring}/MonitorReporter.h | 0 .../fsfw/monitoring}/MonitoringIF.h | 3 - .../fsfw/monitoring}/MonitoringMessage.h | 0 .../monitoring}/MonitoringMessageContent.h | 0 .../monitoring}/ReceivesMonitoringReportsIF.h | 0 .../fsfw/monitoring}/TriplexMonitor.h | 0 .../fsfw/monitoring}/TwoValueLimitMonitor.h | 0 .../fsfw/objectmanager}/ObjectManager.h | 0 .../fsfw/objectmanager}/ObjectManagerIF.h | 0 .../fsfw/objectmanager}/SystemObject.h | 0 .../fsfw/objectmanager}/SystemObjectIF.h | 0 .../fsfw/objectmanager}/frameworkObjects.h | 0 {osal => inc/fsfw/osal}/Endiness.h | 0 {osal => inc/fsfw/osal}/InternalErrorCodes.h | 0 {osal => inc/fsfw/osal}/common/TcpIpBase.h | 0 .../fsfw/osal}/common/TcpTmTcBridge.h | 0 .../fsfw/osal}/common/TcpTmTcServer.h | 0 .../fsfw/osal}/common/UdpTcPollingTask.h | 0 .../fsfw/osal}/common/UdpTmTcBridge.h | 0 {osal => inc/fsfw/osal}/common/tcpipCommon.h | 0 {osal => inc/fsfw/osal}/common/tcpipHelpers.h | 0 .../fsfw/osal/freertos}/BinSemaphUsingTask.h | 0 .../fsfw/osal/freertos}/BinarySemaphore.h | 0 .../osal/freertos}/CountingSemaphUsingTask.h | 0 .../fsfw/osal/freertos}/CountingSemaphore.h | 0 .../fsfw/osal/freertos}/FixedTimeslotTask.h | 0 .../fsfw/osal/freertos}/FreeRTOSTaskIF.h | 0 .../fsfw/osal/freertos}/MessageQueue.h | 0 .../fsfw/osal/freertos}/Mutex.h | 0 .../fsfw/osal/freertos}/PeriodicTask.h | 0 .../fsfw/osal/freertos}/QueueMapManager.h | 0 .../fsfw/osal/freertos}/README.md | 0 .../fsfw/osal/freertos}/TaskManagement.h | 0 .../fsfw/osal/freertos}/Timekeeper.h | 0 .../fsfw/osal}/host/FixedTimeslotTask.h | 0 {osal => inc/fsfw/osal}/host/MessageQueue.h | 0 {osal => inc/fsfw/osal}/host/Mutex.cpp | 0 {osal => inc/fsfw/osal}/host/Mutex.h | 0 {osal => inc/fsfw/osal}/host/PeriodicTask.h | 0 .../fsfw/osal}/host/QueueMapManager.h | 0 {osal => inc/fsfw/osal}/host/taskHelpers.h | 0 .../fsfw/osal}/linux/BinarySemaphore.h | 0 .../fsfw/osal}/linux/CountingSemaphore.h | 0 .../fsfw/osal}/linux/FixedTimeslotTask.h | 0 {osal => inc/fsfw/osal}/linux/MessageQueue.h | 0 {osal => inc/fsfw/osal}/linux/Mutex.h | 0 .../fsfw/osal}/linux/PeriodicPosixTask.h | 0 {osal => inc/fsfw/osal}/linux/PosixThread.h | 0 {osal => inc/fsfw/osal}/linux/Timer.h | 0 {osal => inc/fsfw/osal}/linux/unixUtility.h | 0 {osal => inc/fsfw/osal}/rtems/CpuUsage.h | 0 .../fsfw/osal}/rtems/FixedTimeslotTask.h | 0 {osal => inc/fsfw/osal}/rtems/InitTask.h | 0 {osal => inc/fsfw/osal}/rtems/MessageQueue.h | 0 {osal => inc/fsfw/osal}/rtems/Mutex.h | 0 {osal => inc/fsfw/osal}/rtems/PeriodicTask.h | 0 {osal => inc/fsfw/osal}/rtems/RTEMSTaskBase.h | 0 {osal => inc/fsfw/osal}/rtems/RtemsBasic.h | 0 .../fsfw/osal}/windows/winTaskHelpers.h | 0 .../fsfw/parameters}/HasParametersIF.h | 0 .../fsfw/parameters}/ParameterHelper.h | 0 .../fsfw/parameters}/ParameterMessage.h | 0 .../fsfw/parameters}/ParameterWrapper.h | 0 .../parameters}/ReceivesParameterMessagesIF.h | 0 platform.h => inc/fsfw/platform.h | 0 {power => inc/fsfw/power}/Fuse.h | 0 {power => inc/fsfw/power}/PowerComponent.h | 0 {power => inc/fsfw/power}/PowerComponentIF.h | 0 {power => inc/fsfw/power}/PowerSensor.h | 0 {power => inc/fsfw/power}/PowerSwitchIF.h | 0 {power => inc/fsfw/power}/PowerSwitcher.h | 0 .../fsfw/pus}/CService200ModeCommanding.h | 0 .../fsfw/pus}/CService201HealthCommanding.h | 0 {pus => inc/fsfw/pus}/Service17Test.h | 0 .../pus}/Service1TelecommandVerification.h | 0 .../fsfw/pus}/Service20ParameterManagement.h | 0 {pus => inc/fsfw/pus}/Service2DeviceAccess.h | 0 {pus => inc/fsfw/pus}/Service3Housekeeping.h | 0 .../fsfw/pus}/Service5EventReporting.h | 0 .../fsfw/pus}/Service8FunctionManagement.h | 0 .../fsfw/pus}/Service9TimeManagement.h | 0 .../pus}/servicepackets/Service1Packets.h | 0 .../pus}/servicepackets/Service200Packets.h | 0 .../pus}/servicepackets/Service201Packets.h | 0 .../pus}/servicepackets/Service20Packets.h | 0 .../pus}/servicepackets/Service2Packets.h | 0 .../pus}/servicepackets/Service3Packets.h | 0 .../pus}/servicepackets/Service5Packets.h | 0 .../pus}/servicepackets/Service8Packets.h | 0 .../pus}/servicepackets/Service9Packets.h | 0 .../fsfw/returnvalues}/FwClassIds.h | 0 .../fsfw/returnvalues}/HasReturnvaluesIF.h | 0 {rmap => inc/fsfw/rmap}/RMAP.h | 0 {rmap => inc/fsfw/rmap}/RMAPChannelIF.h | 0 {rmap => inc/fsfw/rmap}/RMAPCookie.h | 0 .../fsfw/rmap}/RmapDeviceCommunicationIF.h | 0 {rmap => inc/fsfw/rmap}/rmapStructs.h | 0 .../fsfw/serialize}/EndianConverter.h | 0 .../fsfw/serialize}/SerialArrayListAdapter.h | 0 .../fsfw/serialize}/SerialBufferAdapter.h | 0 .../serialize}/SerialFixedArrayListAdapter.h | 0 .../fsfw/serialize}/SerialLinkedListAdapter.h | 0 .../fsfw/serialize}/SerializeAdapter.h | 0 .../fsfw/serialize}/SerializeElement.h | 0 .../fsfw/serialize}/SerializeIF.h | 0 .../fsfw/serviceinterface}/ServiceInterface.h | 0 .../ServiceInterfaceBuffer.h | 0 .../ServiceInterfacePrinter.h | 0 .../ServiceInterfaceStream.h | 0 .../serviceInterfaceDefintions.h | 0 .../storagemanager}/ConstStorageAccessor.h | 0 .../fsfw/storagemanager}/LocalPool.h | 0 .../fsfw/storagemanager}/PoolManager.h | 0 .../fsfw/storagemanager}/StorageAccessor.h | 0 .../fsfw/storagemanager}/StorageManagerIF.h | 0 .../fsfw/storagemanager}/storeAddress.h | 0 {subsystem => inc/fsfw/subsystem}/Subsystem.h | 0 .../fsfw/subsystem}/SubsystemBase.h | 0 .../fsfw/subsystem}/modes/HasModeSequenceIF.h | 0 .../fsfw/subsystem}/modes/ModeDefinitions.h | 0 .../subsystem}/modes/ModeSequenceMessage.h | 0 .../fsfw/subsystem}/modes/ModeStore.h | 0 .../fsfw/subsystem}/modes/ModeStoreIF.h | 0 .../fsfw/tasks}/ExecutableObjectIF.h | 0 {tasks => inc/fsfw/tasks}/FixedSequenceSlot.h | 0 {tasks => inc/fsfw/tasks}/FixedSlotSequence.h | 0 .../fsfw/tasks}/FixedTimeslotTaskIF.h | 0 {tasks => inc/fsfw/tasks}/PeriodicTaskIF.h | 0 {tasks => inc/fsfw/tasks}/SemaphoreFactory.h | 0 {tasks => inc/fsfw/tasks}/SemaphoreIF.h | 0 {tasks => inc/fsfw/tasks}/TaskFactory.h | 0 {tasks => inc/fsfw/tasks}/Typedef.h | 0 .../fsfw/tcdistribution}/CCSDSDistributor.h | 0 .../fsfw/tcdistribution}/CCSDSDistributorIF.h | 0 .../fsfw/tcdistribution}/PUSDistributor.h | 0 .../fsfw/tcdistribution}/PUSDistributorIF.h | 0 .../fsfw/tcdistribution}/TcDistributor.h | 0 .../fsfw/tcdistribution}/TcPacketCheck.h | 0 .../fsfw/thermal}/AbstractTemperatureSensor.h | 0 .../fsfw/thermal}/AcceptsThermalMessagesIF.h | 0 {thermal => inc/fsfw/thermal}/Heater.h | 0 .../fsfw/thermal}/RedundantHeater.h | 0 .../fsfw/thermal}/TemperatureSensor.h | 0 .../fsfw/thermal}/ThermalComponent.h | 0 .../fsfw/thermal}/ThermalComponentCore.h | 0 .../fsfw/thermal}/ThermalComponentIF.h | 0 {thermal => inc/fsfw/thermal}/ThermalModule.h | 0 .../fsfw/thermal}/ThermalModuleIF.h | 0 .../fsfw/thermal}/ThermalMonitorReporter.h | 0 .../fsfw/thermal}/tcsDefinitions.h | 0 .../fsfw/timemanager}/CCSDSTime.h | 0 {timemanager => inc/fsfw/timemanager}/Clock.h | 0 .../fsfw/timemanager}/Countdown.h | 0 .../fsfw/timemanager}/ReceivesTimeInfoIF.h | 0 .../fsfw/timemanager}/Stopwatch.h | 0 .../fsfw/timemanager}/TimeMessage.h | 0 .../fsfw/timemanager}/TimeStamper.h | 0 .../fsfw/timemanager}/TimeStamperIF.h | 0 .../fsfw/timemanager}/clockDefinitions.h | 0 .../fsfw/tmstorage}/TmStoreBackendIF.h | 0 .../fsfw/tmstorage}/TmStoreFrontendIF.h | 0 .../fsfw/tmstorage}/TmStoreMessage.h | 0 .../fsfw/tmstorage}/TmStorePackets.h | 0 .../fsfw/tmtcpacket}/SpacePacket.h | 0 .../fsfw/tmtcpacket}/SpacePacketBase.h | 0 .../fsfw/tmtcpacket}/ccsds_header.h | 0 .../tmtcpacket}/packetmatcher/ApidMatcher.h | 0 .../packetmatcher/PacketMatchTree.h | 0 .../packetmatcher/ServiceMatcher.h | 0 .../packetmatcher/SubserviceMatcher.h | 0 .../pus/PacketTimestampInterpreterIF.h | 0 {tmtcpacket => inc/fsfw/tmtcpacket}/pus/tc.h | 0 .../fsfw/tmtcpacket}/pus/tc/TcPacketBase.h | 0 .../fsfw/tmtcpacket}/pus/tc/TcPacketPus.h | 0 .../tmtcpacket}/pus/tc/TcPacketStoredBase.h | 0 .../tmtcpacket}/pus/tc/TcPacketStoredIF.h | 0 .../tmtcpacket}/pus/tc/TcPacketStoredPus.h | 0 {tmtcpacket => inc/fsfw/tmtcpacket}/pus/tm.h | 0 .../fsfw/tmtcpacket}/pus/tm/TmPacketBase.h | 0 .../fsfw/tmtcpacket}/pus/tm/TmPacketMinimal.h | 0 .../fsfw/tmtcpacket}/pus/tm/TmPacketPusA.h | 0 .../fsfw/tmtcpacket}/pus/tm/TmPacketPusC.h | 0 .../fsfw/tmtcpacket}/pus/tm/TmPacketStored.h | 0 .../tmtcpacket}/pus/tm/TmPacketStoredBase.h | 0 .../tmtcpacket}/pus/tm/TmPacketStoredPusA.h | 0 .../tmtcpacket}/pus/tm/TmPacketStoredPusC.h | 0 .../tmtcservices}/AcceptsTelecommandsIF.h | 0 .../fsfw/tmtcservices}/AcceptsTelemetryIF.h | 0 .../tmtcservices}/AcceptsVerifyMessageIF.h | 0 .../tmtcservices}/CommandingServiceBase.h | 0 .../fsfw/tmtcservices}/PusServiceBase.h | 0 .../tmtcservices}/PusVerificationReport.h | 0 .../tmtcservices}/SourceSequenceCounter.h | 0 .../fsfw/tmtcservices}/TmTcBridge.h | 0 .../fsfw/tmtcservices}/TmTcMessage.h | 0 .../fsfw/tmtcservices}/VerificationCodes.h | 0 .../fsfw/tmtcservices}/VerificationReporter.h | 0 {defaultcfg => misc/defaultcfg}/README.md | 0 .../defaultcfg}/fsfwconfig/CMakeLists.txt | 0 .../defaultcfg}/fsfwconfig/FSFWConfig.h | 0 .../defaultcfg}/fsfwconfig/OBSWConfig.h | 0 .../defaultcfg}/fsfwconfig/OBSWVersion.h | 0 .../fsfwconfig/devices/logicalAddresses.h | 0 .../fsfwconfig/devices/powerSwitcherList.h | 0 .../fsfwconfig/events/subsystemIdRanges.h | 0 .../defaultcfg}/fsfwconfig/fsfwconfig.mk | 0 .../fsfwconfig/ipc/missionMessageTypes.cpp | 0 .../fsfwconfig/ipc/missionMessageTypes.h | 0 .../fsfwconfig/objects/FsfwFactory.cpp | 0 .../fsfwconfig/objects/FsfwFactory.h | 0 .../fsfwconfig/objects/systemObjectList.h | 0 .../PollingSequenceFactory.cpp | 0 .../pollingsequence/PollingSequenceFactory.h | 0 .../fsfwconfig/returnvalues/classIds.h | 0 .../defaultcfg}/fsfwconfig/tmtc/apid.h | 0 .../defaultcfg}/fsfwconfig/tmtc/pusIds.h | 0 {logo => misc/logo}/FSFW_Logo_V3.png | Bin {logo => misc/logo}/FSFW_Logo_V3.svg | 0 {logo => misc/logo}/FSFW_Logo_V3_bw.png | Bin .../src => src/core}/action/ActionHelper.cpp | 0 .../src => src/core}/action/ActionMessage.cpp | 0 {core/src => src/core}/action/CMakeLists.txt | 0 .../core}/action/CommandActionHelper.cpp | 0 .../core}/action/SimpleActionHelper.cpp | 0 .../src => src/core}/container/CMakeLists.txt | 0 .../core}/container/SharedRingBuffer.cpp | 0 .../core}/container/SimpleRingBuffer.cpp | 0 .../core}/controller/CMakeLists.txt | 0 .../core}/controller/ControllerBase.cpp | 0 .../controller/ExtendedControllerBase.cpp | 0 .../src => src/core}/datapool/CMakeLists.txt | 0 .../core}/datapool/HkSwitchHelper.cpp | 0 .../core}/datapool/PoolDataSetBase.cpp | 0 {core/src => src/core}/datapool/PoolEntry.cpp | 0 .../core}/datapoollocal/CMakeLists.txt | 0 .../datapoollocal/LocalDataPoolManager.cpp | 0 .../core}/datapoollocal/LocalDataSet.cpp | 0 .../datapoollocal/LocalPoolDataSetBase.cpp | 0 .../datapoollocal/LocalPoolObjectBase.cpp | 0 .../datapoollocal/SharedLocalDataSet.cpp | 0 .../datapoollocal/internal/CMakeLists.txt | 0 .../internal/HasLocalDpIFManagerAttorney.cpp | 0 .../internal/HasLocalDpIFManagerAttorney.h | 0 .../internal/HasLocalDpIFUserAttorney.cpp | 0 .../internal/HasLocalDpIFUserAttorney.h | 0 .../internal/LocalDpManagerAttorney.h | 0 .../internal/LocalPoolDataSetAttorney.h | 0 .../core/devicehandlers}/AssemblyBase.cpp | 0 .../core/devicehandlers}/ChildHandlerBase.cpp | 0 .../core/devicehandlers}/ChildHandlerFDIR.cpp | 0 .../devicehandlers}/DeviceHandlerBase.cpp | 0 .../DeviceHandlerFailureIsolation.cpp | 0 .../devicehandlers}/DeviceHandlerMessage.cpp | 0 .../DeviceTmReportingWrapper.cpp | 0 .../core/devicehandlers}/HealthDevice.cpp | 0 {events => src/core/events}/CMakeLists.txt | 0 {events => src/core/events}/EventManager.cpp | 0 {events => src/core/events}/EventMessage.cpp | 0 {fdir => src/core/fdir}/CMakeLists.txt | 0 {fdir => src/core/fdir}/EventCorrelation.cpp | 0 .../core/fdir}/FailureIsolationBase.cpp | 0 {fdir => src/core/fdir}/FaultCounter.cpp | 0 .../core/globalfunctions}/AsciiConverter.cpp | 0 .../core/globalfunctions}/CMakeLists.txt | 0 .../core/globalfunctions}/CRC.cpp | 0 .../core/globalfunctions}/DleEncoder.cpp | 0 .../PeriodicOperationDivider.cpp | 0 .../core/globalfunctions}/Type.cpp | 0 .../core/globalfunctions}/arrayprinter.cpp | 0 .../core/globalfunctions}/bitutility.cpp | 0 .../core/globalfunctions}/math/CMakeLists.txt | 0 .../math/QuaternionOperations.cpp | 0 .../globalfunctions}/timevalOperations.cpp | 0 {health => src/core/health}/CMakeLists.txt | 0 {health => src/core/health}/HealthHelper.cpp | 0 {health => src/core/health}/HealthMessage.cpp | 0 {health => src/core/health}/HealthTable.cpp | 0 .../housekeeping}/HousekeepingMessage.cpp | 0 .../PeriodicHousekeepingHelper.cpp | 0 .../core/internalError}/CMakeLists.txt | 0 .../internalError}/InternalErrorReporter.cpp | 0 {ipc => src/core/ipc}/CMakeLists.txt | 0 {ipc => src/core/ipc}/CommandMessage.cpp | 0 .../core/ipc}/CommandMessageCleaner.cpp | 0 {ipc => src/core/ipc}/MessageQueueMessage.cpp | 0 {modes => src/core/modes}/CMakeLists.txt | 0 {modes => src/core/modes}/ModeHelper.cpp | 0 {modes => src/core/modes}/ModeMessage.cpp | 0 .../core/objectmanager}/CMakeLists.txt | 0 .../core/objectmanager}/ObjectManager.cpp | 0 .../core/objectmanager}/SystemObject.cpp | 0 .../core/parameters}/CMakeLists.txt | 0 .../core/parameters}/ParameterHelper.cpp | 0 .../core/parameters}/ParameterMessage.cpp | 0 .../core/parameters}/ParameterWrapper.cpp | 0 {power => src/core/power}/CMakeLists.txt | 0 {power => src/core/power}/Fuse.cpp | 0 {power => src/core/power}/PowerComponent.cpp | 0 {power => src/core/power}/PowerSensor.cpp | 0 {power => src/core/power}/PowerSwitcher.cpp | 0 .../core/serialize}/CMakeLists.txt | 0 .../core/serialize}/SerialBufferAdapter.cpp | 0 .../core/serviceinterface}/CMakeLists.txt | 0 .../ServiceInterfaceBuffer.cpp | 0 .../ServiceInterfacePrinter.cpp | 0 .../ServiceInterfaceStream.cpp | 0 .../core/storagemanager}/CMakeLists.txt | 0 .../storagemanager}/ConstStorageAccessor.cpp | 0 .../core/storagemanager}/LocalPool.cpp | 0 .../core/storagemanager}/PoolManager.cpp | 0 .../core/storagemanager}/StorageAccessor.cpp | 0 .../core/subsystem}/CMakeLists.txt | 0 .../core/subsystem}/Subsystem.cpp | 0 .../core/subsystem}/SubsystemBase.cpp | 0 .../core/subsystem}/modes/CMakeLists.txt | 0 .../subsystem}/modes/ModeSequenceMessage.cpp | 0 .../core/subsystem}/modes/ModeStore.cpp | 0 {tasks => src/core/tasks}/CMakeLists.txt | 0 .../core/tasks}/FixedSequenceSlot.cpp | 0 .../core/tasks}/FixedSlotSequence.cpp | 0 .../core/tcdistribution}/CCSDSDistributor.cpp | 0 .../core/tcdistribution}/CMakeLists.txt | 0 .../core/tcdistribution}/PUSDistributor.cpp | 0 .../core/tcdistribution}/TcDistributor.cpp | 0 .../core/tcdistribution}/TcPacketCheck.cpp | 0 .../thermal}/AbstractTemperatureSensor.cpp | 0 {thermal => src/core/thermal}/CMakeLists.txt | 0 {thermal => src/core/thermal}/Heater.cpp | 0 .../core/thermal}/RedundantHeater.cpp | 0 .../core/thermal}/ThermalComponent.cpp | 0 .../core/thermal}/ThermalComponentCore.cpp | 0 .../core/thermal}/ThermalModule.cpp | 0 .../core/thermal}/ThermalMonitorReporter.cpp | 0 .../core/timemanager}/CCSDSTime.cpp | 0 .../core/timemanager}/CMakeLists.txt | 0 .../core/timemanager}/ClockCommon.cpp | 0 .../core/timemanager}/Countdown.cpp | 0 .../core/timemanager}/Stopwatch.cpp | 0 .../core/timemanager}/TimeMessage.cpp | 0 .../core/timemanager}/TimeStamper.cpp | 0 .../core/tmtcpacket}/CMakeLists.txt | 0 .../core/tmtcpacket}/SpacePacket.cpp | 0 .../core/tmtcpacket}/SpacePacketBase.cpp | 0 .../tmtcpacket}/packetmatcher/CMakeLists.txt | 0 .../packetmatcher/PacketMatchTree.cpp | 0 .../core/tmtcpacket}/pus/CMakeLists.txt | 0 .../core/tmtcpacket}/pus/tc/CMakeLists.txt | 0 .../core/tmtcpacket}/pus/tc/TcPacketBase.cpp | 0 .../core/tmtcpacket}/pus/tc/TcPacketPus.cpp | 0 .../tmtcpacket}/pus/tc/TcPacketStoredBase.cpp | 0 .../tmtcpacket}/pus/tc/TcPacketStoredPus.cpp | 0 .../core/tmtcpacket}/pus/tm/CMakeLists.txt | 0 .../core/tmtcpacket}/pus/tm/TmPacketBase.cpp | 0 .../tmtcpacket}/pus/tm/TmPacketMinimal.cpp | 0 .../core/tmtcpacket}/pus/tm/TmPacketPusA.cpp | 0 .../core/tmtcpacket}/pus/tm/TmPacketPusC.cpp | 0 .../tmtcpacket}/pus/tm/TmPacketStoredBase.cpp | 0 .../tmtcpacket}/pus/tm/TmPacketStoredPusA.cpp | 0 .../tmtcpacket}/pus/tm/TmPacketStoredPusC.cpp | 0 .../core/tmtcservices}/CMakeLists.txt | 0 .../tmtcservices}/CommandingServiceBase.cpp | 0 .../core/tmtcservices}/PusServiceBase.cpp | 0 .../tmtcservices}/PusVerificationReport.cpp | 0 .../core/tmtcservices}/TmTcBridge.cpp | 0 .../core/tmtcservices}/TmTcMessage.cpp | 0 .../tmtcservices}/VerificationReporter.cpp | 0 .../opt}/coordinates/CMakeLists.txt | 0 .../coordinates/CoordinateTransformations.cpp | 0 .../opt}/coordinates/Sgp4Propagator.cpp | 0 .../opt}/datalinklayer/CMakeLists.txt | 0 {opt/src => src/opt}/datalinklayer/Clcw.cpp | 0 .../opt}/datalinklayer/DataLinkLayer.cpp | 0 .../opt}/datalinklayer/Farm1StateLockout.cpp | 0 .../opt}/datalinklayer/Farm1StateOpen.cpp | 0 .../opt}/datalinklayer/Farm1StateWait.cpp | 0 .../datalinklayer/MapPacketExtraction.cpp | 0 .../opt}/datalinklayer/TcTransferFrame.cpp | 0 .../datalinklayer/TcTransferFrameLocal.cpp | 0 .../datalinklayer/VirtualChannelReception.cpp | 0 {memory => src/opt/memory}/CMakeLists.txt | 0 .../opt/memory}/GenericFileSystemMessage.cpp | 0 {memory => src/opt/memory}/MemoryHelper.cpp | 0 {memory => src/opt/memory}/MemoryMessage.cpp | 0 .../opt/monitoring}/CMakeLists.txt | 0 .../monitoring}/LimitViolationReporter.cpp | 0 .../opt/monitoring}/MonitoringMessage.cpp | 0 {pus => src/opt/pus}/CMakeLists.txt | 0 .../opt/pus}/CService200ModeCommanding.cpp | 0 .../opt/pus}/CService201HealthCommanding.cpp | 0 {pus => src/opt/pus}/Service17Test.cpp | 0 .../pus}/Service1TelecommandVerification.cpp | 0 .../opt/pus}/Service20ParameterManagement.cpp | 0 {pus => src/opt/pus}/Service2DeviceAccess.cpp | 0 {pus => src/opt/pus}/Service3Housekeeping.cpp | 0 .../opt/pus}/Service5EventReporting.cpp | 0 .../opt/pus}/Service8FunctionManagement.cpp | 0 .../opt/pus}/Service9TimeManagement.cpp | 0 {rmap => src/opt/rmap}/CMakeLists.txt | 0 {rmap => src/opt/rmap}/RMAP.cpp | 0 {rmap => src/opt/rmap}/RMAPCookie.cpp | 0 .../opt/rmap}/RmapDeviceCommunicationIF.cpp | 0 .../opt/tmstorage}/CMakeLists.txt | 0 .../opt/tmstorage}/TmStoreMessage.cpp | 0 {osal => src/osal}/CMakeLists.txt | 0 {osal => src/osal}/common/CMakeLists.txt | 0 {osal => src/osal}/common/TcpIpBase.cpp | 0 {osal => src/osal}/common/TcpTmTcBridge.cpp | 0 {osal => src/osal}/common/TcpTmTcServer.cpp | 0 .../osal}/common/UdpTcPollingTask.cpp | 0 {osal => src/osal}/common/UdpTmTcBridge.cpp | 0 {osal => src/osal}/common/tcpipCommon.cpp | 0 .../osal/freertos}/BinSemaphUsingTask.cpp | 0 .../osal/freertos}/BinarySemaphore.cpp | 0 .../osal/freertos}/CMakeLists.txt | 0 .../FreeRTOS => src/osal/freertos}/Clock.cpp | 0 .../freertos}/CountingSemaphUsingTask.cpp | 0 .../osal/freertos}/CountingSemaphore.cpp | 0 .../osal/freertos}/FixedTimeslotTask.cpp | 0 .../osal/freertos}/MessageQueue.cpp | 0 .../FreeRTOS => src/osal/freertos}/Mutex.cpp | 0 .../osal/freertos}/MutexFactory.cpp | 0 .../osal/freertos}/PeriodicTask.cpp | 0 .../osal/freertos}/QueueFactory.cpp | 0 .../osal/freertos}/QueueMapManager.cpp | 0 .../osal/freertos}/SemaphoreFactory.cpp | 0 .../osal/freertos}/TaskFactory.cpp | 0 .../osal/freertos}/TaskManagement.cpp | 0 .../osal/freertos}/Timekeeper.cpp | 0 {osal => src/osal}/host/CMakeLists.txt | 0 {osal => src/osal}/host/Clock.cpp | 0 {osal => src/osal}/host/FixedTimeslotTask.cpp | 0 {osal => src/osal}/host/MessageQueue.cpp | 0 {osal => src/osal}/host/MutexFactory.cpp | 0 {osal => src/osal}/host/PeriodicTask.cpp | 0 {osal => src/osal}/host/QueueFactory.cpp | 0 {osal => src/osal}/host/QueueMapManager.cpp | 0 {osal => src/osal}/host/SemaphoreFactory.cpp | 0 {osal => src/osal}/host/TaskFactory.cpp | 0 {osal => src/osal}/host/taskHelpers.cpp | 0 {osal => src/osal}/linux/BinarySemaphore.cpp | 0 {osal => src/osal}/linux/CMakeLists.txt | 0 {osal => src/osal}/linux/Clock.cpp | 0 .../osal}/linux/CountingSemaphore.cpp | 0 .../osal}/linux/FixedTimeslotTask.cpp | 0 .../osal}/linux/InternalErrorCodes.cpp | 0 {osal => src/osal}/linux/MessageQueue.cpp | 0 {osal => src/osal}/linux/Mutex.cpp | 0 {osal => src/osal}/linux/MutexFactory.cpp | 0 .../osal}/linux/PeriodicPosixTask.cpp | 0 {osal => src/osal}/linux/PosixThread.cpp | 0 {osal => src/osal}/linux/QueueFactory.cpp | 0 {osal => src/osal}/linux/SemaphoreFactory.cpp | 0 {osal => src/osal}/linux/TaskFactory.cpp | 0 {osal => src/osal}/linux/Timer.cpp | 0 {osal => src/osal}/linux/tcpipHelpers.cpp | 0 {osal => src/osal}/linux/unixUtility.cpp | 0 {osal => src/osal}/rtems/CMakeLists.txt | 0 {osal => src/osal}/rtems/Clock.cpp | 0 {osal => src/osal}/rtems/CpuUsage.cpp | 0 .../osal}/rtems/FixedTimeslotTask.cpp | 0 {osal => src/osal}/rtems/InitTask.cpp | 0 .../osal}/rtems/InternalErrorCodes.cpp | 0 {osal => src/osal}/rtems/MessageQueue.cpp | 0 {osal => src/osal}/rtems/Mutex.cpp | 0 {osal => src/osal}/rtems/MutexFactory.cpp | 0 {osal => src/osal}/rtems/PeriodicTask.cpp | 0 {osal => src/osal}/rtems/QueueFactory.cpp | 0 {osal => src/osal}/rtems/RTEMSTaskBase.cpp | 0 {osal => src/osal}/rtems/RtemsBasic.cpp | 0 {osal => src/osal}/rtems/TaskFactory.cpp | 0 {osal => src/osal}/windows/CMakeLists.txt | 0 {osal => src/osal}/windows/tcpipHelpers.cpp | 0 {osal => src/osal}/windows/winTaskHelpers.cpp | 0 {unittest => src/tests}/CMakeLists.txt | 0 {unittest => src/tests}/README.md | 0 .../tests}/internal/CMakeLists.txt | 0 .../tests}/internal/InternalUnitTester.cpp | 0 .../tests}/internal/InternalUnitTester.h | 0 .../tests}/internal/UnittDefinitions.cpp | 0 .../tests}/internal/UnittDefinitions.h | 0 .../internal/globalfunctions/CMakeLists.txt | 0 .../globalfunctions/TestArrayPrinter.cpp | 0 .../globalfunctions/TestArrayPrinter.h | 0 {unittest => src/tests}/internal/internal.mk | 0 .../tests}/internal/osal/CMakeLists.txt | 0 .../tests}/internal/osal/IntTestMq.cpp | 0 .../tests}/internal/osal/IntTestMq.h | 0 .../tests}/internal/osal/IntTestMutex.cpp | 0 .../tests}/internal/osal/IntTestMutex.h | 0 .../tests}/internal/osal/IntTestSemaphore.cpp | 0 .../tests}/internal/osal/IntTestSemaphore.h | 0 .../tests}/internal/serialize/CMakeLists.txt | 0 .../serialize/IntTestSerialization.cpp | 0 .../internal/serialize/IntTestSerialization.h | 0 {unittest => src/tests}/lcov.sh | 0 {unittest => src/tests}/tests/CMakeLists.txt | 0 .../tests}/tests/action/CMakeLists.txt | 0 .../tests}/tests/action/TestActionHelper.cpp | 0 .../tests}/tests/action/TestActionHelper.h | 0 .../tests}/tests/container/CMakeLists.txt | 0 .../tests}/tests/container/RingBufferTest.cpp | 0 .../tests}/tests/container/TestArrayList.cpp | 0 .../tests/container/TestDynamicFifo.cpp | 0 .../tests}/tests/container/TestFifo.cpp | 0 .../tests/container/TestFixedArrayList.cpp | 0 .../tests}/tests/container/TestFixedMap.cpp | 0 .../container/TestFixedOrderedMultimap.cpp | 0 .../tests/container/TestPlacementFactory.cpp | 0 .../tests}/tests/datapoollocal/CMakeLists.txt | 0 .../tests/datapoollocal/DataSetTest.cpp | 0 .../datapoollocal/LocalPoolManagerTest.cpp | 0 .../datapoollocal/LocalPoolOwnerBase.cpp | 0 .../tests/datapoollocal/LocalPoolOwnerBase.h | 0 .../datapoollocal/LocalPoolVariableTest.cpp | 0 .../datapoollocal/LocalPoolVectorTest.cpp | 0 .../tests/globalfunctions/CMakeLists.txt | 0 .../tests}/tests/mocks/HkReceiverMock.h | 0 .../tests}/tests/mocks/MessageQueueMockBase.h | 0 .../tests}/tests/osal/CMakeLists.txt | 0 .../tests}/tests/osal/TestMessageQueue.cpp | 0 .../tests}/tests/osal/TestSemaphore.cpp | 0 .../tests}/tests/serialize/CMakeLists.txt | 0 .../serialize/TestSerialBufferAdapter.cpp | 0 .../serialize/TestSerialLinkedPacket.cpp | 0 .../tests/serialize/TestSerialLinkedPacket.h | 0 .../tests/serialize/TestSerialization.cpp | 0 .../tests/storagemanager/CMakeLists.txt | 0 .../tests/storagemanager/TestNewAccessor.cpp | 0 .../tests}/tests/storagemanager/TestPool.cpp | 0 {unittest => src/tests}/tests/tests.mk | 0 .../tests}/tests/tmtcpacket/CMakeLists.txt | 0 .../tests}/tests/tmtcpacket/PusTmTest.cpp | 0 {unittest => src/tests}/user/CMakeLists.txt | 0 .../tests}/user/testcfg/CMakeLists.txt | 0 .../tests}/user/testcfg/FSFWConfig.h | 0 .../tests}/user/testcfg/Makefile-FSFW-Tests | 0 .../tests}/user/testcfg/TestsConfig.h | 0 .../user/testcfg/cdatapool/dataPoolInit.cpp | 0 .../user/testcfg/cdatapool/dataPoolInit.h | 0 .../user/testcfg/devices/logicalAddresses.cpp | 0 .../user/testcfg/devices/logicalAddresses.h | 0 .../testcfg/devices/powerSwitcherList.cpp | 0 .../user/testcfg/devices/powerSwitcherList.h | 0 .../user/testcfg/events/subsystemIdRanges.h | 0 .../user/testcfg/ipc/MissionMessageTypes.cpp | 0 .../user/testcfg/ipc/MissionMessageTypes.h | 0 .../user/testcfg/objects/systemObjectList.h | 0 .../PollingSequenceFactory.cpp | 0 .../pollingsequence/PollingSequenceFactory.h | 0 .../user/testcfg/returnvalues/classIds.h | 0 .../tests}/user/testcfg/testcfg.mk | 0 .../tests}/user/testcfg/tmtc/apid.h | 0 .../tests}/user/testcfg/tmtc/pusIds.h | 0 .../tests}/user/testtemplate/TestTemplate.cpp | 0 .../tests}/user/unittest/CMakeLists.txt | 0 .../tests}/user/unittest/core/CMakeLists.txt | 0 .../user/unittest/core/CatchDefinitions.cpp | 0 .../user/unittest/core/CatchDefinitions.h | 0 .../user/unittest/core/CatchFactory.cpp | 0 .../tests}/user/unittest/core/CatchFactory.h | 0 .../tests}/user/unittest/core/CatchRunner.cpp | 0 .../tests}/user/unittest/core/CatchSetup.cpp | 0 .../tests}/user/unittest/core/core.mk | 0 .../tests}/user/unittest/core/printChar.cpp | 0 .../tests}/user/unittest/core/printChar.h | 0 .../tests}/user/unlockRealtime.sh | 0 738 files changed, 78 deletions(-) delete mode 100644 fsfw.mk rename FSFW.h => inc/fsfw/FSFW.h (100%) rename FSFWVersion.h => inc/fsfw/FSFWVersion.h (100%) rename {core/inc => inc}/fsfw/action/ActionHelper.h (100%) rename {core/inc => inc}/fsfw/action/ActionMessage.h (100%) rename {core/inc => inc}/fsfw/action/CommandActionHelper.h (100%) rename {core/inc => inc}/fsfw/action/CommandsActionsIF.h (100%) rename {core/inc => inc}/fsfw/action/HasActionsIF.h (100%) rename {core/inc => inc}/fsfw/action/SimpleActionHelper.h (100%) rename {core/inc => inc}/fsfw/container/ArrayList.h (100%) rename {core/inc => inc}/fsfw/container/BinaryTree.h (100%) rename {core/inc => inc}/fsfw/container/DynamicFIFO.h (100%) rename {core/inc => inc}/fsfw/container/FIFO.h (100%) rename {core/inc => inc}/fsfw/container/FIFOBase.h (100%) rename {core/inc => inc}/fsfw/container/FIFOBase.tpp (100%) rename {core/inc => inc}/fsfw/container/FixedArrayList.h (100%) rename {core/inc => inc}/fsfw/container/FixedMap.h (100%) rename {core/inc => inc}/fsfw/container/FixedOrderedMultimap.h (100%) rename {core/inc => inc}/fsfw/container/FixedOrderedMultimap.tpp (100%) rename {core/inc => inc}/fsfw/container/HybridIterator.h (100%) rename {core/inc => inc}/fsfw/container/IndexedRingMemoryArray.h (100%) rename {core/inc => inc}/fsfw/container/PlacementFactory.h (100%) rename {core/inc => inc}/fsfw/container/RingBufferBase.h (100%) rename {core/inc => inc}/fsfw/container/SharedRingBuffer.h (100%) rename {core/inc => inc}/fsfw/container/SimpleRingBuffer.h (100%) rename {core/inc => inc}/fsfw/container/SinglyLinkedList.h (100%) rename {core/inc => inc}/fsfw/container/group.h (100%) rename {core/inc => inc}/fsfw/controller/ControllerBase.h (100%) rename {core/inc => inc}/fsfw/controller/ExtendedControllerBase.h (100%) rename {opt/inc => inc}/fsfw/coordinates/CoordinateTransformations.h (100%) rename {opt/inc => inc}/fsfw/coordinates/Jgm3Model.h (100%) rename {opt/inc => inc}/fsfw/coordinates/Sgp4Propagator.h (100%) rename {opt/inc => inc}/fsfw/datalinklayer/BCFrame.h (100%) rename {opt/inc => inc}/fsfw/datalinklayer/CCSDSReturnValuesIF.h (100%) rename {opt/inc => inc}/fsfw/datalinklayer/Clcw.h (100%) rename {opt/inc => inc}/fsfw/datalinklayer/ClcwIF.h (100%) rename {opt/inc => inc}/fsfw/datalinklayer/DataLinkLayer.h (100%) rename {opt/inc => inc}/fsfw/datalinklayer/Farm1StateIF.h (100%) rename {opt/inc => inc}/fsfw/datalinklayer/Farm1StateLockout.h (100%) rename {opt/inc => inc}/fsfw/datalinklayer/Farm1StateOpen.h (100%) rename {opt/inc => inc}/fsfw/datalinklayer/Farm1StateWait.h (100%) rename {opt/inc => inc}/fsfw/datalinklayer/MapPacketExtraction.h (100%) rename {opt/inc => inc}/fsfw/datalinklayer/MapPacketExtractionIF.h (100%) rename {opt/inc => inc}/fsfw/datalinklayer/TcTransferFrame.h (100%) rename {opt/inc => inc}/fsfw/datalinklayer/TcTransferFrameLocal.h (100%) rename {opt/inc => inc}/fsfw/datalinklayer/VirtualChannelReception.h (100%) rename {opt/inc => inc}/fsfw/datalinklayer/VirtualChannelReceptionIF.h (100%) rename {core/inc => inc}/fsfw/datapool/DataSetIF.h (100%) rename {core/inc => inc}/fsfw/datapool/HkSwitchHelper.h (100%) rename {core/inc => inc}/fsfw/datapool/PoolDataSetBase.h (100%) rename {core/inc => inc}/fsfw/datapool/PoolDataSetIF.h (100%) rename {core/inc => inc}/fsfw/datapool/PoolEntry.h (100%) rename {core/inc => inc}/fsfw/datapool/PoolEntryIF.h (100%) rename {core/inc => inc}/fsfw/datapool/PoolReadGuard.h (100%) rename {core/inc => inc}/fsfw/datapool/PoolVarList.h (100%) rename {core/inc => inc}/fsfw/datapool/PoolVariableIF.h (100%) rename {core/inc => inc}/fsfw/datapool/ReadCommitIF.h (100%) rename {core/inc => inc}/fsfw/datapool/ReadCommitIFAttorney.h (100%) rename {core/inc => inc}/fsfw/datapool/SharedDataSetIF.h (100%) rename {core/inc => inc}/fsfw/datapoollocal.h (100%) rename {core/inc => inc}/fsfw/datapoollocal/AccessLocalPoolF.h (100%) rename {core/inc => inc}/fsfw/datapoollocal/HasLocalDataPoolIF.h (100%) rename {core/inc => inc}/fsfw/datapoollocal/LocalDataPoolManager.h (100%) rename {core/inc => inc}/fsfw/datapoollocal/LocalDataSet.h (100%) rename {core/inc => inc}/fsfw/datapoollocal/LocalPoolDataSetBase.h (100%) rename {core/inc => inc}/fsfw/datapoollocal/LocalPoolObjectBase.h (100%) rename {core/inc => inc}/fsfw/datapoollocal/LocalPoolVariable.h (100%) rename {core/inc => inc}/fsfw/datapoollocal/LocalPoolVariable.tpp (100%) rename {core/inc => inc}/fsfw/datapoollocal/LocalPoolVector.h (100%) rename {core/inc => inc}/fsfw/datapoollocal/LocalPoolVector.tpp (100%) rename {core/inc => inc}/fsfw/datapoollocal/MarkChangedIF.h (100%) rename {core/inc => inc}/fsfw/datapoollocal/ProvidesDataPoolSubscriptionIF.h (100%) rename {core/inc => inc}/fsfw/datapoollocal/SharedLocalDataSet.h (100%) rename {core/inc => inc}/fsfw/datapoollocal/StaticLocalDataSet.h (100%) rename {core/inc => inc}/fsfw/datapoollocal/localPoolDefinitions.h (100%) rename {devicehandlers => inc/fsfw/devicehandlers}/AcceptsDeviceResponsesIF.h (100%) rename {devicehandlers => inc/fsfw/devicehandlers}/AssemblyBase.h (100%) rename {devicehandlers => inc/fsfw/devicehandlers}/CMakeLists.txt (100%) rename {devicehandlers => inc/fsfw/devicehandlers}/ChildHandlerBase.h (100%) rename {devicehandlers => inc/fsfw/devicehandlers}/ChildHandlerFDIR.h (100%) rename {devicehandlers => inc/fsfw/devicehandlers}/CookieIF.h (100%) rename {devicehandlers => inc/fsfw/devicehandlers}/DeviceCommunicationIF.h (100%) rename {devicehandlers => inc/fsfw/devicehandlers}/DeviceHandlerBase.h (100%) rename {devicehandlers => inc/fsfw/devicehandlers}/DeviceHandlerFailureIsolation.h (100%) rename {devicehandlers => inc/fsfw/devicehandlers}/DeviceHandlerIF.h (100%) rename {devicehandlers => inc/fsfw/devicehandlers}/DeviceHandlerMessage.h (100%) rename {devicehandlers => inc/fsfw/devicehandlers}/DeviceHandlerThermalSet.h (100%) rename {devicehandlers => inc/fsfw/devicehandlers}/DeviceTmReportingWrapper.h (100%) rename {devicehandlers => inc/fsfw/devicehandlers}/HealthDevice.h (100%) rename {events => inc/fsfw/events}/Event.h (100%) rename {events => inc/fsfw/events}/EventManager.h (100%) rename {events => inc/fsfw/events}/EventManagerIF.h (100%) rename {events => inc/fsfw/events}/EventMessage.h (100%) rename {events => inc/fsfw/events}/EventReportingProxyIF.h (100%) rename {events => inc/fsfw/events}/eventmatching/CMakeLists.txt (100%) rename {events => inc/fsfw/events}/eventmatching/EventIdRangeMatcher.cpp (100%) rename {events => inc/fsfw/events}/eventmatching/EventIdRangeMatcher.h (100%) rename {events => inc/fsfw/events}/eventmatching/EventMatchTree.cpp (100%) rename {events => inc/fsfw/events}/eventmatching/EventMatchTree.h (100%) rename {events => inc/fsfw/events}/eventmatching/EventRangeMatcherBase.h (100%) rename {events => inc/fsfw/events}/eventmatching/ReporterRangeMatcher.cpp (100%) rename {events => inc/fsfw/events}/eventmatching/ReporterRangeMatcher.h (100%) rename {events => inc/fsfw/events}/eventmatching/SeverityRangeMatcher.cpp (100%) rename {events => inc/fsfw/events}/eventmatching/SeverityRangeMatcher.h (100%) rename {events => inc/fsfw/events}/eventmatching/eventmatching.h (100%) rename {events => inc/fsfw/events}/fwSubsystemIdRanges.h (100%) rename {fdir => inc/fsfw/fdir}/ConfirmsFailuresIF.h (100%) rename {fdir => inc/fsfw/fdir}/EventCorrelation.h (100%) rename {fdir => inc/fsfw/fdir}/FailureIsolationBase.h (100%) rename {fdir => inc/fsfw/fdir}/FaultCounter.h (100%) rename {globalfunctions => inc/fsfw/globalfunctions}/AsciiConverter.h (100%) rename {globalfunctions => inc/fsfw/globalfunctions}/CRC.h (100%) rename {globalfunctions => inc/fsfw/globalfunctions}/DleEncoder.h (100%) rename {globalfunctions => inc/fsfw/globalfunctions}/PeriodicOperationDivider.h (100%) rename {globalfunctions => inc/fsfw/globalfunctions}/Type.h (100%) rename {globalfunctions => inc/fsfw/globalfunctions}/arrayprinter.h (100%) rename {globalfunctions => inc/fsfw/globalfunctions}/bitutility.h (100%) rename {globalfunctions => inc/fsfw/globalfunctions}/constants.h (100%) rename {globalfunctions => inc/fsfw/globalfunctions}/matching/BinaryMatcher.h (100%) rename {globalfunctions => inc/fsfw/globalfunctions}/matching/DecimalMatcher.h (100%) rename {globalfunctions => inc/fsfw/globalfunctions}/matching/MatchTree.h (100%) rename {globalfunctions => inc/fsfw/globalfunctions}/matching/MatcherIF.h (100%) rename {globalfunctions => inc/fsfw/globalfunctions}/matching/RangeMatcher.h (100%) rename {globalfunctions => inc/fsfw/globalfunctions}/matching/SerializeableMatcherIF.h (100%) rename {globalfunctions => inc/fsfw/globalfunctions}/math/MatrixOperations.h (100%) rename {globalfunctions => inc/fsfw/globalfunctions}/math/QuaternionOperations.h (100%) rename {globalfunctions => inc/fsfw/globalfunctions}/math/VectorOperations.h (100%) rename {globalfunctions => inc/fsfw/globalfunctions}/sign.h (100%) rename {globalfunctions => inc/fsfw/globalfunctions}/timevalOperations.h (100%) rename {health => inc/fsfw/health}/HasHealthIF.h (100%) rename {health => inc/fsfw/health}/HealthHelper.h (100%) rename {health => inc/fsfw/health}/HealthMessage.h (100%) rename {health => inc/fsfw/health}/HealthTable.h (100%) rename {health => inc/fsfw/health}/HealthTableIF.h (100%) rename {health => inc/fsfw/health}/ManagesHealthIF.h (100%) rename {housekeeping => inc/fsfw/housekeeping}/AcceptsHkPacketsIF.h (100%) rename {housekeeping => inc/fsfw/housekeeping}/CMakeLists.txt (100%) rename {housekeeping => inc/fsfw/housekeeping}/HousekeepingMessage.h (100%) rename {housekeeping => inc/fsfw/housekeeping}/HousekeepingPacketDownlink.h (100%) rename {housekeeping => inc/fsfw/housekeeping}/HousekeepingSetPacket.h (100%) rename {housekeeping => inc/fsfw/housekeeping}/HousekeepingSnapshot.h (100%) rename {housekeeping => inc/fsfw/housekeeping}/PeriodicHousekeepingHelper.h (100%) rename {internalError => inc/fsfw/internalError}/InternalErrorDataset.h (100%) rename {internalError => inc/fsfw/internalError}/InternalErrorReporter.h (100%) rename {internalError => inc/fsfw/internalError}/InternalErrorReporterIF.h (100%) rename {ipc => inc/fsfw/ipc}/CommandMessage.h (100%) rename {ipc => inc/fsfw/ipc}/CommandMessageCleaner.h (100%) rename {ipc => inc/fsfw/ipc}/CommandMessageIF.h (100%) rename {ipc => inc/fsfw/ipc}/FwMessageTypes.h (100%) rename {ipc => inc/fsfw/ipc}/MessageQueueIF.h (100%) rename {ipc => inc/fsfw/ipc}/MessageQueueMessage.h (100%) rename {ipc => inc/fsfw/ipc}/MessageQueueMessageIF.h (100%) rename {ipc => inc/fsfw/ipc}/MessageQueueSenderIF.h (100%) rename {ipc => inc/fsfw/ipc}/MutexFactory.h (100%) rename {ipc => inc/fsfw/ipc}/MutexGuard.h (100%) rename {ipc => inc/fsfw/ipc}/MutexIF.h (100%) rename {ipc => inc/fsfw/ipc}/QueueFactory.h (100%) rename {ipc => inc/fsfw/ipc}/messageQueueDefinitions.h (100%) rename {memory => inc/fsfw/memory}/AcceptsMemoryMessagesIF.h (100%) rename {memory => inc/fsfw/memory}/GenericFileSystemMessage.h (100%) rename {memory => inc/fsfw/memory}/HasFileSystemIF.h (100%) rename {memory => inc/fsfw/memory}/HasMemoryIF.h (100%) rename {memory => inc/fsfw/memory}/MemoryHelper.h (100%) rename {memory => inc/fsfw/memory}/MemoryMessage.h (100%) rename {modes => inc/fsfw/modes}/HasModesIF.h (100%) rename {modes => inc/fsfw/modes}/ModeHelper.h (100%) rename {modes => inc/fsfw/modes}/ModeMessage.h (100%) rename {monitoring => inc/fsfw/monitoring}/AbsLimitMonitor.h (100%) rename {monitoring => inc/fsfw/monitoring}/HasMonitorsIF.h (100%) rename {monitoring => inc/fsfw/monitoring}/LimitMonitor.h (100%) rename {monitoring => inc/fsfw/monitoring}/LimitViolationReporter.h (100%) rename {monitoring => inc/fsfw/monitoring}/MonitorBase.h (100%) rename {monitoring => inc/fsfw/monitoring}/MonitorReporter.h (100%) rename {monitoring => inc/fsfw/monitoring}/MonitoringIF.h (98%) rename {monitoring => inc/fsfw/monitoring}/MonitoringMessage.h (100%) rename {monitoring => inc/fsfw/monitoring}/MonitoringMessageContent.h (100%) rename {monitoring => inc/fsfw/monitoring}/ReceivesMonitoringReportsIF.h (100%) rename {monitoring => inc/fsfw/monitoring}/TriplexMonitor.h (100%) rename {monitoring => inc/fsfw/monitoring}/TwoValueLimitMonitor.h (100%) rename {objectmanager => inc/fsfw/objectmanager}/ObjectManager.h (100%) rename {objectmanager => inc/fsfw/objectmanager}/ObjectManagerIF.h (100%) rename {objectmanager => inc/fsfw/objectmanager}/SystemObject.h (100%) rename {objectmanager => inc/fsfw/objectmanager}/SystemObjectIF.h (100%) rename {objectmanager => inc/fsfw/objectmanager}/frameworkObjects.h (100%) rename {osal => inc/fsfw/osal}/Endiness.h (100%) rename {osal => inc/fsfw/osal}/InternalErrorCodes.h (100%) rename {osal => inc/fsfw/osal}/common/TcpIpBase.h (100%) rename {osal => inc/fsfw/osal}/common/TcpTmTcBridge.h (100%) rename {osal => inc/fsfw/osal}/common/TcpTmTcServer.h (100%) rename {osal => inc/fsfw/osal}/common/UdpTcPollingTask.h (100%) rename {osal => inc/fsfw/osal}/common/UdpTmTcBridge.h (100%) rename {osal => inc/fsfw/osal}/common/tcpipCommon.h (100%) rename {osal => inc/fsfw/osal}/common/tcpipHelpers.h (100%) rename {osal/FreeRTOS => inc/fsfw/osal/freertos}/BinSemaphUsingTask.h (100%) rename {osal/FreeRTOS => inc/fsfw/osal/freertos}/BinarySemaphore.h (100%) rename {osal/FreeRTOS => inc/fsfw/osal/freertos}/CountingSemaphUsingTask.h (100%) rename {osal/FreeRTOS => inc/fsfw/osal/freertos}/CountingSemaphore.h (100%) rename {osal/FreeRTOS => inc/fsfw/osal/freertos}/FixedTimeslotTask.h (100%) rename {osal/FreeRTOS => inc/fsfw/osal/freertos}/FreeRTOSTaskIF.h (100%) rename {osal/FreeRTOS => inc/fsfw/osal/freertos}/MessageQueue.h (100%) rename {osal/FreeRTOS => inc/fsfw/osal/freertos}/Mutex.h (100%) rename {osal/FreeRTOS => inc/fsfw/osal/freertos}/PeriodicTask.h (100%) rename {osal/FreeRTOS => inc/fsfw/osal/freertos}/QueueMapManager.h (100%) rename {osal/FreeRTOS => inc/fsfw/osal/freertos}/README.md (100%) rename {osal/FreeRTOS => inc/fsfw/osal/freertos}/TaskManagement.h (100%) rename {osal/FreeRTOS => inc/fsfw/osal/freertos}/Timekeeper.h (100%) rename {osal => inc/fsfw/osal}/host/FixedTimeslotTask.h (100%) rename {osal => inc/fsfw/osal}/host/MessageQueue.h (100%) rename {osal => inc/fsfw/osal}/host/Mutex.cpp (100%) rename {osal => inc/fsfw/osal}/host/Mutex.h (100%) rename {osal => inc/fsfw/osal}/host/PeriodicTask.h (100%) rename {osal => inc/fsfw/osal}/host/QueueMapManager.h (100%) rename {osal => inc/fsfw/osal}/host/taskHelpers.h (100%) rename {osal => inc/fsfw/osal}/linux/BinarySemaphore.h (100%) rename {osal => inc/fsfw/osal}/linux/CountingSemaphore.h (100%) rename {osal => inc/fsfw/osal}/linux/FixedTimeslotTask.h (100%) rename {osal => inc/fsfw/osal}/linux/MessageQueue.h (100%) rename {osal => inc/fsfw/osal}/linux/Mutex.h (100%) rename {osal => inc/fsfw/osal}/linux/PeriodicPosixTask.h (100%) rename {osal => inc/fsfw/osal}/linux/PosixThread.h (100%) rename {osal => inc/fsfw/osal}/linux/Timer.h (100%) rename {osal => inc/fsfw/osal}/linux/unixUtility.h (100%) rename {osal => inc/fsfw/osal}/rtems/CpuUsage.h (100%) rename {osal => inc/fsfw/osal}/rtems/FixedTimeslotTask.h (100%) rename {osal => inc/fsfw/osal}/rtems/InitTask.h (100%) rename {osal => inc/fsfw/osal}/rtems/MessageQueue.h (100%) rename {osal => inc/fsfw/osal}/rtems/Mutex.h (100%) rename {osal => inc/fsfw/osal}/rtems/PeriodicTask.h (100%) rename {osal => inc/fsfw/osal}/rtems/RTEMSTaskBase.h (100%) rename {osal => inc/fsfw/osal}/rtems/RtemsBasic.h (100%) rename {osal => inc/fsfw/osal}/windows/winTaskHelpers.h (100%) rename {parameters => inc/fsfw/parameters}/HasParametersIF.h (100%) rename {parameters => inc/fsfw/parameters}/ParameterHelper.h (100%) rename {parameters => inc/fsfw/parameters}/ParameterMessage.h (100%) rename {parameters => inc/fsfw/parameters}/ParameterWrapper.h (100%) rename {parameters => inc/fsfw/parameters}/ReceivesParameterMessagesIF.h (100%) rename platform.h => inc/fsfw/platform.h (100%) rename {power => inc/fsfw/power}/Fuse.h (100%) rename {power => inc/fsfw/power}/PowerComponent.h (100%) rename {power => inc/fsfw/power}/PowerComponentIF.h (100%) rename {power => inc/fsfw/power}/PowerSensor.h (100%) rename {power => inc/fsfw/power}/PowerSwitchIF.h (100%) rename {power => inc/fsfw/power}/PowerSwitcher.h (100%) rename {pus => inc/fsfw/pus}/CService200ModeCommanding.h (100%) rename {pus => inc/fsfw/pus}/CService201HealthCommanding.h (100%) rename {pus => inc/fsfw/pus}/Service17Test.h (100%) rename {pus => inc/fsfw/pus}/Service1TelecommandVerification.h (100%) rename {pus => inc/fsfw/pus}/Service20ParameterManagement.h (100%) rename {pus => inc/fsfw/pus}/Service2DeviceAccess.h (100%) rename {pus => inc/fsfw/pus}/Service3Housekeeping.h (100%) rename {pus => inc/fsfw/pus}/Service5EventReporting.h (100%) rename {pus => inc/fsfw/pus}/Service8FunctionManagement.h (100%) rename {pus => inc/fsfw/pus}/Service9TimeManagement.h (100%) rename {pus => inc/fsfw/pus}/servicepackets/Service1Packets.h (100%) rename {pus => inc/fsfw/pus}/servicepackets/Service200Packets.h (100%) rename {pus => inc/fsfw/pus}/servicepackets/Service201Packets.h (100%) rename {pus => inc/fsfw/pus}/servicepackets/Service20Packets.h (100%) rename {pus => inc/fsfw/pus}/servicepackets/Service2Packets.h (100%) rename {pus => inc/fsfw/pus}/servicepackets/Service3Packets.h (100%) rename {pus => inc/fsfw/pus}/servicepackets/Service5Packets.h (100%) rename {pus => inc/fsfw/pus}/servicepackets/Service8Packets.h (100%) rename {pus => inc/fsfw/pus}/servicepackets/Service9Packets.h (100%) rename {returnvalues => inc/fsfw/returnvalues}/FwClassIds.h (100%) rename {returnvalues => inc/fsfw/returnvalues}/HasReturnvaluesIF.h (100%) rename {rmap => inc/fsfw/rmap}/RMAP.h (100%) rename {rmap => inc/fsfw/rmap}/RMAPChannelIF.h (100%) rename {rmap => inc/fsfw/rmap}/RMAPCookie.h (100%) rename {rmap => inc/fsfw/rmap}/RmapDeviceCommunicationIF.h (100%) rename {rmap => inc/fsfw/rmap}/rmapStructs.h (100%) rename {serialize => inc/fsfw/serialize}/EndianConverter.h (100%) rename {serialize => inc/fsfw/serialize}/SerialArrayListAdapter.h (100%) rename {serialize => inc/fsfw/serialize}/SerialBufferAdapter.h (100%) rename {serialize => inc/fsfw/serialize}/SerialFixedArrayListAdapter.h (100%) rename {serialize => inc/fsfw/serialize}/SerialLinkedListAdapter.h (100%) rename {serialize => inc/fsfw/serialize}/SerializeAdapter.h (100%) rename {serialize => inc/fsfw/serialize}/SerializeElement.h (100%) rename {serialize => inc/fsfw/serialize}/SerializeIF.h (100%) rename {serviceinterface => inc/fsfw/serviceinterface}/ServiceInterface.h (100%) rename {serviceinterface => inc/fsfw/serviceinterface}/ServiceInterfaceBuffer.h (100%) rename {serviceinterface => inc/fsfw/serviceinterface}/ServiceInterfacePrinter.h (100%) rename {serviceinterface => inc/fsfw/serviceinterface}/ServiceInterfaceStream.h (100%) rename {serviceinterface => inc/fsfw/serviceinterface}/serviceInterfaceDefintions.h (100%) rename {storagemanager => inc/fsfw/storagemanager}/ConstStorageAccessor.h (100%) rename {storagemanager => inc/fsfw/storagemanager}/LocalPool.h (100%) rename {storagemanager => inc/fsfw/storagemanager}/PoolManager.h (100%) rename {storagemanager => inc/fsfw/storagemanager}/StorageAccessor.h (100%) rename {storagemanager => inc/fsfw/storagemanager}/StorageManagerIF.h (100%) rename {storagemanager => inc/fsfw/storagemanager}/storeAddress.h (100%) rename {subsystem => inc/fsfw/subsystem}/Subsystem.h (100%) rename {subsystem => inc/fsfw/subsystem}/SubsystemBase.h (100%) rename {subsystem => inc/fsfw/subsystem}/modes/HasModeSequenceIF.h (100%) rename {subsystem => inc/fsfw/subsystem}/modes/ModeDefinitions.h (100%) rename {subsystem => inc/fsfw/subsystem}/modes/ModeSequenceMessage.h (100%) rename {subsystem => inc/fsfw/subsystem}/modes/ModeStore.h (100%) rename {subsystem => inc/fsfw/subsystem}/modes/ModeStoreIF.h (100%) rename {tasks => inc/fsfw/tasks}/ExecutableObjectIF.h (100%) rename {tasks => inc/fsfw/tasks}/FixedSequenceSlot.h (100%) rename {tasks => inc/fsfw/tasks}/FixedSlotSequence.h (100%) rename {tasks => inc/fsfw/tasks}/FixedTimeslotTaskIF.h (100%) rename {tasks => inc/fsfw/tasks}/PeriodicTaskIF.h (100%) rename {tasks => inc/fsfw/tasks}/SemaphoreFactory.h (100%) rename {tasks => inc/fsfw/tasks}/SemaphoreIF.h (100%) rename {tasks => inc/fsfw/tasks}/TaskFactory.h (100%) rename {tasks => inc/fsfw/tasks}/Typedef.h (100%) rename {tcdistribution => inc/fsfw/tcdistribution}/CCSDSDistributor.h (100%) rename {tcdistribution => inc/fsfw/tcdistribution}/CCSDSDistributorIF.h (100%) rename {tcdistribution => inc/fsfw/tcdistribution}/PUSDistributor.h (100%) rename {tcdistribution => inc/fsfw/tcdistribution}/PUSDistributorIF.h (100%) rename {tcdistribution => inc/fsfw/tcdistribution}/TcDistributor.h (100%) rename {tcdistribution => inc/fsfw/tcdistribution}/TcPacketCheck.h (100%) rename {thermal => inc/fsfw/thermal}/AbstractTemperatureSensor.h (100%) rename {thermal => inc/fsfw/thermal}/AcceptsThermalMessagesIF.h (100%) rename {thermal => inc/fsfw/thermal}/Heater.h (100%) rename {thermal => inc/fsfw/thermal}/RedundantHeater.h (100%) rename {thermal => inc/fsfw/thermal}/TemperatureSensor.h (100%) rename {thermal => inc/fsfw/thermal}/ThermalComponent.h (100%) rename {thermal => inc/fsfw/thermal}/ThermalComponentCore.h (100%) rename {thermal => inc/fsfw/thermal}/ThermalComponentIF.h (100%) rename {thermal => inc/fsfw/thermal}/ThermalModule.h (100%) rename {thermal => inc/fsfw/thermal}/ThermalModuleIF.h (100%) rename {thermal => inc/fsfw/thermal}/ThermalMonitorReporter.h (100%) rename {thermal => inc/fsfw/thermal}/tcsDefinitions.h (100%) rename {timemanager => inc/fsfw/timemanager}/CCSDSTime.h (100%) rename {timemanager => inc/fsfw/timemanager}/Clock.h (100%) rename {timemanager => inc/fsfw/timemanager}/Countdown.h (100%) rename {timemanager => inc/fsfw/timemanager}/ReceivesTimeInfoIF.h (100%) rename {timemanager => inc/fsfw/timemanager}/Stopwatch.h (100%) rename {timemanager => inc/fsfw/timemanager}/TimeMessage.h (100%) rename {timemanager => inc/fsfw/timemanager}/TimeStamper.h (100%) rename {timemanager => inc/fsfw/timemanager}/TimeStamperIF.h (100%) rename {timemanager => inc/fsfw/timemanager}/clockDefinitions.h (100%) rename {tmstorage => inc/fsfw/tmstorage}/TmStoreBackendIF.h (100%) rename {tmstorage => inc/fsfw/tmstorage}/TmStoreFrontendIF.h (100%) rename {tmstorage => inc/fsfw/tmstorage}/TmStoreMessage.h (100%) rename {tmstorage => inc/fsfw/tmstorage}/TmStorePackets.h (100%) rename {tmtcpacket => inc/fsfw/tmtcpacket}/SpacePacket.h (100%) rename {tmtcpacket => inc/fsfw/tmtcpacket}/SpacePacketBase.h (100%) rename {tmtcpacket => inc/fsfw/tmtcpacket}/ccsds_header.h (100%) rename {tmtcpacket => inc/fsfw/tmtcpacket}/packetmatcher/ApidMatcher.h (100%) rename {tmtcpacket => inc/fsfw/tmtcpacket}/packetmatcher/PacketMatchTree.h (100%) rename {tmtcpacket => inc/fsfw/tmtcpacket}/packetmatcher/ServiceMatcher.h (100%) rename {tmtcpacket => inc/fsfw/tmtcpacket}/packetmatcher/SubserviceMatcher.h (100%) rename {tmtcpacket => inc/fsfw/tmtcpacket}/pus/PacketTimestampInterpreterIF.h (100%) rename {tmtcpacket => inc/fsfw/tmtcpacket}/pus/tc.h (100%) rename {tmtcpacket => inc/fsfw/tmtcpacket}/pus/tc/TcPacketBase.h (100%) rename {tmtcpacket => inc/fsfw/tmtcpacket}/pus/tc/TcPacketPus.h (100%) rename {tmtcpacket => inc/fsfw/tmtcpacket}/pus/tc/TcPacketStoredBase.h (100%) rename {tmtcpacket => inc/fsfw/tmtcpacket}/pus/tc/TcPacketStoredIF.h (100%) rename {tmtcpacket => inc/fsfw/tmtcpacket}/pus/tc/TcPacketStoredPus.h (100%) rename {tmtcpacket => inc/fsfw/tmtcpacket}/pus/tm.h (100%) rename {tmtcpacket => inc/fsfw/tmtcpacket}/pus/tm/TmPacketBase.h (100%) rename {tmtcpacket => inc/fsfw/tmtcpacket}/pus/tm/TmPacketMinimal.h (100%) rename {tmtcpacket => inc/fsfw/tmtcpacket}/pus/tm/TmPacketPusA.h (100%) rename {tmtcpacket => inc/fsfw/tmtcpacket}/pus/tm/TmPacketPusC.h (100%) rename {tmtcpacket => inc/fsfw/tmtcpacket}/pus/tm/TmPacketStored.h (100%) rename {tmtcpacket => inc/fsfw/tmtcpacket}/pus/tm/TmPacketStoredBase.h (100%) rename {tmtcpacket => inc/fsfw/tmtcpacket}/pus/tm/TmPacketStoredPusA.h (100%) rename {tmtcpacket => inc/fsfw/tmtcpacket}/pus/tm/TmPacketStoredPusC.h (100%) rename {tmtcservices => inc/fsfw/tmtcservices}/AcceptsTelecommandsIF.h (100%) rename {tmtcservices => inc/fsfw/tmtcservices}/AcceptsTelemetryIF.h (100%) rename {tmtcservices => inc/fsfw/tmtcservices}/AcceptsVerifyMessageIF.h (100%) rename {tmtcservices => inc/fsfw/tmtcservices}/CommandingServiceBase.h (100%) rename {tmtcservices => inc/fsfw/tmtcservices}/PusServiceBase.h (100%) rename {tmtcservices => inc/fsfw/tmtcservices}/PusVerificationReport.h (100%) rename {tmtcservices => inc/fsfw/tmtcservices}/SourceSequenceCounter.h (100%) rename {tmtcservices => inc/fsfw/tmtcservices}/TmTcBridge.h (100%) rename {tmtcservices => inc/fsfw/tmtcservices}/TmTcMessage.h (100%) rename {tmtcservices => inc/fsfw/tmtcservices}/VerificationCodes.h (100%) rename {tmtcservices => inc/fsfw/tmtcservices}/VerificationReporter.h (100%) rename {defaultcfg => misc/defaultcfg}/README.md (100%) rename {defaultcfg => misc/defaultcfg}/fsfwconfig/CMakeLists.txt (100%) rename {defaultcfg => misc/defaultcfg}/fsfwconfig/FSFWConfig.h (100%) rename {defaultcfg => misc/defaultcfg}/fsfwconfig/OBSWConfig.h (100%) rename {defaultcfg => misc/defaultcfg}/fsfwconfig/OBSWVersion.h (100%) rename {defaultcfg => misc/defaultcfg}/fsfwconfig/devices/logicalAddresses.h (100%) rename {defaultcfg => misc/defaultcfg}/fsfwconfig/devices/powerSwitcherList.h (100%) rename {defaultcfg => misc/defaultcfg}/fsfwconfig/events/subsystemIdRanges.h (100%) rename {defaultcfg => misc/defaultcfg}/fsfwconfig/fsfwconfig.mk (100%) rename {defaultcfg => misc/defaultcfg}/fsfwconfig/ipc/missionMessageTypes.cpp (100%) rename {defaultcfg => misc/defaultcfg}/fsfwconfig/ipc/missionMessageTypes.h (100%) rename {defaultcfg => misc/defaultcfg}/fsfwconfig/objects/FsfwFactory.cpp (100%) rename {defaultcfg => misc/defaultcfg}/fsfwconfig/objects/FsfwFactory.h (100%) rename {defaultcfg => misc/defaultcfg}/fsfwconfig/objects/systemObjectList.h (100%) rename {defaultcfg => misc/defaultcfg}/fsfwconfig/pollingsequence/PollingSequenceFactory.cpp (100%) rename {defaultcfg => misc/defaultcfg}/fsfwconfig/pollingsequence/PollingSequenceFactory.h (100%) rename {defaultcfg => misc/defaultcfg}/fsfwconfig/returnvalues/classIds.h (100%) rename {defaultcfg => misc/defaultcfg}/fsfwconfig/tmtc/apid.h (100%) rename {defaultcfg => misc/defaultcfg}/fsfwconfig/tmtc/pusIds.h (100%) rename {logo => misc/logo}/FSFW_Logo_V3.png (100%) rename {logo => misc/logo}/FSFW_Logo_V3.svg (100%) rename {logo => misc/logo}/FSFW_Logo_V3_bw.png (100%) rename {core/src => src/core}/action/ActionHelper.cpp (100%) rename {core/src => src/core}/action/ActionMessage.cpp (100%) rename {core/src => src/core}/action/CMakeLists.txt (100%) rename {core/src => src/core}/action/CommandActionHelper.cpp (100%) rename {core/src => src/core}/action/SimpleActionHelper.cpp (100%) rename {core/src => src/core}/container/CMakeLists.txt (100%) rename {core/src => src/core}/container/SharedRingBuffer.cpp (100%) rename {core/src => src/core}/container/SimpleRingBuffer.cpp (100%) rename {core/src => src/core}/controller/CMakeLists.txt (100%) rename {core/src => src/core}/controller/ControllerBase.cpp (100%) rename {core/src => src/core}/controller/ExtendedControllerBase.cpp (100%) rename {core/src => src/core}/datapool/CMakeLists.txt (100%) rename {core/src => src/core}/datapool/HkSwitchHelper.cpp (100%) rename {core/src => src/core}/datapool/PoolDataSetBase.cpp (100%) rename {core/src => src/core}/datapool/PoolEntry.cpp (100%) rename {core/src => src/core}/datapoollocal/CMakeLists.txt (100%) rename {core/src => src/core}/datapoollocal/LocalDataPoolManager.cpp (100%) rename {core/src => src/core}/datapoollocal/LocalDataSet.cpp (100%) rename {core/src => src/core}/datapoollocal/LocalPoolDataSetBase.cpp (100%) rename {core/src => src/core}/datapoollocal/LocalPoolObjectBase.cpp (100%) rename {core/src => src/core}/datapoollocal/SharedLocalDataSet.cpp (100%) rename {core/src => src/core}/datapoollocal/internal/CMakeLists.txt (100%) rename {core/src => src/core}/datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp (100%) rename {core/src => src/core}/datapoollocal/internal/HasLocalDpIFManagerAttorney.h (100%) rename {core/src => src/core}/datapoollocal/internal/HasLocalDpIFUserAttorney.cpp (100%) rename {core/src => src/core}/datapoollocal/internal/HasLocalDpIFUserAttorney.h (100%) rename {core/src => src/core}/datapoollocal/internal/LocalDpManagerAttorney.h (100%) rename {core/src => src/core}/datapoollocal/internal/LocalPoolDataSetAttorney.h (100%) rename {devicehandlers => src/core/devicehandlers}/AssemblyBase.cpp (100%) rename {devicehandlers => src/core/devicehandlers}/ChildHandlerBase.cpp (100%) rename {devicehandlers => src/core/devicehandlers}/ChildHandlerFDIR.cpp (100%) rename {devicehandlers => src/core/devicehandlers}/DeviceHandlerBase.cpp (100%) rename {devicehandlers => src/core/devicehandlers}/DeviceHandlerFailureIsolation.cpp (100%) rename {devicehandlers => src/core/devicehandlers}/DeviceHandlerMessage.cpp (100%) rename {devicehandlers => src/core/devicehandlers}/DeviceTmReportingWrapper.cpp (100%) rename {devicehandlers => src/core/devicehandlers}/HealthDevice.cpp (100%) rename {events => src/core/events}/CMakeLists.txt (100%) rename {events => src/core/events}/EventManager.cpp (100%) rename {events => src/core/events}/EventMessage.cpp (100%) rename {fdir => src/core/fdir}/CMakeLists.txt (100%) rename {fdir => src/core/fdir}/EventCorrelation.cpp (100%) rename {fdir => src/core/fdir}/FailureIsolationBase.cpp (100%) rename {fdir => src/core/fdir}/FaultCounter.cpp (100%) rename {globalfunctions => src/core/globalfunctions}/AsciiConverter.cpp (100%) rename {globalfunctions => src/core/globalfunctions}/CMakeLists.txt (100%) rename {globalfunctions => src/core/globalfunctions}/CRC.cpp (100%) rename {globalfunctions => src/core/globalfunctions}/DleEncoder.cpp (100%) rename {globalfunctions => src/core/globalfunctions}/PeriodicOperationDivider.cpp (100%) rename {globalfunctions => src/core/globalfunctions}/Type.cpp (100%) rename {globalfunctions => src/core/globalfunctions}/arrayprinter.cpp (100%) rename {globalfunctions => src/core/globalfunctions}/bitutility.cpp (100%) rename {globalfunctions => src/core/globalfunctions}/math/CMakeLists.txt (100%) rename {globalfunctions => src/core/globalfunctions}/math/QuaternionOperations.cpp (100%) rename {globalfunctions => src/core/globalfunctions}/timevalOperations.cpp (100%) rename {health => src/core/health}/CMakeLists.txt (100%) rename {health => src/core/health}/HealthHelper.cpp (100%) rename {health => src/core/health}/HealthMessage.cpp (100%) rename {health => src/core/health}/HealthTable.cpp (100%) rename {housekeeping => src/core/housekeeping}/HousekeepingMessage.cpp (100%) rename {housekeeping => src/core/housekeeping}/PeriodicHousekeepingHelper.cpp (100%) rename {internalError => src/core/internalError}/CMakeLists.txt (100%) rename {internalError => src/core/internalError}/InternalErrorReporter.cpp (100%) rename {ipc => src/core/ipc}/CMakeLists.txt (100%) rename {ipc => src/core/ipc}/CommandMessage.cpp (100%) rename {ipc => src/core/ipc}/CommandMessageCleaner.cpp (100%) rename {ipc => src/core/ipc}/MessageQueueMessage.cpp (100%) rename {modes => src/core/modes}/CMakeLists.txt (100%) rename {modes => src/core/modes}/ModeHelper.cpp (100%) rename {modes => src/core/modes}/ModeMessage.cpp (100%) rename {objectmanager => src/core/objectmanager}/CMakeLists.txt (100%) rename {objectmanager => src/core/objectmanager}/ObjectManager.cpp (100%) rename {objectmanager => src/core/objectmanager}/SystemObject.cpp (100%) rename {parameters => src/core/parameters}/CMakeLists.txt (100%) rename {parameters => src/core/parameters}/ParameterHelper.cpp (100%) rename {parameters => src/core/parameters}/ParameterMessage.cpp (100%) rename {parameters => src/core/parameters}/ParameterWrapper.cpp (100%) rename {power => src/core/power}/CMakeLists.txt (100%) rename {power => src/core/power}/Fuse.cpp (100%) rename {power => src/core/power}/PowerComponent.cpp (100%) rename {power => src/core/power}/PowerSensor.cpp (100%) rename {power => src/core/power}/PowerSwitcher.cpp (100%) rename {serialize => src/core/serialize}/CMakeLists.txt (100%) rename {serialize => src/core/serialize}/SerialBufferAdapter.cpp (100%) rename {serviceinterface => src/core/serviceinterface}/CMakeLists.txt (100%) rename {serviceinterface => src/core/serviceinterface}/ServiceInterfaceBuffer.cpp (100%) rename {serviceinterface => src/core/serviceinterface}/ServiceInterfacePrinter.cpp (100%) rename {serviceinterface => src/core/serviceinterface}/ServiceInterfaceStream.cpp (100%) rename {storagemanager => src/core/storagemanager}/CMakeLists.txt (100%) rename {storagemanager => src/core/storagemanager}/ConstStorageAccessor.cpp (100%) rename {storagemanager => src/core/storagemanager}/LocalPool.cpp (100%) rename {storagemanager => src/core/storagemanager}/PoolManager.cpp (100%) rename {storagemanager => src/core/storagemanager}/StorageAccessor.cpp (100%) rename {subsystem => src/core/subsystem}/CMakeLists.txt (100%) rename {subsystem => src/core/subsystem}/Subsystem.cpp (100%) rename {subsystem => src/core/subsystem}/SubsystemBase.cpp (100%) rename {subsystem => src/core/subsystem}/modes/CMakeLists.txt (100%) rename {subsystem => src/core/subsystem}/modes/ModeSequenceMessage.cpp (100%) rename {subsystem => src/core/subsystem}/modes/ModeStore.cpp (100%) rename {tasks => src/core/tasks}/CMakeLists.txt (100%) rename {tasks => src/core/tasks}/FixedSequenceSlot.cpp (100%) rename {tasks => src/core/tasks}/FixedSlotSequence.cpp (100%) rename {tcdistribution => src/core/tcdistribution}/CCSDSDistributor.cpp (100%) rename {tcdistribution => src/core/tcdistribution}/CMakeLists.txt (100%) rename {tcdistribution => src/core/tcdistribution}/PUSDistributor.cpp (100%) rename {tcdistribution => src/core/tcdistribution}/TcDistributor.cpp (100%) rename {tcdistribution => src/core/tcdistribution}/TcPacketCheck.cpp (100%) rename {thermal => src/core/thermal}/AbstractTemperatureSensor.cpp (100%) rename {thermal => src/core/thermal}/CMakeLists.txt (100%) rename {thermal => src/core/thermal}/Heater.cpp (100%) rename {thermal => src/core/thermal}/RedundantHeater.cpp (100%) rename {thermal => src/core/thermal}/ThermalComponent.cpp (100%) rename {thermal => src/core/thermal}/ThermalComponentCore.cpp (100%) rename {thermal => src/core/thermal}/ThermalModule.cpp (100%) rename {thermal => src/core/thermal}/ThermalMonitorReporter.cpp (100%) rename {timemanager => src/core/timemanager}/CCSDSTime.cpp (100%) rename {timemanager => src/core/timemanager}/CMakeLists.txt (100%) rename {timemanager => src/core/timemanager}/ClockCommon.cpp (100%) rename {timemanager => src/core/timemanager}/Countdown.cpp (100%) rename {timemanager => src/core/timemanager}/Stopwatch.cpp (100%) rename {timemanager => src/core/timemanager}/TimeMessage.cpp (100%) rename {timemanager => src/core/timemanager}/TimeStamper.cpp (100%) rename {tmtcpacket => src/core/tmtcpacket}/CMakeLists.txt (100%) rename {tmtcpacket => src/core/tmtcpacket}/SpacePacket.cpp (100%) rename {tmtcpacket => src/core/tmtcpacket}/SpacePacketBase.cpp (100%) rename {tmtcpacket => src/core/tmtcpacket}/packetmatcher/CMakeLists.txt (100%) rename {tmtcpacket => src/core/tmtcpacket}/packetmatcher/PacketMatchTree.cpp (100%) rename {tmtcpacket => src/core/tmtcpacket}/pus/CMakeLists.txt (100%) rename {tmtcpacket => src/core/tmtcpacket}/pus/tc/CMakeLists.txt (100%) rename {tmtcpacket => src/core/tmtcpacket}/pus/tc/TcPacketBase.cpp (100%) rename {tmtcpacket => src/core/tmtcpacket}/pus/tc/TcPacketPus.cpp (100%) rename {tmtcpacket => src/core/tmtcpacket}/pus/tc/TcPacketStoredBase.cpp (100%) rename {tmtcpacket => src/core/tmtcpacket}/pus/tc/TcPacketStoredPus.cpp (100%) rename {tmtcpacket => src/core/tmtcpacket}/pus/tm/CMakeLists.txt (100%) rename {tmtcpacket => src/core/tmtcpacket}/pus/tm/TmPacketBase.cpp (100%) rename {tmtcpacket => src/core/tmtcpacket}/pus/tm/TmPacketMinimal.cpp (100%) rename {tmtcpacket => src/core/tmtcpacket}/pus/tm/TmPacketPusA.cpp (100%) rename {tmtcpacket => src/core/tmtcpacket}/pus/tm/TmPacketPusC.cpp (100%) rename {tmtcpacket => src/core/tmtcpacket}/pus/tm/TmPacketStoredBase.cpp (100%) rename {tmtcpacket => src/core/tmtcpacket}/pus/tm/TmPacketStoredPusA.cpp (100%) rename {tmtcpacket => src/core/tmtcpacket}/pus/tm/TmPacketStoredPusC.cpp (100%) rename {tmtcservices => src/core/tmtcservices}/CMakeLists.txt (100%) rename {tmtcservices => src/core/tmtcservices}/CommandingServiceBase.cpp (100%) rename {tmtcservices => src/core/tmtcservices}/PusServiceBase.cpp (100%) rename {tmtcservices => src/core/tmtcservices}/PusVerificationReport.cpp (100%) rename {tmtcservices => src/core/tmtcservices}/TmTcBridge.cpp (100%) rename {tmtcservices => src/core/tmtcservices}/TmTcMessage.cpp (100%) rename {tmtcservices => src/core/tmtcservices}/VerificationReporter.cpp (100%) rename {opt/src => src/opt}/coordinates/CMakeLists.txt (100%) rename {opt/src => src/opt}/coordinates/CoordinateTransformations.cpp (100%) rename {opt/src => src/opt}/coordinates/Sgp4Propagator.cpp (100%) rename {opt/src => src/opt}/datalinklayer/CMakeLists.txt (100%) rename {opt/src => src/opt}/datalinklayer/Clcw.cpp (100%) rename {opt/src => src/opt}/datalinklayer/DataLinkLayer.cpp (100%) rename {opt/src => src/opt}/datalinklayer/Farm1StateLockout.cpp (100%) rename {opt/src => src/opt}/datalinklayer/Farm1StateOpen.cpp (100%) rename {opt/src => src/opt}/datalinklayer/Farm1StateWait.cpp (100%) rename {opt/src => src/opt}/datalinklayer/MapPacketExtraction.cpp (100%) rename {opt/src => src/opt}/datalinklayer/TcTransferFrame.cpp (100%) rename {opt/src => src/opt}/datalinklayer/TcTransferFrameLocal.cpp (100%) rename {opt/src => src/opt}/datalinklayer/VirtualChannelReception.cpp (100%) rename {memory => src/opt/memory}/CMakeLists.txt (100%) rename {memory => src/opt/memory}/GenericFileSystemMessage.cpp (100%) rename {memory => src/opt/memory}/MemoryHelper.cpp (100%) rename {memory => src/opt/memory}/MemoryMessage.cpp (100%) rename {monitoring => src/opt/monitoring}/CMakeLists.txt (100%) rename {monitoring => src/opt/monitoring}/LimitViolationReporter.cpp (100%) rename {monitoring => src/opt/monitoring}/MonitoringMessage.cpp (100%) rename {pus => src/opt/pus}/CMakeLists.txt (100%) rename {pus => src/opt/pus}/CService200ModeCommanding.cpp (100%) rename {pus => src/opt/pus}/CService201HealthCommanding.cpp (100%) rename {pus => src/opt/pus}/Service17Test.cpp (100%) rename {pus => src/opt/pus}/Service1TelecommandVerification.cpp (100%) rename {pus => src/opt/pus}/Service20ParameterManagement.cpp (100%) rename {pus => src/opt/pus}/Service2DeviceAccess.cpp (100%) rename {pus => src/opt/pus}/Service3Housekeeping.cpp (100%) rename {pus => src/opt/pus}/Service5EventReporting.cpp (100%) rename {pus => src/opt/pus}/Service8FunctionManagement.cpp (100%) rename {pus => src/opt/pus}/Service9TimeManagement.cpp (100%) rename {rmap => src/opt/rmap}/CMakeLists.txt (100%) rename {rmap => src/opt/rmap}/RMAP.cpp (100%) rename {rmap => src/opt/rmap}/RMAPCookie.cpp (100%) rename {rmap => src/opt/rmap}/RmapDeviceCommunicationIF.cpp (100%) rename {tmstorage => src/opt/tmstorage}/CMakeLists.txt (100%) rename {tmstorage => src/opt/tmstorage}/TmStoreMessage.cpp (100%) rename {osal => src/osal}/CMakeLists.txt (100%) rename {osal => src/osal}/common/CMakeLists.txt (100%) rename {osal => src/osal}/common/TcpIpBase.cpp (100%) rename {osal => src/osal}/common/TcpTmTcBridge.cpp (100%) rename {osal => src/osal}/common/TcpTmTcServer.cpp (100%) rename {osal => src/osal}/common/UdpTcPollingTask.cpp (100%) rename {osal => src/osal}/common/UdpTmTcBridge.cpp (100%) rename {osal => src/osal}/common/tcpipCommon.cpp (100%) rename {osal/FreeRTOS => src/osal/freertos}/BinSemaphUsingTask.cpp (100%) rename {osal/FreeRTOS => src/osal/freertos}/BinarySemaphore.cpp (100%) rename {osal/FreeRTOS => src/osal/freertos}/CMakeLists.txt (100%) rename {osal/FreeRTOS => src/osal/freertos}/Clock.cpp (100%) rename {osal/FreeRTOS => src/osal/freertos}/CountingSemaphUsingTask.cpp (100%) rename {osal/FreeRTOS => src/osal/freertos}/CountingSemaphore.cpp (100%) rename {osal/FreeRTOS => src/osal/freertos}/FixedTimeslotTask.cpp (100%) rename {osal/FreeRTOS => src/osal/freertos}/MessageQueue.cpp (100%) rename {osal/FreeRTOS => src/osal/freertos}/Mutex.cpp (100%) rename {osal/FreeRTOS => src/osal/freertos}/MutexFactory.cpp (100%) rename {osal/FreeRTOS => src/osal/freertos}/PeriodicTask.cpp (100%) rename {osal/FreeRTOS => src/osal/freertos}/QueueFactory.cpp (100%) rename {osal/FreeRTOS => src/osal/freertos}/QueueMapManager.cpp (100%) rename {osal/FreeRTOS => src/osal/freertos}/SemaphoreFactory.cpp (100%) rename {osal/FreeRTOS => src/osal/freertos}/TaskFactory.cpp (100%) rename {osal/FreeRTOS => src/osal/freertos}/TaskManagement.cpp (100%) rename {osal/FreeRTOS => src/osal/freertos}/Timekeeper.cpp (100%) rename {osal => src/osal}/host/CMakeLists.txt (100%) rename {osal => src/osal}/host/Clock.cpp (100%) rename {osal => src/osal}/host/FixedTimeslotTask.cpp (100%) rename {osal => src/osal}/host/MessageQueue.cpp (100%) rename {osal => src/osal}/host/MutexFactory.cpp (100%) rename {osal => src/osal}/host/PeriodicTask.cpp (100%) rename {osal => src/osal}/host/QueueFactory.cpp (100%) rename {osal => src/osal}/host/QueueMapManager.cpp (100%) rename {osal => src/osal}/host/SemaphoreFactory.cpp (100%) rename {osal => src/osal}/host/TaskFactory.cpp (100%) rename {osal => src/osal}/host/taskHelpers.cpp (100%) rename {osal => src/osal}/linux/BinarySemaphore.cpp (100%) rename {osal => src/osal}/linux/CMakeLists.txt (100%) rename {osal => src/osal}/linux/Clock.cpp (100%) rename {osal => src/osal}/linux/CountingSemaphore.cpp (100%) rename {osal => src/osal}/linux/FixedTimeslotTask.cpp (100%) rename {osal => src/osal}/linux/InternalErrorCodes.cpp (100%) rename {osal => src/osal}/linux/MessageQueue.cpp (100%) rename {osal => src/osal}/linux/Mutex.cpp (100%) rename {osal => src/osal}/linux/MutexFactory.cpp (100%) rename {osal => src/osal}/linux/PeriodicPosixTask.cpp (100%) rename {osal => src/osal}/linux/PosixThread.cpp (100%) rename {osal => src/osal}/linux/QueueFactory.cpp (100%) rename {osal => src/osal}/linux/SemaphoreFactory.cpp (100%) rename {osal => src/osal}/linux/TaskFactory.cpp (100%) rename {osal => src/osal}/linux/Timer.cpp (100%) rename {osal => src/osal}/linux/tcpipHelpers.cpp (100%) rename {osal => src/osal}/linux/unixUtility.cpp (100%) rename {osal => src/osal}/rtems/CMakeLists.txt (100%) rename {osal => src/osal}/rtems/Clock.cpp (100%) rename {osal => src/osal}/rtems/CpuUsage.cpp (100%) rename {osal => src/osal}/rtems/FixedTimeslotTask.cpp (100%) rename {osal => src/osal}/rtems/InitTask.cpp (100%) rename {osal => src/osal}/rtems/InternalErrorCodes.cpp (100%) rename {osal => src/osal}/rtems/MessageQueue.cpp (100%) rename {osal => src/osal}/rtems/Mutex.cpp (100%) rename {osal => src/osal}/rtems/MutexFactory.cpp (100%) rename {osal => src/osal}/rtems/PeriodicTask.cpp (100%) rename {osal => src/osal}/rtems/QueueFactory.cpp (100%) rename {osal => src/osal}/rtems/RTEMSTaskBase.cpp (100%) rename {osal => src/osal}/rtems/RtemsBasic.cpp (100%) rename {osal => src/osal}/rtems/TaskFactory.cpp (100%) rename {osal => src/osal}/windows/CMakeLists.txt (100%) rename {osal => src/osal}/windows/tcpipHelpers.cpp (100%) rename {osal => src/osal}/windows/winTaskHelpers.cpp (100%) rename {unittest => src/tests}/CMakeLists.txt (100%) rename {unittest => src/tests}/README.md (100%) rename {unittest => src/tests}/internal/CMakeLists.txt (100%) rename {unittest => src/tests}/internal/InternalUnitTester.cpp (100%) rename {unittest => src/tests}/internal/InternalUnitTester.h (100%) rename {unittest => src/tests}/internal/UnittDefinitions.cpp (100%) rename {unittest => src/tests}/internal/UnittDefinitions.h (100%) rename {unittest => src/tests}/internal/globalfunctions/CMakeLists.txt (100%) rename {unittest => src/tests}/internal/globalfunctions/TestArrayPrinter.cpp (100%) rename {unittest => src/tests}/internal/globalfunctions/TestArrayPrinter.h (100%) rename {unittest => src/tests}/internal/internal.mk (100%) rename {unittest => src/tests}/internal/osal/CMakeLists.txt (100%) rename {unittest => src/tests}/internal/osal/IntTestMq.cpp (100%) rename {unittest => src/tests}/internal/osal/IntTestMq.h (100%) rename {unittest => src/tests}/internal/osal/IntTestMutex.cpp (100%) rename {unittest => src/tests}/internal/osal/IntTestMutex.h (100%) rename {unittest => src/tests}/internal/osal/IntTestSemaphore.cpp (100%) rename {unittest => src/tests}/internal/osal/IntTestSemaphore.h (100%) rename {unittest => src/tests}/internal/serialize/CMakeLists.txt (100%) rename {unittest => src/tests}/internal/serialize/IntTestSerialization.cpp (100%) rename {unittest => src/tests}/internal/serialize/IntTestSerialization.h (100%) rename {unittest => src/tests}/lcov.sh (100%) rename {unittest => src/tests}/tests/CMakeLists.txt (100%) rename {unittest => src/tests}/tests/action/CMakeLists.txt (100%) rename {unittest => src/tests}/tests/action/TestActionHelper.cpp (100%) rename {unittest => src/tests}/tests/action/TestActionHelper.h (100%) rename {unittest => src/tests}/tests/container/CMakeLists.txt (100%) rename {unittest => src/tests}/tests/container/RingBufferTest.cpp (100%) rename {unittest => src/tests}/tests/container/TestArrayList.cpp (100%) rename {unittest => src/tests}/tests/container/TestDynamicFifo.cpp (100%) rename {unittest => src/tests}/tests/container/TestFifo.cpp (100%) rename {unittest => src/tests}/tests/container/TestFixedArrayList.cpp (100%) rename {unittest => src/tests}/tests/container/TestFixedMap.cpp (100%) rename {unittest => src/tests}/tests/container/TestFixedOrderedMultimap.cpp (100%) rename {unittest => src/tests}/tests/container/TestPlacementFactory.cpp (100%) rename {unittest => src/tests}/tests/datapoollocal/CMakeLists.txt (100%) rename {unittest => src/tests}/tests/datapoollocal/DataSetTest.cpp (100%) rename {unittest => src/tests}/tests/datapoollocal/LocalPoolManagerTest.cpp (100%) rename {unittest => src/tests}/tests/datapoollocal/LocalPoolOwnerBase.cpp (100%) rename {unittest => src/tests}/tests/datapoollocal/LocalPoolOwnerBase.h (100%) rename {unittest => src/tests}/tests/datapoollocal/LocalPoolVariableTest.cpp (100%) rename {unittest => src/tests}/tests/datapoollocal/LocalPoolVectorTest.cpp (100%) rename {unittest => src/tests}/tests/globalfunctions/CMakeLists.txt (100%) rename {unittest => src/tests}/tests/mocks/HkReceiverMock.h (100%) rename {unittest => src/tests}/tests/mocks/MessageQueueMockBase.h (100%) rename {unittest => src/tests}/tests/osal/CMakeLists.txt (100%) rename {unittest => src/tests}/tests/osal/TestMessageQueue.cpp (100%) rename {unittest => src/tests}/tests/osal/TestSemaphore.cpp (100%) rename {unittest => src/tests}/tests/serialize/CMakeLists.txt (100%) rename {unittest => src/tests}/tests/serialize/TestSerialBufferAdapter.cpp (100%) rename {unittest => src/tests}/tests/serialize/TestSerialLinkedPacket.cpp (100%) rename {unittest => src/tests}/tests/serialize/TestSerialLinkedPacket.h (100%) rename {unittest => src/tests}/tests/serialize/TestSerialization.cpp (100%) rename {unittest => src/tests}/tests/storagemanager/CMakeLists.txt (100%) rename {unittest => src/tests}/tests/storagemanager/TestNewAccessor.cpp (100%) rename {unittest => src/tests}/tests/storagemanager/TestPool.cpp (100%) rename {unittest => src/tests}/tests/tests.mk (100%) rename {unittest => src/tests}/tests/tmtcpacket/CMakeLists.txt (100%) rename {unittest => src/tests}/tests/tmtcpacket/PusTmTest.cpp (100%) rename {unittest => src/tests}/user/CMakeLists.txt (100%) rename {unittest => src/tests}/user/testcfg/CMakeLists.txt (100%) rename {unittest => src/tests}/user/testcfg/FSFWConfig.h (100%) rename {unittest => src/tests}/user/testcfg/Makefile-FSFW-Tests (100%) rename {unittest => src/tests}/user/testcfg/TestsConfig.h (100%) rename {unittest => src/tests}/user/testcfg/cdatapool/dataPoolInit.cpp (100%) rename {unittest => src/tests}/user/testcfg/cdatapool/dataPoolInit.h (100%) rename {unittest => src/tests}/user/testcfg/devices/logicalAddresses.cpp (100%) rename {unittest => src/tests}/user/testcfg/devices/logicalAddresses.h (100%) rename {unittest => src/tests}/user/testcfg/devices/powerSwitcherList.cpp (100%) rename {unittest => src/tests}/user/testcfg/devices/powerSwitcherList.h (100%) rename {unittest => src/tests}/user/testcfg/events/subsystemIdRanges.h (100%) rename {unittest => src/tests}/user/testcfg/ipc/MissionMessageTypes.cpp (100%) rename {unittest => src/tests}/user/testcfg/ipc/MissionMessageTypes.h (100%) rename {unittest => src/tests}/user/testcfg/objects/systemObjectList.h (100%) rename {unittest => src/tests}/user/testcfg/pollingsequence/PollingSequenceFactory.cpp (100%) rename {unittest => src/tests}/user/testcfg/pollingsequence/PollingSequenceFactory.h (100%) rename {unittest => src/tests}/user/testcfg/returnvalues/classIds.h (100%) rename {unittest => src/tests}/user/testcfg/testcfg.mk (100%) rename {unittest => src/tests}/user/testcfg/tmtc/apid.h (100%) rename {unittest => src/tests}/user/testcfg/tmtc/pusIds.h (100%) rename {unittest => src/tests}/user/testtemplate/TestTemplate.cpp (100%) rename {unittest => src/tests}/user/unittest/CMakeLists.txt (100%) rename {unittest => src/tests}/user/unittest/core/CMakeLists.txt (100%) rename {unittest => src/tests}/user/unittest/core/CatchDefinitions.cpp (100%) rename {unittest => src/tests}/user/unittest/core/CatchDefinitions.h (100%) rename {unittest => src/tests}/user/unittest/core/CatchFactory.cpp (100%) rename {unittest => src/tests}/user/unittest/core/CatchFactory.h (100%) rename {unittest => src/tests}/user/unittest/core/CatchRunner.cpp (100%) rename {unittest => src/tests}/user/unittest/core/CatchSetup.cpp (100%) rename {unittest => src/tests}/user/unittest/core/core.mk (100%) rename {unittest => src/tests}/user/unittest/core/printChar.cpp (100%) rename {unittest => src/tests}/user/unittest/core/printChar.h (100%) rename {unittest => src/tests}/user/unlockRealtime.sh (100%) diff --git a/fsfw.mk b/fsfw.mk deleted file mode 100644 index 0d72fae1..00000000 --- a/fsfw.mk +++ /dev/null @@ -1,75 +0,0 @@ -# This submake file needs to be included by the primary Makefile. -# This file needs FRAMEWORK_PATH and OS_FSFW set correctly by another Makefile. -# Valid API settings: rtems, linux, freeRTOS, host - -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/action/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/container/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/contrib/sgp4/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/controller/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/coordinates/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/datalinklayer/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/datapool/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/datapoollocal/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/datapoollocal/internal/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/housekeeping/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/devicehandlers/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/events/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/events/eventmatching/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/fdir/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/globalfunctions/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/globalfunctions/matching/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/globalfunctions/math/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/health/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/internalError/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/ipc/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/memory/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/modes/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/monitoring/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/objectmanager/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/*.cpp) - -# select the OS -ifeq ($(OS_FSFW),rtems) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/rtems/*.cpp) - -else ifeq ($(OS_FSFW),linux) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/linux/*.cpp) - -else ifeq ($(OS_FSFW),freeRTOS) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/FreeRTOS/*.cpp) - -else ifeq ($(OS_FSFW),host) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/host/*.cpp) -ifeq ($(OS),Windows_NT) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/osal/windows/*.cpp) -else -# For now, the linux UDP bridge sources needs to be included manually by upper makefile -# for host OS because we can't be sure the OS is linux. -# Following lines can be used to do this: -# CXXSRC += $(FRAMEWORK_PATH)/osal/linux/TcUnixUdpPollingTask.cpp -# CXXSRC += $(FRAMEWORK_PATH)/osal/linux/TmTcUnixUdpBridge.cpp -endif - -else -$(error invalid OS_FSFW specified, valid OS_FSFW are rtems, linux, freeRTOS, host) -endif - -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/parameters/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/power/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/returnvalues/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/rmap/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/serialize/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/serviceinterface/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/storagemanager/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/subsystem/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/subsystem/modes/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/tasks/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/tcdistribution/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/thermal/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/timemanager/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/tmstorage/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/tmtcpacket/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/tmtcpacket/packetmatcher/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/tmtcpacket/pus/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/tmtcservices/*.cpp) -CXXSRC += $(wildcard $(FRAMEWORK_PATH)/pus/*.cpp) diff --git a/FSFW.h b/inc/fsfw/FSFW.h similarity index 100% rename from FSFW.h rename to inc/fsfw/FSFW.h diff --git a/FSFWVersion.h b/inc/fsfw/FSFWVersion.h similarity index 100% rename from FSFWVersion.h rename to inc/fsfw/FSFWVersion.h diff --git a/core/inc/fsfw/action/ActionHelper.h b/inc/fsfw/action/ActionHelper.h similarity index 100% rename from core/inc/fsfw/action/ActionHelper.h rename to inc/fsfw/action/ActionHelper.h diff --git a/core/inc/fsfw/action/ActionMessage.h b/inc/fsfw/action/ActionMessage.h similarity index 100% rename from core/inc/fsfw/action/ActionMessage.h rename to inc/fsfw/action/ActionMessage.h diff --git a/core/inc/fsfw/action/CommandActionHelper.h b/inc/fsfw/action/CommandActionHelper.h similarity index 100% rename from core/inc/fsfw/action/CommandActionHelper.h rename to inc/fsfw/action/CommandActionHelper.h diff --git a/core/inc/fsfw/action/CommandsActionsIF.h b/inc/fsfw/action/CommandsActionsIF.h similarity index 100% rename from core/inc/fsfw/action/CommandsActionsIF.h rename to inc/fsfw/action/CommandsActionsIF.h diff --git a/core/inc/fsfw/action/HasActionsIF.h b/inc/fsfw/action/HasActionsIF.h similarity index 100% rename from core/inc/fsfw/action/HasActionsIF.h rename to inc/fsfw/action/HasActionsIF.h diff --git a/core/inc/fsfw/action/SimpleActionHelper.h b/inc/fsfw/action/SimpleActionHelper.h similarity index 100% rename from core/inc/fsfw/action/SimpleActionHelper.h rename to inc/fsfw/action/SimpleActionHelper.h diff --git a/core/inc/fsfw/container/ArrayList.h b/inc/fsfw/container/ArrayList.h similarity index 100% rename from core/inc/fsfw/container/ArrayList.h rename to inc/fsfw/container/ArrayList.h diff --git a/core/inc/fsfw/container/BinaryTree.h b/inc/fsfw/container/BinaryTree.h similarity index 100% rename from core/inc/fsfw/container/BinaryTree.h rename to inc/fsfw/container/BinaryTree.h diff --git a/core/inc/fsfw/container/DynamicFIFO.h b/inc/fsfw/container/DynamicFIFO.h similarity index 100% rename from core/inc/fsfw/container/DynamicFIFO.h rename to inc/fsfw/container/DynamicFIFO.h diff --git a/core/inc/fsfw/container/FIFO.h b/inc/fsfw/container/FIFO.h similarity index 100% rename from core/inc/fsfw/container/FIFO.h rename to inc/fsfw/container/FIFO.h diff --git a/core/inc/fsfw/container/FIFOBase.h b/inc/fsfw/container/FIFOBase.h similarity index 100% rename from core/inc/fsfw/container/FIFOBase.h rename to inc/fsfw/container/FIFOBase.h diff --git a/core/inc/fsfw/container/FIFOBase.tpp b/inc/fsfw/container/FIFOBase.tpp similarity index 100% rename from core/inc/fsfw/container/FIFOBase.tpp rename to inc/fsfw/container/FIFOBase.tpp diff --git a/core/inc/fsfw/container/FixedArrayList.h b/inc/fsfw/container/FixedArrayList.h similarity index 100% rename from core/inc/fsfw/container/FixedArrayList.h rename to inc/fsfw/container/FixedArrayList.h diff --git a/core/inc/fsfw/container/FixedMap.h b/inc/fsfw/container/FixedMap.h similarity index 100% rename from core/inc/fsfw/container/FixedMap.h rename to inc/fsfw/container/FixedMap.h diff --git a/core/inc/fsfw/container/FixedOrderedMultimap.h b/inc/fsfw/container/FixedOrderedMultimap.h similarity index 100% rename from core/inc/fsfw/container/FixedOrderedMultimap.h rename to inc/fsfw/container/FixedOrderedMultimap.h diff --git a/core/inc/fsfw/container/FixedOrderedMultimap.tpp b/inc/fsfw/container/FixedOrderedMultimap.tpp similarity index 100% rename from core/inc/fsfw/container/FixedOrderedMultimap.tpp rename to inc/fsfw/container/FixedOrderedMultimap.tpp diff --git a/core/inc/fsfw/container/HybridIterator.h b/inc/fsfw/container/HybridIterator.h similarity index 100% rename from core/inc/fsfw/container/HybridIterator.h rename to inc/fsfw/container/HybridIterator.h diff --git a/core/inc/fsfw/container/IndexedRingMemoryArray.h b/inc/fsfw/container/IndexedRingMemoryArray.h similarity index 100% rename from core/inc/fsfw/container/IndexedRingMemoryArray.h rename to inc/fsfw/container/IndexedRingMemoryArray.h diff --git a/core/inc/fsfw/container/PlacementFactory.h b/inc/fsfw/container/PlacementFactory.h similarity index 100% rename from core/inc/fsfw/container/PlacementFactory.h rename to inc/fsfw/container/PlacementFactory.h diff --git a/core/inc/fsfw/container/RingBufferBase.h b/inc/fsfw/container/RingBufferBase.h similarity index 100% rename from core/inc/fsfw/container/RingBufferBase.h rename to inc/fsfw/container/RingBufferBase.h diff --git a/core/inc/fsfw/container/SharedRingBuffer.h b/inc/fsfw/container/SharedRingBuffer.h similarity index 100% rename from core/inc/fsfw/container/SharedRingBuffer.h rename to inc/fsfw/container/SharedRingBuffer.h diff --git a/core/inc/fsfw/container/SimpleRingBuffer.h b/inc/fsfw/container/SimpleRingBuffer.h similarity index 100% rename from core/inc/fsfw/container/SimpleRingBuffer.h rename to inc/fsfw/container/SimpleRingBuffer.h diff --git a/core/inc/fsfw/container/SinglyLinkedList.h b/inc/fsfw/container/SinglyLinkedList.h similarity index 100% rename from core/inc/fsfw/container/SinglyLinkedList.h rename to inc/fsfw/container/SinglyLinkedList.h diff --git a/core/inc/fsfw/container/group.h b/inc/fsfw/container/group.h similarity index 100% rename from core/inc/fsfw/container/group.h rename to inc/fsfw/container/group.h diff --git a/core/inc/fsfw/controller/ControllerBase.h b/inc/fsfw/controller/ControllerBase.h similarity index 100% rename from core/inc/fsfw/controller/ControllerBase.h rename to inc/fsfw/controller/ControllerBase.h diff --git a/core/inc/fsfw/controller/ExtendedControllerBase.h b/inc/fsfw/controller/ExtendedControllerBase.h similarity index 100% rename from core/inc/fsfw/controller/ExtendedControllerBase.h rename to inc/fsfw/controller/ExtendedControllerBase.h diff --git a/opt/inc/fsfw/coordinates/CoordinateTransformations.h b/inc/fsfw/coordinates/CoordinateTransformations.h similarity index 100% rename from opt/inc/fsfw/coordinates/CoordinateTransformations.h rename to inc/fsfw/coordinates/CoordinateTransformations.h diff --git a/opt/inc/fsfw/coordinates/Jgm3Model.h b/inc/fsfw/coordinates/Jgm3Model.h similarity index 100% rename from opt/inc/fsfw/coordinates/Jgm3Model.h rename to inc/fsfw/coordinates/Jgm3Model.h diff --git a/opt/inc/fsfw/coordinates/Sgp4Propagator.h b/inc/fsfw/coordinates/Sgp4Propagator.h similarity index 100% rename from opt/inc/fsfw/coordinates/Sgp4Propagator.h rename to inc/fsfw/coordinates/Sgp4Propagator.h diff --git a/opt/inc/fsfw/datalinklayer/BCFrame.h b/inc/fsfw/datalinklayer/BCFrame.h similarity index 100% rename from opt/inc/fsfw/datalinklayer/BCFrame.h rename to inc/fsfw/datalinklayer/BCFrame.h diff --git a/opt/inc/fsfw/datalinklayer/CCSDSReturnValuesIF.h b/inc/fsfw/datalinklayer/CCSDSReturnValuesIF.h similarity index 100% rename from opt/inc/fsfw/datalinklayer/CCSDSReturnValuesIF.h rename to inc/fsfw/datalinklayer/CCSDSReturnValuesIF.h diff --git a/opt/inc/fsfw/datalinklayer/Clcw.h b/inc/fsfw/datalinklayer/Clcw.h similarity index 100% rename from opt/inc/fsfw/datalinklayer/Clcw.h rename to inc/fsfw/datalinklayer/Clcw.h diff --git a/opt/inc/fsfw/datalinklayer/ClcwIF.h b/inc/fsfw/datalinklayer/ClcwIF.h similarity index 100% rename from opt/inc/fsfw/datalinklayer/ClcwIF.h rename to inc/fsfw/datalinklayer/ClcwIF.h diff --git a/opt/inc/fsfw/datalinklayer/DataLinkLayer.h b/inc/fsfw/datalinklayer/DataLinkLayer.h similarity index 100% rename from opt/inc/fsfw/datalinklayer/DataLinkLayer.h rename to inc/fsfw/datalinklayer/DataLinkLayer.h diff --git a/opt/inc/fsfw/datalinklayer/Farm1StateIF.h b/inc/fsfw/datalinklayer/Farm1StateIF.h similarity index 100% rename from opt/inc/fsfw/datalinklayer/Farm1StateIF.h rename to inc/fsfw/datalinklayer/Farm1StateIF.h diff --git a/opt/inc/fsfw/datalinklayer/Farm1StateLockout.h b/inc/fsfw/datalinklayer/Farm1StateLockout.h similarity index 100% rename from opt/inc/fsfw/datalinklayer/Farm1StateLockout.h rename to inc/fsfw/datalinklayer/Farm1StateLockout.h diff --git a/opt/inc/fsfw/datalinklayer/Farm1StateOpen.h b/inc/fsfw/datalinklayer/Farm1StateOpen.h similarity index 100% rename from opt/inc/fsfw/datalinklayer/Farm1StateOpen.h rename to inc/fsfw/datalinklayer/Farm1StateOpen.h diff --git a/opt/inc/fsfw/datalinklayer/Farm1StateWait.h b/inc/fsfw/datalinklayer/Farm1StateWait.h similarity index 100% rename from opt/inc/fsfw/datalinklayer/Farm1StateWait.h rename to inc/fsfw/datalinklayer/Farm1StateWait.h diff --git a/opt/inc/fsfw/datalinklayer/MapPacketExtraction.h b/inc/fsfw/datalinklayer/MapPacketExtraction.h similarity index 100% rename from opt/inc/fsfw/datalinklayer/MapPacketExtraction.h rename to inc/fsfw/datalinklayer/MapPacketExtraction.h diff --git a/opt/inc/fsfw/datalinklayer/MapPacketExtractionIF.h b/inc/fsfw/datalinklayer/MapPacketExtractionIF.h similarity index 100% rename from opt/inc/fsfw/datalinklayer/MapPacketExtractionIF.h rename to inc/fsfw/datalinklayer/MapPacketExtractionIF.h diff --git a/opt/inc/fsfw/datalinklayer/TcTransferFrame.h b/inc/fsfw/datalinklayer/TcTransferFrame.h similarity index 100% rename from opt/inc/fsfw/datalinklayer/TcTransferFrame.h rename to inc/fsfw/datalinklayer/TcTransferFrame.h diff --git a/opt/inc/fsfw/datalinklayer/TcTransferFrameLocal.h b/inc/fsfw/datalinklayer/TcTransferFrameLocal.h similarity index 100% rename from opt/inc/fsfw/datalinklayer/TcTransferFrameLocal.h rename to inc/fsfw/datalinklayer/TcTransferFrameLocal.h diff --git a/opt/inc/fsfw/datalinklayer/VirtualChannelReception.h b/inc/fsfw/datalinklayer/VirtualChannelReception.h similarity index 100% rename from opt/inc/fsfw/datalinklayer/VirtualChannelReception.h rename to inc/fsfw/datalinklayer/VirtualChannelReception.h diff --git a/opt/inc/fsfw/datalinklayer/VirtualChannelReceptionIF.h b/inc/fsfw/datalinklayer/VirtualChannelReceptionIF.h similarity index 100% rename from opt/inc/fsfw/datalinklayer/VirtualChannelReceptionIF.h rename to inc/fsfw/datalinklayer/VirtualChannelReceptionIF.h diff --git a/core/inc/fsfw/datapool/DataSetIF.h b/inc/fsfw/datapool/DataSetIF.h similarity index 100% rename from core/inc/fsfw/datapool/DataSetIF.h rename to inc/fsfw/datapool/DataSetIF.h diff --git a/core/inc/fsfw/datapool/HkSwitchHelper.h b/inc/fsfw/datapool/HkSwitchHelper.h similarity index 100% rename from core/inc/fsfw/datapool/HkSwitchHelper.h rename to inc/fsfw/datapool/HkSwitchHelper.h diff --git a/core/inc/fsfw/datapool/PoolDataSetBase.h b/inc/fsfw/datapool/PoolDataSetBase.h similarity index 100% rename from core/inc/fsfw/datapool/PoolDataSetBase.h rename to inc/fsfw/datapool/PoolDataSetBase.h diff --git a/core/inc/fsfw/datapool/PoolDataSetIF.h b/inc/fsfw/datapool/PoolDataSetIF.h similarity index 100% rename from core/inc/fsfw/datapool/PoolDataSetIF.h rename to inc/fsfw/datapool/PoolDataSetIF.h diff --git a/core/inc/fsfw/datapool/PoolEntry.h b/inc/fsfw/datapool/PoolEntry.h similarity index 100% rename from core/inc/fsfw/datapool/PoolEntry.h rename to inc/fsfw/datapool/PoolEntry.h diff --git a/core/inc/fsfw/datapool/PoolEntryIF.h b/inc/fsfw/datapool/PoolEntryIF.h similarity index 100% rename from core/inc/fsfw/datapool/PoolEntryIF.h rename to inc/fsfw/datapool/PoolEntryIF.h diff --git a/core/inc/fsfw/datapool/PoolReadGuard.h b/inc/fsfw/datapool/PoolReadGuard.h similarity index 100% rename from core/inc/fsfw/datapool/PoolReadGuard.h rename to inc/fsfw/datapool/PoolReadGuard.h diff --git a/core/inc/fsfw/datapool/PoolVarList.h b/inc/fsfw/datapool/PoolVarList.h similarity index 100% rename from core/inc/fsfw/datapool/PoolVarList.h rename to inc/fsfw/datapool/PoolVarList.h diff --git a/core/inc/fsfw/datapool/PoolVariableIF.h b/inc/fsfw/datapool/PoolVariableIF.h similarity index 100% rename from core/inc/fsfw/datapool/PoolVariableIF.h rename to inc/fsfw/datapool/PoolVariableIF.h diff --git a/core/inc/fsfw/datapool/ReadCommitIF.h b/inc/fsfw/datapool/ReadCommitIF.h similarity index 100% rename from core/inc/fsfw/datapool/ReadCommitIF.h rename to inc/fsfw/datapool/ReadCommitIF.h diff --git a/core/inc/fsfw/datapool/ReadCommitIFAttorney.h b/inc/fsfw/datapool/ReadCommitIFAttorney.h similarity index 100% rename from core/inc/fsfw/datapool/ReadCommitIFAttorney.h rename to inc/fsfw/datapool/ReadCommitIFAttorney.h diff --git a/core/inc/fsfw/datapool/SharedDataSetIF.h b/inc/fsfw/datapool/SharedDataSetIF.h similarity index 100% rename from core/inc/fsfw/datapool/SharedDataSetIF.h rename to inc/fsfw/datapool/SharedDataSetIF.h diff --git a/core/inc/fsfw/datapoollocal.h b/inc/fsfw/datapoollocal.h similarity index 100% rename from core/inc/fsfw/datapoollocal.h rename to inc/fsfw/datapoollocal.h diff --git a/core/inc/fsfw/datapoollocal/AccessLocalPoolF.h b/inc/fsfw/datapoollocal/AccessLocalPoolF.h similarity index 100% rename from core/inc/fsfw/datapoollocal/AccessLocalPoolF.h rename to inc/fsfw/datapoollocal/AccessLocalPoolF.h diff --git a/core/inc/fsfw/datapoollocal/HasLocalDataPoolIF.h b/inc/fsfw/datapoollocal/HasLocalDataPoolIF.h similarity index 100% rename from core/inc/fsfw/datapoollocal/HasLocalDataPoolIF.h rename to inc/fsfw/datapoollocal/HasLocalDataPoolIF.h diff --git a/core/inc/fsfw/datapoollocal/LocalDataPoolManager.h b/inc/fsfw/datapoollocal/LocalDataPoolManager.h similarity index 100% rename from core/inc/fsfw/datapoollocal/LocalDataPoolManager.h rename to inc/fsfw/datapoollocal/LocalDataPoolManager.h diff --git a/core/inc/fsfw/datapoollocal/LocalDataSet.h b/inc/fsfw/datapoollocal/LocalDataSet.h similarity index 100% rename from core/inc/fsfw/datapoollocal/LocalDataSet.h rename to inc/fsfw/datapoollocal/LocalDataSet.h diff --git a/core/inc/fsfw/datapoollocal/LocalPoolDataSetBase.h b/inc/fsfw/datapoollocal/LocalPoolDataSetBase.h similarity index 100% rename from core/inc/fsfw/datapoollocal/LocalPoolDataSetBase.h rename to inc/fsfw/datapoollocal/LocalPoolDataSetBase.h diff --git a/core/inc/fsfw/datapoollocal/LocalPoolObjectBase.h b/inc/fsfw/datapoollocal/LocalPoolObjectBase.h similarity index 100% rename from core/inc/fsfw/datapoollocal/LocalPoolObjectBase.h rename to inc/fsfw/datapoollocal/LocalPoolObjectBase.h diff --git a/core/inc/fsfw/datapoollocal/LocalPoolVariable.h b/inc/fsfw/datapoollocal/LocalPoolVariable.h similarity index 100% rename from core/inc/fsfw/datapoollocal/LocalPoolVariable.h rename to inc/fsfw/datapoollocal/LocalPoolVariable.h diff --git a/core/inc/fsfw/datapoollocal/LocalPoolVariable.tpp b/inc/fsfw/datapoollocal/LocalPoolVariable.tpp similarity index 100% rename from core/inc/fsfw/datapoollocal/LocalPoolVariable.tpp rename to inc/fsfw/datapoollocal/LocalPoolVariable.tpp diff --git a/core/inc/fsfw/datapoollocal/LocalPoolVector.h b/inc/fsfw/datapoollocal/LocalPoolVector.h similarity index 100% rename from core/inc/fsfw/datapoollocal/LocalPoolVector.h rename to inc/fsfw/datapoollocal/LocalPoolVector.h diff --git a/core/inc/fsfw/datapoollocal/LocalPoolVector.tpp b/inc/fsfw/datapoollocal/LocalPoolVector.tpp similarity index 100% rename from core/inc/fsfw/datapoollocal/LocalPoolVector.tpp rename to inc/fsfw/datapoollocal/LocalPoolVector.tpp diff --git a/core/inc/fsfw/datapoollocal/MarkChangedIF.h b/inc/fsfw/datapoollocal/MarkChangedIF.h similarity index 100% rename from core/inc/fsfw/datapoollocal/MarkChangedIF.h rename to inc/fsfw/datapoollocal/MarkChangedIF.h diff --git a/core/inc/fsfw/datapoollocal/ProvidesDataPoolSubscriptionIF.h b/inc/fsfw/datapoollocal/ProvidesDataPoolSubscriptionIF.h similarity index 100% rename from core/inc/fsfw/datapoollocal/ProvidesDataPoolSubscriptionIF.h rename to inc/fsfw/datapoollocal/ProvidesDataPoolSubscriptionIF.h diff --git a/core/inc/fsfw/datapoollocal/SharedLocalDataSet.h b/inc/fsfw/datapoollocal/SharedLocalDataSet.h similarity index 100% rename from core/inc/fsfw/datapoollocal/SharedLocalDataSet.h rename to inc/fsfw/datapoollocal/SharedLocalDataSet.h diff --git a/core/inc/fsfw/datapoollocal/StaticLocalDataSet.h b/inc/fsfw/datapoollocal/StaticLocalDataSet.h similarity index 100% rename from core/inc/fsfw/datapoollocal/StaticLocalDataSet.h rename to inc/fsfw/datapoollocal/StaticLocalDataSet.h diff --git a/core/inc/fsfw/datapoollocal/localPoolDefinitions.h b/inc/fsfw/datapoollocal/localPoolDefinitions.h similarity index 100% rename from core/inc/fsfw/datapoollocal/localPoolDefinitions.h rename to inc/fsfw/datapoollocal/localPoolDefinitions.h diff --git a/devicehandlers/AcceptsDeviceResponsesIF.h b/inc/fsfw/devicehandlers/AcceptsDeviceResponsesIF.h similarity index 100% rename from devicehandlers/AcceptsDeviceResponsesIF.h rename to inc/fsfw/devicehandlers/AcceptsDeviceResponsesIF.h diff --git a/devicehandlers/AssemblyBase.h b/inc/fsfw/devicehandlers/AssemblyBase.h similarity index 100% rename from devicehandlers/AssemblyBase.h rename to inc/fsfw/devicehandlers/AssemblyBase.h diff --git a/devicehandlers/CMakeLists.txt b/inc/fsfw/devicehandlers/CMakeLists.txt similarity index 100% rename from devicehandlers/CMakeLists.txt rename to inc/fsfw/devicehandlers/CMakeLists.txt diff --git a/devicehandlers/ChildHandlerBase.h b/inc/fsfw/devicehandlers/ChildHandlerBase.h similarity index 100% rename from devicehandlers/ChildHandlerBase.h rename to inc/fsfw/devicehandlers/ChildHandlerBase.h diff --git a/devicehandlers/ChildHandlerFDIR.h b/inc/fsfw/devicehandlers/ChildHandlerFDIR.h similarity index 100% rename from devicehandlers/ChildHandlerFDIR.h rename to inc/fsfw/devicehandlers/ChildHandlerFDIR.h diff --git a/devicehandlers/CookieIF.h b/inc/fsfw/devicehandlers/CookieIF.h similarity index 100% rename from devicehandlers/CookieIF.h rename to inc/fsfw/devicehandlers/CookieIF.h diff --git a/devicehandlers/DeviceCommunicationIF.h b/inc/fsfw/devicehandlers/DeviceCommunicationIF.h similarity index 100% rename from devicehandlers/DeviceCommunicationIF.h rename to inc/fsfw/devicehandlers/DeviceCommunicationIF.h diff --git a/devicehandlers/DeviceHandlerBase.h b/inc/fsfw/devicehandlers/DeviceHandlerBase.h similarity index 100% rename from devicehandlers/DeviceHandlerBase.h rename to inc/fsfw/devicehandlers/DeviceHandlerBase.h diff --git a/devicehandlers/DeviceHandlerFailureIsolation.h b/inc/fsfw/devicehandlers/DeviceHandlerFailureIsolation.h similarity index 100% rename from devicehandlers/DeviceHandlerFailureIsolation.h rename to inc/fsfw/devicehandlers/DeviceHandlerFailureIsolation.h diff --git a/devicehandlers/DeviceHandlerIF.h b/inc/fsfw/devicehandlers/DeviceHandlerIF.h similarity index 100% rename from devicehandlers/DeviceHandlerIF.h rename to inc/fsfw/devicehandlers/DeviceHandlerIF.h diff --git a/devicehandlers/DeviceHandlerMessage.h b/inc/fsfw/devicehandlers/DeviceHandlerMessage.h similarity index 100% rename from devicehandlers/DeviceHandlerMessage.h rename to inc/fsfw/devicehandlers/DeviceHandlerMessage.h diff --git a/devicehandlers/DeviceHandlerThermalSet.h b/inc/fsfw/devicehandlers/DeviceHandlerThermalSet.h similarity index 100% rename from devicehandlers/DeviceHandlerThermalSet.h rename to inc/fsfw/devicehandlers/DeviceHandlerThermalSet.h diff --git a/devicehandlers/DeviceTmReportingWrapper.h b/inc/fsfw/devicehandlers/DeviceTmReportingWrapper.h similarity index 100% rename from devicehandlers/DeviceTmReportingWrapper.h rename to inc/fsfw/devicehandlers/DeviceTmReportingWrapper.h diff --git a/devicehandlers/HealthDevice.h b/inc/fsfw/devicehandlers/HealthDevice.h similarity index 100% rename from devicehandlers/HealthDevice.h rename to inc/fsfw/devicehandlers/HealthDevice.h diff --git a/events/Event.h b/inc/fsfw/events/Event.h similarity index 100% rename from events/Event.h rename to inc/fsfw/events/Event.h diff --git a/events/EventManager.h b/inc/fsfw/events/EventManager.h similarity index 100% rename from events/EventManager.h rename to inc/fsfw/events/EventManager.h diff --git a/events/EventManagerIF.h b/inc/fsfw/events/EventManagerIF.h similarity index 100% rename from events/EventManagerIF.h rename to inc/fsfw/events/EventManagerIF.h diff --git a/events/EventMessage.h b/inc/fsfw/events/EventMessage.h similarity index 100% rename from events/EventMessage.h rename to inc/fsfw/events/EventMessage.h diff --git a/events/EventReportingProxyIF.h b/inc/fsfw/events/EventReportingProxyIF.h similarity index 100% rename from events/EventReportingProxyIF.h rename to inc/fsfw/events/EventReportingProxyIF.h diff --git a/events/eventmatching/CMakeLists.txt b/inc/fsfw/events/eventmatching/CMakeLists.txt similarity index 100% rename from events/eventmatching/CMakeLists.txt rename to inc/fsfw/events/eventmatching/CMakeLists.txt diff --git a/events/eventmatching/EventIdRangeMatcher.cpp b/inc/fsfw/events/eventmatching/EventIdRangeMatcher.cpp similarity index 100% rename from events/eventmatching/EventIdRangeMatcher.cpp rename to inc/fsfw/events/eventmatching/EventIdRangeMatcher.cpp diff --git a/events/eventmatching/EventIdRangeMatcher.h b/inc/fsfw/events/eventmatching/EventIdRangeMatcher.h similarity index 100% rename from events/eventmatching/EventIdRangeMatcher.h rename to inc/fsfw/events/eventmatching/EventIdRangeMatcher.h diff --git a/events/eventmatching/EventMatchTree.cpp b/inc/fsfw/events/eventmatching/EventMatchTree.cpp similarity index 100% rename from events/eventmatching/EventMatchTree.cpp rename to inc/fsfw/events/eventmatching/EventMatchTree.cpp diff --git a/events/eventmatching/EventMatchTree.h b/inc/fsfw/events/eventmatching/EventMatchTree.h similarity index 100% rename from events/eventmatching/EventMatchTree.h rename to inc/fsfw/events/eventmatching/EventMatchTree.h diff --git a/events/eventmatching/EventRangeMatcherBase.h b/inc/fsfw/events/eventmatching/EventRangeMatcherBase.h similarity index 100% rename from events/eventmatching/EventRangeMatcherBase.h rename to inc/fsfw/events/eventmatching/EventRangeMatcherBase.h diff --git a/events/eventmatching/ReporterRangeMatcher.cpp b/inc/fsfw/events/eventmatching/ReporterRangeMatcher.cpp similarity index 100% rename from events/eventmatching/ReporterRangeMatcher.cpp rename to inc/fsfw/events/eventmatching/ReporterRangeMatcher.cpp diff --git a/events/eventmatching/ReporterRangeMatcher.h b/inc/fsfw/events/eventmatching/ReporterRangeMatcher.h similarity index 100% rename from events/eventmatching/ReporterRangeMatcher.h rename to inc/fsfw/events/eventmatching/ReporterRangeMatcher.h diff --git a/events/eventmatching/SeverityRangeMatcher.cpp b/inc/fsfw/events/eventmatching/SeverityRangeMatcher.cpp similarity index 100% rename from events/eventmatching/SeverityRangeMatcher.cpp rename to inc/fsfw/events/eventmatching/SeverityRangeMatcher.cpp diff --git a/events/eventmatching/SeverityRangeMatcher.h b/inc/fsfw/events/eventmatching/SeverityRangeMatcher.h similarity index 100% rename from events/eventmatching/SeverityRangeMatcher.h rename to inc/fsfw/events/eventmatching/SeverityRangeMatcher.h diff --git a/events/eventmatching/eventmatching.h b/inc/fsfw/events/eventmatching/eventmatching.h similarity index 100% rename from events/eventmatching/eventmatching.h rename to inc/fsfw/events/eventmatching/eventmatching.h diff --git a/events/fwSubsystemIdRanges.h b/inc/fsfw/events/fwSubsystemIdRanges.h similarity index 100% rename from events/fwSubsystemIdRanges.h rename to inc/fsfw/events/fwSubsystemIdRanges.h diff --git a/fdir/ConfirmsFailuresIF.h b/inc/fsfw/fdir/ConfirmsFailuresIF.h similarity index 100% rename from fdir/ConfirmsFailuresIF.h rename to inc/fsfw/fdir/ConfirmsFailuresIF.h diff --git a/fdir/EventCorrelation.h b/inc/fsfw/fdir/EventCorrelation.h similarity index 100% rename from fdir/EventCorrelation.h rename to inc/fsfw/fdir/EventCorrelation.h diff --git a/fdir/FailureIsolationBase.h b/inc/fsfw/fdir/FailureIsolationBase.h similarity index 100% rename from fdir/FailureIsolationBase.h rename to inc/fsfw/fdir/FailureIsolationBase.h diff --git a/fdir/FaultCounter.h b/inc/fsfw/fdir/FaultCounter.h similarity index 100% rename from fdir/FaultCounter.h rename to inc/fsfw/fdir/FaultCounter.h diff --git a/globalfunctions/AsciiConverter.h b/inc/fsfw/globalfunctions/AsciiConverter.h similarity index 100% rename from globalfunctions/AsciiConverter.h rename to inc/fsfw/globalfunctions/AsciiConverter.h diff --git a/globalfunctions/CRC.h b/inc/fsfw/globalfunctions/CRC.h similarity index 100% rename from globalfunctions/CRC.h rename to inc/fsfw/globalfunctions/CRC.h diff --git a/globalfunctions/DleEncoder.h b/inc/fsfw/globalfunctions/DleEncoder.h similarity index 100% rename from globalfunctions/DleEncoder.h rename to inc/fsfw/globalfunctions/DleEncoder.h diff --git a/globalfunctions/PeriodicOperationDivider.h b/inc/fsfw/globalfunctions/PeriodicOperationDivider.h similarity index 100% rename from globalfunctions/PeriodicOperationDivider.h rename to inc/fsfw/globalfunctions/PeriodicOperationDivider.h diff --git a/globalfunctions/Type.h b/inc/fsfw/globalfunctions/Type.h similarity index 100% rename from globalfunctions/Type.h rename to inc/fsfw/globalfunctions/Type.h diff --git a/globalfunctions/arrayprinter.h b/inc/fsfw/globalfunctions/arrayprinter.h similarity index 100% rename from globalfunctions/arrayprinter.h rename to inc/fsfw/globalfunctions/arrayprinter.h diff --git a/globalfunctions/bitutility.h b/inc/fsfw/globalfunctions/bitutility.h similarity index 100% rename from globalfunctions/bitutility.h rename to inc/fsfw/globalfunctions/bitutility.h diff --git a/globalfunctions/constants.h b/inc/fsfw/globalfunctions/constants.h similarity index 100% rename from globalfunctions/constants.h rename to inc/fsfw/globalfunctions/constants.h diff --git a/globalfunctions/matching/BinaryMatcher.h b/inc/fsfw/globalfunctions/matching/BinaryMatcher.h similarity index 100% rename from globalfunctions/matching/BinaryMatcher.h rename to inc/fsfw/globalfunctions/matching/BinaryMatcher.h diff --git a/globalfunctions/matching/DecimalMatcher.h b/inc/fsfw/globalfunctions/matching/DecimalMatcher.h similarity index 100% rename from globalfunctions/matching/DecimalMatcher.h rename to inc/fsfw/globalfunctions/matching/DecimalMatcher.h diff --git a/globalfunctions/matching/MatchTree.h b/inc/fsfw/globalfunctions/matching/MatchTree.h similarity index 100% rename from globalfunctions/matching/MatchTree.h rename to inc/fsfw/globalfunctions/matching/MatchTree.h diff --git a/globalfunctions/matching/MatcherIF.h b/inc/fsfw/globalfunctions/matching/MatcherIF.h similarity index 100% rename from globalfunctions/matching/MatcherIF.h rename to inc/fsfw/globalfunctions/matching/MatcherIF.h diff --git a/globalfunctions/matching/RangeMatcher.h b/inc/fsfw/globalfunctions/matching/RangeMatcher.h similarity index 100% rename from globalfunctions/matching/RangeMatcher.h rename to inc/fsfw/globalfunctions/matching/RangeMatcher.h diff --git a/globalfunctions/matching/SerializeableMatcherIF.h b/inc/fsfw/globalfunctions/matching/SerializeableMatcherIF.h similarity index 100% rename from globalfunctions/matching/SerializeableMatcherIF.h rename to inc/fsfw/globalfunctions/matching/SerializeableMatcherIF.h diff --git a/globalfunctions/math/MatrixOperations.h b/inc/fsfw/globalfunctions/math/MatrixOperations.h similarity index 100% rename from globalfunctions/math/MatrixOperations.h rename to inc/fsfw/globalfunctions/math/MatrixOperations.h diff --git a/globalfunctions/math/QuaternionOperations.h b/inc/fsfw/globalfunctions/math/QuaternionOperations.h similarity index 100% rename from globalfunctions/math/QuaternionOperations.h rename to inc/fsfw/globalfunctions/math/QuaternionOperations.h diff --git a/globalfunctions/math/VectorOperations.h b/inc/fsfw/globalfunctions/math/VectorOperations.h similarity index 100% rename from globalfunctions/math/VectorOperations.h rename to inc/fsfw/globalfunctions/math/VectorOperations.h diff --git a/globalfunctions/sign.h b/inc/fsfw/globalfunctions/sign.h similarity index 100% rename from globalfunctions/sign.h rename to inc/fsfw/globalfunctions/sign.h diff --git a/globalfunctions/timevalOperations.h b/inc/fsfw/globalfunctions/timevalOperations.h similarity index 100% rename from globalfunctions/timevalOperations.h rename to inc/fsfw/globalfunctions/timevalOperations.h diff --git a/health/HasHealthIF.h b/inc/fsfw/health/HasHealthIF.h similarity index 100% rename from health/HasHealthIF.h rename to inc/fsfw/health/HasHealthIF.h diff --git a/health/HealthHelper.h b/inc/fsfw/health/HealthHelper.h similarity index 100% rename from health/HealthHelper.h rename to inc/fsfw/health/HealthHelper.h diff --git a/health/HealthMessage.h b/inc/fsfw/health/HealthMessage.h similarity index 100% rename from health/HealthMessage.h rename to inc/fsfw/health/HealthMessage.h diff --git a/health/HealthTable.h b/inc/fsfw/health/HealthTable.h similarity index 100% rename from health/HealthTable.h rename to inc/fsfw/health/HealthTable.h diff --git a/health/HealthTableIF.h b/inc/fsfw/health/HealthTableIF.h similarity index 100% rename from health/HealthTableIF.h rename to inc/fsfw/health/HealthTableIF.h diff --git a/health/ManagesHealthIF.h b/inc/fsfw/health/ManagesHealthIF.h similarity index 100% rename from health/ManagesHealthIF.h rename to inc/fsfw/health/ManagesHealthIF.h diff --git a/housekeeping/AcceptsHkPacketsIF.h b/inc/fsfw/housekeeping/AcceptsHkPacketsIF.h similarity index 100% rename from housekeeping/AcceptsHkPacketsIF.h rename to inc/fsfw/housekeeping/AcceptsHkPacketsIF.h diff --git a/housekeeping/CMakeLists.txt b/inc/fsfw/housekeeping/CMakeLists.txt similarity index 100% rename from housekeeping/CMakeLists.txt rename to inc/fsfw/housekeeping/CMakeLists.txt diff --git a/housekeeping/HousekeepingMessage.h b/inc/fsfw/housekeeping/HousekeepingMessage.h similarity index 100% rename from housekeeping/HousekeepingMessage.h rename to inc/fsfw/housekeeping/HousekeepingMessage.h diff --git a/housekeeping/HousekeepingPacketDownlink.h b/inc/fsfw/housekeeping/HousekeepingPacketDownlink.h similarity index 100% rename from housekeeping/HousekeepingPacketDownlink.h rename to inc/fsfw/housekeeping/HousekeepingPacketDownlink.h diff --git a/housekeeping/HousekeepingSetPacket.h b/inc/fsfw/housekeeping/HousekeepingSetPacket.h similarity index 100% rename from housekeeping/HousekeepingSetPacket.h rename to inc/fsfw/housekeeping/HousekeepingSetPacket.h diff --git a/housekeeping/HousekeepingSnapshot.h b/inc/fsfw/housekeeping/HousekeepingSnapshot.h similarity index 100% rename from housekeeping/HousekeepingSnapshot.h rename to inc/fsfw/housekeeping/HousekeepingSnapshot.h diff --git a/housekeeping/PeriodicHousekeepingHelper.h b/inc/fsfw/housekeeping/PeriodicHousekeepingHelper.h similarity index 100% rename from housekeeping/PeriodicHousekeepingHelper.h rename to inc/fsfw/housekeeping/PeriodicHousekeepingHelper.h diff --git a/internalError/InternalErrorDataset.h b/inc/fsfw/internalError/InternalErrorDataset.h similarity index 100% rename from internalError/InternalErrorDataset.h rename to inc/fsfw/internalError/InternalErrorDataset.h diff --git a/internalError/InternalErrorReporter.h b/inc/fsfw/internalError/InternalErrorReporter.h similarity index 100% rename from internalError/InternalErrorReporter.h rename to inc/fsfw/internalError/InternalErrorReporter.h diff --git a/internalError/InternalErrorReporterIF.h b/inc/fsfw/internalError/InternalErrorReporterIF.h similarity index 100% rename from internalError/InternalErrorReporterIF.h rename to inc/fsfw/internalError/InternalErrorReporterIF.h diff --git a/ipc/CommandMessage.h b/inc/fsfw/ipc/CommandMessage.h similarity index 100% rename from ipc/CommandMessage.h rename to inc/fsfw/ipc/CommandMessage.h diff --git a/ipc/CommandMessageCleaner.h b/inc/fsfw/ipc/CommandMessageCleaner.h similarity index 100% rename from ipc/CommandMessageCleaner.h rename to inc/fsfw/ipc/CommandMessageCleaner.h diff --git a/ipc/CommandMessageIF.h b/inc/fsfw/ipc/CommandMessageIF.h similarity index 100% rename from ipc/CommandMessageIF.h rename to inc/fsfw/ipc/CommandMessageIF.h diff --git a/ipc/FwMessageTypes.h b/inc/fsfw/ipc/FwMessageTypes.h similarity index 100% rename from ipc/FwMessageTypes.h rename to inc/fsfw/ipc/FwMessageTypes.h diff --git a/ipc/MessageQueueIF.h b/inc/fsfw/ipc/MessageQueueIF.h similarity index 100% rename from ipc/MessageQueueIF.h rename to inc/fsfw/ipc/MessageQueueIF.h diff --git a/ipc/MessageQueueMessage.h b/inc/fsfw/ipc/MessageQueueMessage.h similarity index 100% rename from ipc/MessageQueueMessage.h rename to inc/fsfw/ipc/MessageQueueMessage.h diff --git a/ipc/MessageQueueMessageIF.h b/inc/fsfw/ipc/MessageQueueMessageIF.h similarity index 100% rename from ipc/MessageQueueMessageIF.h rename to inc/fsfw/ipc/MessageQueueMessageIF.h diff --git a/ipc/MessageQueueSenderIF.h b/inc/fsfw/ipc/MessageQueueSenderIF.h similarity index 100% rename from ipc/MessageQueueSenderIF.h rename to inc/fsfw/ipc/MessageQueueSenderIF.h diff --git a/ipc/MutexFactory.h b/inc/fsfw/ipc/MutexFactory.h similarity index 100% rename from ipc/MutexFactory.h rename to inc/fsfw/ipc/MutexFactory.h diff --git a/ipc/MutexGuard.h b/inc/fsfw/ipc/MutexGuard.h similarity index 100% rename from ipc/MutexGuard.h rename to inc/fsfw/ipc/MutexGuard.h diff --git a/ipc/MutexIF.h b/inc/fsfw/ipc/MutexIF.h similarity index 100% rename from ipc/MutexIF.h rename to inc/fsfw/ipc/MutexIF.h diff --git a/ipc/QueueFactory.h b/inc/fsfw/ipc/QueueFactory.h similarity index 100% rename from ipc/QueueFactory.h rename to inc/fsfw/ipc/QueueFactory.h diff --git a/ipc/messageQueueDefinitions.h b/inc/fsfw/ipc/messageQueueDefinitions.h similarity index 100% rename from ipc/messageQueueDefinitions.h rename to inc/fsfw/ipc/messageQueueDefinitions.h diff --git a/memory/AcceptsMemoryMessagesIF.h b/inc/fsfw/memory/AcceptsMemoryMessagesIF.h similarity index 100% rename from memory/AcceptsMemoryMessagesIF.h rename to inc/fsfw/memory/AcceptsMemoryMessagesIF.h diff --git a/memory/GenericFileSystemMessage.h b/inc/fsfw/memory/GenericFileSystemMessage.h similarity index 100% rename from memory/GenericFileSystemMessage.h rename to inc/fsfw/memory/GenericFileSystemMessage.h diff --git a/memory/HasFileSystemIF.h b/inc/fsfw/memory/HasFileSystemIF.h similarity index 100% rename from memory/HasFileSystemIF.h rename to inc/fsfw/memory/HasFileSystemIF.h diff --git a/memory/HasMemoryIF.h b/inc/fsfw/memory/HasMemoryIF.h similarity index 100% rename from memory/HasMemoryIF.h rename to inc/fsfw/memory/HasMemoryIF.h diff --git a/memory/MemoryHelper.h b/inc/fsfw/memory/MemoryHelper.h similarity index 100% rename from memory/MemoryHelper.h rename to inc/fsfw/memory/MemoryHelper.h diff --git a/memory/MemoryMessage.h b/inc/fsfw/memory/MemoryMessage.h similarity index 100% rename from memory/MemoryMessage.h rename to inc/fsfw/memory/MemoryMessage.h diff --git a/modes/HasModesIF.h b/inc/fsfw/modes/HasModesIF.h similarity index 100% rename from modes/HasModesIF.h rename to inc/fsfw/modes/HasModesIF.h diff --git a/modes/ModeHelper.h b/inc/fsfw/modes/ModeHelper.h similarity index 100% rename from modes/ModeHelper.h rename to inc/fsfw/modes/ModeHelper.h diff --git a/modes/ModeMessage.h b/inc/fsfw/modes/ModeMessage.h similarity index 100% rename from modes/ModeMessage.h rename to inc/fsfw/modes/ModeMessage.h diff --git a/monitoring/AbsLimitMonitor.h b/inc/fsfw/monitoring/AbsLimitMonitor.h similarity index 100% rename from monitoring/AbsLimitMonitor.h rename to inc/fsfw/monitoring/AbsLimitMonitor.h diff --git a/monitoring/HasMonitorsIF.h b/inc/fsfw/monitoring/HasMonitorsIF.h similarity index 100% rename from monitoring/HasMonitorsIF.h rename to inc/fsfw/monitoring/HasMonitorsIF.h diff --git a/monitoring/LimitMonitor.h b/inc/fsfw/monitoring/LimitMonitor.h similarity index 100% rename from monitoring/LimitMonitor.h rename to inc/fsfw/monitoring/LimitMonitor.h diff --git a/monitoring/LimitViolationReporter.h b/inc/fsfw/monitoring/LimitViolationReporter.h similarity index 100% rename from monitoring/LimitViolationReporter.h rename to inc/fsfw/monitoring/LimitViolationReporter.h diff --git a/monitoring/MonitorBase.h b/inc/fsfw/monitoring/MonitorBase.h similarity index 100% rename from monitoring/MonitorBase.h rename to inc/fsfw/monitoring/MonitorBase.h diff --git a/monitoring/MonitorReporter.h b/inc/fsfw/monitoring/MonitorReporter.h similarity index 100% rename from monitoring/MonitorReporter.h rename to inc/fsfw/monitoring/MonitorReporter.h diff --git a/monitoring/MonitoringIF.h b/inc/fsfw/monitoring/MonitoringIF.h similarity index 98% rename from monitoring/MonitoringIF.h rename to inc/fsfw/monitoring/MonitoringIF.h index 32c62530..aae29475 100644 --- a/monitoring/MonitoringIF.h +++ b/inc/fsfw/monitoring/MonitoringIF.h @@ -2,7 +2,6 @@ #define FSFW_MONITORING_MONITORINGIF_H_ #include "MonitoringMessage.h" -#include "../memory/HasMemoryIF.h" #include "../serialize/SerializeIF.h" class MonitoringIF : public SerializeIF { @@ -62,6 +61,4 @@ public: } }; - - #endif /* FSFW_MONITORING_MONITORINGIF_H_ */ diff --git a/monitoring/MonitoringMessage.h b/inc/fsfw/monitoring/MonitoringMessage.h similarity index 100% rename from monitoring/MonitoringMessage.h rename to inc/fsfw/monitoring/MonitoringMessage.h diff --git a/monitoring/MonitoringMessageContent.h b/inc/fsfw/monitoring/MonitoringMessageContent.h similarity index 100% rename from monitoring/MonitoringMessageContent.h rename to inc/fsfw/monitoring/MonitoringMessageContent.h diff --git a/monitoring/ReceivesMonitoringReportsIF.h b/inc/fsfw/monitoring/ReceivesMonitoringReportsIF.h similarity index 100% rename from monitoring/ReceivesMonitoringReportsIF.h rename to inc/fsfw/monitoring/ReceivesMonitoringReportsIF.h diff --git a/monitoring/TriplexMonitor.h b/inc/fsfw/monitoring/TriplexMonitor.h similarity index 100% rename from monitoring/TriplexMonitor.h rename to inc/fsfw/monitoring/TriplexMonitor.h diff --git a/monitoring/TwoValueLimitMonitor.h b/inc/fsfw/monitoring/TwoValueLimitMonitor.h similarity index 100% rename from monitoring/TwoValueLimitMonitor.h rename to inc/fsfw/monitoring/TwoValueLimitMonitor.h diff --git a/objectmanager/ObjectManager.h b/inc/fsfw/objectmanager/ObjectManager.h similarity index 100% rename from objectmanager/ObjectManager.h rename to inc/fsfw/objectmanager/ObjectManager.h diff --git a/objectmanager/ObjectManagerIF.h b/inc/fsfw/objectmanager/ObjectManagerIF.h similarity index 100% rename from objectmanager/ObjectManagerIF.h rename to inc/fsfw/objectmanager/ObjectManagerIF.h diff --git a/objectmanager/SystemObject.h b/inc/fsfw/objectmanager/SystemObject.h similarity index 100% rename from objectmanager/SystemObject.h rename to inc/fsfw/objectmanager/SystemObject.h diff --git a/objectmanager/SystemObjectIF.h b/inc/fsfw/objectmanager/SystemObjectIF.h similarity index 100% rename from objectmanager/SystemObjectIF.h rename to inc/fsfw/objectmanager/SystemObjectIF.h diff --git a/objectmanager/frameworkObjects.h b/inc/fsfw/objectmanager/frameworkObjects.h similarity index 100% rename from objectmanager/frameworkObjects.h rename to inc/fsfw/objectmanager/frameworkObjects.h diff --git a/osal/Endiness.h b/inc/fsfw/osal/Endiness.h similarity index 100% rename from osal/Endiness.h rename to inc/fsfw/osal/Endiness.h diff --git a/osal/InternalErrorCodes.h b/inc/fsfw/osal/InternalErrorCodes.h similarity index 100% rename from osal/InternalErrorCodes.h rename to inc/fsfw/osal/InternalErrorCodes.h diff --git a/osal/common/TcpIpBase.h b/inc/fsfw/osal/common/TcpIpBase.h similarity index 100% rename from osal/common/TcpIpBase.h rename to inc/fsfw/osal/common/TcpIpBase.h diff --git a/osal/common/TcpTmTcBridge.h b/inc/fsfw/osal/common/TcpTmTcBridge.h similarity index 100% rename from osal/common/TcpTmTcBridge.h rename to inc/fsfw/osal/common/TcpTmTcBridge.h diff --git a/osal/common/TcpTmTcServer.h b/inc/fsfw/osal/common/TcpTmTcServer.h similarity index 100% rename from osal/common/TcpTmTcServer.h rename to inc/fsfw/osal/common/TcpTmTcServer.h diff --git a/osal/common/UdpTcPollingTask.h b/inc/fsfw/osal/common/UdpTcPollingTask.h similarity index 100% rename from osal/common/UdpTcPollingTask.h rename to inc/fsfw/osal/common/UdpTcPollingTask.h diff --git a/osal/common/UdpTmTcBridge.h b/inc/fsfw/osal/common/UdpTmTcBridge.h similarity index 100% rename from osal/common/UdpTmTcBridge.h rename to inc/fsfw/osal/common/UdpTmTcBridge.h diff --git a/osal/common/tcpipCommon.h b/inc/fsfw/osal/common/tcpipCommon.h similarity index 100% rename from osal/common/tcpipCommon.h rename to inc/fsfw/osal/common/tcpipCommon.h diff --git a/osal/common/tcpipHelpers.h b/inc/fsfw/osal/common/tcpipHelpers.h similarity index 100% rename from osal/common/tcpipHelpers.h rename to inc/fsfw/osal/common/tcpipHelpers.h diff --git a/osal/FreeRTOS/BinSemaphUsingTask.h b/inc/fsfw/osal/freertos/BinSemaphUsingTask.h similarity index 100% rename from osal/FreeRTOS/BinSemaphUsingTask.h rename to inc/fsfw/osal/freertos/BinSemaphUsingTask.h diff --git a/osal/FreeRTOS/BinarySemaphore.h b/inc/fsfw/osal/freertos/BinarySemaphore.h similarity index 100% rename from osal/FreeRTOS/BinarySemaphore.h rename to inc/fsfw/osal/freertos/BinarySemaphore.h diff --git a/osal/FreeRTOS/CountingSemaphUsingTask.h b/inc/fsfw/osal/freertos/CountingSemaphUsingTask.h similarity index 100% rename from osal/FreeRTOS/CountingSemaphUsingTask.h rename to inc/fsfw/osal/freertos/CountingSemaphUsingTask.h diff --git a/osal/FreeRTOS/CountingSemaphore.h b/inc/fsfw/osal/freertos/CountingSemaphore.h similarity index 100% rename from osal/FreeRTOS/CountingSemaphore.h rename to inc/fsfw/osal/freertos/CountingSemaphore.h diff --git a/osal/FreeRTOS/FixedTimeslotTask.h b/inc/fsfw/osal/freertos/FixedTimeslotTask.h similarity index 100% rename from osal/FreeRTOS/FixedTimeslotTask.h rename to inc/fsfw/osal/freertos/FixedTimeslotTask.h diff --git a/osal/FreeRTOS/FreeRTOSTaskIF.h b/inc/fsfw/osal/freertos/FreeRTOSTaskIF.h similarity index 100% rename from osal/FreeRTOS/FreeRTOSTaskIF.h rename to inc/fsfw/osal/freertos/FreeRTOSTaskIF.h diff --git a/osal/FreeRTOS/MessageQueue.h b/inc/fsfw/osal/freertos/MessageQueue.h similarity index 100% rename from osal/FreeRTOS/MessageQueue.h rename to inc/fsfw/osal/freertos/MessageQueue.h diff --git a/osal/FreeRTOS/Mutex.h b/inc/fsfw/osal/freertos/Mutex.h similarity index 100% rename from osal/FreeRTOS/Mutex.h rename to inc/fsfw/osal/freertos/Mutex.h diff --git a/osal/FreeRTOS/PeriodicTask.h b/inc/fsfw/osal/freertos/PeriodicTask.h similarity index 100% rename from osal/FreeRTOS/PeriodicTask.h rename to inc/fsfw/osal/freertos/PeriodicTask.h diff --git a/osal/FreeRTOS/QueueMapManager.h b/inc/fsfw/osal/freertos/QueueMapManager.h similarity index 100% rename from osal/FreeRTOS/QueueMapManager.h rename to inc/fsfw/osal/freertos/QueueMapManager.h diff --git a/osal/FreeRTOS/README.md b/inc/fsfw/osal/freertos/README.md similarity index 100% rename from osal/FreeRTOS/README.md rename to inc/fsfw/osal/freertos/README.md diff --git a/osal/FreeRTOS/TaskManagement.h b/inc/fsfw/osal/freertos/TaskManagement.h similarity index 100% rename from osal/FreeRTOS/TaskManagement.h rename to inc/fsfw/osal/freertos/TaskManagement.h diff --git a/osal/FreeRTOS/Timekeeper.h b/inc/fsfw/osal/freertos/Timekeeper.h similarity index 100% rename from osal/FreeRTOS/Timekeeper.h rename to inc/fsfw/osal/freertos/Timekeeper.h diff --git a/osal/host/FixedTimeslotTask.h b/inc/fsfw/osal/host/FixedTimeslotTask.h similarity index 100% rename from osal/host/FixedTimeslotTask.h rename to inc/fsfw/osal/host/FixedTimeslotTask.h diff --git a/osal/host/MessageQueue.h b/inc/fsfw/osal/host/MessageQueue.h similarity index 100% rename from osal/host/MessageQueue.h rename to inc/fsfw/osal/host/MessageQueue.h diff --git a/osal/host/Mutex.cpp b/inc/fsfw/osal/host/Mutex.cpp similarity index 100% rename from osal/host/Mutex.cpp rename to inc/fsfw/osal/host/Mutex.cpp diff --git a/osal/host/Mutex.h b/inc/fsfw/osal/host/Mutex.h similarity index 100% rename from osal/host/Mutex.h rename to inc/fsfw/osal/host/Mutex.h diff --git a/osal/host/PeriodicTask.h b/inc/fsfw/osal/host/PeriodicTask.h similarity index 100% rename from osal/host/PeriodicTask.h rename to inc/fsfw/osal/host/PeriodicTask.h diff --git a/osal/host/QueueMapManager.h b/inc/fsfw/osal/host/QueueMapManager.h similarity index 100% rename from osal/host/QueueMapManager.h rename to inc/fsfw/osal/host/QueueMapManager.h diff --git a/osal/host/taskHelpers.h b/inc/fsfw/osal/host/taskHelpers.h similarity index 100% rename from osal/host/taskHelpers.h rename to inc/fsfw/osal/host/taskHelpers.h diff --git a/osal/linux/BinarySemaphore.h b/inc/fsfw/osal/linux/BinarySemaphore.h similarity index 100% rename from osal/linux/BinarySemaphore.h rename to inc/fsfw/osal/linux/BinarySemaphore.h diff --git a/osal/linux/CountingSemaphore.h b/inc/fsfw/osal/linux/CountingSemaphore.h similarity index 100% rename from osal/linux/CountingSemaphore.h rename to inc/fsfw/osal/linux/CountingSemaphore.h diff --git a/osal/linux/FixedTimeslotTask.h b/inc/fsfw/osal/linux/FixedTimeslotTask.h similarity index 100% rename from osal/linux/FixedTimeslotTask.h rename to inc/fsfw/osal/linux/FixedTimeslotTask.h diff --git a/osal/linux/MessageQueue.h b/inc/fsfw/osal/linux/MessageQueue.h similarity index 100% rename from osal/linux/MessageQueue.h rename to inc/fsfw/osal/linux/MessageQueue.h diff --git a/osal/linux/Mutex.h b/inc/fsfw/osal/linux/Mutex.h similarity index 100% rename from osal/linux/Mutex.h rename to inc/fsfw/osal/linux/Mutex.h diff --git a/osal/linux/PeriodicPosixTask.h b/inc/fsfw/osal/linux/PeriodicPosixTask.h similarity index 100% rename from osal/linux/PeriodicPosixTask.h rename to inc/fsfw/osal/linux/PeriodicPosixTask.h diff --git a/osal/linux/PosixThread.h b/inc/fsfw/osal/linux/PosixThread.h similarity index 100% rename from osal/linux/PosixThread.h rename to inc/fsfw/osal/linux/PosixThread.h diff --git a/osal/linux/Timer.h b/inc/fsfw/osal/linux/Timer.h similarity index 100% rename from osal/linux/Timer.h rename to inc/fsfw/osal/linux/Timer.h diff --git a/osal/linux/unixUtility.h b/inc/fsfw/osal/linux/unixUtility.h similarity index 100% rename from osal/linux/unixUtility.h rename to inc/fsfw/osal/linux/unixUtility.h diff --git a/osal/rtems/CpuUsage.h b/inc/fsfw/osal/rtems/CpuUsage.h similarity index 100% rename from osal/rtems/CpuUsage.h rename to inc/fsfw/osal/rtems/CpuUsage.h diff --git a/osal/rtems/FixedTimeslotTask.h b/inc/fsfw/osal/rtems/FixedTimeslotTask.h similarity index 100% rename from osal/rtems/FixedTimeslotTask.h rename to inc/fsfw/osal/rtems/FixedTimeslotTask.h diff --git a/osal/rtems/InitTask.h b/inc/fsfw/osal/rtems/InitTask.h similarity index 100% rename from osal/rtems/InitTask.h rename to inc/fsfw/osal/rtems/InitTask.h diff --git a/osal/rtems/MessageQueue.h b/inc/fsfw/osal/rtems/MessageQueue.h similarity index 100% rename from osal/rtems/MessageQueue.h rename to inc/fsfw/osal/rtems/MessageQueue.h diff --git a/osal/rtems/Mutex.h b/inc/fsfw/osal/rtems/Mutex.h similarity index 100% rename from osal/rtems/Mutex.h rename to inc/fsfw/osal/rtems/Mutex.h diff --git a/osal/rtems/PeriodicTask.h b/inc/fsfw/osal/rtems/PeriodicTask.h similarity index 100% rename from osal/rtems/PeriodicTask.h rename to inc/fsfw/osal/rtems/PeriodicTask.h diff --git a/osal/rtems/RTEMSTaskBase.h b/inc/fsfw/osal/rtems/RTEMSTaskBase.h similarity index 100% rename from osal/rtems/RTEMSTaskBase.h rename to inc/fsfw/osal/rtems/RTEMSTaskBase.h diff --git a/osal/rtems/RtemsBasic.h b/inc/fsfw/osal/rtems/RtemsBasic.h similarity index 100% rename from osal/rtems/RtemsBasic.h rename to inc/fsfw/osal/rtems/RtemsBasic.h diff --git a/osal/windows/winTaskHelpers.h b/inc/fsfw/osal/windows/winTaskHelpers.h similarity index 100% rename from osal/windows/winTaskHelpers.h rename to inc/fsfw/osal/windows/winTaskHelpers.h diff --git a/parameters/HasParametersIF.h b/inc/fsfw/parameters/HasParametersIF.h similarity index 100% rename from parameters/HasParametersIF.h rename to inc/fsfw/parameters/HasParametersIF.h diff --git a/parameters/ParameterHelper.h b/inc/fsfw/parameters/ParameterHelper.h similarity index 100% rename from parameters/ParameterHelper.h rename to inc/fsfw/parameters/ParameterHelper.h diff --git a/parameters/ParameterMessage.h b/inc/fsfw/parameters/ParameterMessage.h similarity index 100% rename from parameters/ParameterMessage.h rename to inc/fsfw/parameters/ParameterMessage.h diff --git a/parameters/ParameterWrapper.h b/inc/fsfw/parameters/ParameterWrapper.h similarity index 100% rename from parameters/ParameterWrapper.h rename to inc/fsfw/parameters/ParameterWrapper.h diff --git a/parameters/ReceivesParameterMessagesIF.h b/inc/fsfw/parameters/ReceivesParameterMessagesIF.h similarity index 100% rename from parameters/ReceivesParameterMessagesIF.h rename to inc/fsfw/parameters/ReceivesParameterMessagesIF.h diff --git a/platform.h b/inc/fsfw/platform.h similarity index 100% rename from platform.h rename to inc/fsfw/platform.h diff --git a/power/Fuse.h b/inc/fsfw/power/Fuse.h similarity index 100% rename from power/Fuse.h rename to inc/fsfw/power/Fuse.h diff --git a/power/PowerComponent.h b/inc/fsfw/power/PowerComponent.h similarity index 100% rename from power/PowerComponent.h rename to inc/fsfw/power/PowerComponent.h diff --git a/power/PowerComponentIF.h b/inc/fsfw/power/PowerComponentIF.h similarity index 100% rename from power/PowerComponentIF.h rename to inc/fsfw/power/PowerComponentIF.h diff --git a/power/PowerSensor.h b/inc/fsfw/power/PowerSensor.h similarity index 100% rename from power/PowerSensor.h rename to inc/fsfw/power/PowerSensor.h diff --git a/power/PowerSwitchIF.h b/inc/fsfw/power/PowerSwitchIF.h similarity index 100% rename from power/PowerSwitchIF.h rename to inc/fsfw/power/PowerSwitchIF.h diff --git a/power/PowerSwitcher.h b/inc/fsfw/power/PowerSwitcher.h similarity index 100% rename from power/PowerSwitcher.h rename to inc/fsfw/power/PowerSwitcher.h diff --git a/pus/CService200ModeCommanding.h b/inc/fsfw/pus/CService200ModeCommanding.h similarity index 100% rename from pus/CService200ModeCommanding.h rename to inc/fsfw/pus/CService200ModeCommanding.h diff --git a/pus/CService201HealthCommanding.h b/inc/fsfw/pus/CService201HealthCommanding.h similarity index 100% rename from pus/CService201HealthCommanding.h rename to inc/fsfw/pus/CService201HealthCommanding.h diff --git a/pus/Service17Test.h b/inc/fsfw/pus/Service17Test.h similarity index 100% rename from pus/Service17Test.h rename to inc/fsfw/pus/Service17Test.h diff --git a/pus/Service1TelecommandVerification.h b/inc/fsfw/pus/Service1TelecommandVerification.h similarity index 100% rename from pus/Service1TelecommandVerification.h rename to inc/fsfw/pus/Service1TelecommandVerification.h diff --git a/pus/Service20ParameterManagement.h b/inc/fsfw/pus/Service20ParameterManagement.h similarity index 100% rename from pus/Service20ParameterManagement.h rename to inc/fsfw/pus/Service20ParameterManagement.h diff --git a/pus/Service2DeviceAccess.h b/inc/fsfw/pus/Service2DeviceAccess.h similarity index 100% rename from pus/Service2DeviceAccess.h rename to inc/fsfw/pus/Service2DeviceAccess.h diff --git a/pus/Service3Housekeeping.h b/inc/fsfw/pus/Service3Housekeeping.h similarity index 100% rename from pus/Service3Housekeeping.h rename to inc/fsfw/pus/Service3Housekeeping.h diff --git a/pus/Service5EventReporting.h b/inc/fsfw/pus/Service5EventReporting.h similarity index 100% rename from pus/Service5EventReporting.h rename to inc/fsfw/pus/Service5EventReporting.h diff --git a/pus/Service8FunctionManagement.h b/inc/fsfw/pus/Service8FunctionManagement.h similarity index 100% rename from pus/Service8FunctionManagement.h rename to inc/fsfw/pus/Service8FunctionManagement.h diff --git a/pus/Service9TimeManagement.h b/inc/fsfw/pus/Service9TimeManagement.h similarity index 100% rename from pus/Service9TimeManagement.h rename to inc/fsfw/pus/Service9TimeManagement.h diff --git a/pus/servicepackets/Service1Packets.h b/inc/fsfw/pus/servicepackets/Service1Packets.h similarity index 100% rename from pus/servicepackets/Service1Packets.h rename to inc/fsfw/pus/servicepackets/Service1Packets.h diff --git a/pus/servicepackets/Service200Packets.h b/inc/fsfw/pus/servicepackets/Service200Packets.h similarity index 100% rename from pus/servicepackets/Service200Packets.h rename to inc/fsfw/pus/servicepackets/Service200Packets.h diff --git a/pus/servicepackets/Service201Packets.h b/inc/fsfw/pus/servicepackets/Service201Packets.h similarity index 100% rename from pus/servicepackets/Service201Packets.h rename to inc/fsfw/pus/servicepackets/Service201Packets.h diff --git a/pus/servicepackets/Service20Packets.h b/inc/fsfw/pus/servicepackets/Service20Packets.h similarity index 100% rename from pus/servicepackets/Service20Packets.h rename to inc/fsfw/pus/servicepackets/Service20Packets.h diff --git a/pus/servicepackets/Service2Packets.h b/inc/fsfw/pus/servicepackets/Service2Packets.h similarity index 100% rename from pus/servicepackets/Service2Packets.h rename to inc/fsfw/pus/servicepackets/Service2Packets.h diff --git a/pus/servicepackets/Service3Packets.h b/inc/fsfw/pus/servicepackets/Service3Packets.h similarity index 100% rename from pus/servicepackets/Service3Packets.h rename to inc/fsfw/pus/servicepackets/Service3Packets.h diff --git a/pus/servicepackets/Service5Packets.h b/inc/fsfw/pus/servicepackets/Service5Packets.h similarity index 100% rename from pus/servicepackets/Service5Packets.h rename to inc/fsfw/pus/servicepackets/Service5Packets.h diff --git a/pus/servicepackets/Service8Packets.h b/inc/fsfw/pus/servicepackets/Service8Packets.h similarity index 100% rename from pus/servicepackets/Service8Packets.h rename to inc/fsfw/pus/servicepackets/Service8Packets.h diff --git a/pus/servicepackets/Service9Packets.h b/inc/fsfw/pus/servicepackets/Service9Packets.h similarity index 100% rename from pus/servicepackets/Service9Packets.h rename to inc/fsfw/pus/servicepackets/Service9Packets.h diff --git a/returnvalues/FwClassIds.h b/inc/fsfw/returnvalues/FwClassIds.h similarity index 100% rename from returnvalues/FwClassIds.h rename to inc/fsfw/returnvalues/FwClassIds.h diff --git a/returnvalues/HasReturnvaluesIF.h b/inc/fsfw/returnvalues/HasReturnvaluesIF.h similarity index 100% rename from returnvalues/HasReturnvaluesIF.h rename to inc/fsfw/returnvalues/HasReturnvaluesIF.h diff --git a/rmap/RMAP.h b/inc/fsfw/rmap/RMAP.h similarity index 100% rename from rmap/RMAP.h rename to inc/fsfw/rmap/RMAP.h diff --git a/rmap/RMAPChannelIF.h b/inc/fsfw/rmap/RMAPChannelIF.h similarity index 100% rename from rmap/RMAPChannelIF.h rename to inc/fsfw/rmap/RMAPChannelIF.h diff --git a/rmap/RMAPCookie.h b/inc/fsfw/rmap/RMAPCookie.h similarity index 100% rename from rmap/RMAPCookie.h rename to inc/fsfw/rmap/RMAPCookie.h diff --git a/rmap/RmapDeviceCommunicationIF.h b/inc/fsfw/rmap/RmapDeviceCommunicationIF.h similarity index 100% rename from rmap/RmapDeviceCommunicationIF.h rename to inc/fsfw/rmap/RmapDeviceCommunicationIF.h diff --git a/rmap/rmapStructs.h b/inc/fsfw/rmap/rmapStructs.h similarity index 100% rename from rmap/rmapStructs.h rename to inc/fsfw/rmap/rmapStructs.h diff --git a/serialize/EndianConverter.h b/inc/fsfw/serialize/EndianConverter.h similarity index 100% rename from serialize/EndianConverter.h rename to inc/fsfw/serialize/EndianConverter.h diff --git a/serialize/SerialArrayListAdapter.h b/inc/fsfw/serialize/SerialArrayListAdapter.h similarity index 100% rename from serialize/SerialArrayListAdapter.h rename to inc/fsfw/serialize/SerialArrayListAdapter.h diff --git a/serialize/SerialBufferAdapter.h b/inc/fsfw/serialize/SerialBufferAdapter.h similarity index 100% rename from serialize/SerialBufferAdapter.h rename to inc/fsfw/serialize/SerialBufferAdapter.h diff --git a/serialize/SerialFixedArrayListAdapter.h b/inc/fsfw/serialize/SerialFixedArrayListAdapter.h similarity index 100% rename from serialize/SerialFixedArrayListAdapter.h rename to inc/fsfw/serialize/SerialFixedArrayListAdapter.h diff --git a/serialize/SerialLinkedListAdapter.h b/inc/fsfw/serialize/SerialLinkedListAdapter.h similarity index 100% rename from serialize/SerialLinkedListAdapter.h rename to inc/fsfw/serialize/SerialLinkedListAdapter.h diff --git a/serialize/SerializeAdapter.h b/inc/fsfw/serialize/SerializeAdapter.h similarity index 100% rename from serialize/SerializeAdapter.h rename to inc/fsfw/serialize/SerializeAdapter.h diff --git a/serialize/SerializeElement.h b/inc/fsfw/serialize/SerializeElement.h similarity index 100% rename from serialize/SerializeElement.h rename to inc/fsfw/serialize/SerializeElement.h diff --git a/serialize/SerializeIF.h b/inc/fsfw/serialize/SerializeIF.h similarity index 100% rename from serialize/SerializeIF.h rename to inc/fsfw/serialize/SerializeIF.h diff --git a/serviceinterface/ServiceInterface.h b/inc/fsfw/serviceinterface/ServiceInterface.h similarity index 100% rename from serviceinterface/ServiceInterface.h rename to inc/fsfw/serviceinterface/ServiceInterface.h diff --git a/serviceinterface/ServiceInterfaceBuffer.h b/inc/fsfw/serviceinterface/ServiceInterfaceBuffer.h similarity index 100% rename from serviceinterface/ServiceInterfaceBuffer.h rename to inc/fsfw/serviceinterface/ServiceInterfaceBuffer.h diff --git a/serviceinterface/ServiceInterfacePrinter.h b/inc/fsfw/serviceinterface/ServiceInterfacePrinter.h similarity index 100% rename from serviceinterface/ServiceInterfacePrinter.h rename to inc/fsfw/serviceinterface/ServiceInterfacePrinter.h diff --git a/serviceinterface/ServiceInterfaceStream.h b/inc/fsfw/serviceinterface/ServiceInterfaceStream.h similarity index 100% rename from serviceinterface/ServiceInterfaceStream.h rename to inc/fsfw/serviceinterface/ServiceInterfaceStream.h diff --git a/serviceinterface/serviceInterfaceDefintions.h b/inc/fsfw/serviceinterface/serviceInterfaceDefintions.h similarity index 100% rename from serviceinterface/serviceInterfaceDefintions.h rename to inc/fsfw/serviceinterface/serviceInterfaceDefintions.h diff --git a/storagemanager/ConstStorageAccessor.h b/inc/fsfw/storagemanager/ConstStorageAccessor.h similarity index 100% rename from storagemanager/ConstStorageAccessor.h rename to inc/fsfw/storagemanager/ConstStorageAccessor.h diff --git a/storagemanager/LocalPool.h b/inc/fsfw/storagemanager/LocalPool.h similarity index 100% rename from storagemanager/LocalPool.h rename to inc/fsfw/storagemanager/LocalPool.h diff --git a/storagemanager/PoolManager.h b/inc/fsfw/storagemanager/PoolManager.h similarity index 100% rename from storagemanager/PoolManager.h rename to inc/fsfw/storagemanager/PoolManager.h diff --git a/storagemanager/StorageAccessor.h b/inc/fsfw/storagemanager/StorageAccessor.h similarity index 100% rename from storagemanager/StorageAccessor.h rename to inc/fsfw/storagemanager/StorageAccessor.h diff --git a/storagemanager/StorageManagerIF.h b/inc/fsfw/storagemanager/StorageManagerIF.h similarity index 100% rename from storagemanager/StorageManagerIF.h rename to inc/fsfw/storagemanager/StorageManagerIF.h diff --git a/storagemanager/storeAddress.h b/inc/fsfw/storagemanager/storeAddress.h similarity index 100% rename from storagemanager/storeAddress.h rename to inc/fsfw/storagemanager/storeAddress.h diff --git a/subsystem/Subsystem.h b/inc/fsfw/subsystem/Subsystem.h similarity index 100% rename from subsystem/Subsystem.h rename to inc/fsfw/subsystem/Subsystem.h diff --git a/subsystem/SubsystemBase.h b/inc/fsfw/subsystem/SubsystemBase.h similarity index 100% rename from subsystem/SubsystemBase.h rename to inc/fsfw/subsystem/SubsystemBase.h diff --git a/subsystem/modes/HasModeSequenceIF.h b/inc/fsfw/subsystem/modes/HasModeSequenceIF.h similarity index 100% rename from subsystem/modes/HasModeSequenceIF.h rename to inc/fsfw/subsystem/modes/HasModeSequenceIF.h diff --git a/subsystem/modes/ModeDefinitions.h b/inc/fsfw/subsystem/modes/ModeDefinitions.h similarity index 100% rename from subsystem/modes/ModeDefinitions.h rename to inc/fsfw/subsystem/modes/ModeDefinitions.h diff --git a/subsystem/modes/ModeSequenceMessage.h b/inc/fsfw/subsystem/modes/ModeSequenceMessage.h similarity index 100% rename from subsystem/modes/ModeSequenceMessage.h rename to inc/fsfw/subsystem/modes/ModeSequenceMessage.h diff --git a/subsystem/modes/ModeStore.h b/inc/fsfw/subsystem/modes/ModeStore.h similarity index 100% rename from subsystem/modes/ModeStore.h rename to inc/fsfw/subsystem/modes/ModeStore.h diff --git a/subsystem/modes/ModeStoreIF.h b/inc/fsfw/subsystem/modes/ModeStoreIF.h similarity index 100% rename from subsystem/modes/ModeStoreIF.h rename to inc/fsfw/subsystem/modes/ModeStoreIF.h diff --git a/tasks/ExecutableObjectIF.h b/inc/fsfw/tasks/ExecutableObjectIF.h similarity index 100% rename from tasks/ExecutableObjectIF.h rename to inc/fsfw/tasks/ExecutableObjectIF.h diff --git a/tasks/FixedSequenceSlot.h b/inc/fsfw/tasks/FixedSequenceSlot.h similarity index 100% rename from tasks/FixedSequenceSlot.h rename to inc/fsfw/tasks/FixedSequenceSlot.h diff --git a/tasks/FixedSlotSequence.h b/inc/fsfw/tasks/FixedSlotSequence.h similarity index 100% rename from tasks/FixedSlotSequence.h rename to inc/fsfw/tasks/FixedSlotSequence.h diff --git a/tasks/FixedTimeslotTaskIF.h b/inc/fsfw/tasks/FixedTimeslotTaskIF.h similarity index 100% rename from tasks/FixedTimeslotTaskIF.h rename to inc/fsfw/tasks/FixedTimeslotTaskIF.h diff --git a/tasks/PeriodicTaskIF.h b/inc/fsfw/tasks/PeriodicTaskIF.h similarity index 100% rename from tasks/PeriodicTaskIF.h rename to inc/fsfw/tasks/PeriodicTaskIF.h diff --git a/tasks/SemaphoreFactory.h b/inc/fsfw/tasks/SemaphoreFactory.h similarity index 100% rename from tasks/SemaphoreFactory.h rename to inc/fsfw/tasks/SemaphoreFactory.h diff --git a/tasks/SemaphoreIF.h b/inc/fsfw/tasks/SemaphoreIF.h similarity index 100% rename from tasks/SemaphoreIF.h rename to inc/fsfw/tasks/SemaphoreIF.h diff --git a/tasks/TaskFactory.h b/inc/fsfw/tasks/TaskFactory.h similarity index 100% rename from tasks/TaskFactory.h rename to inc/fsfw/tasks/TaskFactory.h diff --git a/tasks/Typedef.h b/inc/fsfw/tasks/Typedef.h similarity index 100% rename from tasks/Typedef.h rename to inc/fsfw/tasks/Typedef.h diff --git a/tcdistribution/CCSDSDistributor.h b/inc/fsfw/tcdistribution/CCSDSDistributor.h similarity index 100% rename from tcdistribution/CCSDSDistributor.h rename to inc/fsfw/tcdistribution/CCSDSDistributor.h diff --git a/tcdistribution/CCSDSDistributorIF.h b/inc/fsfw/tcdistribution/CCSDSDistributorIF.h similarity index 100% rename from tcdistribution/CCSDSDistributorIF.h rename to inc/fsfw/tcdistribution/CCSDSDistributorIF.h diff --git a/tcdistribution/PUSDistributor.h b/inc/fsfw/tcdistribution/PUSDistributor.h similarity index 100% rename from tcdistribution/PUSDistributor.h rename to inc/fsfw/tcdistribution/PUSDistributor.h diff --git a/tcdistribution/PUSDistributorIF.h b/inc/fsfw/tcdistribution/PUSDistributorIF.h similarity index 100% rename from tcdistribution/PUSDistributorIF.h rename to inc/fsfw/tcdistribution/PUSDistributorIF.h diff --git a/tcdistribution/TcDistributor.h b/inc/fsfw/tcdistribution/TcDistributor.h similarity index 100% rename from tcdistribution/TcDistributor.h rename to inc/fsfw/tcdistribution/TcDistributor.h diff --git a/tcdistribution/TcPacketCheck.h b/inc/fsfw/tcdistribution/TcPacketCheck.h similarity index 100% rename from tcdistribution/TcPacketCheck.h rename to inc/fsfw/tcdistribution/TcPacketCheck.h diff --git a/thermal/AbstractTemperatureSensor.h b/inc/fsfw/thermal/AbstractTemperatureSensor.h similarity index 100% rename from thermal/AbstractTemperatureSensor.h rename to inc/fsfw/thermal/AbstractTemperatureSensor.h diff --git a/thermal/AcceptsThermalMessagesIF.h b/inc/fsfw/thermal/AcceptsThermalMessagesIF.h similarity index 100% rename from thermal/AcceptsThermalMessagesIF.h rename to inc/fsfw/thermal/AcceptsThermalMessagesIF.h diff --git a/thermal/Heater.h b/inc/fsfw/thermal/Heater.h similarity index 100% rename from thermal/Heater.h rename to inc/fsfw/thermal/Heater.h diff --git a/thermal/RedundantHeater.h b/inc/fsfw/thermal/RedundantHeater.h similarity index 100% rename from thermal/RedundantHeater.h rename to inc/fsfw/thermal/RedundantHeater.h diff --git a/thermal/TemperatureSensor.h b/inc/fsfw/thermal/TemperatureSensor.h similarity index 100% rename from thermal/TemperatureSensor.h rename to inc/fsfw/thermal/TemperatureSensor.h diff --git a/thermal/ThermalComponent.h b/inc/fsfw/thermal/ThermalComponent.h similarity index 100% rename from thermal/ThermalComponent.h rename to inc/fsfw/thermal/ThermalComponent.h diff --git a/thermal/ThermalComponentCore.h b/inc/fsfw/thermal/ThermalComponentCore.h similarity index 100% rename from thermal/ThermalComponentCore.h rename to inc/fsfw/thermal/ThermalComponentCore.h diff --git a/thermal/ThermalComponentIF.h b/inc/fsfw/thermal/ThermalComponentIF.h similarity index 100% rename from thermal/ThermalComponentIF.h rename to inc/fsfw/thermal/ThermalComponentIF.h diff --git a/thermal/ThermalModule.h b/inc/fsfw/thermal/ThermalModule.h similarity index 100% rename from thermal/ThermalModule.h rename to inc/fsfw/thermal/ThermalModule.h diff --git a/thermal/ThermalModuleIF.h b/inc/fsfw/thermal/ThermalModuleIF.h similarity index 100% rename from thermal/ThermalModuleIF.h rename to inc/fsfw/thermal/ThermalModuleIF.h diff --git a/thermal/ThermalMonitorReporter.h b/inc/fsfw/thermal/ThermalMonitorReporter.h similarity index 100% rename from thermal/ThermalMonitorReporter.h rename to inc/fsfw/thermal/ThermalMonitorReporter.h diff --git a/thermal/tcsDefinitions.h b/inc/fsfw/thermal/tcsDefinitions.h similarity index 100% rename from thermal/tcsDefinitions.h rename to inc/fsfw/thermal/tcsDefinitions.h diff --git a/timemanager/CCSDSTime.h b/inc/fsfw/timemanager/CCSDSTime.h similarity index 100% rename from timemanager/CCSDSTime.h rename to inc/fsfw/timemanager/CCSDSTime.h diff --git a/timemanager/Clock.h b/inc/fsfw/timemanager/Clock.h similarity index 100% rename from timemanager/Clock.h rename to inc/fsfw/timemanager/Clock.h diff --git a/timemanager/Countdown.h b/inc/fsfw/timemanager/Countdown.h similarity index 100% rename from timemanager/Countdown.h rename to inc/fsfw/timemanager/Countdown.h diff --git a/timemanager/ReceivesTimeInfoIF.h b/inc/fsfw/timemanager/ReceivesTimeInfoIF.h similarity index 100% rename from timemanager/ReceivesTimeInfoIF.h rename to inc/fsfw/timemanager/ReceivesTimeInfoIF.h diff --git a/timemanager/Stopwatch.h b/inc/fsfw/timemanager/Stopwatch.h similarity index 100% rename from timemanager/Stopwatch.h rename to inc/fsfw/timemanager/Stopwatch.h diff --git a/timemanager/TimeMessage.h b/inc/fsfw/timemanager/TimeMessage.h similarity index 100% rename from timemanager/TimeMessage.h rename to inc/fsfw/timemanager/TimeMessage.h diff --git a/timemanager/TimeStamper.h b/inc/fsfw/timemanager/TimeStamper.h similarity index 100% rename from timemanager/TimeStamper.h rename to inc/fsfw/timemanager/TimeStamper.h diff --git a/timemanager/TimeStamperIF.h b/inc/fsfw/timemanager/TimeStamperIF.h similarity index 100% rename from timemanager/TimeStamperIF.h rename to inc/fsfw/timemanager/TimeStamperIF.h diff --git a/timemanager/clockDefinitions.h b/inc/fsfw/timemanager/clockDefinitions.h similarity index 100% rename from timemanager/clockDefinitions.h rename to inc/fsfw/timemanager/clockDefinitions.h diff --git a/tmstorage/TmStoreBackendIF.h b/inc/fsfw/tmstorage/TmStoreBackendIF.h similarity index 100% rename from tmstorage/TmStoreBackendIF.h rename to inc/fsfw/tmstorage/TmStoreBackendIF.h diff --git a/tmstorage/TmStoreFrontendIF.h b/inc/fsfw/tmstorage/TmStoreFrontendIF.h similarity index 100% rename from tmstorage/TmStoreFrontendIF.h rename to inc/fsfw/tmstorage/TmStoreFrontendIF.h diff --git a/tmstorage/TmStoreMessage.h b/inc/fsfw/tmstorage/TmStoreMessage.h similarity index 100% rename from tmstorage/TmStoreMessage.h rename to inc/fsfw/tmstorage/TmStoreMessage.h diff --git a/tmstorage/TmStorePackets.h b/inc/fsfw/tmstorage/TmStorePackets.h similarity index 100% rename from tmstorage/TmStorePackets.h rename to inc/fsfw/tmstorage/TmStorePackets.h diff --git a/tmtcpacket/SpacePacket.h b/inc/fsfw/tmtcpacket/SpacePacket.h similarity index 100% rename from tmtcpacket/SpacePacket.h rename to inc/fsfw/tmtcpacket/SpacePacket.h diff --git a/tmtcpacket/SpacePacketBase.h b/inc/fsfw/tmtcpacket/SpacePacketBase.h similarity index 100% rename from tmtcpacket/SpacePacketBase.h rename to inc/fsfw/tmtcpacket/SpacePacketBase.h diff --git a/tmtcpacket/ccsds_header.h b/inc/fsfw/tmtcpacket/ccsds_header.h similarity index 100% rename from tmtcpacket/ccsds_header.h rename to inc/fsfw/tmtcpacket/ccsds_header.h diff --git a/tmtcpacket/packetmatcher/ApidMatcher.h b/inc/fsfw/tmtcpacket/packetmatcher/ApidMatcher.h similarity index 100% rename from tmtcpacket/packetmatcher/ApidMatcher.h rename to inc/fsfw/tmtcpacket/packetmatcher/ApidMatcher.h diff --git a/tmtcpacket/packetmatcher/PacketMatchTree.h b/inc/fsfw/tmtcpacket/packetmatcher/PacketMatchTree.h similarity index 100% rename from tmtcpacket/packetmatcher/PacketMatchTree.h rename to inc/fsfw/tmtcpacket/packetmatcher/PacketMatchTree.h diff --git a/tmtcpacket/packetmatcher/ServiceMatcher.h b/inc/fsfw/tmtcpacket/packetmatcher/ServiceMatcher.h similarity index 100% rename from tmtcpacket/packetmatcher/ServiceMatcher.h rename to inc/fsfw/tmtcpacket/packetmatcher/ServiceMatcher.h diff --git a/tmtcpacket/packetmatcher/SubserviceMatcher.h b/inc/fsfw/tmtcpacket/packetmatcher/SubserviceMatcher.h similarity index 100% rename from tmtcpacket/packetmatcher/SubserviceMatcher.h rename to inc/fsfw/tmtcpacket/packetmatcher/SubserviceMatcher.h diff --git a/tmtcpacket/pus/PacketTimestampInterpreterIF.h b/inc/fsfw/tmtcpacket/pus/PacketTimestampInterpreterIF.h similarity index 100% rename from tmtcpacket/pus/PacketTimestampInterpreterIF.h rename to inc/fsfw/tmtcpacket/pus/PacketTimestampInterpreterIF.h diff --git a/tmtcpacket/pus/tc.h b/inc/fsfw/tmtcpacket/pus/tc.h similarity index 100% rename from tmtcpacket/pus/tc.h rename to inc/fsfw/tmtcpacket/pus/tc.h diff --git a/tmtcpacket/pus/tc/TcPacketBase.h b/inc/fsfw/tmtcpacket/pus/tc/TcPacketBase.h similarity index 100% rename from tmtcpacket/pus/tc/TcPacketBase.h rename to inc/fsfw/tmtcpacket/pus/tc/TcPacketBase.h diff --git a/tmtcpacket/pus/tc/TcPacketPus.h b/inc/fsfw/tmtcpacket/pus/tc/TcPacketPus.h similarity index 100% rename from tmtcpacket/pus/tc/TcPacketPus.h rename to inc/fsfw/tmtcpacket/pus/tc/TcPacketPus.h diff --git a/tmtcpacket/pus/tc/TcPacketStoredBase.h b/inc/fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.h similarity index 100% rename from tmtcpacket/pus/tc/TcPacketStoredBase.h rename to inc/fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.h diff --git a/tmtcpacket/pus/tc/TcPacketStoredIF.h b/inc/fsfw/tmtcpacket/pus/tc/TcPacketStoredIF.h similarity index 100% rename from tmtcpacket/pus/tc/TcPacketStoredIF.h rename to inc/fsfw/tmtcpacket/pus/tc/TcPacketStoredIF.h diff --git a/tmtcpacket/pus/tc/TcPacketStoredPus.h b/inc/fsfw/tmtcpacket/pus/tc/TcPacketStoredPus.h similarity index 100% rename from tmtcpacket/pus/tc/TcPacketStoredPus.h rename to inc/fsfw/tmtcpacket/pus/tc/TcPacketStoredPus.h diff --git a/tmtcpacket/pus/tm.h b/inc/fsfw/tmtcpacket/pus/tm.h similarity index 100% rename from tmtcpacket/pus/tm.h rename to inc/fsfw/tmtcpacket/pus/tm.h diff --git a/tmtcpacket/pus/tm/TmPacketBase.h b/inc/fsfw/tmtcpacket/pus/tm/TmPacketBase.h similarity index 100% rename from tmtcpacket/pus/tm/TmPacketBase.h rename to inc/fsfw/tmtcpacket/pus/tm/TmPacketBase.h diff --git a/tmtcpacket/pus/tm/TmPacketMinimal.h b/inc/fsfw/tmtcpacket/pus/tm/TmPacketMinimal.h similarity index 100% rename from tmtcpacket/pus/tm/TmPacketMinimal.h rename to inc/fsfw/tmtcpacket/pus/tm/TmPacketMinimal.h diff --git a/tmtcpacket/pus/tm/TmPacketPusA.h b/inc/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h similarity index 100% rename from tmtcpacket/pus/tm/TmPacketPusA.h rename to inc/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h diff --git a/tmtcpacket/pus/tm/TmPacketPusC.h b/inc/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h similarity index 100% rename from tmtcpacket/pus/tm/TmPacketPusC.h rename to inc/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h diff --git a/tmtcpacket/pus/tm/TmPacketStored.h b/inc/fsfw/tmtcpacket/pus/tm/TmPacketStored.h similarity index 100% rename from tmtcpacket/pus/tm/TmPacketStored.h rename to inc/fsfw/tmtcpacket/pus/tm/TmPacketStored.h diff --git a/tmtcpacket/pus/tm/TmPacketStoredBase.h b/inc/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.h similarity index 100% rename from tmtcpacket/pus/tm/TmPacketStoredBase.h rename to inc/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.h diff --git a/tmtcpacket/pus/tm/TmPacketStoredPusA.h b/inc/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.h similarity index 100% rename from tmtcpacket/pus/tm/TmPacketStoredPusA.h rename to inc/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.h diff --git a/tmtcpacket/pus/tm/TmPacketStoredPusC.h b/inc/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.h similarity index 100% rename from tmtcpacket/pus/tm/TmPacketStoredPusC.h rename to inc/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.h diff --git a/tmtcservices/AcceptsTelecommandsIF.h b/inc/fsfw/tmtcservices/AcceptsTelecommandsIF.h similarity index 100% rename from tmtcservices/AcceptsTelecommandsIF.h rename to inc/fsfw/tmtcservices/AcceptsTelecommandsIF.h diff --git a/tmtcservices/AcceptsTelemetryIF.h b/inc/fsfw/tmtcservices/AcceptsTelemetryIF.h similarity index 100% rename from tmtcservices/AcceptsTelemetryIF.h rename to inc/fsfw/tmtcservices/AcceptsTelemetryIF.h diff --git a/tmtcservices/AcceptsVerifyMessageIF.h b/inc/fsfw/tmtcservices/AcceptsVerifyMessageIF.h similarity index 100% rename from tmtcservices/AcceptsVerifyMessageIF.h rename to inc/fsfw/tmtcservices/AcceptsVerifyMessageIF.h diff --git a/tmtcservices/CommandingServiceBase.h b/inc/fsfw/tmtcservices/CommandingServiceBase.h similarity index 100% rename from tmtcservices/CommandingServiceBase.h rename to inc/fsfw/tmtcservices/CommandingServiceBase.h diff --git a/tmtcservices/PusServiceBase.h b/inc/fsfw/tmtcservices/PusServiceBase.h similarity index 100% rename from tmtcservices/PusServiceBase.h rename to inc/fsfw/tmtcservices/PusServiceBase.h diff --git a/tmtcservices/PusVerificationReport.h b/inc/fsfw/tmtcservices/PusVerificationReport.h similarity index 100% rename from tmtcservices/PusVerificationReport.h rename to inc/fsfw/tmtcservices/PusVerificationReport.h diff --git a/tmtcservices/SourceSequenceCounter.h b/inc/fsfw/tmtcservices/SourceSequenceCounter.h similarity index 100% rename from tmtcservices/SourceSequenceCounter.h rename to inc/fsfw/tmtcservices/SourceSequenceCounter.h diff --git a/tmtcservices/TmTcBridge.h b/inc/fsfw/tmtcservices/TmTcBridge.h similarity index 100% rename from tmtcservices/TmTcBridge.h rename to inc/fsfw/tmtcservices/TmTcBridge.h diff --git a/tmtcservices/TmTcMessage.h b/inc/fsfw/tmtcservices/TmTcMessage.h similarity index 100% rename from tmtcservices/TmTcMessage.h rename to inc/fsfw/tmtcservices/TmTcMessage.h diff --git a/tmtcservices/VerificationCodes.h b/inc/fsfw/tmtcservices/VerificationCodes.h similarity index 100% rename from tmtcservices/VerificationCodes.h rename to inc/fsfw/tmtcservices/VerificationCodes.h diff --git a/tmtcservices/VerificationReporter.h b/inc/fsfw/tmtcservices/VerificationReporter.h similarity index 100% rename from tmtcservices/VerificationReporter.h rename to inc/fsfw/tmtcservices/VerificationReporter.h diff --git a/defaultcfg/README.md b/misc/defaultcfg/README.md similarity index 100% rename from defaultcfg/README.md rename to misc/defaultcfg/README.md diff --git a/defaultcfg/fsfwconfig/CMakeLists.txt b/misc/defaultcfg/fsfwconfig/CMakeLists.txt similarity index 100% rename from defaultcfg/fsfwconfig/CMakeLists.txt rename to misc/defaultcfg/fsfwconfig/CMakeLists.txt diff --git a/defaultcfg/fsfwconfig/FSFWConfig.h b/misc/defaultcfg/fsfwconfig/FSFWConfig.h similarity index 100% rename from defaultcfg/fsfwconfig/FSFWConfig.h rename to misc/defaultcfg/fsfwconfig/FSFWConfig.h diff --git a/defaultcfg/fsfwconfig/OBSWConfig.h b/misc/defaultcfg/fsfwconfig/OBSWConfig.h similarity index 100% rename from defaultcfg/fsfwconfig/OBSWConfig.h rename to misc/defaultcfg/fsfwconfig/OBSWConfig.h diff --git a/defaultcfg/fsfwconfig/OBSWVersion.h b/misc/defaultcfg/fsfwconfig/OBSWVersion.h similarity index 100% rename from defaultcfg/fsfwconfig/OBSWVersion.h rename to misc/defaultcfg/fsfwconfig/OBSWVersion.h diff --git a/defaultcfg/fsfwconfig/devices/logicalAddresses.h b/misc/defaultcfg/fsfwconfig/devices/logicalAddresses.h similarity index 100% rename from defaultcfg/fsfwconfig/devices/logicalAddresses.h rename to misc/defaultcfg/fsfwconfig/devices/logicalAddresses.h diff --git a/defaultcfg/fsfwconfig/devices/powerSwitcherList.h b/misc/defaultcfg/fsfwconfig/devices/powerSwitcherList.h similarity index 100% rename from defaultcfg/fsfwconfig/devices/powerSwitcherList.h rename to misc/defaultcfg/fsfwconfig/devices/powerSwitcherList.h diff --git a/defaultcfg/fsfwconfig/events/subsystemIdRanges.h b/misc/defaultcfg/fsfwconfig/events/subsystemIdRanges.h similarity index 100% rename from defaultcfg/fsfwconfig/events/subsystemIdRanges.h rename to misc/defaultcfg/fsfwconfig/events/subsystemIdRanges.h diff --git a/defaultcfg/fsfwconfig/fsfwconfig.mk b/misc/defaultcfg/fsfwconfig/fsfwconfig.mk similarity index 100% rename from defaultcfg/fsfwconfig/fsfwconfig.mk rename to misc/defaultcfg/fsfwconfig/fsfwconfig.mk diff --git a/defaultcfg/fsfwconfig/ipc/missionMessageTypes.cpp b/misc/defaultcfg/fsfwconfig/ipc/missionMessageTypes.cpp similarity index 100% rename from defaultcfg/fsfwconfig/ipc/missionMessageTypes.cpp rename to misc/defaultcfg/fsfwconfig/ipc/missionMessageTypes.cpp diff --git a/defaultcfg/fsfwconfig/ipc/missionMessageTypes.h b/misc/defaultcfg/fsfwconfig/ipc/missionMessageTypes.h similarity index 100% rename from defaultcfg/fsfwconfig/ipc/missionMessageTypes.h rename to misc/defaultcfg/fsfwconfig/ipc/missionMessageTypes.h diff --git a/defaultcfg/fsfwconfig/objects/FsfwFactory.cpp b/misc/defaultcfg/fsfwconfig/objects/FsfwFactory.cpp similarity index 100% rename from defaultcfg/fsfwconfig/objects/FsfwFactory.cpp rename to misc/defaultcfg/fsfwconfig/objects/FsfwFactory.cpp diff --git a/defaultcfg/fsfwconfig/objects/FsfwFactory.h b/misc/defaultcfg/fsfwconfig/objects/FsfwFactory.h similarity index 100% rename from defaultcfg/fsfwconfig/objects/FsfwFactory.h rename to misc/defaultcfg/fsfwconfig/objects/FsfwFactory.h diff --git a/defaultcfg/fsfwconfig/objects/systemObjectList.h b/misc/defaultcfg/fsfwconfig/objects/systemObjectList.h similarity index 100% rename from defaultcfg/fsfwconfig/objects/systemObjectList.h rename to misc/defaultcfg/fsfwconfig/objects/systemObjectList.h diff --git a/defaultcfg/fsfwconfig/pollingsequence/PollingSequenceFactory.cpp b/misc/defaultcfg/fsfwconfig/pollingsequence/PollingSequenceFactory.cpp similarity index 100% rename from defaultcfg/fsfwconfig/pollingsequence/PollingSequenceFactory.cpp rename to misc/defaultcfg/fsfwconfig/pollingsequence/PollingSequenceFactory.cpp diff --git a/defaultcfg/fsfwconfig/pollingsequence/PollingSequenceFactory.h b/misc/defaultcfg/fsfwconfig/pollingsequence/PollingSequenceFactory.h similarity index 100% rename from defaultcfg/fsfwconfig/pollingsequence/PollingSequenceFactory.h rename to misc/defaultcfg/fsfwconfig/pollingsequence/PollingSequenceFactory.h diff --git a/defaultcfg/fsfwconfig/returnvalues/classIds.h b/misc/defaultcfg/fsfwconfig/returnvalues/classIds.h similarity index 100% rename from defaultcfg/fsfwconfig/returnvalues/classIds.h rename to misc/defaultcfg/fsfwconfig/returnvalues/classIds.h diff --git a/defaultcfg/fsfwconfig/tmtc/apid.h b/misc/defaultcfg/fsfwconfig/tmtc/apid.h similarity index 100% rename from defaultcfg/fsfwconfig/tmtc/apid.h rename to misc/defaultcfg/fsfwconfig/tmtc/apid.h diff --git a/defaultcfg/fsfwconfig/tmtc/pusIds.h b/misc/defaultcfg/fsfwconfig/tmtc/pusIds.h similarity index 100% rename from defaultcfg/fsfwconfig/tmtc/pusIds.h rename to misc/defaultcfg/fsfwconfig/tmtc/pusIds.h diff --git a/logo/FSFW_Logo_V3.png b/misc/logo/FSFW_Logo_V3.png similarity index 100% rename from logo/FSFW_Logo_V3.png rename to misc/logo/FSFW_Logo_V3.png diff --git a/logo/FSFW_Logo_V3.svg b/misc/logo/FSFW_Logo_V3.svg similarity index 100% rename from logo/FSFW_Logo_V3.svg rename to misc/logo/FSFW_Logo_V3.svg diff --git a/logo/FSFW_Logo_V3_bw.png b/misc/logo/FSFW_Logo_V3_bw.png similarity index 100% rename from logo/FSFW_Logo_V3_bw.png rename to misc/logo/FSFW_Logo_V3_bw.png diff --git a/core/src/action/ActionHelper.cpp b/src/core/action/ActionHelper.cpp similarity index 100% rename from core/src/action/ActionHelper.cpp rename to src/core/action/ActionHelper.cpp diff --git a/core/src/action/ActionMessage.cpp b/src/core/action/ActionMessage.cpp similarity index 100% rename from core/src/action/ActionMessage.cpp rename to src/core/action/ActionMessage.cpp diff --git a/core/src/action/CMakeLists.txt b/src/core/action/CMakeLists.txt similarity index 100% rename from core/src/action/CMakeLists.txt rename to src/core/action/CMakeLists.txt diff --git a/core/src/action/CommandActionHelper.cpp b/src/core/action/CommandActionHelper.cpp similarity index 100% rename from core/src/action/CommandActionHelper.cpp rename to src/core/action/CommandActionHelper.cpp diff --git a/core/src/action/SimpleActionHelper.cpp b/src/core/action/SimpleActionHelper.cpp similarity index 100% rename from core/src/action/SimpleActionHelper.cpp rename to src/core/action/SimpleActionHelper.cpp diff --git a/core/src/container/CMakeLists.txt b/src/core/container/CMakeLists.txt similarity index 100% rename from core/src/container/CMakeLists.txt rename to src/core/container/CMakeLists.txt diff --git a/core/src/container/SharedRingBuffer.cpp b/src/core/container/SharedRingBuffer.cpp similarity index 100% rename from core/src/container/SharedRingBuffer.cpp rename to src/core/container/SharedRingBuffer.cpp diff --git a/core/src/container/SimpleRingBuffer.cpp b/src/core/container/SimpleRingBuffer.cpp similarity index 100% rename from core/src/container/SimpleRingBuffer.cpp rename to src/core/container/SimpleRingBuffer.cpp diff --git a/core/src/controller/CMakeLists.txt b/src/core/controller/CMakeLists.txt similarity index 100% rename from core/src/controller/CMakeLists.txt rename to src/core/controller/CMakeLists.txt diff --git a/core/src/controller/ControllerBase.cpp b/src/core/controller/ControllerBase.cpp similarity index 100% rename from core/src/controller/ControllerBase.cpp rename to src/core/controller/ControllerBase.cpp diff --git a/core/src/controller/ExtendedControllerBase.cpp b/src/core/controller/ExtendedControllerBase.cpp similarity index 100% rename from core/src/controller/ExtendedControllerBase.cpp rename to src/core/controller/ExtendedControllerBase.cpp diff --git a/core/src/datapool/CMakeLists.txt b/src/core/datapool/CMakeLists.txt similarity index 100% rename from core/src/datapool/CMakeLists.txt rename to src/core/datapool/CMakeLists.txt diff --git a/core/src/datapool/HkSwitchHelper.cpp b/src/core/datapool/HkSwitchHelper.cpp similarity index 100% rename from core/src/datapool/HkSwitchHelper.cpp rename to src/core/datapool/HkSwitchHelper.cpp diff --git a/core/src/datapool/PoolDataSetBase.cpp b/src/core/datapool/PoolDataSetBase.cpp similarity index 100% rename from core/src/datapool/PoolDataSetBase.cpp rename to src/core/datapool/PoolDataSetBase.cpp diff --git a/core/src/datapool/PoolEntry.cpp b/src/core/datapool/PoolEntry.cpp similarity index 100% rename from core/src/datapool/PoolEntry.cpp rename to src/core/datapool/PoolEntry.cpp diff --git a/core/src/datapoollocal/CMakeLists.txt b/src/core/datapoollocal/CMakeLists.txt similarity index 100% rename from core/src/datapoollocal/CMakeLists.txt rename to src/core/datapoollocal/CMakeLists.txt diff --git a/core/src/datapoollocal/LocalDataPoolManager.cpp b/src/core/datapoollocal/LocalDataPoolManager.cpp similarity index 100% rename from core/src/datapoollocal/LocalDataPoolManager.cpp rename to src/core/datapoollocal/LocalDataPoolManager.cpp diff --git a/core/src/datapoollocal/LocalDataSet.cpp b/src/core/datapoollocal/LocalDataSet.cpp similarity index 100% rename from core/src/datapoollocal/LocalDataSet.cpp rename to src/core/datapoollocal/LocalDataSet.cpp diff --git a/core/src/datapoollocal/LocalPoolDataSetBase.cpp b/src/core/datapoollocal/LocalPoolDataSetBase.cpp similarity index 100% rename from core/src/datapoollocal/LocalPoolDataSetBase.cpp rename to src/core/datapoollocal/LocalPoolDataSetBase.cpp diff --git a/core/src/datapoollocal/LocalPoolObjectBase.cpp b/src/core/datapoollocal/LocalPoolObjectBase.cpp similarity index 100% rename from core/src/datapoollocal/LocalPoolObjectBase.cpp rename to src/core/datapoollocal/LocalPoolObjectBase.cpp diff --git a/core/src/datapoollocal/SharedLocalDataSet.cpp b/src/core/datapoollocal/SharedLocalDataSet.cpp similarity index 100% rename from core/src/datapoollocal/SharedLocalDataSet.cpp rename to src/core/datapoollocal/SharedLocalDataSet.cpp diff --git a/core/src/datapoollocal/internal/CMakeLists.txt b/src/core/datapoollocal/internal/CMakeLists.txt similarity index 100% rename from core/src/datapoollocal/internal/CMakeLists.txt rename to src/core/datapoollocal/internal/CMakeLists.txt diff --git a/core/src/datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp b/src/core/datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp similarity index 100% rename from core/src/datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp rename to src/core/datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp diff --git a/core/src/datapoollocal/internal/HasLocalDpIFManagerAttorney.h b/src/core/datapoollocal/internal/HasLocalDpIFManagerAttorney.h similarity index 100% rename from core/src/datapoollocal/internal/HasLocalDpIFManagerAttorney.h rename to src/core/datapoollocal/internal/HasLocalDpIFManagerAttorney.h diff --git a/core/src/datapoollocal/internal/HasLocalDpIFUserAttorney.cpp b/src/core/datapoollocal/internal/HasLocalDpIFUserAttorney.cpp similarity index 100% rename from core/src/datapoollocal/internal/HasLocalDpIFUserAttorney.cpp rename to src/core/datapoollocal/internal/HasLocalDpIFUserAttorney.cpp diff --git a/core/src/datapoollocal/internal/HasLocalDpIFUserAttorney.h b/src/core/datapoollocal/internal/HasLocalDpIFUserAttorney.h similarity index 100% rename from core/src/datapoollocal/internal/HasLocalDpIFUserAttorney.h rename to src/core/datapoollocal/internal/HasLocalDpIFUserAttorney.h diff --git a/core/src/datapoollocal/internal/LocalDpManagerAttorney.h b/src/core/datapoollocal/internal/LocalDpManagerAttorney.h similarity index 100% rename from core/src/datapoollocal/internal/LocalDpManagerAttorney.h rename to src/core/datapoollocal/internal/LocalDpManagerAttorney.h diff --git a/core/src/datapoollocal/internal/LocalPoolDataSetAttorney.h b/src/core/datapoollocal/internal/LocalPoolDataSetAttorney.h similarity index 100% rename from core/src/datapoollocal/internal/LocalPoolDataSetAttorney.h rename to src/core/datapoollocal/internal/LocalPoolDataSetAttorney.h diff --git a/devicehandlers/AssemblyBase.cpp b/src/core/devicehandlers/AssemblyBase.cpp similarity index 100% rename from devicehandlers/AssemblyBase.cpp rename to src/core/devicehandlers/AssemblyBase.cpp diff --git a/devicehandlers/ChildHandlerBase.cpp b/src/core/devicehandlers/ChildHandlerBase.cpp similarity index 100% rename from devicehandlers/ChildHandlerBase.cpp rename to src/core/devicehandlers/ChildHandlerBase.cpp diff --git a/devicehandlers/ChildHandlerFDIR.cpp b/src/core/devicehandlers/ChildHandlerFDIR.cpp similarity index 100% rename from devicehandlers/ChildHandlerFDIR.cpp rename to src/core/devicehandlers/ChildHandlerFDIR.cpp diff --git a/devicehandlers/DeviceHandlerBase.cpp b/src/core/devicehandlers/DeviceHandlerBase.cpp similarity index 100% rename from devicehandlers/DeviceHandlerBase.cpp rename to src/core/devicehandlers/DeviceHandlerBase.cpp diff --git a/devicehandlers/DeviceHandlerFailureIsolation.cpp b/src/core/devicehandlers/DeviceHandlerFailureIsolation.cpp similarity index 100% rename from devicehandlers/DeviceHandlerFailureIsolation.cpp rename to src/core/devicehandlers/DeviceHandlerFailureIsolation.cpp diff --git a/devicehandlers/DeviceHandlerMessage.cpp b/src/core/devicehandlers/DeviceHandlerMessage.cpp similarity index 100% rename from devicehandlers/DeviceHandlerMessage.cpp rename to src/core/devicehandlers/DeviceHandlerMessage.cpp diff --git a/devicehandlers/DeviceTmReportingWrapper.cpp b/src/core/devicehandlers/DeviceTmReportingWrapper.cpp similarity index 100% rename from devicehandlers/DeviceTmReportingWrapper.cpp rename to src/core/devicehandlers/DeviceTmReportingWrapper.cpp diff --git a/devicehandlers/HealthDevice.cpp b/src/core/devicehandlers/HealthDevice.cpp similarity index 100% rename from devicehandlers/HealthDevice.cpp rename to src/core/devicehandlers/HealthDevice.cpp diff --git a/events/CMakeLists.txt b/src/core/events/CMakeLists.txt similarity index 100% rename from events/CMakeLists.txt rename to src/core/events/CMakeLists.txt diff --git a/events/EventManager.cpp b/src/core/events/EventManager.cpp similarity index 100% rename from events/EventManager.cpp rename to src/core/events/EventManager.cpp diff --git a/events/EventMessage.cpp b/src/core/events/EventMessage.cpp similarity index 100% rename from events/EventMessage.cpp rename to src/core/events/EventMessage.cpp diff --git a/fdir/CMakeLists.txt b/src/core/fdir/CMakeLists.txt similarity index 100% rename from fdir/CMakeLists.txt rename to src/core/fdir/CMakeLists.txt diff --git a/fdir/EventCorrelation.cpp b/src/core/fdir/EventCorrelation.cpp similarity index 100% rename from fdir/EventCorrelation.cpp rename to src/core/fdir/EventCorrelation.cpp diff --git a/fdir/FailureIsolationBase.cpp b/src/core/fdir/FailureIsolationBase.cpp similarity index 100% rename from fdir/FailureIsolationBase.cpp rename to src/core/fdir/FailureIsolationBase.cpp diff --git a/fdir/FaultCounter.cpp b/src/core/fdir/FaultCounter.cpp similarity index 100% rename from fdir/FaultCounter.cpp rename to src/core/fdir/FaultCounter.cpp diff --git a/globalfunctions/AsciiConverter.cpp b/src/core/globalfunctions/AsciiConverter.cpp similarity index 100% rename from globalfunctions/AsciiConverter.cpp rename to src/core/globalfunctions/AsciiConverter.cpp diff --git a/globalfunctions/CMakeLists.txt b/src/core/globalfunctions/CMakeLists.txt similarity index 100% rename from globalfunctions/CMakeLists.txt rename to src/core/globalfunctions/CMakeLists.txt diff --git a/globalfunctions/CRC.cpp b/src/core/globalfunctions/CRC.cpp similarity index 100% rename from globalfunctions/CRC.cpp rename to src/core/globalfunctions/CRC.cpp diff --git a/globalfunctions/DleEncoder.cpp b/src/core/globalfunctions/DleEncoder.cpp similarity index 100% rename from globalfunctions/DleEncoder.cpp rename to src/core/globalfunctions/DleEncoder.cpp diff --git a/globalfunctions/PeriodicOperationDivider.cpp b/src/core/globalfunctions/PeriodicOperationDivider.cpp similarity index 100% rename from globalfunctions/PeriodicOperationDivider.cpp rename to src/core/globalfunctions/PeriodicOperationDivider.cpp diff --git a/globalfunctions/Type.cpp b/src/core/globalfunctions/Type.cpp similarity index 100% rename from globalfunctions/Type.cpp rename to src/core/globalfunctions/Type.cpp diff --git a/globalfunctions/arrayprinter.cpp b/src/core/globalfunctions/arrayprinter.cpp similarity index 100% rename from globalfunctions/arrayprinter.cpp rename to src/core/globalfunctions/arrayprinter.cpp diff --git a/globalfunctions/bitutility.cpp b/src/core/globalfunctions/bitutility.cpp similarity index 100% rename from globalfunctions/bitutility.cpp rename to src/core/globalfunctions/bitutility.cpp diff --git a/globalfunctions/math/CMakeLists.txt b/src/core/globalfunctions/math/CMakeLists.txt similarity index 100% rename from globalfunctions/math/CMakeLists.txt rename to src/core/globalfunctions/math/CMakeLists.txt diff --git a/globalfunctions/math/QuaternionOperations.cpp b/src/core/globalfunctions/math/QuaternionOperations.cpp similarity index 100% rename from globalfunctions/math/QuaternionOperations.cpp rename to src/core/globalfunctions/math/QuaternionOperations.cpp diff --git a/globalfunctions/timevalOperations.cpp b/src/core/globalfunctions/timevalOperations.cpp similarity index 100% rename from globalfunctions/timevalOperations.cpp rename to src/core/globalfunctions/timevalOperations.cpp diff --git a/health/CMakeLists.txt b/src/core/health/CMakeLists.txt similarity index 100% rename from health/CMakeLists.txt rename to src/core/health/CMakeLists.txt diff --git a/health/HealthHelper.cpp b/src/core/health/HealthHelper.cpp similarity index 100% rename from health/HealthHelper.cpp rename to src/core/health/HealthHelper.cpp diff --git a/health/HealthMessage.cpp b/src/core/health/HealthMessage.cpp similarity index 100% rename from health/HealthMessage.cpp rename to src/core/health/HealthMessage.cpp diff --git a/health/HealthTable.cpp b/src/core/health/HealthTable.cpp similarity index 100% rename from health/HealthTable.cpp rename to src/core/health/HealthTable.cpp diff --git a/housekeeping/HousekeepingMessage.cpp b/src/core/housekeeping/HousekeepingMessage.cpp similarity index 100% rename from housekeeping/HousekeepingMessage.cpp rename to src/core/housekeeping/HousekeepingMessage.cpp diff --git a/housekeeping/PeriodicHousekeepingHelper.cpp b/src/core/housekeeping/PeriodicHousekeepingHelper.cpp similarity index 100% rename from housekeeping/PeriodicHousekeepingHelper.cpp rename to src/core/housekeeping/PeriodicHousekeepingHelper.cpp diff --git a/internalError/CMakeLists.txt b/src/core/internalError/CMakeLists.txt similarity index 100% rename from internalError/CMakeLists.txt rename to src/core/internalError/CMakeLists.txt diff --git a/internalError/InternalErrorReporter.cpp b/src/core/internalError/InternalErrorReporter.cpp similarity index 100% rename from internalError/InternalErrorReporter.cpp rename to src/core/internalError/InternalErrorReporter.cpp diff --git a/ipc/CMakeLists.txt b/src/core/ipc/CMakeLists.txt similarity index 100% rename from ipc/CMakeLists.txt rename to src/core/ipc/CMakeLists.txt diff --git a/ipc/CommandMessage.cpp b/src/core/ipc/CommandMessage.cpp similarity index 100% rename from ipc/CommandMessage.cpp rename to src/core/ipc/CommandMessage.cpp diff --git a/ipc/CommandMessageCleaner.cpp b/src/core/ipc/CommandMessageCleaner.cpp similarity index 100% rename from ipc/CommandMessageCleaner.cpp rename to src/core/ipc/CommandMessageCleaner.cpp diff --git a/ipc/MessageQueueMessage.cpp b/src/core/ipc/MessageQueueMessage.cpp similarity index 100% rename from ipc/MessageQueueMessage.cpp rename to src/core/ipc/MessageQueueMessage.cpp diff --git a/modes/CMakeLists.txt b/src/core/modes/CMakeLists.txt similarity index 100% rename from modes/CMakeLists.txt rename to src/core/modes/CMakeLists.txt diff --git a/modes/ModeHelper.cpp b/src/core/modes/ModeHelper.cpp similarity index 100% rename from modes/ModeHelper.cpp rename to src/core/modes/ModeHelper.cpp diff --git a/modes/ModeMessage.cpp b/src/core/modes/ModeMessage.cpp similarity index 100% rename from modes/ModeMessage.cpp rename to src/core/modes/ModeMessage.cpp diff --git a/objectmanager/CMakeLists.txt b/src/core/objectmanager/CMakeLists.txt similarity index 100% rename from objectmanager/CMakeLists.txt rename to src/core/objectmanager/CMakeLists.txt diff --git a/objectmanager/ObjectManager.cpp b/src/core/objectmanager/ObjectManager.cpp similarity index 100% rename from objectmanager/ObjectManager.cpp rename to src/core/objectmanager/ObjectManager.cpp diff --git a/objectmanager/SystemObject.cpp b/src/core/objectmanager/SystemObject.cpp similarity index 100% rename from objectmanager/SystemObject.cpp rename to src/core/objectmanager/SystemObject.cpp diff --git a/parameters/CMakeLists.txt b/src/core/parameters/CMakeLists.txt similarity index 100% rename from parameters/CMakeLists.txt rename to src/core/parameters/CMakeLists.txt diff --git a/parameters/ParameterHelper.cpp b/src/core/parameters/ParameterHelper.cpp similarity index 100% rename from parameters/ParameterHelper.cpp rename to src/core/parameters/ParameterHelper.cpp diff --git a/parameters/ParameterMessage.cpp b/src/core/parameters/ParameterMessage.cpp similarity index 100% rename from parameters/ParameterMessage.cpp rename to src/core/parameters/ParameterMessage.cpp diff --git a/parameters/ParameterWrapper.cpp b/src/core/parameters/ParameterWrapper.cpp similarity index 100% rename from parameters/ParameterWrapper.cpp rename to src/core/parameters/ParameterWrapper.cpp diff --git a/power/CMakeLists.txt b/src/core/power/CMakeLists.txt similarity index 100% rename from power/CMakeLists.txt rename to src/core/power/CMakeLists.txt diff --git a/power/Fuse.cpp b/src/core/power/Fuse.cpp similarity index 100% rename from power/Fuse.cpp rename to src/core/power/Fuse.cpp diff --git a/power/PowerComponent.cpp b/src/core/power/PowerComponent.cpp similarity index 100% rename from power/PowerComponent.cpp rename to src/core/power/PowerComponent.cpp diff --git a/power/PowerSensor.cpp b/src/core/power/PowerSensor.cpp similarity index 100% rename from power/PowerSensor.cpp rename to src/core/power/PowerSensor.cpp diff --git a/power/PowerSwitcher.cpp b/src/core/power/PowerSwitcher.cpp similarity index 100% rename from power/PowerSwitcher.cpp rename to src/core/power/PowerSwitcher.cpp diff --git a/serialize/CMakeLists.txt b/src/core/serialize/CMakeLists.txt similarity index 100% rename from serialize/CMakeLists.txt rename to src/core/serialize/CMakeLists.txt diff --git a/serialize/SerialBufferAdapter.cpp b/src/core/serialize/SerialBufferAdapter.cpp similarity index 100% rename from serialize/SerialBufferAdapter.cpp rename to src/core/serialize/SerialBufferAdapter.cpp diff --git a/serviceinterface/CMakeLists.txt b/src/core/serviceinterface/CMakeLists.txt similarity index 100% rename from serviceinterface/CMakeLists.txt rename to src/core/serviceinterface/CMakeLists.txt diff --git a/serviceinterface/ServiceInterfaceBuffer.cpp b/src/core/serviceinterface/ServiceInterfaceBuffer.cpp similarity index 100% rename from serviceinterface/ServiceInterfaceBuffer.cpp rename to src/core/serviceinterface/ServiceInterfaceBuffer.cpp diff --git a/serviceinterface/ServiceInterfacePrinter.cpp b/src/core/serviceinterface/ServiceInterfacePrinter.cpp similarity index 100% rename from serviceinterface/ServiceInterfacePrinter.cpp rename to src/core/serviceinterface/ServiceInterfacePrinter.cpp diff --git a/serviceinterface/ServiceInterfaceStream.cpp b/src/core/serviceinterface/ServiceInterfaceStream.cpp similarity index 100% rename from serviceinterface/ServiceInterfaceStream.cpp rename to src/core/serviceinterface/ServiceInterfaceStream.cpp diff --git a/storagemanager/CMakeLists.txt b/src/core/storagemanager/CMakeLists.txt similarity index 100% rename from storagemanager/CMakeLists.txt rename to src/core/storagemanager/CMakeLists.txt diff --git a/storagemanager/ConstStorageAccessor.cpp b/src/core/storagemanager/ConstStorageAccessor.cpp similarity index 100% rename from storagemanager/ConstStorageAccessor.cpp rename to src/core/storagemanager/ConstStorageAccessor.cpp diff --git a/storagemanager/LocalPool.cpp b/src/core/storagemanager/LocalPool.cpp similarity index 100% rename from storagemanager/LocalPool.cpp rename to src/core/storagemanager/LocalPool.cpp diff --git a/storagemanager/PoolManager.cpp b/src/core/storagemanager/PoolManager.cpp similarity index 100% rename from storagemanager/PoolManager.cpp rename to src/core/storagemanager/PoolManager.cpp diff --git a/storagemanager/StorageAccessor.cpp b/src/core/storagemanager/StorageAccessor.cpp similarity index 100% rename from storagemanager/StorageAccessor.cpp rename to src/core/storagemanager/StorageAccessor.cpp diff --git a/subsystem/CMakeLists.txt b/src/core/subsystem/CMakeLists.txt similarity index 100% rename from subsystem/CMakeLists.txt rename to src/core/subsystem/CMakeLists.txt diff --git a/subsystem/Subsystem.cpp b/src/core/subsystem/Subsystem.cpp similarity index 100% rename from subsystem/Subsystem.cpp rename to src/core/subsystem/Subsystem.cpp diff --git a/subsystem/SubsystemBase.cpp b/src/core/subsystem/SubsystemBase.cpp similarity index 100% rename from subsystem/SubsystemBase.cpp rename to src/core/subsystem/SubsystemBase.cpp diff --git a/subsystem/modes/CMakeLists.txt b/src/core/subsystem/modes/CMakeLists.txt similarity index 100% rename from subsystem/modes/CMakeLists.txt rename to src/core/subsystem/modes/CMakeLists.txt diff --git a/subsystem/modes/ModeSequenceMessage.cpp b/src/core/subsystem/modes/ModeSequenceMessage.cpp similarity index 100% rename from subsystem/modes/ModeSequenceMessage.cpp rename to src/core/subsystem/modes/ModeSequenceMessage.cpp diff --git a/subsystem/modes/ModeStore.cpp b/src/core/subsystem/modes/ModeStore.cpp similarity index 100% rename from subsystem/modes/ModeStore.cpp rename to src/core/subsystem/modes/ModeStore.cpp diff --git a/tasks/CMakeLists.txt b/src/core/tasks/CMakeLists.txt similarity index 100% rename from tasks/CMakeLists.txt rename to src/core/tasks/CMakeLists.txt diff --git a/tasks/FixedSequenceSlot.cpp b/src/core/tasks/FixedSequenceSlot.cpp similarity index 100% rename from tasks/FixedSequenceSlot.cpp rename to src/core/tasks/FixedSequenceSlot.cpp diff --git a/tasks/FixedSlotSequence.cpp b/src/core/tasks/FixedSlotSequence.cpp similarity index 100% rename from tasks/FixedSlotSequence.cpp rename to src/core/tasks/FixedSlotSequence.cpp diff --git a/tcdistribution/CCSDSDistributor.cpp b/src/core/tcdistribution/CCSDSDistributor.cpp similarity index 100% rename from tcdistribution/CCSDSDistributor.cpp rename to src/core/tcdistribution/CCSDSDistributor.cpp diff --git a/tcdistribution/CMakeLists.txt b/src/core/tcdistribution/CMakeLists.txt similarity index 100% rename from tcdistribution/CMakeLists.txt rename to src/core/tcdistribution/CMakeLists.txt diff --git a/tcdistribution/PUSDistributor.cpp b/src/core/tcdistribution/PUSDistributor.cpp similarity index 100% rename from tcdistribution/PUSDistributor.cpp rename to src/core/tcdistribution/PUSDistributor.cpp diff --git a/tcdistribution/TcDistributor.cpp b/src/core/tcdistribution/TcDistributor.cpp similarity index 100% rename from tcdistribution/TcDistributor.cpp rename to src/core/tcdistribution/TcDistributor.cpp diff --git a/tcdistribution/TcPacketCheck.cpp b/src/core/tcdistribution/TcPacketCheck.cpp similarity index 100% rename from tcdistribution/TcPacketCheck.cpp rename to src/core/tcdistribution/TcPacketCheck.cpp diff --git a/thermal/AbstractTemperatureSensor.cpp b/src/core/thermal/AbstractTemperatureSensor.cpp similarity index 100% rename from thermal/AbstractTemperatureSensor.cpp rename to src/core/thermal/AbstractTemperatureSensor.cpp diff --git a/thermal/CMakeLists.txt b/src/core/thermal/CMakeLists.txt similarity index 100% rename from thermal/CMakeLists.txt rename to src/core/thermal/CMakeLists.txt diff --git a/thermal/Heater.cpp b/src/core/thermal/Heater.cpp similarity index 100% rename from thermal/Heater.cpp rename to src/core/thermal/Heater.cpp diff --git a/thermal/RedundantHeater.cpp b/src/core/thermal/RedundantHeater.cpp similarity index 100% rename from thermal/RedundantHeater.cpp rename to src/core/thermal/RedundantHeater.cpp diff --git a/thermal/ThermalComponent.cpp b/src/core/thermal/ThermalComponent.cpp similarity index 100% rename from thermal/ThermalComponent.cpp rename to src/core/thermal/ThermalComponent.cpp diff --git a/thermal/ThermalComponentCore.cpp b/src/core/thermal/ThermalComponentCore.cpp similarity index 100% rename from thermal/ThermalComponentCore.cpp rename to src/core/thermal/ThermalComponentCore.cpp diff --git a/thermal/ThermalModule.cpp b/src/core/thermal/ThermalModule.cpp similarity index 100% rename from thermal/ThermalModule.cpp rename to src/core/thermal/ThermalModule.cpp diff --git a/thermal/ThermalMonitorReporter.cpp b/src/core/thermal/ThermalMonitorReporter.cpp similarity index 100% rename from thermal/ThermalMonitorReporter.cpp rename to src/core/thermal/ThermalMonitorReporter.cpp diff --git a/timemanager/CCSDSTime.cpp b/src/core/timemanager/CCSDSTime.cpp similarity index 100% rename from timemanager/CCSDSTime.cpp rename to src/core/timemanager/CCSDSTime.cpp diff --git a/timemanager/CMakeLists.txt b/src/core/timemanager/CMakeLists.txt similarity index 100% rename from timemanager/CMakeLists.txt rename to src/core/timemanager/CMakeLists.txt diff --git a/timemanager/ClockCommon.cpp b/src/core/timemanager/ClockCommon.cpp similarity index 100% rename from timemanager/ClockCommon.cpp rename to src/core/timemanager/ClockCommon.cpp diff --git a/timemanager/Countdown.cpp b/src/core/timemanager/Countdown.cpp similarity index 100% rename from timemanager/Countdown.cpp rename to src/core/timemanager/Countdown.cpp diff --git a/timemanager/Stopwatch.cpp b/src/core/timemanager/Stopwatch.cpp similarity index 100% rename from timemanager/Stopwatch.cpp rename to src/core/timemanager/Stopwatch.cpp diff --git a/timemanager/TimeMessage.cpp b/src/core/timemanager/TimeMessage.cpp similarity index 100% rename from timemanager/TimeMessage.cpp rename to src/core/timemanager/TimeMessage.cpp diff --git a/timemanager/TimeStamper.cpp b/src/core/timemanager/TimeStamper.cpp similarity index 100% rename from timemanager/TimeStamper.cpp rename to src/core/timemanager/TimeStamper.cpp diff --git a/tmtcpacket/CMakeLists.txt b/src/core/tmtcpacket/CMakeLists.txt similarity index 100% rename from tmtcpacket/CMakeLists.txt rename to src/core/tmtcpacket/CMakeLists.txt diff --git a/tmtcpacket/SpacePacket.cpp b/src/core/tmtcpacket/SpacePacket.cpp similarity index 100% rename from tmtcpacket/SpacePacket.cpp rename to src/core/tmtcpacket/SpacePacket.cpp diff --git a/tmtcpacket/SpacePacketBase.cpp b/src/core/tmtcpacket/SpacePacketBase.cpp similarity index 100% rename from tmtcpacket/SpacePacketBase.cpp rename to src/core/tmtcpacket/SpacePacketBase.cpp diff --git a/tmtcpacket/packetmatcher/CMakeLists.txt b/src/core/tmtcpacket/packetmatcher/CMakeLists.txt similarity index 100% rename from tmtcpacket/packetmatcher/CMakeLists.txt rename to src/core/tmtcpacket/packetmatcher/CMakeLists.txt diff --git a/tmtcpacket/packetmatcher/PacketMatchTree.cpp b/src/core/tmtcpacket/packetmatcher/PacketMatchTree.cpp similarity index 100% rename from tmtcpacket/packetmatcher/PacketMatchTree.cpp rename to src/core/tmtcpacket/packetmatcher/PacketMatchTree.cpp diff --git a/tmtcpacket/pus/CMakeLists.txt b/src/core/tmtcpacket/pus/CMakeLists.txt similarity index 100% rename from tmtcpacket/pus/CMakeLists.txt rename to src/core/tmtcpacket/pus/CMakeLists.txt diff --git a/tmtcpacket/pus/tc/CMakeLists.txt b/src/core/tmtcpacket/pus/tc/CMakeLists.txt similarity index 100% rename from tmtcpacket/pus/tc/CMakeLists.txt rename to src/core/tmtcpacket/pus/tc/CMakeLists.txt diff --git a/tmtcpacket/pus/tc/TcPacketBase.cpp b/src/core/tmtcpacket/pus/tc/TcPacketBase.cpp similarity index 100% rename from tmtcpacket/pus/tc/TcPacketBase.cpp rename to src/core/tmtcpacket/pus/tc/TcPacketBase.cpp diff --git a/tmtcpacket/pus/tc/TcPacketPus.cpp b/src/core/tmtcpacket/pus/tc/TcPacketPus.cpp similarity index 100% rename from tmtcpacket/pus/tc/TcPacketPus.cpp rename to src/core/tmtcpacket/pus/tc/TcPacketPus.cpp diff --git a/tmtcpacket/pus/tc/TcPacketStoredBase.cpp b/src/core/tmtcpacket/pus/tc/TcPacketStoredBase.cpp similarity index 100% rename from tmtcpacket/pus/tc/TcPacketStoredBase.cpp rename to src/core/tmtcpacket/pus/tc/TcPacketStoredBase.cpp diff --git a/tmtcpacket/pus/tc/TcPacketStoredPus.cpp b/src/core/tmtcpacket/pus/tc/TcPacketStoredPus.cpp similarity index 100% rename from tmtcpacket/pus/tc/TcPacketStoredPus.cpp rename to src/core/tmtcpacket/pus/tc/TcPacketStoredPus.cpp diff --git a/tmtcpacket/pus/tm/CMakeLists.txt b/src/core/tmtcpacket/pus/tm/CMakeLists.txt similarity index 100% rename from tmtcpacket/pus/tm/CMakeLists.txt rename to src/core/tmtcpacket/pus/tm/CMakeLists.txt diff --git a/tmtcpacket/pus/tm/TmPacketBase.cpp b/src/core/tmtcpacket/pus/tm/TmPacketBase.cpp similarity index 100% rename from tmtcpacket/pus/tm/TmPacketBase.cpp rename to src/core/tmtcpacket/pus/tm/TmPacketBase.cpp diff --git a/tmtcpacket/pus/tm/TmPacketMinimal.cpp b/src/core/tmtcpacket/pus/tm/TmPacketMinimal.cpp similarity index 100% rename from tmtcpacket/pus/tm/TmPacketMinimal.cpp rename to src/core/tmtcpacket/pus/tm/TmPacketMinimal.cpp diff --git a/tmtcpacket/pus/tm/TmPacketPusA.cpp b/src/core/tmtcpacket/pus/tm/TmPacketPusA.cpp similarity index 100% rename from tmtcpacket/pus/tm/TmPacketPusA.cpp rename to src/core/tmtcpacket/pus/tm/TmPacketPusA.cpp diff --git a/tmtcpacket/pus/tm/TmPacketPusC.cpp b/src/core/tmtcpacket/pus/tm/TmPacketPusC.cpp similarity index 100% rename from tmtcpacket/pus/tm/TmPacketPusC.cpp rename to src/core/tmtcpacket/pus/tm/TmPacketPusC.cpp diff --git a/tmtcpacket/pus/tm/TmPacketStoredBase.cpp b/src/core/tmtcpacket/pus/tm/TmPacketStoredBase.cpp similarity index 100% rename from tmtcpacket/pus/tm/TmPacketStoredBase.cpp rename to src/core/tmtcpacket/pus/tm/TmPacketStoredBase.cpp diff --git a/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp b/src/core/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp similarity index 100% rename from tmtcpacket/pus/tm/TmPacketStoredPusA.cpp rename to src/core/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp diff --git a/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp b/src/core/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp similarity index 100% rename from tmtcpacket/pus/tm/TmPacketStoredPusC.cpp rename to src/core/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp diff --git a/tmtcservices/CMakeLists.txt b/src/core/tmtcservices/CMakeLists.txt similarity index 100% rename from tmtcservices/CMakeLists.txt rename to src/core/tmtcservices/CMakeLists.txt diff --git a/tmtcservices/CommandingServiceBase.cpp b/src/core/tmtcservices/CommandingServiceBase.cpp similarity index 100% rename from tmtcservices/CommandingServiceBase.cpp rename to src/core/tmtcservices/CommandingServiceBase.cpp diff --git a/tmtcservices/PusServiceBase.cpp b/src/core/tmtcservices/PusServiceBase.cpp similarity index 100% rename from tmtcservices/PusServiceBase.cpp rename to src/core/tmtcservices/PusServiceBase.cpp diff --git a/tmtcservices/PusVerificationReport.cpp b/src/core/tmtcservices/PusVerificationReport.cpp similarity index 100% rename from tmtcservices/PusVerificationReport.cpp rename to src/core/tmtcservices/PusVerificationReport.cpp diff --git a/tmtcservices/TmTcBridge.cpp b/src/core/tmtcservices/TmTcBridge.cpp similarity index 100% rename from tmtcservices/TmTcBridge.cpp rename to src/core/tmtcservices/TmTcBridge.cpp diff --git a/tmtcservices/TmTcMessage.cpp b/src/core/tmtcservices/TmTcMessage.cpp similarity index 100% rename from tmtcservices/TmTcMessage.cpp rename to src/core/tmtcservices/TmTcMessage.cpp diff --git a/tmtcservices/VerificationReporter.cpp b/src/core/tmtcservices/VerificationReporter.cpp similarity index 100% rename from tmtcservices/VerificationReporter.cpp rename to src/core/tmtcservices/VerificationReporter.cpp diff --git a/opt/src/coordinates/CMakeLists.txt b/src/opt/coordinates/CMakeLists.txt similarity index 100% rename from opt/src/coordinates/CMakeLists.txt rename to src/opt/coordinates/CMakeLists.txt diff --git a/opt/src/coordinates/CoordinateTransformations.cpp b/src/opt/coordinates/CoordinateTransformations.cpp similarity index 100% rename from opt/src/coordinates/CoordinateTransformations.cpp rename to src/opt/coordinates/CoordinateTransformations.cpp diff --git a/opt/src/coordinates/Sgp4Propagator.cpp b/src/opt/coordinates/Sgp4Propagator.cpp similarity index 100% rename from opt/src/coordinates/Sgp4Propagator.cpp rename to src/opt/coordinates/Sgp4Propagator.cpp diff --git a/opt/src/datalinklayer/CMakeLists.txt b/src/opt/datalinklayer/CMakeLists.txt similarity index 100% rename from opt/src/datalinklayer/CMakeLists.txt rename to src/opt/datalinklayer/CMakeLists.txt diff --git a/opt/src/datalinklayer/Clcw.cpp b/src/opt/datalinklayer/Clcw.cpp similarity index 100% rename from opt/src/datalinklayer/Clcw.cpp rename to src/opt/datalinklayer/Clcw.cpp diff --git a/opt/src/datalinklayer/DataLinkLayer.cpp b/src/opt/datalinklayer/DataLinkLayer.cpp similarity index 100% rename from opt/src/datalinklayer/DataLinkLayer.cpp rename to src/opt/datalinklayer/DataLinkLayer.cpp diff --git a/opt/src/datalinklayer/Farm1StateLockout.cpp b/src/opt/datalinklayer/Farm1StateLockout.cpp similarity index 100% rename from opt/src/datalinklayer/Farm1StateLockout.cpp rename to src/opt/datalinklayer/Farm1StateLockout.cpp diff --git a/opt/src/datalinklayer/Farm1StateOpen.cpp b/src/opt/datalinklayer/Farm1StateOpen.cpp similarity index 100% rename from opt/src/datalinklayer/Farm1StateOpen.cpp rename to src/opt/datalinklayer/Farm1StateOpen.cpp diff --git a/opt/src/datalinklayer/Farm1StateWait.cpp b/src/opt/datalinklayer/Farm1StateWait.cpp similarity index 100% rename from opt/src/datalinklayer/Farm1StateWait.cpp rename to src/opt/datalinklayer/Farm1StateWait.cpp diff --git a/opt/src/datalinklayer/MapPacketExtraction.cpp b/src/opt/datalinklayer/MapPacketExtraction.cpp similarity index 100% rename from opt/src/datalinklayer/MapPacketExtraction.cpp rename to src/opt/datalinklayer/MapPacketExtraction.cpp diff --git a/opt/src/datalinklayer/TcTransferFrame.cpp b/src/opt/datalinklayer/TcTransferFrame.cpp similarity index 100% rename from opt/src/datalinklayer/TcTransferFrame.cpp rename to src/opt/datalinklayer/TcTransferFrame.cpp diff --git a/opt/src/datalinklayer/TcTransferFrameLocal.cpp b/src/opt/datalinklayer/TcTransferFrameLocal.cpp similarity index 100% rename from opt/src/datalinklayer/TcTransferFrameLocal.cpp rename to src/opt/datalinklayer/TcTransferFrameLocal.cpp diff --git a/opt/src/datalinklayer/VirtualChannelReception.cpp b/src/opt/datalinklayer/VirtualChannelReception.cpp similarity index 100% rename from opt/src/datalinklayer/VirtualChannelReception.cpp rename to src/opt/datalinklayer/VirtualChannelReception.cpp diff --git a/memory/CMakeLists.txt b/src/opt/memory/CMakeLists.txt similarity index 100% rename from memory/CMakeLists.txt rename to src/opt/memory/CMakeLists.txt diff --git a/memory/GenericFileSystemMessage.cpp b/src/opt/memory/GenericFileSystemMessage.cpp similarity index 100% rename from memory/GenericFileSystemMessage.cpp rename to src/opt/memory/GenericFileSystemMessage.cpp diff --git a/memory/MemoryHelper.cpp b/src/opt/memory/MemoryHelper.cpp similarity index 100% rename from memory/MemoryHelper.cpp rename to src/opt/memory/MemoryHelper.cpp diff --git a/memory/MemoryMessage.cpp b/src/opt/memory/MemoryMessage.cpp similarity index 100% rename from memory/MemoryMessage.cpp rename to src/opt/memory/MemoryMessage.cpp diff --git a/monitoring/CMakeLists.txt b/src/opt/monitoring/CMakeLists.txt similarity index 100% rename from monitoring/CMakeLists.txt rename to src/opt/monitoring/CMakeLists.txt diff --git a/monitoring/LimitViolationReporter.cpp b/src/opt/monitoring/LimitViolationReporter.cpp similarity index 100% rename from monitoring/LimitViolationReporter.cpp rename to src/opt/monitoring/LimitViolationReporter.cpp diff --git a/monitoring/MonitoringMessage.cpp b/src/opt/monitoring/MonitoringMessage.cpp similarity index 100% rename from monitoring/MonitoringMessage.cpp rename to src/opt/monitoring/MonitoringMessage.cpp diff --git a/pus/CMakeLists.txt b/src/opt/pus/CMakeLists.txt similarity index 100% rename from pus/CMakeLists.txt rename to src/opt/pus/CMakeLists.txt diff --git a/pus/CService200ModeCommanding.cpp b/src/opt/pus/CService200ModeCommanding.cpp similarity index 100% rename from pus/CService200ModeCommanding.cpp rename to src/opt/pus/CService200ModeCommanding.cpp diff --git a/pus/CService201HealthCommanding.cpp b/src/opt/pus/CService201HealthCommanding.cpp similarity index 100% rename from pus/CService201HealthCommanding.cpp rename to src/opt/pus/CService201HealthCommanding.cpp diff --git a/pus/Service17Test.cpp b/src/opt/pus/Service17Test.cpp similarity index 100% rename from pus/Service17Test.cpp rename to src/opt/pus/Service17Test.cpp diff --git a/pus/Service1TelecommandVerification.cpp b/src/opt/pus/Service1TelecommandVerification.cpp similarity index 100% rename from pus/Service1TelecommandVerification.cpp rename to src/opt/pus/Service1TelecommandVerification.cpp diff --git a/pus/Service20ParameterManagement.cpp b/src/opt/pus/Service20ParameterManagement.cpp similarity index 100% rename from pus/Service20ParameterManagement.cpp rename to src/opt/pus/Service20ParameterManagement.cpp diff --git a/pus/Service2DeviceAccess.cpp b/src/opt/pus/Service2DeviceAccess.cpp similarity index 100% rename from pus/Service2DeviceAccess.cpp rename to src/opt/pus/Service2DeviceAccess.cpp diff --git a/pus/Service3Housekeeping.cpp b/src/opt/pus/Service3Housekeeping.cpp similarity index 100% rename from pus/Service3Housekeeping.cpp rename to src/opt/pus/Service3Housekeeping.cpp diff --git a/pus/Service5EventReporting.cpp b/src/opt/pus/Service5EventReporting.cpp similarity index 100% rename from pus/Service5EventReporting.cpp rename to src/opt/pus/Service5EventReporting.cpp diff --git a/pus/Service8FunctionManagement.cpp b/src/opt/pus/Service8FunctionManagement.cpp similarity index 100% rename from pus/Service8FunctionManagement.cpp rename to src/opt/pus/Service8FunctionManagement.cpp diff --git a/pus/Service9TimeManagement.cpp b/src/opt/pus/Service9TimeManagement.cpp similarity index 100% rename from pus/Service9TimeManagement.cpp rename to src/opt/pus/Service9TimeManagement.cpp diff --git a/rmap/CMakeLists.txt b/src/opt/rmap/CMakeLists.txt similarity index 100% rename from rmap/CMakeLists.txt rename to src/opt/rmap/CMakeLists.txt diff --git a/rmap/RMAP.cpp b/src/opt/rmap/RMAP.cpp similarity index 100% rename from rmap/RMAP.cpp rename to src/opt/rmap/RMAP.cpp diff --git a/rmap/RMAPCookie.cpp b/src/opt/rmap/RMAPCookie.cpp similarity index 100% rename from rmap/RMAPCookie.cpp rename to src/opt/rmap/RMAPCookie.cpp diff --git a/rmap/RmapDeviceCommunicationIF.cpp b/src/opt/rmap/RmapDeviceCommunicationIF.cpp similarity index 100% rename from rmap/RmapDeviceCommunicationIF.cpp rename to src/opt/rmap/RmapDeviceCommunicationIF.cpp diff --git a/tmstorage/CMakeLists.txt b/src/opt/tmstorage/CMakeLists.txt similarity index 100% rename from tmstorage/CMakeLists.txt rename to src/opt/tmstorage/CMakeLists.txt diff --git a/tmstorage/TmStoreMessage.cpp b/src/opt/tmstorage/TmStoreMessage.cpp similarity index 100% rename from tmstorage/TmStoreMessage.cpp rename to src/opt/tmstorage/TmStoreMessage.cpp diff --git a/osal/CMakeLists.txt b/src/osal/CMakeLists.txt similarity index 100% rename from osal/CMakeLists.txt rename to src/osal/CMakeLists.txt diff --git a/osal/common/CMakeLists.txt b/src/osal/common/CMakeLists.txt similarity index 100% rename from osal/common/CMakeLists.txt rename to src/osal/common/CMakeLists.txt diff --git a/osal/common/TcpIpBase.cpp b/src/osal/common/TcpIpBase.cpp similarity index 100% rename from osal/common/TcpIpBase.cpp rename to src/osal/common/TcpIpBase.cpp diff --git a/osal/common/TcpTmTcBridge.cpp b/src/osal/common/TcpTmTcBridge.cpp similarity index 100% rename from osal/common/TcpTmTcBridge.cpp rename to src/osal/common/TcpTmTcBridge.cpp diff --git a/osal/common/TcpTmTcServer.cpp b/src/osal/common/TcpTmTcServer.cpp similarity index 100% rename from osal/common/TcpTmTcServer.cpp rename to src/osal/common/TcpTmTcServer.cpp diff --git a/osal/common/UdpTcPollingTask.cpp b/src/osal/common/UdpTcPollingTask.cpp similarity index 100% rename from osal/common/UdpTcPollingTask.cpp rename to src/osal/common/UdpTcPollingTask.cpp diff --git a/osal/common/UdpTmTcBridge.cpp b/src/osal/common/UdpTmTcBridge.cpp similarity index 100% rename from osal/common/UdpTmTcBridge.cpp rename to src/osal/common/UdpTmTcBridge.cpp diff --git a/osal/common/tcpipCommon.cpp b/src/osal/common/tcpipCommon.cpp similarity index 100% rename from osal/common/tcpipCommon.cpp rename to src/osal/common/tcpipCommon.cpp diff --git a/osal/FreeRTOS/BinSemaphUsingTask.cpp b/src/osal/freertos/BinSemaphUsingTask.cpp similarity index 100% rename from osal/FreeRTOS/BinSemaphUsingTask.cpp rename to src/osal/freertos/BinSemaphUsingTask.cpp diff --git a/osal/FreeRTOS/BinarySemaphore.cpp b/src/osal/freertos/BinarySemaphore.cpp similarity index 100% rename from osal/FreeRTOS/BinarySemaphore.cpp rename to src/osal/freertos/BinarySemaphore.cpp diff --git a/osal/FreeRTOS/CMakeLists.txt b/src/osal/freertos/CMakeLists.txt similarity index 100% rename from osal/FreeRTOS/CMakeLists.txt rename to src/osal/freertos/CMakeLists.txt diff --git a/osal/FreeRTOS/Clock.cpp b/src/osal/freertos/Clock.cpp similarity index 100% rename from osal/FreeRTOS/Clock.cpp rename to src/osal/freertos/Clock.cpp diff --git a/osal/FreeRTOS/CountingSemaphUsingTask.cpp b/src/osal/freertos/CountingSemaphUsingTask.cpp similarity index 100% rename from osal/FreeRTOS/CountingSemaphUsingTask.cpp rename to src/osal/freertos/CountingSemaphUsingTask.cpp diff --git a/osal/FreeRTOS/CountingSemaphore.cpp b/src/osal/freertos/CountingSemaphore.cpp similarity index 100% rename from osal/FreeRTOS/CountingSemaphore.cpp rename to src/osal/freertos/CountingSemaphore.cpp diff --git a/osal/FreeRTOS/FixedTimeslotTask.cpp b/src/osal/freertos/FixedTimeslotTask.cpp similarity index 100% rename from osal/FreeRTOS/FixedTimeslotTask.cpp rename to src/osal/freertos/FixedTimeslotTask.cpp diff --git a/osal/FreeRTOS/MessageQueue.cpp b/src/osal/freertos/MessageQueue.cpp similarity index 100% rename from osal/FreeRTOS/MessageQueue.cpp rename to src/osal/freertos/MessageQueue.cpp diff --git a/osal/FreeRTOS/Mutex.cpp b/src/osal/freertos/Mutex.cpp similarity index 100% rename from osal/FreeRTOS/Mutex.cpp rename to src/osal/freertos/Mutex.cpp diff --git a/osal/FreeRTOS/MutexFactory.cpp b/src/osal/freertos/MutexFactory.cpp similarity index 100% rename from osal/FreeRTOS/MutexFactory.cpp rename to src/osal/freertos/MutexFactory.cpp diff --git a/osal/FreeRTOS/PeriodicTask.cpp b/src/osal/freertos/PeriodicTask.cpp similarity index 100% rename from osal/FreeRTOS/PeriodicTask.cpp rename to src/osal/freertos/PeriodicTask.cpp diff --git a/osal/FreeRTOS/QueueFactory.cpp b/src/osal/freertos/QueueFactory.cpp similarity index 100% rename from osal/FreeRTOS/QueueFactory.cpp rename to src/osal/freertos/QueueFactory.cpp diff --git a/osal/FreeRTOS/QueueMapManager.cpp b/src/osal/freertos/QueueMapManager.cpp similarity index 100% rename from osal/FreeRTOS/QueueMapManager.cpp rename to src/osal/freertos/QueueMapManager.cpp diff --git a/osal/FreeRTOS/SemaphoreFactory.cpp b/src/osal/freertos/SemaphoreFactory.cpp similarity index 100% rename from osal/FreeRTOS/SemaphoreFactory.cpp rename to src/osal/freertos/SemaphoreFactory.cpp diff --git a/osal/FreeRTOS/TaskFactory.cpp b/src/osal/freertos/TaskFactory.cpp similarity index 100% rename from osal/FreeRTOS/TaskFactory.cpp rename to src/osal/freertos/TaskFactory.cpp diff --git a/osal/FreeRTOS/TaskManagement.cpp b/src/osal/freertos/TaskManagement.cpp similarity index 100% rename from osal/FreeRTOS/TaskManagement.cpp rename to src/osal/freertos/TaskManagement.cpp diff --git a/osal/FreeRTOS/Timekeeper.cpp b/src/osal/freertos/Timekeeper.cpp similarity index 100% rename from osal/FreeRTOS/Timekeeper.cpp rename to src/osal/freertos/Timekeeper.cpp diff --git a/osal/host/CMakeLists.txt b/src/osal/host/CMakeLists.txt similarity index 100% rename from osal/host/CMakeLists.txt rename to src/osal/host/CMakeLists.txt diff --git a/osal/host/Clock.cpp b/src/osal/host/Clock.cpp similarity index 100% rename from osal/host/Clock.cpp rename to src/osal/host/Clock.cpp diff --git a/osal/host/FixedTimeslotTask.cpp b/src/osal/host/FixedTimeslotTask.cpp similarity index 100% rename from osal/host/FixedTimeslotTask.cpp rename to src/osal/host/FixedTimeslotTask.cpp diff --git a/osal/host/MessageQueue.cpp b/src/osal/host/MessageQueue.cpp similarity index 100% rename from osal/host/MessageQueue.cpp rename to src/osal/host/MessageQueue.cpp diff --git a/osal/host/MutexFactory.cpp b/src/osal/host/MutexFactory.cpp similarity index 100% rename from osal/host/MutexFactory.cpp rename to src/osal/host/MutexFactory.cpp diff --git a/osal/host/PeriodicTask.cpp b/src/osal/host/PeriodicTask.cpp similarity index 100% rename from osal/host/PeriodicTask.cpp rename to src/osal/host/PeriodicTask.cpp diff --git a/osal/host/QueueFactory.cpp b/src/osal/host/QueueFactory.cpp similarity index 100% rename from osal/host/QueueFactory.cpp rename to src/osal/host/QueueFactory.cpp diff --git a/osal/host/QueueMapManager.cpp b/src/osal/host/QueueMapManager.cpp similarity index 100% rename from osal/host/QueueMapManager.cpp rename to src/osal/host/QueueMapManager.cpp diff --git a/osal/host/SemaphoreFactory.cpp b/src/osal/host/SemaphoreFactory.cpp similarity index 100% rename from osal/host/SemaphoreFactory.cpp rename to src/osal/host/SemaphoreFactory.cpp diff --git a/osal/host/TaskFactory.cpp b/src/osal/host/TaskFactory.cpp similarity index 100% rename from osal/host/TaskFactory.cpp rename to src/osal/host/TaskFactory.cpp diff --git a/osal/host/taskHelpers.cpp b/src/osal/host/taskHelpers.cpp similarity index 100% rename from osal/host/taskHelpers.cpp rename to src/osal/host/taskHelpers.cpp diff --git a/osal/linux/BinarySemaphore.cpp b/src/osal/linux/BinarySemaphore.cpp similarity index 100% rename from osal/linux/BinarySemaphore.cpp rename to src/osal/linux/BinarySemaphore.cpp diff --git a/osal/linux/CMakeLists.txt b/src/osal/linux/CMakeLists.txt similarity index 100% rename from osal/linux/CMakeLists.txt rename to src/osal/linux/CMakeLists.txt diff --git a/osal/linux/Clock.cpp b/src/osal/linux/Clock.cpp similarity index 100% rename from osal/linux/Clock.cpp rename to src/osal/linux/Clock.cpp diff --git a/osal/linux/CountingSemaphore.cpp b/src/osal/linux/CountingSemaphore.cpp similarity index 100% rename from osal/linux/CountingSemaphore.cpp rename to src/osal/linux/CountingSemaphore.cpp diff --git a/osal/linux/FixedTimeslotTask.cpp b/src/osal/linux/FixedTimeslotTask.cpp similarity index 100% rename from osal/linux/FixedTimeslotTask.cpp rename to src/osal/linux/FixedTimeslotTask.cpp diff --git a/osal/linux/InternalErrorCodes.cpp b/src/osal/linux/InternalErrorCodes.cpp similarity index 100% rename from osal/linux/InternalErrorCodes.cpp rename to src/osal/linux/InternalErrorCodes.cpp diff --git a/osal/linux/MessageQueue.cpp b/src/osal/linux/MessageQueue.cpp similarity index 100% rename from osal/linux/MessageQueue.cpp rename to src/osal/linux/MessageQueue.cpp diff --git a/osal/linux/Mutex.cpp b/src/osal/linux/Mutex.cpp similarity index 100% rename from osal/linux/Mutex.cpp rename to src/osal/linux/Mutex.cpp diff --git a/osal/linux/MutexFactory.cpp b/src/osal/linux/MutexFactory.cpp similarity index 100% rename from osal/linux/MutexFactory.cpp rename to src/osal/linux/MutexFactory.cpp diff --git a/osal/linux/PeriodicPosixTask.cpp b/src/osal/linux/PeriodicPosixTask.cpp similarity index 100% rename from osal/linux/PeriodicPosixTask.cpp rename to src/osal/linux/PeriodicPosixTask.cpp diff --git a/osal/linux/PosixThread.cpp b/src/osal/linux/PosixThread.cpp similarity index 100% rename from osal/linux/PosixThread.cpp rename to src/osal/linux/PosixThread.cpp diff --git a/osal/linux/QueueFactory.cpp b/src/osal/linux/QueueFactory.cpp similarity index 100% rename from osal/linux/QueueFactory.cpp rename to src/osal/linux/QueueFactory.cpp diff --git a/osal/linux/SemaphoreFactory.cpp b/src/osal/linux/SemaphoreFactory.cpp similarity index 100% rename from osal/linux/SemaphoreFactory.cpp rename to src/osal/linux/SemaphoreFactory.cpp diff --git a/osal/linux/TaskFactory.cpp b/src/osal/linux/TaskFactory.cpp similarity index 100% rename from osal/linux/TaskFactory.cpp rename to src/osal/linux/TaskFactory.cpp diff --git a/osal/linux/Timer.cpp b/src/osal/linux/Timer.cpp similarity index 100% rename from osal/linux/Timer.cpp rename to src/osal/linux/Timer.cpp diff --git a/osal/linux/tcpipHelpers.cpp b/src/osal/linux/tcpipHelpers.cpp similarity index 100% rename from osal/linux/tcpipHelpers.cpp rename to src/osal/linux/tcpipHelpers.cpp diff --git a/osal/linux/unixUtility.cpp b/src/osal/linux/unixUtility.cpp similarity index 100% rename from osal/linux/unixUtility.cpp rename to src/osal/linux/unixUtility.cpp diff --git a/osal/rtems/CMakeLists.txt b/src/osal/rtems/CMakeLists.txt similarity index 100% rename from osal/rtems/CMakeLists.txt rename to src/osal/rtems/CMakeLists.txt diff --git a/osal/rtems/Clock.cpp b/src/osal/rtems/Clock.cpp similarity index 100% rename from osal/rtems/Clock.cpp rename to src/osal/rtems/Clock.cpp diff --git a/osal/rtems/CpuUsage.cpp b/src/osal/rtems/CpuUsage.cpp similarity index 100% rename from osal/rtems/CpuUsage.cpp rename to src/osal/rtems/CpuUsage.cpp diff --git a/osal/rtems/FixedTimeslotTask.cpp b/src/osal/rtems/FixedTimeslotTask.cpp similarity index 100% rename from osal/rtems/FixedTimeslotTask.cpp rename to src/osal/rtems/FixedTimeslotTask.cpp diff --git a/osal/rtems/InitTask.cpp b/src/osal/rtems/InitTask.cpp similarity index 100% rename from osal/rtems/InitTask.cpp rename to src/osal/rtems/InitTask.cpp diff --git a/osal/rtems/InternalErrorCodes.cpp b/src/osal/rtems/InternalErrorCodes.cpp similarity index 100% rename from osal/rtems/InternalErrorCodes.cpp rename to src/osal/rtems/InternalErrorCodes.cpp diff --git a/osal/rtems/MessageQueue.cpp b/src/osal/rtems/MessageQueue.cpp similarity index 100% rename from osal/rtems/MessageQueue.cpp rename to src/osal/rtems/MessageQueue.cpp diff --git a/osal/rtems/Mutex.cpp b/src/osal/rtems/Mutex.cpp similarity index 100% rename from osal/rtems/Mutex.cpp rename to src/osal/rtems/Mutex.cpp diff --git a/osal/rtems/MutexFactory.cpp b/src/osal/rtems/MutexFactory.cpp similarity index 100% rename from osal/rtems/MutexFactory.cpp rename to src/osal/rtems/MutexFactory.cpp diff --git a/osal/rtems/PeriodicTask.cpp b/src/osal/rtems/PeriodicTask.cpp similarity index 100% rename from osal/rtems/PeriodicTask.cpp rename to src/osal/rtems/PeriodicTask.cpp diff --git a/osal/rtems/QueueFactory.cpp b/src/osal/rtems/QueueFactory.cpp similarity index 100% rename from osal/rtems/QueueFactory.cpp rename to src/osal/rtems/QueueFactory.cpp diff --git a/osal/rtems/RTEMSTaskBase.cpp b/src/osal/rtems/RTEMSTaskBase.cpp similarity index 100% rename from osal/rtems/RTEMSTaskBase.cpp rename to src/osal/rtems/RTEMSTaskBase.cpp diff --git a/osal/rtems/RtemsBasic.cpp b/src/osal/rtems/RtemsBasic.cpp similarity index 100% rename from osal/rtems/RtemsBasic.cpp rename to src/osal/rtems/RtemsBasic.cpp diff --git a/osal/rtems/TaskFactory.cpp b/src/osal/rtems/TaskFactory.cpp similarity index 100% rename from osal/rtems/TaskFactory.cpp rename to src/osal/rtems/TaskFactory.cpp diff --git a/osal/windows/CMakeLists.txt b/src/osal/windows/CMakeLists.txt similarity index 100% rename from osal/windows/CMakeLists.txt rename to src/osal/windows/CMakeLists.txt diff --git a/osal/windows/tcpipHelpers.cpp b/src/osal/windows/tcpipHelpers.cpp similarity index 100% rename from osal/windows/tcpipHelpers.cpp rename to src/osal/windows/tcpipHelpers.cpp diff --git a/osal/windows/winTaskHelpers.cpp b/src/osal/windows/winTaskHelpers.cpp similarity index 100% rename from osal/windows/winTaskHelpers.cpp rename to src/osal/windows/winTaskHelpers.cpp diff --git a/unittest/CMakeLists.txt b/src/tests/CMakeLists.txt similarity index 100% rename from unittest/CMakeLists.txt rename to src/tests/CMakeLists.txt diff --git a/unittest/README.md b/src/tests/README.md similarity index 100% rename from unittest/README.md rename to src/tests/README.md diff --git a/unittest/internal/CMakeLists.txt b/src/tests/internal/CMakeLists.txt similarity index 100% rename from unittest/internal/CMakeLists.txt rename to src/tests/internal/CMakeLists.txt diff --git a/unittest/internal/InternalUnitTester.cpp b/src/tests/internal/InternalUnitTester.cpp similarity index 100% rename from unittest/internal/InternalUnitTester.cpp rename to src/tests/internal/InternalUnitTester.cpp diff --git a/unittest/internal/InternalUnitTester.h b/src/tests/internal/InternalUnitTester.h similarity index 100% rename from unittest/internal/InternalUnitTester.h rename to src/tests/internal/InternalUnitTester.h diff --git a/unittest/internal/UnittDefinitions.cpp b/src/tests/internal/UnittDefinitions.cpp similarity index 100% rename from unittest/internal/UnittDefinitions.cpp rename to src/tests/internal/UnittDefinitions.cpp diff --git a/unittest/internal/UnittDefinitions.h b/src/tests/internal/UnittDefinitions.h similarity index 100% rename from unittest/internal/UnittDefinitions.h rename to src/tests/internal/UnittDefinitions.h diff --git a/unittest/internal/globalfunctions/CMakeLists.txt b/src/tests/internal/globalfunctions/CMakeLists.txt similarity index 100% rename from unittest/internal/globalfunctions/CMakeLists.txt rename to src/tests/internal/globalfunctions/CMakeLists.txt diff --git a/unittest/internal/globalfunctions/TestArrayPrinter.cpp b/src/tests/internal/globalfunctions/TestArrayPrinter.cpp similarity index 100% rename from unittest/internal/globalfunctions/TestArrayPrinter.cpp rename to src/tests/internal/globalfunctions/TestArrayPrinter.cpp diff --git a/unittest/internal/globalfunctions/TestArrayPrinter.h b/src/tests/internal/globalfunctions/TestArrayPrinter.h similarity index 100% rename from unittest/internal/globalfunctions/TestArrayPrinter.h rename to src/tests/internal/globalfunctions/TestArrayPrinter.h diff --git a/unittest/internal/internal.mk b/src/tests/internal/internal.mk similarity index 100% rename from unittest/internal/internal.mk rename to src/tests/internal/internal.mk diff --git a/unittest/internal/osal/CMakeLists.txt b/src/tests/internal/osal/CMakeLists.txt similarity index 100% rename from unittest/internal/osal/CMakeLists.txt rename to src/tests/internal/osal/CMakeLists.txt diff --git a/unittest/internal/osal/IntTestMq.cpp b/src/tests/internal/osal/IntTestMq.cpp similarity index 100% rename from unittest/internal/osal/IntTestMq.cpp rename to src/tests/internal/osal/IntTestMq.cpp diff --git a/unittest/internal/osal/IntTestMq.h b/src/tests/internal/osal/IntTestMq.h similarity index 100% rename from unittest/internal/osal/IntTestMq.h rename to src/tests/internal/osal/IntTestMq.h diff --git a/unittest/internal/osal/IntTestMutex.cpp b/src/tests/internal/osal/IntTestMutex.cpp similarity index 100% rename from unittest/internal/osal/IntTestMutex.cpp rename to src/tests/internal/osal/IntTestMutex.cpp diff --git a/unittest/internal/osal/IntTestMutex.h b/src/tests/internal/osal/IntTestMutex.h similarity index 100% rename from unittest/internal/osal/IntTestMutex.h rename to src/tests/internal/osal/IntTestMutex.h diff --git a/unittest/internal/osal/IntTestSemaphore.cpp b/src/tests/internal/osal/IntTestSemaphore.cpp similarity index 100% rename from unittest/internal/osal/IntTestSemaphore.cpp rename to src/tests/internal/osal/IntTestSemaphore.cpp diff --git a/unittest/internal/osal/IntTestSemaphore.h b/src/tests/internal/osal/IntTestSemaphore.h similarity index 100% rename from unittest/internal/osal/IntTestSemaphore.h rename to src/tests/internal/osal/IntTestSemaphore.h diff --git a/unittest/internal/serialize/CMakeLists.txt b/src/tests/internal/serialize/CMakeLists.txt similarity index 100% rename from unittest/internal/serialize/CMakeLists.txt rename to src/tests/internal/serialize/CMakeLists.txt diff --git a/unittest/internal/serialize/IntTestSerialization.cpp b/src/tests/internal/serialize/IntTestSerialization.cpp similarity index 100% rename from unittest/internal/serialize/IntTestSerialization.cpp rename to src/tests/internal/serialize/IntTestSerialization.cpp diff --git a/unittest/internal/serialize/IntTestSerialization.h b/src/tests/internal/serialize/IntTestSerialization.h similarity index 100% rename from unittest/internal/serialize/IntTestSerialization.h rename to src/tests/internal/serialize/IntTestSerialization.h diff --git a/unittest/lcov.sh b/src/tests/lcov.sh similarity index 100% rename from unittest/lcov.sh rename to src/tests/lcov.sh diff --git a/unittest/tests/CMakeLists.txt b/src/tests/tests/CMakeLists.txt similarity index 100% rename from unittest/tests/CMakeLists.txt rename to src/tests/tests/CMakeLists.txt diff --git a/unittest/tests/action/CMakeLists.txt b/src/tests/tests/action/CMakeLists.txt similarity index 100% rename from unittest/tests/action/CMakeLists.txt rename to src/tests/tests/action/CMakeLists.txt diff --git a/unittest/tests/action/TestActionHelper.cpp b/src/tests/tests/action/TestActionHelper.cpp similarity index 100% rename from unittest/tests/action/TestActionHelper.cpp rename to src/tests/tests/action/TestActionHelper.cpp diff --git a/unittest/tests/action/TestActionHelper.h b/src/tests/tests/action/TestActionHelper.h similarity index 100% rename from unittest/tests/action/TestActionHelper.h rename to src/tests/tests/action/TestActionHelper.h diff --git a/unittest/tests/container/CMakeLists.txt b/src/tests/tests/container/CMakeLists.txt similarity index 100% rename from unittest/tests/container/CMakeLists.txt rename to src/tests/tests/container/CMakeLists.txt diff --git a/unittest/tests/container/RingBufferTest.cpp b/src/tests/tests/container/RingBufferTest.cpp similarity index 100% rename from unittest/tests/container/RingBufferTest.cpp rename to src/tests/tests/container/RingBufferTest.cpp diff --git a/unittest/tests/container/TestArrayList.cpp b/src/tests/tests/container/TestArrayList.cpp similarity index 100% rename from unittest/tests/container/TestArrayList.cpp rename to src/tests/tests/container/TestArrayList.cpp diff --git a/unittest/tests/container/TestDynamicFifo.cpp b/src/tests/tests/container/TestDynamicFifo.cpp similarity index 100% rename from unittest/tests/container/TestDynamicFifo.cpp rename to src/tests/tests/container/TestDynamicFifo.cpp diff --git a/unittest/tests/container/TestFifo.cpp b/src/tests/tests/container/TestFifo.cpp similarity index 100% rename from unittest/tests/container/TestFifo.cpp rename to src/tests/tests/container/TestFifo.cpp diff --git a/unittest/tests/container/TestFixedArrayList.cpp b/src/tests/tests/container/TestFixedArrayList.cpp similarity index 100% rename from unittest/tests/container/TestFixedArrayList.cpp rename to src/tests/tests/container/TestFixedArrayList.cpp diff --git a/unittest/tests/container/TestFixedMap.cpp b/src/tests/tests/container/TestFixedMap.cpp similarity index 100% rename from unittest/tests/container/TestFixedMap.cpp rename to src/tests/tests/container/TestFixedMap.cpp diff --git a/unittest/tests/container/TestFixedOrderedMultimap.cpp b/src/tests/tests/container/TestFixedOrderedMultimap.cpp similarity index 100% rename from unittest/tests/container/TestFixedOrderedMultimap.cpp rename to src/tests/tests/container/TestFixedOrderedMultimap.cpp diff --git a/unittest/tests/container/TestPlacementFactory.cpp b/src/tests/tests/container/TestPlacementFactory.cpp similarity index 100% rename from unittest/tests/container/TestPlacementFactory.cpp rename to src/tests/tests/container/TestPlacementFactory.cpp diff --git a/unittest/tests/datapoollocal/CMakeLists.txt b/src/tests/tests/datapoollocal/CMakeLists.txt similarity index 100% rename from unittest/tests/datapoollocal/CMakeLists.txt rename to src/tests/tests/datapoollocal/CMakeLists.txt diff --git a/unittest/tests/datapoollocal/DataSetTest.cpp b/src/tests/tests/datapoollocal/DataSetTest.cpp similarity index 100% rename from unittest/tests/datapoollocal/DataSetTest.cpp rename to src/tests/tests/datapoollocal/DataSetTest.cpp diff --git a/unittest/tests/datapoollocal/LocalPoolManagerTest.cpp b/src/tests/tests/datapoollocal/LocalPoolManagerTest.cpp similarity index 100% rename from unittest/tests/datapoollocal/LocalPoolManagerTest.cpp rename to src/tests/tests/datapoollocal/LocalPoolManagerTest.cpp diff --git a/unittest/tests/datapoollocal/LocalPoolOwnerBase.cpp b/src/tests/tests/datapoollocal/LocalPoolOwnerBase.cpp similarity index 100% rename from unittest/tests/datapoollocal/LocalPoolOwnerBase.cpp rename to src/tests/tests/datapoollocal/LocalPoolOwnerBase.cpp diff --git a/unittest/tests/datapoollocal/LocalPoolOwnerBase.h b/src/tests/tests/datapoollocal/LocalPoolOwnerBase.h similarity index 100% rename from unittest/tests/datapoollocal/LocalPoolOwnerBase.h rename to src/tests/tests/datapoollocal/LocalPoolOwnerBase.h diff --git a/unittest/tests/datapoollocal/LocalPoolVariableTest.cpp b/src/tests/tests/datapoollocal/LocalPoolVariableTest.cpp similarity index 100% rename from unittest/tests/datapoollocal/LocalPoolVariableTest.cpp rename to src/tests/tests/datapoollocal/LocalPoolVariableTest.cpp diff --git a/unittest/tests/datapoollocal/LocalPoolVectorTest.cpp b/src/tests/tests/datapoollocal/LocalPoolVectorTest.cpp similarity index 100% rename from unittest/tests/datapoollocal/LocalPoolVectorTest.cpp rename to src/tests/tests/datapoollocal/LocalPoolVectorTest.cpp diff --git a/unittest/tests/globalfunctions/CMakeLists.txt b/src/tests/tests/globalfunctions/CMakeLists.txt similarity index 100% rename from unittest/tests/globalfunctions/CMakeLists.txt rename to src/tests/tests/globalfunctions/CMakeLists.txt diff --git a/unittest/tests/mocks/HkReceiverMock.h b/src/tests/tests/mocks/HkReceiverMock.h similarity index 100% rename from unittest/tests/mocks/HkReceiverMock.h rename to src/tests/tests/mocks/HkReceiverMock.h diff --git a/unittest/tests/mocks/MessageQueueMockBase.h b/src/tests/tests/mocks/MessageQueueMockBase.h similarity index 100% rename from unittest/tests/mocks/MessageQueueMockBase.h rename to src/tests/tests/mocks/MessageQueueMockBase.h diff --git a/unittest/tests/osal/CMakeLists.txt b/src/tests/tests/osal/CMakeLists.txt similarity index 100% rename from unittest/tests/osal/CMakeLists.txt rename to src/tests/tests/osal/CMakeLists.txt diff --git a/unittest/tests/osal/TestMessageQueue.cpp b/src/tests/tests/osal/TestMessageQueue.cpp similarity index 100% rename from unittest/tests/osal/TestMessageQueue.cpp rename to src/tests/tests/osal/TestMessageQueue.cpp diff --git a/unittest/tests/osal/TestSemaphore.cpp b/src/tests/tests/osal/TestSemaphore.cpp similarity index 100% rename from unittest/tests/osal/TestSemaphore.cpp rename to src/tests/tests/osal/TestSemaphore.cpp diff --git a/unittest/tests/serialize/CMakeLists.txt b/src/tests/tests/serialize/CMakeLists.txt similarity index 100% rename from unittest/tests/serialize/CMakeLists.txt rename to src/tests/tests/serialize/CMakeLists.txt diff --git a/unittest/tests/serialize/TestSerialBufferAdapter.cpp b/src/tests/tests/serialize/TestSerialBufferAdapter.cpp similarity index 100% rename from unittest/tests/serialize/TestSerialBufferAdapter.cpp rename to src/tests/tests/serialize/TestSerialBufferAdapter.cpp diff --git a/unittest/tests/serialize/TestSerialLinkedPacket.cpp b/src/tests/tests/serialize/TestSerialLinkedPacket.cpp similarity index 100% rename from unittest/tests/serialize/TestSerialLinkedPacket.cpp rename to src/tests/tests/serialize/TestSerialLinkedPacket.cpp diff --git a/unittest/tests/serialize/TestSerialLinkedPacket.h b/src/tests/tests/serialize/TestSerialLinkedPacket.h similarity index 100% rename from unittest/tests/serialize/TestSerialLinkedPacket.h rename to src/tests/tests/serialize/TestSerialLinkedPacket.h diff --git a/unittest/tests/serialize/TestSerialization.cpp b/src/tests/tests/serialize/TestSerialization.cpp similarity index 100% rename from unittest/tests/serialize/TestSerialization.cpp rename to src/tests/tests/serialize/TestSerialization.cpp diff --git a/unittest/tests/storagemanager/CMakeLists.txt b/src/tests/tests/storagemanager/CMakeLists.txt similarity index 100% rename from unittest/tests/storagemanager/CMakeLists.txt rename to src/tests/tests/storagemanager/CMakeLists.txt diff --git a/unittest/tests/storagemanager/TestNewAccessor.cpp b/src/tests/tests/storagemanager/TestNewAccessor.cpp similarity index 100% rename from unittest/tests/storagemanager/TestNewAccessor.cpp rename to src/tests/tests/storagemanager/TestNewAccessor.cpp diff --git a/unittest/tests/storagemanager/TestPool.cpp b/src/tests/tests/storagemanager/TestPool.cpp similarity index 100% rename from unittest/tests/storagemanager/TestPool.cpp rename to src/tests/tests/storagemanager/TestPool.cpp diff --git a/unittest/tests/tests.mk b/src/tests/tests/tests.mk similarity index 100% rename from unittest/tests/tests.mk rename to src/tests/tests/tests.mk diff --git a/unittest/tests/tmtcpacket/CMakeLists.txt b/src/tests/tests/tmtcpacket/CMakeLists.txt similarity index 100% rename from unittest/tests/tmtcpacket/CMakeLists.txt rename to src/tests/tests/tmtcpacket/CMakeLists.txt diff --git a/unittest/tests/tmtcpacket/PusTmTest.cpp b/src/tests/tests/tmtcpacket/PusTmTest.cpp similarity index 100% rename from unittest/tests/tmtcpacket/PusTmTest.cpp rename to src/tests/tests/tmtcpacket/PusTmTest.cpp diff --git a/unittest/user/CMakeLists.txt b/src/tests/user/CMakeLists.txt similarity index 100% rename from unittest/user/CMakeLists.txt rename to src/tests/user/CMakeLists.txt diff --git a/unittest/user/testcfg/CMakeLists.txt b/src/tests/user/testcfg/CMakeLists.txt similarity index 100% rename from unittest/user/testcfg/CMakeLists.txt rename to src/tests/user/testcfg/CMakeLists.txt diff --git a/unittest/user/testcfg/FSFWConfig.h b/src/tests/user/testcfg/FSFWConfig.h similarity index 100% rename from unittest/user/testcfg/FSFWConfig.h rename to src/tests/user/testcfg/FSFWConfig.h diff --git a/unittest/user/testcfg/Makefile-FSFW-Tests b/src/tests/user/testcfg/Makefile-FSFW-Tests similarity index 100% rename from unittest/user/testcfg/Makefile-FSFW-Tests rename to src/tests/user/testcfg/Makefile-FSFW-Tests diff --git a/unittest/user/testcfg/TestsConfig.h b/src/tests/user/testcfg/TestsConfig.h similarity index 100% rename from unittest/user/testcfg/TestsConfig.h rename to src/tests/user/testcfg/TestsConfig.h diff --git a/unittest/user/testcfg/cdatapool/dataPoolInit.cpp b/src/tests/user/testcfg/cdatapool/dataPoolInit.cpp similarity index 100% rename from unittest/user/testcfg/cdatapool/dataPoolInit.cpp rename to src/tests/user/testcfg/cdatapool/dataPoolInit.cpp diff --git a/unittest/user/testcfg/cdatapool/dataPoolInit.h b/src/tests/user/testcfg/cdatapool/dataPoolInit.h similarity index 100% rename from unittest/user/testcfg/cdatapool/dataPoolInit.h rename to src/tests/user/testcfg/cdatapool/dataPoolInit.h diff --git a/unittest/user/testcfg/devices/logicalAddresses.cpp b/src/tests/user/testcfg/devices/logicalAddresses.cpp similarity index 100% rename from unittest/user/testcfg/devices/logicalAddresses.cpp rename to src/tests/user/testcfg/devices/logicalAddresses.cpp diff --git a/unittest/user/testcfg/devices/logicalAddresses.h b/src/tests/user/testcfg/devices/logicalAddresses.h similarity index 100% rename from unittest/user/testcfg/devices/logicalAddresses.h rename to src/tests/user/testcfg/devices/logicalAddresses.h diff --git a/unittest/user/testcfg/devices/powerSwitcherList.cpp b/src/tests/user/testcfg/devices/powerSwitcherList.cpp similarity index 100% rename from unittest/user/testcfg/devices/powerSwitcherList.cpp rename to src/tests/user/testcfg/devices/powerSwitcherList.cpp diff --git a/unittest/user/testcfg/devices/powerSwitcherList.h b/src/tests/user/testcfg/devices/powerSwitcherList.h similarity index 100% rename from unittest/user/testcfg/devices/powerSwitcherList.h rename to src/tests/user/testcfg/devices/powerSwitcherList.h diff --git a/unittest/user/testcfg/events/subsystemIdRanges.h b/src/tests/user/testcfg/events/subsystemIdRanges.h similarity index 100% rename from unittest/user/testcfg/events/subsystemIdRanges.h rename to src/tests/user/testcfg/events/subsystemIdRanges.h diff --git a/unittest/user/testcfg/ipc/MissionMessageTypes.cpp b/src/tests/user/testcfg/ipc/MissionMessageTypes.cpp similarity index 100% rename from unittest/user/testcfg/ipc/MissionMessageTypes.cpp rename to src/tests/user/testcfg/ipc/MissionMessageTypes.cpp diff --git a/unittest/user/testcfg/ipc/MissionMessageTypes.h b/src/tests/user/testcfg/ipc/MissionMessageTypes.h similarity index 100% rename from unittest/user/testcfg/ipc/MissionMessageTypes.h rename to src/tests/user/testcfg/ipc/MissionMessageTypes.h diff --git a/unittest/user/testcfg/objects/systemObjectList.h b/src/tests/user/testcfg/objects/systemObjectList.h similarity index 100% rename from unittest/user/testcfg/objects/systemObjectList.h rename to src/tests/user/testcfg/objects/systemObjectList.h diff --git a/unittest/user/testcfg/pollingsequence/PollingSequenceFactory.cpp b/src/tests/user/testcfg/pollingsequence/PollingSequenceFactory.cpp similarity index 100% rename from unittest/user/testcfg/pollingsequence/PollingSequenceFactory.cpp rename to src/tests/user/testcfg/pollingsequence/PollingSequenceFactory.cpp diff --git a/unittest/user/testcfg/pollingsequence/PollingSequenceFactory.h b/src/tests/user/testcfg/pollingsequence/PollingSequenceFactory.h similarity index 100% rename from unittest/user/testcfg/pollingsequence/PollingSequenceFactory.h rename to src/tests/user/testcfg/pollingsequence/PollingSequenceFactory.h diff --git a/unittest/user/testcfg/returnvalues/classIds.h b/src/tests/user/testcfg/returnvalues/classIds.h similarity index 100% rename from unittest/user/testcfg/returnvalues/classIds.h rename to src/tests/user/testcfg/returnvalues/classIds.h diff --git a/unittest/user/testcfg/testcfg.mk b/src/tests/user/testcfg/testcfg.mk similarity index 100% rename from unittest/user/testcfg/testcfg.mk rename to src/tests/user/testcfg/testcfg.mk diff --git a/unittest/user/testcfg/tmtc/apid.h b/src/tests/user/testcfg/tmtc/apid.h similarity index 100% rename from unittest/user/testcfg/tmtc/apid.h rename to src/tests/user/testcfg/tmtc/apid.h diff --git a/unittest/user/testcfg/tmtc/pusIds.h b/src/tests/user/testcfg/tmtc/pusIds.h similarity index 100% rename from unittest/user/testcfg/tmtc/pusIds.h rename to src/tests/user/testcfg/tmtc/pusIds.h diff --git a/unittest/user/testtemplate/TestTemplate.cpp b/src/tests/user/testtemplate/TestTemplate.cpp similarity index 100% rename from unittest/user/testtemplate/TestTemplate.cpp rename to src/tests/user/testtemplate/TestTemplate.cpp diff --git a/unittest/user/unittest/CMakeLists.txt b/src/tests/user/unittest/CMakeLists.txt similarity index 100% rename from unittest/user/unittest/CMakeLists.txt rename to src/tests/user/unittest/CMakeLists.txt diff --git a/unittest/user/unittest/core/CMakeLists.txt b/src/tests/user/unittest/core/CMakeLists.txt similarity index 100% rename from unittest/user/unittest/core/CMakeLists.txt rename to src/tests/user/unittest/core/CMakeLists.txt diff --git a/unittest/user/unittest/core/CatchDefinitions.cpp b/src/tests/user/unittest/core/CatchDefinitions.cpp similarity index 100% rename from unittest/user/unittest/core/CatchDefinitions.cpp rename to src/tests/user/unittest/core/CatchDefinitions.cpp diff --git a/unittest/user/unittest/core/CatchDefinitions.h b/src/tests/user/unittest/core/CatchDefinitions.h similarity index 100% rename from unittest/user/unittest/core/CatchDefinitions.h rename to src/tests/user/unittest/core/CatchDefinitions.h diff --git a/unittest/user/unittest/core/CatchFactory.cpp b/src/tests/user/unittest/core/CatchFactory.cpp similarity index 100% rename from unittest/user/unittest/core/CatchFactory.cpp rename to src/tests/user/unittest/core/CatchFactory.cpp diff --git a/unittest/user/unittest/core/CatchFactory.h b/src/tests/user/unittest/core/CatchFactory.h similarity index 100% rename from unittest/user/unittest/core/CatchFactory.h rename to src/tests/user/unittest/core/CatchFactory.h diff --git a/unittest/user/unittest/core/CatchRunner.cpp b/src/tests/user/unittest/core/CatchRunner.cpp similarity index 100% rename from unittest/user/unittest/core/CatchRunner.cpp rename to src/tests/user/unittest/core/CatchRunner.cpp diff --git a/unittest/user/unittest/core/CatchSetup.cpp b/src/tests/user/unittest/core/CatchSetup.cpp similarity index 100% rename from unittest/user/unittest/core/CatchSetup.cpp rename to src/tests/user/unittest/core/CatchSetup.cpp diff --git a/unittest/user/unittest/core/core.mk b/src/tests/user/unittest/core/core.mk similarity index 100% rename from unittest/user/unittest/core/core.mk rename to src/tests/user/unittest/core/core.mk diff --git a/unittest/user/unittest/core/printChar.cpp b/src/tests/user/unittest/core/printChar.cpp similarity index 100% rename from unittest/user/unittest/core/printChar.cpp rename to src/tests/user/unittest/core/printChar.cpp diff --git a/unittest/user/unittest/core/printChar.h b/src/tests/user/unittest/core/printChar.h similarity index 100% rename from unittest/user/unittest/core/printChar.h rename to src/tests/user/unittest/core/printChar.h diff --git a/unittest/user/unlockRealtime.sh b/src/tests/user/unlockRealtime.sh similarity index 100% rename from unittest/user/unlockRealtime.sh rename to src/tests/user/unlockRealtime.sh From f15352bb2f8eee905ef7485a2a72dd5ed52e0530 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 13 Jul 2021 18:46:09 +0200 Subject: [PATCH 170/389] moved memory helper to core --- src/{opt => core}/memory/CMakeLists.txt | 0 src/{opt => core}/memory/GenericFileSystemMessage.cpp | 0 src/{opt => core}/memory/MemoryHelper.cpp | 0 src/{opt => core}/memory/MemoryMessage.cpp | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename src/{opt => core}/memory/CMakeLists.txt (100%) rename src/{opt => core}/memory/GenericFileSystemMessage.cpp (100%) rename src/{opt => core}/memory/MemoryHelper.cpp (100%) rename src/{opt => core}/memory/MemoryMessage.cpp (100%) diff --git a/src/opt/memory/CMakeLists.txt b/src/core/memory/CMakeLists.txt similarity index 100% rename from src/opt/memory/CMakeLists.txt rename to src/core/memory/CMakeLists.txt diff --git a/src/opt/memory/GenericFileSystemMessage.cpp b/src/core/memory/GenericFileSystemMessage.cpp similarity index 100% rename from src/opt/memory/GenericFileSystemMessage.cpp rename to src/core/memory/GenericFileSystemMessage.cpp diff --git a/src/opt/memory/MemoryHelper.cpp b/src/core/memory/MemoryHelper.cpp similarity index 100% rename from src/opt/memory/MemoryHelper.cpp rename to src/core/memory/MemoryHelper.cpp diff --git a/src/opt/memory/MemoryMessage.cpp b/src/core/memory/MemoryMessage.cpp similarity index 100% rename from src/opt/memory/MemoryMessage.cpp rename to src/core/memory/MemoryMessage.cpp From f14d5edf42f593b21598de45dec67fec42916b15 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 13 Jul 2021 18:52:19 +0200 Subject: [PATCH 171/389] added more cmakelists files --- CMakeLists.txt | 53 ++++------------------------------------- src/CMakeLists.txt | 5 ++++ src/core/CMakeLists.txt | 29 ++++++++++++++++++++++ src/opt/CMakeLists.txt | 6 +++++ src/osal/CMakeLists.txt | 8 +++---- 5 files changed, 49 insertions(+), 52 deletions(-) create mode 100644 src/CMakeLists.txt create mode 100644 src/core/CMakeLists.txt create mode 100644 src/opt/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ff504f7..2b04b978 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,18 +43,18 @@ endif() set(FSFW_OSAL_DEFINITION FSFW_HOST) -if(OS_FSFW MATCHES host) +if(FSFW_OSAL MATCHES host) set(OS_FSFW_NAME "Host") -elseif(OS_FSFW MATCHES linux) +elseif(FSFW_OSAL MATCHES linux) set(OS_FSFW_NAME "Linux") set(FSFW_OSAL_DEFINITION FSFW_LINUX) -elseif(OS_FSFW MATCHES freertos) +elseif(FSFW_OSAL MATCHES freertos) set(OS_FSFW_NAME "FreeRTOS") set(FSFW_OSAL_DEFINITION FSFW_FREERTOS) target_link_libraries(${LIB_FSFW_NAME} PRIVATE ${LIB_OS_NAME} ) -elseif(${OS_FSFW} STREQUAL rtems) +elseif(FSFW_OSAL STREQUAL rtems) set(OS_FSFW_NAME "RTEMS") set(FSFW_OSAL_DEFINITION FSFW_RTEMS) else() @@ -75,50 +75,7 @@ target_compile_definitions(${LIB_FSFW_NAME} INTERFACE message(STATUS "Compiling FSFW for the ${OS_FSFW_NAME} operating system.") -add_subdirectory(action) -add_subdirectory(container) -add_subdirectory(controller) -add_subdirectory(coordinates) - -if(FSFW_USE_DATALINKLAYER) - add_subdirectory(datalinklayer) -endif() - -add_subdirectory(datapool) -add_subdirectory(datapoollocal) -add_subdirectory(housekeeping) -add_subdirectory(devicehandlers) -add_subdirectory(events) -add_subdirectory(fdir) -add_subdirectory(globalfunctions) -add_subdirectory(health) -add_subdirectory(internalError) -add_subdirectory(ipc) -add_subdirectory(memory) -add_subdirectory(modes) -add_subdirectory(monitoring) -add_subdirectory(objectmanager) -add_subdirectory(osal) -add_subdirectory(parameters) -add_subdirectory(power) -add_subdirectory(pus) - -if(FSFW_USE_RMAP) - add_subdirectory(rmap) -endif() - -add_subdirectory(serialize) -add_subdirectory(serviceinterface) -add_subdirectory(storagemanager) -add_subdirectory(subsystem) -add_subdirectory(tasks) -add_subdirectory(tcdistribution) -add_subdirectory(thermal) -add_subdirectory(timemanager) -add_subdirectory(tmstorage) -add_subdirectory(tmtcpacket) -add_subdirectory(tmtcservices) -add_subdirectory(unittest) +add_subdirectory(src) # The project CMakeLists file has to set the FSFW_CONFIG_PATH and add it. # If this is not given, we include the default configuration and emit a warning. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 00000000..b4f52cb1 --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,5 @@ +add_subdirectory(core) +add_subdirectory(hal) +add_subdirectory(opt) +add_subdirectory(osal) +# add_subdirectory(tests) diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt new file mode 100644 index 00000000..6240d8f2 --- /dev/null +++ b/src/core/CMakeLists.txt @@ -0,0 +1,29 @@ +add_subdirectory(action) +add_subdirectory(container) +add_subdirectory(controller) +add_subdirectory(datapool) +add_subdirectory(datapoollocal) +add_subdirectory(devicehandlers) +add_subdirectory(events) +add_subdirectory(fdir) +add_subdirectory(globalfunctions) +add_subdirectory(health) +add_subdirectory(housekeeping) +add_subdirectory(internalError) +add_subdirectory(ipc) +add_subdirectory(memory) +add_subdirectory(modes) +add_subdirectory(objectmanager) +add_subdirectory(parameters) +add_subdirectory(power) +add_subdirectory(serialize) +add_subdirectory(serviceinterface) +add_subdirectory(storagemanager) +add_subdirectory(subsystem) +add_subdirectory(tasks) +add_subdirectory(tcdistribution) +add_subdirectory(thermal) +add_subdirectory(timemanager) +add_subdirectory(tmstorage) +add_subdirectory(tmtcpacket) +add_subdirectory(tmtcservices) diff --git a/src/opt/CMakeLists.txt b/src/opt/CMakeLists.txt new file mode 100644 index 00000000..48ee664b --- /dev/null +++ b/src/opt/CMakeLists.txt @@ -0,0 +1,6 @@ +add_subdirectory(coordinates) +add_subdirectory(datalinklayer) +add_subdirectory(monitoring) +add_subdirectory(pus) +add_subdirectory(rmap) +add_subdirectory(tmstorage) diff --git a/src/osal/CMakeLists.txt b/src/osal/CMakeLists.txt index 76b939b1..0e28bd3c 100644 --- a/src/osal/CMakeLists.txt +++ b/src/osal/CMakeLists.txt @@ -1,11 +1,11 @@ # Check the OS_FSFW variable -if(${OS_FSFW} STREQUAL "freertos") +if(FSFW_OSAL MATCHES "freertos") add_subdirectory(FreeRTOS) -elseif(${OS_FSFW} STREQUAL "rtems") +elseif(FSFW_OSAL MATCHES "rtems") add_subdirectory(rtems) -elseif(${OS_FSFW} STREQUAL "linux") +elseif(FSFW_OSAL MATCHES "linux") add_subdirectory(linux) -elseif(${OS_FSFW} STREQUAL "host") +elseif(FSFW_OSAL MATCHES "host") add_subdirectory(host) if (WIN32) add_subdirectory(windows) From eee84f93186c454dd1b33944c5a73563b8adaca1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 13 Jul 2021 18:53:07 +0200 Subject: [PATCH 172/389] some more corrections --- CMakeLists.txt | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b04b978..e2186822 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ option(FSFW_USE_DATALINKLAYER "Compile with Data Link Layer" ON) set(LIB_FSFW_NAME fsfw) add_library(${LIB_FSFW_NAME}) -set_property(CACHE OS_FSFW PROPERTY STRINGS host linux rtems freertos) +set_property(CACHE FSFW_OSAL PROPERTY STRINGS host linux rtems freertos) if(NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 11) @@ -25,16 +25,16 @@ elseif(${CMAKE_CXX_STANDARD} LESS 11) message(FATAL_ERROR "Compiling the FSFW requires a minimum of C++11 support") endif() -if(NOT OS_FSFW) - message(STATUS "No OS for FSFW via OS_FSFW set. Assuming host OS") +if(NOT FSFW_OSAL) + message(STATUS "No OS for FSFW via FSFW_OSAL set. Assuming host OS") # Assume host OS and autodetermine from OS_FSFW if(UNIX) - set(OS_FSFW "linux" + set(FSFW_OSAL "linux" CACHE STRING "OS abstraction layer used in the FSFW" ) elseif(WIN32) - set(OS_FSFW "host" + set(FSFW_OSAL "host" CACHE STRING "OS abstraction layer used in the FSFW" ) endif() From 3a9add82fe56b4b75b0079b48c094e6c4f778c42 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 13 Jul 2021 18:58:31 +0200 Subject: [PATCH 173/389] additonal warning --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e2186822..1efb856f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,12 @@ elseif(${CMAKE_CXX_STANDARD} LESS 11) message(FATAL_ERROR "Compiling the FSFW requires a minimum of C++11 support") endif() +# Backwards comptability +if(OS_FSFW) + message(WARNING "Please pass the FSFW OSAL as FSFW_OSAL instead of OS_FSFW") + set(FSFW_OSAL OS_FSFW) +endif() + if(NOT FSFW_OSAL) message(STATUS "No OS for FSFW via FSFW_OSAL set. Assuming host OS") # Assume host OS and autodetermine from OS_FSFW From ca297a7dcda6579173afe323a89dfac7e75fe80c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 13 Jul 2021 19:19:25 +0200 Subject: [PATCH 174/389] added hal folder --- hal/CMakeLists.txt | 89 +++ hal/inc/fsfw/common/gpio/GpioCookie.h | 41 ++ hal/inc/fsfw/common/gpio/GpioIF.h | 54 ++ hal/inc/fsfw/common/gpio/gpioDefinitions.h | 110 ++++ hal/inc/fsfw/common/spi/spiCommon.h | 17 + .../fsfw/devicehandlers/GyroL3GD20Handler.h | 86 +++ .../devicedefinitions/GyroL3GD20Definitions.h | 143 +++++ hal/inc/fsfw/linux/UnixFileGuard.h | 33 ++ hal/inc/fsfw/linux/gpio/LinuxLibgpioIF.h | 77 +++ hal/inc/fsfw/linux/i2c/I2cComIF.h | 61 ++ hal/inc/fsfw/linux/i2c/I2cCookie.h | 38 ++ hal/inc/fsfw/linux/rpi/GpioRPi.h | 26 + hal/inc/fsfw/linux/spi/SpiComIF.h | 90 +++ hal/inc/fsfw/linux/spi/SpiCookie.h | 185 ++++++ hal/inc/fsfw/linux/spi/spiDefinitions.h | 28 + hal/inc/fsfw/linux/uart/UartComIF.h | 110 ++++ hal/inc/fsfw/linux/uart/UartCookie.h | 121 ++++ hal/inc/fsfw/linux/utility.h | 10 + hal/inc/fsfw/stm32h7/devicetest/GyroL3GD20H.h | 70 +++ hal/inc/fsfw/stm32h7/dma.h | 49 ++ hal/inc/fsfw/stm32h7/gpio/gpio.h | 14 + hal/inc/fsfw/stm32h7/interrupts.h | 28 + hal/inc/fsfw/stm32h7/spi/SpiComIF.h | 130 ++++ hal/inc/fsfw/stm32h7/spi/SpiCookie.h | 75 +++ hal/inc/fsfw/stm32h7/spi/mspInit.h | 114 ++++ hal/inc/fsfw/stm32h7/spi/spiCore.h | 53 ++ hal/inc/fsfw/stm32h7/spi/spiDefinitions.h | 50 ++ hal/inc/fsfw/stm32h7/spi/spiInterrupts.h | 41 ++ hal/inc/fsfw/stm32h7/spi/stm32h743ziSpi.h | 23 + hal/src/common/gpio/CMakeLists.txt | 3 + hal/src/common/gpio/GpioCookie.cpp | 50 ++ hal/src/devicehandlers/CMakeLists.txt | 3 + hal/src/devicehandlers/GyroL3GD20Handler.cpp | 262 ++++++++ hal/src/host/CMakeLists.txt | 1 + hal/src/linux/CMakeLists.txt | 13 + hal/src/linux/UnixFileGuard.cpp | 33 ++ hal/src/linux/gpio/CMakeLists.txt | 12 + hal/src/linux/gpio/LinuxLibgpioIF.cpp | 305 ++++++++++ hal/src/linux/i2c/CMakeLists.txt | 8 + hal/src/linux/i2c/I2cComIF.cpp | 205 +++++++ hal/src/linux/i2c/I2cCookie.cpp | 20 + hal/src/linux/rpi/CMakeLists.txt | 3 + hal/src/linux/rpi/GpioRPi.cpp | 37 ++ hal/src/linux/spi/CMakeLists.txt | 8 + hal/src/linux/spi/SpiComIF.cpp | 398 +++++++++++++ hal/src/linux/spi/SpiCookie.cpp | 144 +++++ hal/src/linux/uart/CMakeLists.txt | 8 + hal/src/linux/uart/UartComIF.cpp | 455 ++++++++++++++ hal/src/linux/uart/UartCookie.cpp | 97 +++ hal/src/linux/utility.cpp | 21 + hal/src/stm32h7/CMakeLists.txt | 7 + hal/src/stm32h7/devicetest/CMakeLists.txt | 3 + hal/src/stm32h7/devicetest/GyroL3GD20H.cpp | 559 ++++++++++++++++++ hal/src/stm32h7/dma.cpp | 83 +++ hal/src/stm32h7/gpio/CMakeLists.txt | 3 + hal/src/stm32h7/gpio/gpio.cpp | 71 +++ hal/src/stm32h7/i2c/CMakeLists.txt | 2 + hal/src/stm32h7/spi/CMakeLists.txt | 9 + hal/src/stm32h7/spi/SpiComIF.cpp | 453 ++++++++++++++ hal/src/stm32h7/spi/SpiCookie.cpp | 78 +++ hal/src/stm32h7/spi/mspInit.cpp | 252 ++++++++ hal/src/stm32h7/spi/spiCore.cpp | 340 +++++++++++ hal/src/stm32h7/spi/spiDefinitions.cpp | 52 ++ hal/src/stm32h7/spi/spiInterrupts.cpp | 106 ++++ hal/src/stm32h7/spi/stm32h743ziSpi.cpp | 81 +++ hal/src/stm32h7/uart/CMakeLists.txt | 2 + src/CMakeLists.txt | 1 - 67 files changed, 6153 insertions(+), 1 deletion(-) create mode 100644 hal/CMakeLists.txt create mode 100644 hal/inc/fsfw/common/gpio/GpioCookie.h create mode 100644 hal/inc/fsfw/common/gpio/GpioIF.h create mode 100644 hal/inc/fsfw/common/gpio/gpioDefinitions.h create mode 100644 hal/inc/fsfw/common/spi/spiCommon.h create mode 100644 hal/inc/fsfw/devicehandlers/GyroL3GD20Handler.h create mode 100644 hal/inc/fsfw/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h create mode 100644 hal/inc/fsfw/linux/UnixFileGuard.h create mode 100644 hal/inc/fsfw/linux/gpio/LinuxLibgpioIF.h create mode 100644 hal/inc/fsfw/linux/i2c/I2cComIF.h create mode 100644 hal/inc/fsfw/linux/i2c/I2cCookie.h create mode 100644 hal/inc/fsfw/linux/rpi/GpioRPi.h create mode 100644 hal/inc/fsfw/linux/spi/SpiComIF.h create mode 100644 hal/inc/fsfw/linux/spi/SpiCookie.h create mode 100644 hal/inc/fsfw/linux/spi/spiDefinitions.h create mode 100644 hal/inc/fsfw/linux/uart/UartComIF.h create mode 100644 hal/inc/fsfw/linux/uart/UartCookie.h create mode 100644 hal/inc/fsfw/linux/utility.h create mode 100644 hal/inc/fsfw/stm32h7/devicetest/GyroL3GD20H.h create mode 100644 hal/inc/fsfw/stm32h7/dma.h create mode 100644 hal/inc/fsfw/stm32h7/gpio/gpio.h create mode 100644 hal/inc/fsfw/stm32h7/interrupts.h create mode 100644 hal/inc/fsfw/stm32h7/spi/SpiComIF.h create mode 100644 hal/inc/fsfw/stm32h7/spi/SpiCookie.h create mode 100644 hal/inc/fsfw/stm32h7/spi/mspInit.h create mode 100644 hal/inc/fsfw/stm32h7/spi/spiCore.h create mode 100644 hal/inc/fsfw/stm32h7/spi/spiDefinitions.h create mode 100644 hal/inc/fsfw/stm32h7/spi/spiInterrupts.h create mode 100644 hal/inc/fsfw/stm32h7/spi/stm32h743ziSpi.h create mode 100644 hal/src/common/gpio/CMakeLists.txt create mode 100644 hal/src/common/gpio/GpioCookie.cpp create mode 100644 hal/src/devicehandlers/CMakeLists.txt create mode 100644 hal/src/devicehandlers/GyroL3GD20Handler.cpp create mode 100644 hal/src/host/CMakeLists.txt create mode 100644 hal/src/linux/CMakeLists.txt create mode 100644 hal/src/linux/UnixFileGuard.cpp create mode 100644 hal/src/linux/gpio/CMakeLists.txt create mode 100644 hal/src/linux/gpio/LinuxLibgpioIF.cpp create mode 100644 hal/src/linux/i2c/CMakeLists.txt create mode 100644 hal/src/linux/i2c/I2cComIF.cpp create mode 100644 hal/src/linux/i2c/I2cCookie.cpp create mode 100644 hal/src/linux/rpi/CMakeLists.txt create mode 100644 hal/src/linux/rpi/GpioRPi.cpp create mode 100644 hal/src/linux/spi/CMakeLists.txt create mode 100644 hal/src/linux/spi/SpiComIF.cpp create mode 100644 hal/src/linux/spi/SpiCookie.cpp create mode 100644 hal/src/linux/uart/CMakeLists.txt create mode 100644 hal/src/linux/uart/UartComIF.cpp create mode 100644 hal/src/linux/uart/UartCookie.cpp create mode 100644 hal/src/linux/utility.cpp create mode 100644 hal/src/stm32h7/CMakeLists.txt create mode 100644 hal/src/stm32h7/devicetest/CMakeLists.txt create mode 100644 hal/src/stm32h7/devicetest/GyroL3GD20H.cpp create mode 100644 hal/src/stm32h7/dma.cpp create mode 100644 hal/src/stm32h7/gpio/CMakeLists.txt create mode 100644 hal/src/stm32h7/gpio/gpio.cpp create mode 100644 hal/src/stm32h7/i2c/CMakeLists.txt create mode 100644 hal/src/stm32h7/spi/CMakeLists.txt create mode 100644 hal/src/stm32h7/spi/SpiComIF.cpp create mode 100644 hal/src/stm32h7/spi/SpiCookie.cpp create mode 100644 hal/src/stm32h7/spi/mspInit.cpp create mode 100644 hal/src/stm32h7/spi/spiCore.cpp create mode 100644 hal/src/stm32h7/spi/spiDefinitions.cpp create mode 100644 hal/src/stm32h7/spi/spiInterrupts.cpp create mode 100644 hal/src/stm32h7/spi/stm32h743ziSpi.cpp create mode 100644 hal/src/stm32h7/uart/CMakeLists.txt diff --git a/hal/CMakeLists.txt b/hal/CMakeLists.txt new file mode 100644 index 00000000..24d7dac3 --- /dev/null +++ b/hal/CMakeLists.txt @@ -0,0 +1,89 @@ +cmake_minimum_required(VERSION 3.13) + +# Can also be changed by upper CMakeLists.txt file +find_library(LIB_FSFW_NAME fsfw REQUIRED) + +option(FSFW_HAL_ADD_LINUX "Add the Linux HAL to the sources. Required gpiod library" OFF) +option(FSFW_HAL_ADD_RASPBERRY_PI "Add Raspberry Pi specific code to the sources" OFF) + +option(FSFW_HAL_ADD_STM32H7 "Add the STM32H7 HAL to the sources" OFF) + +option(FSFW_HAL_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON) + +set(LIB_FSFW_HAL_NAME fsfw_hal) +set(LINUX_HAL_PATH_NAME linux) +set(STM32H7_PATH_NAME stm32h7) + +add_library(${LIB_FSFW_HAL_NAME}) + +if(NOT LIB_FSFW_NAME) + message(ERROR "LIB_FSFW_NAME needs to be set as a linkable target") +endif() + +add_subdirectory(devicehandlers) +add_subdirectory(common) + +if(FSFW_HAL_ADD_LINUX) + add_subdirectory(${LINUX_HAL_PATH_NAME}) +endif() + +if(FSFW_HAL_ADD_STM32H7) + add_subdirectory(${STM32H7_PATH_NAME}) +endif() + +target_link_libraries(${LIB_FSFW_HAL_NAME} PRIVATE + ${LIB_FSFW_NAME} +) + +foreach(INCLUDE_PATH ${FSFW_HAL_ADDITIONAL_INC_PATHS}) + if(IS_ABSOLUTE ${INCLUDE_PATH}) + set(CURR_ABS_INC_PATH "${INCLUDE_PATH}") + else() + get_filename_component(CURR_ABS_INC_PATH + ${INCLUDE_PATH} REALPATH BASE_DIR ${CMAKE_SOURCE_DIR}) + endif() + + if(CMAKE_VERBOSE) + message(STATUS "FSFW include path: ${CURR_ABS_INC_PATH}") + endif() + + list(APPEND FSFW_HAL_ADD_INC_PATHS_ABS ${CURR_ABS_INC_PATH}) +endforeach() + +target_include_directories(${LIB_FSFW_HAL_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + ${FSFW_HAL_ADD_INC_PATHS_ABS} +) + +target_compile_definitions(${LIB_FSFW_HAL_NAME} PRIVATE + ${FSFW_HAL_DEFINES} +) + +target_link_libraries(${LIB_FSFW_HAL_NAME} PRIVATE + ${FSFW_HAL_LINK_LIBS} +) + +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + if(NOT DEFINED FSFW_WARNING_FLAGS) + set(FSFW_WARNING_FLAGS + -Wall + -Wextra + -Wimplicit-fallthrough=1 + -Wno-unused-parameter + ) + endif() + + target_compile_options(${LIB_FSFW_NAME} PRIVATE + "-ffunction-sections" + "-fdata-sections" + ) + + target_link_options(${LIB_FSFW_NAME} PRIVATE + "Wl,--gc-sections" + ) + + if(FSFW_HAL_WARNING_SHADOW_LOCAL_GCC) + list(APPEND WARNING_FLAGS "-Wshadow=local") + endif() + +endif() diff --git a/hal/inc/fsfw/common/gpio/GpioCookie.h b/hal/inc/fsfw/common/gpio/GpioCookie.h new file mode 100644 index 00000000..0473fe0f --- /dev/null +++ b/hal/inc/fsfw/common/gpio/GpioCookie.h @@ -0,0 +1,41 @@ +#ifndef COMMON_GPIO_GPIOCOOKIE_H_ +#define COMMON_GPIO_GPIOCOOKIE_H_ + +#include "GpioIF.h" +#include "gpioDefinitions.h" + +#include +#include + +/** + * @brief Cookie for the GpioIF. Allows the GpioIF to determine which + * GPIOs to initialize and whether they should be configured as in- or + * output. + * @details One GpioCookie can hold multiple GPIO configurations. To add a new + * GPIO configuration to a GpioCookie use the GpioCookie::addGpio + * function. + * + * @author J. Meier + */ +class GpioCookie: public CookieIF { +public: + + GpioCookie(); + + virtual ~GpioCookie(); + + ReturnValue_t addGpio(gpioId_t gpioId, GpioBase* gpioConfig); + + /** + * @brief Get map with registered GPIOs. + */ + GpioMap getGpioMap() const; + +private: + /** + * Returns a copy of the internal GPIO map. + */ + GpioMap gpioMap; +}; + +#endif /* COMMON_GPIO_GPIOCOOKIE_H_ */ diff --git a/hal/inc/fsfw/common/gpio/GpioIF.h b/hal/inc/fsfw/common/gpio/GpioIF.h new file mode 100644 index 00000000..af73f94c --- /dev/null +++ b/hal/inc/fsfw/common/gpio/GpioIF.h @@ -0,0 +1,54 @@ +#ifndef COMMON_GPIO_GPIOIF_H_ +#define COMMON_GPIO_GPIOIF_H_ + +#include "gpioDefinitions.h" +#include +#include + +class GpioCookie; + +/** + * @brief This class defines the interface for objects requiring the control + * over GPIOs. + * @author J. Meier + */ +class GpioIF : public HasReturnvaluesIF { +public: + + virtual ~GpioIF() {}; + + /** + * @brief Called by the GPIO using object. + * @param cookie Cookie specifying informations of the GPIOs required + * by a object. + */ + virtual ReturnValue_t addGpios(GpioCookie* cookie) = 0; + + /** + * @brief By implementing this function a child must provide the + * functionality to pull a certain GPIO to high logic level. + * + * @param gpioId A unique number which specifies the GPIO to drive. + * @return Returns RETURN_OK for success. This should never return RETURN_FAILED. + */ + virtual ReturnValue_t pullHigh(gpioId_t gpioId) = 0; + + /** + * @brief By implementing this function a child must provide the + * functionality to pull a certain GPIO to low logic level. + * + * @param gpioId A unique number which specifies the GPIO to drive. + */ + virtual ReturnValue_t pullLow(gpioId_t gpioId) = 0; + + /** + * @brief This function requires a child to implement the functionality to read the state of + * an ouput or input gpio. + * + * @param gpioId A unique number which specifies the GPIO to read. + * @param gpioState State of GPIO will be written to this pointer. + */ + virtual ReturnValue_t readGpio(gpioId_t gpioId, int* gpioState) = 0; +}; + +#endif /* COMMON_GPIO_GPIOIF_H_ */ diff --git a/hal/inc/fsfw/common/gpio/gpioDefinitions.h b/hal/inc/fsfw/common/gpio/gpioDefinitions.h new file mode 100644 index 00000000..710b2e2c --- /dev/null +++ b/hal/inc/fsfw/common/gpio/gpioDefinitions.h @@ -0,0 +1,110 @@ +#ifndef COMMON_GPIO_GPIODEFINITIONS_H_ +#define COMMON_GPIO_GPIODEFINITIONS_H_ + +#include +#include +#include + +using gpioId_t = uint16_t; + +namespace gpio { + +enum Levels { + LOW = 0, + HIGH = 1 +}; + +enum Direction { + IN = 0, + OUT = 1 +}; + +enum GpioOperation { + READ, + WRITE +}; + +enum GpioTypes { + NONE, + GPIO_REGULAR, + CALLBACK +}; + +static constexpr gpioId_t NO_GPIO = -1; + +using gpio_cb_t = void (*) (gpioId_t gpioId, gpio::GpioOperation gpioOp, int value, void* args); + +} + +/** + * @brief Struct containing information about the GPIO to use. This is + * required by the libgpiod to access and drive a GPIO. + * @param chipname String of the chipname specifying the group which contains the GPIO to + * access. E.g. gpiochip0. To detect names of GPIO groups run gpiodetect on + * the linux command line. + * @param lineNum The offset of the GPIO within the GPIO group. + * @param consumer Name of the consumer. Simply a description of the GPIO configuration. + * @param direction Specifies whether the GPIO should be used as in- or output. + * @param initValue Defines the initial state of the GPIO when configured as output. + * Only required for output GPIOs. + * @param lineHandle The handle returned by gpiod_chip_get_line will be later written to this + * pointer. + */ +class GpioBase { +public: + + GpioBase() = default; + + GpioBase(gpio::GpioTypes gpioType, std::string consumer, gpio::Direction direction, + int initValue): + gpioType(gpioType), consumer(consumer),direction(direction), initValue(initValue) {} + + virtual~ GpioBase() {}; + + // Can be used to cast GpioBase to a concrete child implementation + gpio::GpioTypes gpioType = gpio::GpioTypes::NONE; + std::string consumer; + gpio::Direction direction = gpio::Direction::IN; + int initValue = 0; +}; + +class GpiodRegular: public GpioBase { +public: + GpiodRegular() : + GpioBase(gpio::GpioTypes::GPIO_REGULAR, std::string(), gpio::Direction::IN, 0) { + } + ; + + GpiodRegular(std::string chipname_, int lineNum_, std::string consumer_, + gpio::Direction direction_, int initValue_) : + GpioBase(gpio::GpioTypes::GPIO_REGULAR, consumer_, direction_, initValue_), + chipname(chipname_), lineNum(lineNum_) { + } + + GpiodRegular(std::string chipname_, int lineNum_, std::string consumer_) : + GpioBase(gpio::GpioTypes::GPIO_REGULAR, consumer_, gpio::Direction::IN, 0), + chipname(chipname_), lineNum(lineNum_) { + } + std::string chipname; + int lineNum = 0; + struct gpiod_line* lineHandle = nullptr; +}; + +class GpioCallback: public GpioBase { +public: + GpioCallback(std::string consumer, gpio::Direction direction_, int initValue_, + gpio::gpio_cb_t callback, void* callbackArgs): + GpioBase(gpio::GpioTypes::CALLBACK, consumer, direction_, initValue_), + callback(callback), callbackArgs(callbackArgs) {} + + gpio::gpio_cb_t callback = nullptr; + void* callbackArgs = nullptr; +}; + + +using GpioMap = std::map; +using GpioUnorderedMap = std::unordered_map; +using GpioMapIter = GpioMap::iterator; +using GpioUnorderedMapIter = GpioUnorderedMap::iterator; + +#endif /* LINUX_GPIO_GPIODEFINITIONS_H_ */ diff --git a/hal/inc/fsfw/common/spi/spiCommon.h b/hal/inc/fsfw/common/spi/spiCommon.h new file mode 100644 index 00000000..9b3aef6a --- /dev/null +++ b/hal/inc/fsfw/common/spi/spiCommon.h @@ -0,0 +1,17 @@ +#ifndef FSFW_HAL_COMMON_SPI_SPICOMMON_H_ +#define FSFW_HAL_COMMON_SPI_SPICOMMON_H_ + +#include + +namespace spi { + +enum SpiModes: uint8_t { + MODE_0, + MODE_1, + MODE_2, + MODE_3 +}; + +} + +#endif /* FSFW_HAL_COMMON_SPI_SPICOMMON_H_ */ diff --git a/hal/inc/fsfw/devicehandlers/GyroL3GD20Handler.h b/hal/inc/fsfw/devicehandlers/GyroL3GD20Handler.h new file mode 100644 index 00000000..f82ba935 --- /dev/null +++ b/hal/inc/fsfw/devicehandlers/GyroL3GD20Handler.h @@ -0,0 +1,86 @@ +#ifndef MISSION_DEVICES_GYROL3GD20HANDLER_H_ +#define MISSION_DEVICES_GYROL3GD20HANDLER_H_ + +#include "OBSWConfig.h" +#include "devicedefinitions/GyroL3GD20Definitions.h" + +#include +#include + +#ifndef FSFW_HAL_L3GD20_GYRO_DEBUG +#define FSFW_HAL_L3GD20_GYRO_DEBUG 1 +#endif /* FSFW_HAL_L3GD20_GYRO_DEBUG */ + +/** + * @brief Device Handler for the L3GD20H gyroscope sensor + * (https://www.st.com/en/mems-and-sensors/l3gd20h.html) + * @details + * Advanced documentation: + * https://egit.irs.uni-stuttgart.de/redmine/projects/eive-flight-manual/wiki/L3GD20H_Gyro + * + * Data is read big endian with the smallest possible range of 245 degrees per second. + */ +class GyroHandlerL3GD20H: public DeviceHandlerBase { +public: + GyroHandlerL3GD20H(object_id_t objectId, object_id_t deviceCommunication, + CookieIF* comCookie); + virtual ~GyroHandlerL3GD20H(); + + void setGoNormalModeAtStartup(); +protected: + + /* DeviceHandlerBase overrides */ + ReturnValue_t buildTransitionDeviceCommand( + DeviceCommandId_t *id) override; + void doStartUp() override; + void doShutDown() override; + ReturnValue_t buildNormalDeviceCommand( + DeviceCommandId_t *id) override; + ReturnValue_t buildCommandFromCommand( + DeviceCommandId_t deviceCommand, const uint8_t *commandData, + size_t commandDataLen) override; + ReturnValue_t scanForReply(const uint8_t *start, size_t len, + DeviceCommandId_t *foundId, size_t *foundLen) override; + ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, + const uint8_t *packet) override; + + void fillCommandAndReplyMap() override; + void modeChanged() override; + uint32_t getTransitionDelayMs(Mode_t from, Mode_t to) override; + ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, + LocalDataPoolManager &poolManager) override; + +private: + GyroPrimaryDataset dataset; + + enum class InternalState { + NONE, + CONFIGURE, + CHECK_REGS, + NORMAL + }; + InternalState internalState = InternalState::NONE; + bool commandExecuted = false; + + uint8_t statusReg = 0; + bool goNormalModeImmediately = false; + + uint8_t ctrlReg1Value = L3GD20H::CTRL_REG_1_VAL; + uint8_t ctrlReg2Value = L3GD20H::CTRL_REG_2_VAL; + uint8_t ctrlReg3Value = L3GD20H::CTRL_REG_3_VAL; + uint8_t ctrlReg4Value = L3GD20H::CTRL_REG_4_VAL; + uint8_t ctrlReg5Value = L3GD20H::CTRL_REG_5_VAL; + + uint8_t commandBuffer[L3GD20H::READ_LEN + 1]; + + // Set default value + float sensitivity = L3GD20H::SENSITIVITY_00; + +#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 + PeriodicOperationDivider* debugDivider = nullptr; +#endif +}; + + + +#endif /* MISSION_DEVICES_GYROL3GD20HANDLER_H_ */ diff --git a/hal/inc/fsfw/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h b/hal/inc/fsfw/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h new file mode 100644 index 00000000..56a2468d --- /dev/null +++ b/hal/inc/fsfw/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h @@ -0,0 +1,143 @@ +#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_GYROL3GD20DEFINITIONS_H_ +#define MISSION_DEVICES_DEVICEDEFINITIONS_GYROL3GD20DEFINITIONS_H_ + +#include +#include +#include + +namespace L3GD20H { + +/* Actual size is 15 but we round up a bit */ +static constexpr size_t MAX_BUFFER_SIZE = 16; + +static constexpr uint8_t READ_MASK = 0b10000000; + +static constexpr uint8_t AUTO_INCREMENT_MASK = 0b01000000; + +static constexpr uint8_t WHO_AM_I_REG = 0b00001111; +static constexpr uint8_t WHO_AM_I_VAL = 0b11010111; + +/*------------------------------------------------------------------------*/ +/* Control registers */ +/*------------------------------------------------------------------------*/ +static constexpr uint8_t CTRL_REG_1 = 0b00100000; +static constexpr uint8_t CTRL_REG_2 = 0b00100001; +static constexpr uint8_t CTRL_REG_3 = 0b00100010; +static constexpr uint8_t CTRL_REG_4 = 0b00100011; +static constexpr uint8_t CTRL_REG_5 = 0b00100100; + +/* Register 1 */ +static constexpr uint8_t SET_DR_1 = 1 << 7; +static constexpr uint8_t SET_DR_0 = 1 << 6; +static constexpr uint8_t SET_BW_1 = 1 << 5; +static constexpr uint8_t SET_BW_0 = 1 << 4; +static constexpr uint8_t SET_POWER_NORMAL_MODE = 1 << 3; +static constexpr uint8_t SET_Z_ENABLE = 1 << 2; +static constexpr uint8_t SET_X_ENABLE = 1 << 1; +static constexpr uint8_t SET_Y_ENABLE = 1; + +static constexpr uint8_t CTRL_REG_1_VAL = SET_POWER_NORMAL_MODE | SET_Z_ENABLE | + SET_Y_ENABLE | SET_X_ENABLE; + +/* Register 2 */ +static constexpr uint8_t EXTERNAL_EDGE_ENB = 1 << 7; +static constexpr uint8_t LEVEL_SENSITIVE_TRIGGER = 1 << 6; +static constexpr uint8_t SET_HPM_1 = 1 << 5; +static constexpr uint8_t SET_HPM_0 = 1 << 4; +static constexpr uint8_t SET_HPCF_3 = 1 << 3; +static constexpr uint8_t SET_HPCF_2 = 1 << 2; +static constexpr uint8_t SET_HPCF_1 = 1 << 1; +static constexpr uint8_t SET_HPCF_0 = 1; + +static constexpr uint8_t CTRL_REG_2_VAL = 0b00000000; + +/* Register 3 */ +static constexpr uint8_t CTRL_REG_3_VAL = 0b00000000; + +/* Register 4 */ +static constexpr uint8_t SET_BNU = 1 << 7; +static constexpr uint8_t SET_BLE = 1 << 6; +static constexpr uint8_t SET_FS_1 = 1 << 5; +static constexpr uint8_t SET_FS_0 = 1 << 4; +static constexpr uint8_t SET_IMP_ENB = 1 << 3; +static constexpr uint8_t SET_SELF_TEST_ENB_1 = 1 << 2; +static constexpr uint8_t SET_SELF_TEST_ENB_0 = 1 << 1; +static constexpr uint8_t SET_SPI_IF_SELECT = 1; + +/* Enable big endian data format */ +static constexpr uint8_t CTRL_REG_4_VAL = SET_BLE; + +/* Register 5 */ +static constexpr uint8_t SET_REBOOT_MEM = 1 << 7; +static constexpr uint8_t SET_FIFO_ENB = 1 << 6; + +static constexpr uint8_t CTRL_REG_5_VAL = 0b00000000; + +/* Possible range values in degrees per second (DPS). */ +static constexpr uint16_t RANGE_DPS_00 = 245; +static constexpr float SENSITIVITY_00 = 8.75 * 0.001; +static constexpr uint16_t RANGE_DPS_01 = 500; +static constexpr float SENSITIVITY_01 = 17.5 * 0.001; +static constexpr uint16_t RANGE_DPS_11 = 2000; +static constexpr float SENSITIVITY_11 = 70.0 * 0.001; + +static constexpr uint8_t READ_START = CTRL_REG_1; +static constexpr size_t READ_LEN = 14; + +/* Indexing */ +static constexpr uint8_t REFERENCE_IDX = 6; +static constexpr uint8_t TEMPERATURE_IDX = 7; +static constexpr uint8_t STATUS_IDX = 8; +static constexpr uint8_t OUT_X_H = 9; +static constexpr uint8_t OUT_X_L = 10; +static constexpr uint8_t OUT_Y_H = 11; +static constexpr uint8_t OUT_Y_L = 12; +static constexpr uint8_t OUT_Z_H = 13; +static constexpr uint8_t OUT_Z_L = 14; + +/*------------------------------------------------------------------------*/ +/* Device Handler specific */ +/*------------------------------------------------------------------------*/ +static constexpr DeviceCommandId_t READ_REGS = 0; +static constexpr DeviceCommandId_t CONFIGURE_CTRL_REGS = 1; +static constexpr DeviceCommandId_t READ_CTRL_REGS = 2; + +static constexpr uint32_t GYRO_DATASET_ID = READ_REGS; + +enum GyroPoolIds: lp_id_t { + ANG_VELOC_X, + ANG_VELOC_Y, + ANG_VELOC_Z, + TEMPERATURE +}; + +} + +class GyroPrimaryDataset: public StaticLocalDataSet<5> { +public: + + /** Constructor for data users like controllers */ + GyroPrimaryDataset(object_id_t mgmId): + StaticLocalDataSet(sid_t(mgmId, L3GD20H::GYRO_DATASET_ID)) { + setAllVariablesReadOnly(); + } + + /* Angular velocities in degrees per second (DPS) */ + lp_var_t angVelocX = lp_var_t(sid.objectId, + L3GD20H::ANG_VELOC_X, this); + lp_var_t angVelocY = lp_var_t(sid.objectId, + L3GD20H::ANG_VELOC_Y, this); + lp_var_t angVelocZ = lp_var_t(sid.objectId, + L3GD20H::ANG_VELOC_Z, this); + lp_var_t temperature = lp_var_t(sid.objectId, + L3GD20H::TEMPERATURE, this); +private: + + friend class GyroHandlerL3GD20H; + /** Constructor for the data creator */ + GyroPrimaryDataset(HasLocalDataPoolIF* hkOwner): + StaticLocalDataSet(hkOwner, L3GD20H::GYRO_DATASET_ID) {} +}; + + +#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_GYROL3GD20DEFINITIONS_H_ */ diff --git a/hal/inc/fsfw/linux/UnixFileGuard.h b/hal/inc/fsfw/linux/UnixFileGuard.h new file mode 100644 index 00000000..fb595704 --- /dev/null +++ b/hal/inc/fsfw/linux/UnixFileGuard.h @@ -0,0 +1,33 @@ +#ifndef LINUX_UTILITY_UNIXFILEGUARD_H_ +#define LINUX_UTILITY_UNIXFILEGUARD_H_ + +#include + +#include + +#include +#include + + +class UnixFileGuard { +public: + static constexpr int READ_WRITE_FLAG = O_RDWR; + static constexpr int READ_ONLY_FLAG = O_RDONLY; + static constexpr int NON_BLOCKING_IO_FLAG = O_NONBLOCK; + + static constexpr ReturnValue_t OPEN_FILE_FAILED = 1; + + UnixFileGuard(std::string device, int* fileDescriptor, int flags, + std::string diagnosticPrefix = ""); + + virtual~ UnixFileGuard(); + + ReturnValue_t getOpenResult() const; +private: + int* fileDescriptor = nullptr; + ReturnValue_t openStatus = HasReturnvaluesIF::RETURN_OK; +}; + + + +#endif /* LINUX_UTILITY_UNIXFILEGUARD_H_ */ diff --git a/hal/inc/fsfw/linux/gpio/LinuxLibgpioIF.h b/hal/inc/fsfw/linux/gpio/LinuxLibgpioIF.h new file mode 100644 index 00000000..00e1bdfe --- /dev/null +++ b/hal/inc/fsfw/linux/gpio/LinuxLibgpioIF.h @@ -0,0 +1,77 @@ +#ifndef LINUX_GPIO_LINUXLIBGPIOIF_H_ +#define LINUX_GPIO_LINUXLIBGPIOIF_H_ + +#include "../../common/gpio/GpioIF.h" +#include +#include + +class GpioCookie; + +/** + * @brief This class implements the GpioIF for a linux based system. The + * implementation is based on the libgpiod lib which requires linux 4.8 + * or higher. + * @note The Petalinux SDK from Xilinx supports libgpiod since Petalinux + * 2019.1. + */ +class LinuxLibgpioIF : public GpioIF, public SystemObject { +public: + + static const uint8_t gpioRetvalId = CLASS_ID::HAL_GPIO; + + static constexpr ReturnValue_t UNKNOWN_GPIO_ID = + HasReturnvaluesIF::makeReturnCode(gpioRetvalId, 1); + static constexpr ReturnValue_t DRIVE_GPIO_FAILURE = + HasReturnvaluesIF::makeReturnCode(gpioRetvalId, 2); + static constexpr ReturnValue_t GPIO_TYPE_FAILURE = + HasReturnvaluesIF::makeReturnCode(gpioRetvalId, 3); + static constexpr ReturnValue_t GPIO_INVALID_INSTANCE = + HasReturnvaluesIF::makeReturnCode(gpioRetvalId, 4); + + LinuxLibgpioIF(object_id_t objectId); + virtual ~LinuxLibgpioIF(); + + ReturnValue_t addGpios(GpioCookie* gpioCookie) override; + ReturnValue_t pullHigh(gpioId_t gpioId) override; + ReturnValue_t pullLow(gpioId_t gpioId) override; + ReturnValue_t readGpio(gpioId_t gpioId, int* gpioState) override; + +private: + /* Holds the information and configuration of all used GPIOs */ + GpioUnorderedMap gpioMap; + GpioUnorderedMapIter gpioMapIter; + + /** + * @brief This functions drives line of a GPIO specified by the GPIO ID. + * + * @param gpioId The GPIO ID of the GPIO to drive. + * @param logiclevel The logic level to set. O or 1. + */ + ReturnValue_t driveGpio(gpioId_t gpioId, GpiodRegular* regularGpio, unsigned int logiclevel); + + ReturnValue_t configureRegularGpio(gpioId_t gpioId, GpiodRegular* regularGpio); + + /** + * @brief This function checks if GPIOs are already registered and whether + * there exists a conflict in the GPIO configuration. E.g. the + * direction. + * + * @param mapToAdd The GPIOs which shall be added to the gpioMap. + * + * @return RETURN_OK if successful, otherwise RETURN_FAILED + */ + ReturnValue_t checkForConflicts(GpioMap& mapToAdd); + + ReturnValue_t checkForConflictsRegularGpio(gpioId_t gpiodId, GpiodRegular* regularGpio, + GpioMap& mapToAdd); + ReturnValue_t checkForConflictsCallbackGpio(gpioId_t gpiodId, GpioCallback* regularGpio, + GpioMap& mapToAdd); + + /** + * @brief Performs the initial configuration of all GPIOs specified in the GpioMap mapToAdd. + */ + ReturnValue_t configureGpios(GpioMap& mapToAdd); + +}; + +#endif /* LINUX_GPIO_LINUXLIBGPIOIF_H_ */ diff --git a/hal/inc/fsfw/linux/i2c/I2cComIF.h b/hal/inc/fsfw/linux/i2c/I2cComIF.h new file mode 100644 index 00000000..0856c9bd --- /dev/null +++ b/hal/inc/fsfw/linux/i2c/I2cComIF.h @@ -0,0 +1,61 @@ +#ifndef LINUX_I2C_I2COMIF_H_ +#define LINUX_I2C_I2COMIF_H_ + +#include "I2cCookie.h" +#include +#include + +#include +#include + +/** + * @brief This is the communication interface for I2C devices connected + * to a system running a Linux OS. + * + * @note The Xilinx Linux kernel might not support to read more than 255 bytes at once. + * + * @author J. Meier + */ +class I2cComIF: public DeviceCommunicationIF, public SystemObject { +public: + I2cComIF(object_id_t objectId); + + virtual ~I2cComIF(); + + ReturnValue_t initializeInterface(CookieIF * cookie) override; + ReturnValue_t sendMessage(CookieIF *cookie,const uint8_t *sendData, + size_t sendLen) override; + ReturnValue_t getSendSuccess(CookieIF *cookie) override; + ReturnValue_t requestReceiveMessage(CookieIF *cookie, + size_t requestLen) override; + ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer, + size_t *size) override; + +private: + + struct I2cInstance { + std::vector replyBuffer; + size_t replyLen; + }; + + using I2cDeviceMap = std::unordered_map; + using I2cDeviceMapIter = I2cDeviceMap::iterator; + + /* In this map all i2c devices will be registered with their address and + * the appropriate file descriptor will be stored */ + I2cDeviceMap i2cDeviceMap; + I2cDeviceMapIter i2cDeviceMapIter; + + /** + * @brief This function opens an I2C device and binds the opened file + * to a specific I2C address. + * @param deviceFile The name of the device file. E.g. i2c-0 + * @param i2cAddress The address of the i2c slave device. + * @param fileDescriptor Pointer to device descriptor. + * @return RETURN_OK if successful, otherwise RETURN_FAILED. + */ + ReturnValue_t openDevice(std::string deviceFile, + address_t i2cAddress, int* fileDescriptor); +}; + +#endif /* LINUX_I2C_I2COMIF_H_ */ diff --git a/hal/inc/fsfw/linux/i2c/I2cCookie.h b/hal/inc/fsfw/linux/i2c/I2cCookie.h new file mode 100644 index 00000000..888a2b12 --- /dev/null +++ b/hal/inc/fsfw/linux/i2c/I2cCookie.h @@ -0,0 +1,38 @@ +#ifndef LINUX_I2C_I2CCOOKIE_H_ +#define LINUX_I2C_I2CCOOKIE_H_ + +#include +#include + +/** + * @brief Cookie for the i2cDeviceComIF. + * + * @author J. Meier + */ +class I2cCookie: public CookieIF { +public: + + /** + * @brief Constructor for the I2C cookie. + * @param i2cAddress_ The i2c address of the target device. + * @param maxReplyLen_ The maximum expected length of a reply from the + * target device. + * @param devicFile_ The device file specifying the i2c interface to use. E.g. "/dev/i2c-0". + */ + I2cCookie(address_t i2cAddress_, size_t maxReplyLen_, + std::string deviceFile_); + + virtual ~I2cCookie(); + + address_t getAddress() const; + size_t getMaxReplyLen() const; + std::string getDeviceFile() const; + +private: + + address_t i2cAddress = 0; + size_t maxReplyLen = 0; + std::string deviceFile; +}; + +#endif /* LINUX_I2C_I2CCOOKIE_H_ */ diff --git a/hal/inc/fsfw/linux/rpi/GpioRPi.h b/hal/inc/fsfw/linux/rpi/GpioRPi.h new file mode 100644 index 00000000..54917e6d --- /dev/null +++ b/hal/inc/fsfw/linux/rpi/GpioRPi.h @@ -0,0 +1,26 @@ +#ifndef BSP_RPI_GPIO_GPIORPI_H_ +#define BSP_RPI_GPIO_GPIORPI_H_ + +#include +#include "../../common/gpio/gpioDefinitions.h" + +class GpioCookie; + +namespace gpio { + +/** + * Create a GpioConfig_t. This function does a sanity check on the BCM pin number and fails if the + * BCM pin is invalid. + * @param cookie Adds the configuration to this cookie directly + * @param gpioId ID which identifies the GPIO configuration + * @param bcmPin Raspberry Pi BCM pin + * @param consumer Information string + * @param direction GPIO direction + * @param initValue Intial value for output pins, 0 for low, 1 for high + * @return + */ +ReturnValue_t createRpiGpioConfig(GpioCookie* cookie, gpioId_t gpioId, int bcmPin, + std::string consumer, gpio::Direction direction, int initValue); +} + +#endif /* BSP_RPI_GPIO_GPIORPI_H_ */ diff --git a/hal/inc/fsfw/linux/spi/SpiComIF.h b/hal/inc/fsfw/linux/spi/SpiComIF.h new file mode 100644 index 00000000..676c7cba --- /dev/null +++ b/hal/inc/fsfw/linux/spi/SpiComIF.h @@ -0,0 +1,90 @@ +#ifndef LINUX_SPI_SPICOMIF_H_ +#define LINUX_SPI_SPICOMIF_H_ + +#include "spiDefinitions.h" +#include "returnvalues/classIds.h" +#include "../../common/gpio/GpioIF.h" + +#include +#include + +#include +#include + +class SpiCookie; + +/** + * @brief Encapsulates access to linux SPI driver for FSFW objects + * @details + * Right now, only full-duplex SPI is supported. Most device specific transfer properties + * are contained in the SPI cookie. + * @author R. Mueller + */ +class SpiComIF: public DeviceCommunicationIF, public SystemObject { +public: + static constexpr uint8_t spiRetvalId = CLASS_ID::HAL_SPI; + static constexpr ReturnValue_t OPENING_FILE_FAILED = + HasReturnvaluesIF::makeReturnCode(spiRetvalId, 0); + /* Full duplex (ioctl) transfer failure */ + static constexpr ReturnValue_t FULL_DUPLEX_TRANSFER_FAILED = + HasReturnvaluesIF::makeReturnCode(spiRetvalId, 1); + /* Half duplex (read/write) transfer failure */ + static constexpr ReturnValue_t HALF_DUPLEX_TRANSFER_FAILED = + HasReturnvaluesIF::makeReturnCode(spiRetvalId, 2); + + SpiComIF(object_id_t objectId, GpioIF* gpioComIF); + + ReturnValue_t initializeInterface(CookieIF * cookie) override; + ReturnValue_t sendMessage(CookieIF *cookie,const uint8_t *sendData, + size_t sendLen) override; + ReturnValue_t getSendSuccess(CookieIF *cookie) override; + ReturnValue_t requestReceiveMessage(CookieIF *cookie, + size_t requestLen) override; + ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer, + size_t *size) override; + + /** + * @brief This function returns the mutex which can be used to protect the spi bus when + * the chip select must be driven from outside of the com if. + */ + MutexIF* getMutex(MutexIF::TimeoutType* timeoutType = nullptr, uint32_t* timeoutMs = nullptr); + + /** + * Perform a regular send operation using Linux iotcl. This is public so it can be used + * in functions like a user callback if special handling is only necessary for certain commands. + * @param spiCookie + * @param sendData + * @param sendLen + * @return + */ + ReturnValue_t performRegularSendOperation(SpiCookie* spiCookie, const uint8_t *sendData, + size_t sendLen); + + GpioIF* getGpioInterface(); + void setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed); + void performSpiWiretapping(SpiCookie* spiCookie); + + ReturnValue_t getReadBuffer(address_t spiAddress, uint8_t** buffer); + +private: + + struct SpiInstance { + SpiInstance(size_t maxRecvSize): replyBuffer(std::vector(maxRecvSize)) {} + std::vector replyBuffer; + }; + + GpioIF* gpioComIF = nullptr; + + MutexIF* spiMutex = nullptr; + MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING; + uint32_t timeoutMs = 20; + + using SpiDeviceMap = std::unordered_map; + using SpiDeviceMapIter = SpiDeviceMap::iterator; + + SpiDeviceMap spiDeviceMap; + + ReturnValue_t performHalfDuplexReception(SpiCookie* spiCookie); +}; + +#endif /* LINUX_SPI_SPICOMIF_H_ */ diff --git a/hal/inc/fsfw/linux/spi/SpiCookie.h b/hal/inc/fsfw/linux/spi/SpiCookie.h new file mode 100644 index 00000000..acf7c77c --- /dev/null +++ b/hal/inc/fsfw/linux/spi/SpiCookie.h @@ -0,0 +1,185 @@ +#ifndef LINUX_SPI_SPICOOKIE_H_ +#define LINUX_SPI_SPICOOKIE_H_ + +#include "spiDefinitions.h" +#include "../../common/gpio/gpioDefinitions.h" + +#include + +#include + +/** + * @brief This cookie class is passed to the SPI communication interface + * @details + * This cookie contains device specific properties like speed and SPI mode or the SPI transfer + * struct required by the Linux SPI driver. It also contains a handle to a GPIO interface + * to perform slave select switching when necessary. + * + * The user can specify gpio::NO_GPIO as the GPIO ID or use a custom send callback to meet + * special requirements like expander slave select switching (e.g. GPIO or I2C expander) + * or special timing related requirements. + */ +class SpiCookie: public CookieIF { +public: + /** + * Each SPI device will have a corresponding cookie. The cookie is used by the communication + * interface and contains device specific information like the largest expected size to be + * sent and received and the GPIO pin used to toggle the SPI slave select pin. + * @param spiAddress + * @param chipSelect Chip select. gpio::NO_GPIO can be used for hardware slave selects. + * @param spiDev + * @param maxSize + */ + SpiCookie(address_t spiAddress, gpioId_t chipSelect, std::string spiDev, + const size_t maxSize, spi::SpiModes spiMode, uint32_t spiSpeed); + + /** + * Like constructor above, but without a dedicated GPIO CS. Can be used for hardware + * slave select or if CS logic is performed with decoders. + */ + SpiCookie(address_t spiAddress, std::string spiDev, const size_t maxReplySize, + spi::SpiModes spiMode, uint32_t spiSpeed); + + /** + * Use the callback mode of the SPI communication interface. The user can pass the callback + * function here or by using the setter function #setCallbackMode + */ + SpiCookie(address_t spiAddress, gpioId_t chipSelect, std::string spiDev, const size_t maxSize, + spi::SpiModes spiMode, uint32_t spiSpeed, spi::send_callback_function_t callback, + void *args); + + /** + * Get the callback function + * @param callback + * @param args + */ + void getCallback(spi::send_callback_function_t* callback, void** args); + + address_t getSpiAddress() const; + std::string getSpiDevice() const; + gpioId_t getChipSelectPin() const; + size_t getMaxBufferSize() const; + + spi::SpiComIfModes getComIfMode() const; + + /** Enables changing SPI speed at run-time */ + void setSpiSpeed(uint32_t newSpeed); + /** Enables changing the SPI mode at run-time */ + void setSpiMode(spi::SpiModes newMode); + + /** + * Set the SPI to callback mode and assigns the user supplied callback and an argument + * passed to the callback. + * @param callback + * @param args + */ + void setCallbackMode(spi::send_callback_function_t callback, void* args); + + /** + * Can be used to set the callback arguments and a later point than initialization. + * @param args + */ + void setCallbackArgs(void* args); + + /** + * True if SPI transfers should be performed in full duplex mode + * @return + */ + bool isFullDuplex() const; + + /** + * Set transfer type to full duplex or half duplex. Full duplex is the default setting, + * ressembling common SPI hardware implementation with shift registers, where read and writes + * happen simultaneosly. + * @param fullDuplex + */ + void setFullOrHalfDuplex(bool halfDuplex); + + /** + * This needs to be called to specify where the SPI driver writes to or reads from. + * @param readLocation + * @param writeLocation + */ + void assignReadBuffer(uint8_t* rx); + void assignWriteBuffer(const uint8_t* tx); + /** + * Assign size for the next transfer. + * @param transferSize + */ + void assignTransferSize(size_t transferSize); + size_t getCurrentTransferSize() const; + + struct UncommonParameters { + uint8_t bitsPerWord = 8; + bool noCs = false; + bool csHigh = false; + bool threeWireSpi = false; + /* MSB first is more common */ + bool lsbFirst = false; + }; + + /** + * Can be used to explicitely disable hardware chip select. + * Some drivers like the Raspberry Pi Linux driver will not use hardware chip select by default + * (see https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md) + * @param enable + */ + void setNoCs(bool enable); + void setThreeWireSpi(bool enable); + void setLsbFirst(bool enable); + void setCsHigh(bool enable); + void setBitsPerWord(uint8_t bitsPerWord); + + void getSpiParameters(spi::SpiModes& spiMode, uint32_t& spiSpeed, + UncommonParameters* parameters = nullptr) const; + + /** + * See spidev.h cs_change and delay_usecs + * @param deselectCs + * @param delayUsecs + */ + void activateCsDeselect(bool deselectCs, uint16_t delayUsecs); + + spi_ioc_transfer* getTransferStructHandle(); +private: + + /** + * Internal constructor which initializes every field + * @param spiAddress + * @param chipSelect + * @param spiDev + * @param maxSize + * @param spiMode + * @param spiSpeed + * @param callback + * @param args + */ + SpiCookie(spi::SpiComIfModes comIfMode, address_t spiAddress, gpioId_t chipSelect, + std::string spiDev, const size_t maxSize, spi::SpiModes spiMode, uint32_t spiSpeed, + spi::send_callback_function_t callback, void* args); + + size_t currentTransferSize = 0; + + address_t spiAddress; + gpioId_t chipSelectPin; + std::string spiDevice; + + spi::SpiComIfModes comIfMode; + + // Required for regular mode + const size_t maxSize; + spi::SpiModes spiMode; + uint32_t spiSpeed; + bool halfDuplex = false; + + // Required for callback mode + spi::send_callback_function_t sendCallback = nullptr; + void* callbackArgs = nullptr; + + struct spi_ioc_transfer spiTransferStruct = {}; + UncommonParameters uncommonParameters; +}; + + + +#endif /* LINUX_SPI_SPICOOKIE_H_ */ diff --git a/hal/inc/fsfw/linux/spi/spiDefinitions.h b/hal/inc/fsfw/linux/spi/spiDefinitions.h new file mode 100644 index 00000000..14af4fd5 --- /dev/null +++ b/hal/inc/fsfw/linux/spi/spiDefinitions.h @@ -0,0 +1,28 @@ +#ifndef LINUX_SPI_SPIDEFINITONS_H_ +#define LINUX_SPI_SPIDEFINITONS_H_ + +#include "../../common/gpio/gpioDefinitions.h" +#include "../../common/spi/spiCommon.h" + +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include + +#include + +class SpiCookie; +class SpiComIF; + +namespace spi { + +enum SpiComIfModes { + REGULAR, + CALLBACK +}; + + +using send_callback_function_t = ReturnValue_t (*) (SpiComIF* comIf, SpiCookie *cookie, + const uint8_t *sendData, size_t sendLen, void* args); + +} + +#endif /* LINUX_SPI_SPIDEFINITONS_H_ */ diff --git a/hal/inc/fsfw/linux/uart/UartComIF.h b/hal/inc/fsfw/linux/uart/UartComIF.h new file mode 100644 index 00000000..e513aa86 --- /dev/null +++ b/hal/inc/fsfw/linux/uart/UartComIF.h @@ -0,0 +1,110 @@ +#ifndef BSP_Q7S_COMIF_UARTCOMIF_H_ +#define BSP_Q7S_COMIF_UARTCOMIF_H_ + +#include "UartCookie.h" +#include +#include + +#include +#include + +/** + * @brief This is the communication interface to access serial ports on linux based operating + * systems. + * + * @details The implementation follows the instructions from https://blog.mbedded.ninja/programming/ + * operating-systems/linux/linux-serial-ports-using-c-cpp/#disabling-canonical-mode + * + * @author J. Meier + */ +class UartComIF: public DeviceCommunicationIF, public SystemObject { +public: + static constexpr uint8_t uartRetvalId = CLASS_ID::HAL_UART; + + static constexpr ReturnValue_t UART_READ_FAILURE = + HasReturnvaluesIF::makeReturnCode(uartRetvalId, 1); + static constexpr ReturnValue_t UART_READ_SIZE_MISSMATCH = + HasReturnvaluesIF::makeReturnCode(uartRetvalId, 2); + static constexpr ReturnValue_t UART_RX_BUFFER_TOO_SMALL = + HasReturnvaluesIF::makeReturnCode(uartRetvalId, 3); + + UartComIF(object_id_t objectId); + + virtual ~UartComIF(); + + ReturnValue_t initializeInterface(CookieIF * cookie) override; + ReturnValue_t sendMessage(CookieIF *cookie,const uint8_t *sendData, + size_t sendLen) override; + ReturnValue_t getSendSuccess(CookieIF *cookie) override; + ReturnValue_t requestReceiveMessage(CookieIF *cookie, + size_t requestLen) override; + ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer, + size_t *size) override; + +private: + + using UartDeviceFile_t = std::string; + + struct UartElements { + int fileDescriptor; + std::vector replyBuffer; + /** Number of bytes read will be written to this variable */ + size_t replyLen; + }; + + using UartDeviceMap = std::unordered_map; + using UartDeviceMapIter = UartDeviceMap::iterator; + + /** + * The uart devie map stores informations of initialized uart ports. + */ + UartDeviceMap uartDeviceMap; + + /** + * @brief This function opens and configures a uart device by using the information stored + * in the uart cookie. + * @param uartCookie Pointer to uart cookie with information about the uart. Contains the + * uart device file, baudrate, parity, stopbits etc. + * @return The file descriptor of the configured uart. + */ + int configureUartPort(UartCookie* uartCookie); + + /** + * @brief This function adds the parity settings to the termios options struct. + * + * @param options Pointer to termios options struct which will be modified to enable or disable + * parity checking. + * @param uartCookie Pointer to uart cookie containing the information about the desired + * parity settings. + * + */ + void setParityOptions(struct termios* options, UartCookie* uartCookie); + + void setStopBitOptions(struct termios* options, UartCookie* uartCookie); + + /** + * @brief This function sets options which are not configurable by the uartCookie. + */ + void setFixedOptions(struct termios* options); + + /** + * @brief With this function the datasize settings are added to the termios options struct. + */ + void setDatasizeOptions(struct termios* options, UartCookie* uartCookie); + + /** + * @brief This functions adds the baudrate specified in the uartCookie to the termios options + * struct. + */ + void configureBaudrate(struct termios* options, UartCookie* uartCookie); + + void setUartMode(struct termios* options, UartCookie& uartCookie); + + ReturnValue_t handleCanonicalRead(UartCookie& uartCookie, UartDeviceMapIter& iter, + size_t requestLen); + ReturnValue_t handleNoncanonicalRead(UartCookie& uartCookie, UartDeviceMapIter& iter, + size_t requestLen); + +}; + +#endif /* BSP_Q7S_COMIF_UARTCOMIF_H_ */ diff --git a/hal/inc/fsfw/linux/uart/UartCookie.h b/hal/inc/fsfw/linux/uart/UartCookie.h new file mode 100644 index 00000000..faf95d50 --- /dev/null +++ b/hal/inc/fsfw/linux/uart/UartCookie.h @@ -0,0 +1,121 @@ +#ifndef SAM9G20_COMIF_COOKIES_UART_COOKIE_H_ +#define SAM9G20_COMIF_COOKIES_UART_COOKIE_H_ + +#include +#include + +#include + +enum class Parity { + NONE, + EVEN, + ODD +}; + +enum class StopBits { + ONE_STOP_BIT, + TWO_STOP_BITS +}; + +enum class UartModes { + CANONICAL, + NON_CANONICAL +}; + +/** + * @brief Cookie for the UartComIF. There are many options available to configure the UART driver. + * The constructor only requests for common options like the baudrate. Other options can + * be set by member functions. + * + * @author J. Meier + */ +class UartCookie: public CookieIF { +public: + + /** + * @brief Constructor for the uart cookie. + * @param deviceFile The device file specifying the uart to use, e.g. "/dev/ttyPS1" + * @param uartMode Specify the UART mode. The canonical mode should be used if the + * messages are separated by a delimited character like '\n'. See the + * termios documentation for more information + * @param baudrate The baudrate to use for input and output. Possible Baudrates are: 50, + * 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800, 9600, B19200, + * 38400, 57600, 115200, 230400, 460800 + * @param maxReplyLen The maximum size an object using this cookie expects + * @details + * Default configuration: No parity + * 8 databits (number of bits transfered with one uart frame) + * One stop bit + */ + UartCookie(object_id_t handlerId, std::string deviceFile, UartModes uartMode, + uint32_t baudrate, size_t maxReplyLen); + + virtual ~UartCookie(); + + uint32_t getBaudrate() const; + size_t getMaxReplyLen() const; + std::string getDeviceFile() const; + Parity getParity() const; + uint8_t getBitsPerWord() const; + StopBits getStopBits() const; + UartModes getUartMode() const; + object_id_t getHandlerId() const; + + /** + * The UART ComIF will only perform a specified number of read cycles for the canonical mode. + * The user can specify how many of those read cycles are performed for one device handler + * communication cycle. An example use-case would be to read all available GPS NMEA strings + * at once. + * @param readCycles + */ + void setReadCycles(uint8_t readCycles); + uint8_t getReadCycles() const; + + /** + * Allows to flush the data which was received but has not been read yet. This is useful + * to discard obsolete data at software startup. + */ + void setToFlushInput(bool enable); + bool getInputShouldBeFlushed(); + + /** + * Functions two enable parity checking. + */ + void setParityOdd(); + void setParityEven(); + + /** + * Function two set number of bits per UART frame. + */ + void setBitsPerWord(uint8_t bitsPerWord_); + + /** + * Function to specify the number of stopbits. + */ + void setTwoStopBits(); + void setOneStopBit(); + + /** + * Calling this function prevents the UartComIF to return failed if not all requested bytes + * could be read. This is required by a device handler when the size of a reply is not known. + */ + void setNoFixedSizeReply(); + + bool isReplySizeFixed(); + +private: + + const object_id_t handlerId; + std::string deviceFile; + const UartModes uartMode; + bool flushInput = false; + uint32_t baudrate; + size_t maxReplyLen = 0; + Parity parity = Parity::NONE; + uint8_t bitsPerWord = 8; + uint8_t readCycles = 1; + StopBits stopBits = StopBits::ONE_STOP_BIT; + bool replySizeFixed = true; +}; + +#endif diff --git a/hal/inc/fsfw/linux/utility.h b/hal/inc/fsfw/linux/utility.h new file mode 100644 index 00000000..0353b1d0 --- /dev/null +++ b/hal/inc/fsfw/linux/utility.h @@ -0,0 +1,10 @@ +#ifndef LINUX_UTILITY_UTILITY_H_ +#define LINUX_UTILITY_UTILITY_H_ + +namespace utility { + +void handleIoctlError(const char* const customPrintout); + +} + +#endif /* LINUX_UTILITY_UTILITY_H_ */ diff --git a/hal/inc/fsfw/stm32h7/devicetest/GyroL3GD20H.h b/hal/inc/fsfw/stm32h7/devicetest/GyroL3GD20H.h new file mode 100644 index 00000000..b65654de --- /dev/null +++ b/hal/inc/fsfw/stm32h7/devicetest/GyroL3GD20H.h @@ -0,0 +1,70 @@ +#ifndef FSFW_HAL_STM32H7_DEVICETEST_GYRO_L3GD20H_H_ +#define FSFW_HAL_STM32H7_DEVICETEST_GYRO_L3GD20H_H_ + +#include "stm32h7xx_hal.h" +#include "stm32h7xx_hal_spi.h" +#include "../spi/mspInit.h" +#include "../spi/spiDefinitions.h" + +#include "fsfw/returnvalues/HasReturnvaluesIF.h" + +#include +#include + +enum class TransferStates { + IDLE, + WAIT, + SUCCESS, + FAILURE +}; + +class GyroL3GD20H { +public: + GyroL3GD20H(SPI_HandleTypeDef* spiHandle, spi::TransferModes transferMode); + ~GyroL3GD20H(); + + ReturnValue_t initialize(); + ReturnValue_t performOperation(); + +private: + + const uint8_t WHO_AM_I_REG = 0b00001111; + const uint8_t STM_READ_MASK = 0b10000000; + const uint8_t STM_AUTO_INCREMENT_MASK = 0b01000000; + const uint8_t EXPECTED_WHO_AM_I_VAL = 0b11010111; + const uint8_t CTRL_REG_1 = 0b00100000; + const uint32_t L3G_RANGE = 245; + + SPI_HandleTypeDef* spiHandle; + + static spi::TransferModes transferMode; + static constexpr size_t recvBufferSize = 32 * 10; + static std::array rxBuffer; + static constexpr size_t txBufferSize = 32; + static std::array txBuffer; + + ReturnValue_t handleDmaTransferInit(); + ReturnValue_t handlePollingTransferInit(); + ReturnValue_t handleInterruptTransferInit(); + + ReturnValue_t handleDmaSensorRead(); + HAL_StatusTypeDef performDmaTransfer(size_t sendSize); + ReturnValue_t handlePollingSensorRead(); + ReturnValue_t handleInterruptSensorRead(); + + uint8_t readRegPolling(uint8_t reg); + + static void spiTransferCompleteCallback(SPI_HandleTypeDef *hspi, void* args); + static void spiTransferErrorCallback(SPI_HandleTypeDef *hspi, void* args); + + + void prepareConfigRegs(uint8_t* configRegs); + void handleSensorReadout(); + + + DMA_HandleTypeDef* txDmaHandle = {}; + DMA_HandleTypeDef* rxDmaHandle = {}; + spi::MspCfgBase* mspCfg = {}; +}; + +#endif /* FSFW_HAL_STM32H7_DEVICETEST_GYRO_L3GD20H_H_ */ diff --git a/hal/inc/fsfw/stm32h7/dma.h b/hal/inc/fsfw/stm32h7/dma.h new file mode 100644 index 00000000..779a64cb --- /dev/null +++ b/hal/inc/fsfw/stm32h7/dma.h @@ -0,0 +1,49 @@ +#ifndef FSFW_HAL_STM32H7_DMA_H_ +#define FSFW_HAL_STM32H7_DMA_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "interrupts.h" +#include + +namespace dma { + +enum DMAType { + TX = 0, + RX = 1 +}; + +enum DMAIndexes: uint8_t { + DMA_1 = 1, + DMA_2 = 2 +}; + +enum DMAStreams { + STREAM_0 = 0, + STREAM_1 = 1, + STREAM_2 = 2, + STREAM_3 = 3, + STREAM_4 = 4, + STREAM_5 = 5, + STREAM_6 = 6, + STREAM_7 = 7, +} ; + +/** + * Assign user interrupt handlers for DMA streams, allowing to pass an + * arbitrary argument as well. Generally, this argument will be the related DMA handle. + * @param user_handler + * @param user_args + */ +void assignDmaUserHandler(DMAIndexes dma_idx, DMAStreams stream_idx, + user_handler_t user_handler, user_args_t user_args); + +} + +#ifdef __cplusplus +} +#endif + +#endif /* FSFW_HAL_STM32H7_DMA_H_ */ diff --git a/hal/inc/fsfw/stm32h7/gpio/gpio.h b/hal/inc/fsfw/stm32h7/gpio/gpio.h new file mode 100644 index 00000000..adb60de6 --- /dev/null +++ b/hal/inc/fsfw/stm32h7/gpio/gpio.h @@ -0,0 +1,14 @@ +#ifndef FSFW_HAL_STM32H7_GPIO_GPIO_H_ +#define FSFW_HAL_STM32H7_GPIO_GPIO_H_ + +#include "stm32h7xx.h" + +namespace gpio { + +void initializeGpioClock(GPIO_TypeDef* gpioPort); + +} + + + +#endif /* FSFW_HAL_STM32H7_GPIO_GPIO_H_ */ diff --git a/hal/inc/fsfw/stm32h7/interrupts.h b/hal/inc/fsfw/stm32h7/interrupts.h new file mode 100644 index 00000000..aef60bf7 --- /dev/null +++ b/hal/inc/fsfw/stm32h7/interrupts.h @@ -0,0 +1,28 @@ +#ifndef FSFW_HAL_STM32H7_INTERRUPTS_H_ +#define FSFW_HAL_STM32H7_INTERRUPTS_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Default handler which is defined in startup file as assembly code. + */ +extern void Default_Handler(); + +typedef void (*user_handler_t) (void*); +typedef void* user_args_t; + +enum IrqPriorities: uint8_t { + HIGHEST = 0, + HIGHEST_FREERTOS = 6, + LOWEST = 15 +}; + +#ifdef __cplusplus +} +#endif + +#endif /* FSFW_HAL_STM32H7_INTERRUPTS_H_ */ diff --git a/hal/inc/fsfw/stm32h7/spi/SpiComIF.h b/hal/inc/fsfw/stm32h7/spi/SpiComIF.h new file mode 100644 index 00000000..4b1ef801 --- /dev/null +++ b/hal/inc/fsfw/stm32h7/spi/SpiComIF.h @@ -0,0 +1,130 @@ +#ifndef FSFW_HAL_STM32H7_SPI_SPICOMIF_H_ +#define FSFW_HAL_STM32H7_SPI_SPICOMIF_H_ + +#include "fsfw/tasks/SemaphoreIF.h" +#include "fsfw/devicehandlers/DeviceCommunicationIF.h" +#include "fsfw/objectmanager/SystemObject.h" + +#include "fsfw/osal/FreeRTOS/BinarySemaphore.h" +#include "fsfw_hal/stm32h7/spi/spiDefinitions.h" +#include "stm32h7xx_hal_spi.h" +#include "stm32h743xx.h" + +#include +#include + +class SpiCookie; + +/** + * @brief This communication interface allows using generic device handlers with using + * the STM32H7 SPI peripherals + * @details + * This communication interface supports all three major communcation modes: + * - Polling: Simple, but not recommended to real use-cases, blocks the CPU + * - Interrupt: Good for small data only arriving occasionally + * - DMA: Good for large data which also occur regularly. Please note that the number + * of DMA channels in limited + * The device specific information is usually kept in the SpiCookie class. The current + * implementation limits the transfer mode for a given SPI bus. + * @author R. Mueller + */ +class SpiComIF: + public SystemObject, + public DeviceCommunicationIF { +public: + /** + * Create a SPI communication interface for the given SPI peripheral (spiInstance) + * @param objectId + * @param spiInstance + * @param spiHandle + * @param transferMode + */ + SpiComIF(object_id_t objectId); + + /** + * Allows the user to disable cache maintenance on the TX buffer. This can be done if the + * TX buffers are places and MPU protected properly like specified in this link: + * https://community.st.com/s/article/FAQ-DMA-is-not-working-on-STM32H7-devices + * The cache maintenace is enabled by default. + * @param enable + */ + void configureCacheMaintenanceOnTxBuffer(bool enable); + + void setDefaultPollingTimeout(dur_millis_t timeout); + + /** + * Add the DMA handles. These need to be set in the DMA transfer mode is used. + * @param txHandle + * @param rxHandle + */ + void addDmaHandles(DMA_HandleTypeDef* txHandle, DMA_HandleTypeDef* rxHandle); + + ReturnValue_t initialize() override; +protected: + + // DeviceCommunicationIF overrides + virtual ReturnValue_t initializeInterface(CookieIF * cookie) override; + virtual ReturnValue_t sendMessage(CookieIF *cookie, + const uint8_t * sendData, size_t sendLen) override; + virtual ReturnValue_t getSendSuccess(CookieIF *cookie) override; + virtual ReturnValue_t requestReceiveMessage(CookieIF *cookie, + size_t requestLen) override; + virtual ReturnValue_t readReceivedMessage(CookieIF *cookie, + uint8_t **buffer, size_t *size) override; + +private: + + struct SpiInstance { + SpiInstance(size_t maxRecvSize): replyBuffer(std::vector(maxRecvSize)) {} + std::vector replyBuffer; + size_t currentTransferLen = 0; + }; + + struct IrqArgs { + SpiComIF* comIF = nullptr; + SpiCookie* spiCookie = nullptr; + }; + + IrqArgs irqArgs; + + uint32_t defaultPollingTimeout = 50; + + SemaphoreIF::TimeoutType timeoutType = SemaphoreIF::TimeoutType::WAITING; + dur_millis_t timeoutMs = 20; + + BinarySemaphore* spiSemaphore = nullptr; + bool cacheMaintenanceOnTxBuffer = true; + + using SpiDeviceMap = std::map; + using SpiDeviceMapIter = SpiDeviceMap::iterator; + + uint8_t* currentRecvPtr = nullptr; + size_t currentRecvBuffSize = 0; + + SpiDeviceMap spiDeviceMap; + + ReturnValue_t handlePollingSendOperation(uint8_t* recvPtr, SPI_HandleTypeDef& spiHandle, + SpiCookie& spiCookie, const uint8_t * sendData, size_t sendLen); + ReturnValue_t handleInterruptSendOperation(uint8_t* recvPtr, SPI_HandleTypeDef& spiHandle, + SpiCookie& spiCookie, const uint8_t * sendData, size_t sendLen); + ReturnValue_t handleDmaSendOperation(uint8_t* recvPtr, SPI_HandleTypeDef& spiHandle, + SpiCookie& spiCookie, const uint8_t * sendData, size_t sendLen); + ReturnValue_t handleIrqSendOperation(uint8_t* recvPtr, SPI_HandleTypeDef& spiHandle, + SpiCookie& spiCookie, const uint8_t * sendData, size_t sendLen); + ReturnValue_t genericIrqSendSetup(uint8_t* recvPtr, SPI_HandleTypeDef& spiHandle, + SpiCookie& spiCookie, const uint8_t * sendData, size_t sendLen); + ReturnValue_t halErrorHandler(HAL_StatusTypeDef status, spi::TransferModes transferMode); + + static void spiTransferTxCompleteCallback(SPI_HandleTypeDef *hspi, void* args); + static void spiTransferRxCompleteCallback(SPI_HandleTypeDef *hspi, void* args); + static void spiTransferCompleteCallback(SPI_HandleTypeDef *hspi, void* args); + static void spiTransferErrorCallback(SPI_HandleTypeDef *hspi, void* args); + + static void genericIrqHandler(void* irqArgs, spi::TransferStates targetState); + + void printCfgError(const char* const type); +}; + + + +#endif /* FSFW_HAL_STM32H7_SPI_SPICOMIF_H_ */ diff --git a/hal/inc/fsfw/stm32h7/spi/SpiCookie.h b/hal/inc/fsfw/stm32h7/spi/SpiCookie.h new file mode 100644 index 00000000..45226b4a --- /dev/null +++ b/hal/inc/fsfw/stm32h7/spi/SpiCookie.h @@ -0,0 +1,75 @@ +#ifndef FSFW_HAL_STM32H7_SPI_SPICOOKIE_H_ +#define FSFW_HAL_STM32H7_SPI_SPICOOKIE_H_ + +#include "spiDefinitions.h" +#include "mspInit.h" + +#include "fsfw/devicehandlers/CookieIF.h" + +#include "stm32h743xx.h" + +/** + * @brief SPI cookie implementation for the STM32H7 device family + * @details + * This cookie contains and caches device specific information to be used by the + * SPI communication interface + * @author R. Mueller + */ +class SpiCookie: public CookieIF { + friend class SpiComIF; +public: + /** + * Allows construction of a SPI cookie for a connected SPI device + * @param deviceAddress + * @param spiIdx SPI bus, e.g. SPI1 or SPI2 + * @param transferMode + * @param mspCfg This is the MSP configuration. The user is expected to supply + * a valid MSP configuration. See mspInit.h for functions + * to create one. + * @param spiSpeed + * @param spiMode + * @param chipSelectGpioPin GPIO port. Don't use a number here, use the 16 bit type + * definitions supplied in the MCU header file! (e.g. GPIO_PIN_X) + * @param chipSelectGpioPort GPIO port (e.g. GPIOA) + * @param maxRecvSize Maximum expected receive size. Chose as small as possible. + */ + SpiCookie(address_t deviceAddress, spi::SpiBus spiIdx, spi::TransferModes transferMode, + spi::MspCfgBase* mspCfg, uint32_t spiSpeed, spi::SpiModes spiMode, + uint16_t chipSelectGpioPin, GPIO_TypeDef* chipSelectGpioPort, size_t maxRecvSize); + + uint16_t getChipSelectGpioPin() const; + GPIO_TypeDef* getChipSelectGpioPort(); + address_t getDeviceAddress() const; + spi::SpiBus getSpiIdx() const; + spi::SpiModes getSpiMode() const; + spi::TransferModes getTransferMode() const; + uint32_t getSpiSpeed() const; + size_t getMaxRecvSize() const; + SPI_HandleTypeDef& getSpiHandle(); + +private: + address_t deviceAddress; + SPI_HandleTypeDef spiHandle = {}; + spi::SpiBus spiIdx; + uint32_t spiSpeed; + spi::SpiModes spiMode; + spi::TransferModes transferMode; + volatile spi::TransferStates transferState = spi::TransferStates::IDLE; + uint16_t chipSelectGpioPin; + GPIO_TypeDef* chipSelectGpioPort; + // The MSP configuration is cached here. Be careful when using this, it is automatically + // deleted by the SPI communication interface if it is not required anymore! + spi::MspCfgBase* mspCfg = nullptr; + const size_t maxRecvSize; + + // Only the SpiComIF is allowed to use this to prevent dangling pointers issues + spi::MspCfgBase* getMspCfg(); + void deleteMspCfg(); + + void setTransferState(spi::TransferStates transferState); + spi::TransferStates getTransferState() const; +}; + + + +#endif /* FSFW_HAL_STM32H7_SPI_SPICOOKIE_H_ */ diff --git a/hal/inc/fsfw/stm32h7/spi/mspInit.h b/hal/inc/fsfw/stm32h7/spi/mspInit.h new file mode 100644 index 00000000..e6de2f8e --- /dev/null +++ b/hal/inc/fsfw/stm32h7/spi/mspInit.h @@ -0,0 +1,114 @@ +#ifndef FSFW_HAL_STM32H7_SPI_MSPINIT_H_ +#define FSFW_HAL_STM32H7_SPI_MSPINIT_H_ + +#include "spiDefinitions.h" +#include "../dma.h" + +#include "stm32h7xx_hal_spi.h" + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief This file provides MSP implementation for DMA, IRQ and Polling mode for the + * SPI peripheral. This configuration is required for the SPI communication to work. + */ +namespace spi { + +struct MspCfgBase { + virtual ~MspCfgBase() = default; + + void (* cleanUpMacroWrapper) (void) = nullptr; + void (* setupMacroWrapper) (void) = nullptr; + + GPIO_TypeDef* sckPort = nullptr; + uint32_t sckPin = 0; + uint8_t sckAlternateFunction = 0; + GPIO_TypeDef* mosiPort = nullptr; + uint32_t mosiPin = 0; + uint8_t mosiAlternateFunction = 0; + GPIO_TypeDef* misoPort = nullptr; + uint32_t misoPin = 0; + uint8_t misoAlternateFunction = 0; +}; + +struct MspPollingConfigStruct: public MspCfgBase {}; + +/* A valid instance of this struct must be passed to the MSP initialization function as a void* +argument */ +struct MspIrqConfigStruct: public MspPollingConfigStruct { + SpiBus spiBus = SpiBus::SPI_1; + user_handler_t spiIrqHandler = nullptr; + user_args_t spiUserArgs = nullptr; + IRQn_Type spiIrqNumber = SPI1_IRQn; + // Priorities for NVIC + // Pre-Empt priority ranging from 0 to 15. If FreeRTOS calls are used, only 5-15 are allowed + IrqPriorities preEmptPriority = IrqPriorities::LOWEST; + IrqPriorities subpriority = IrqPriorities::LOWEST; +}; + +/* A valid instance of this struct must be passed to the MSP initialization function as a void* +argument */ +struct MspDmaConfigStruct: public MspIrqConfigStruct { + void (* dmaClkEnableWrapper) (void) = nullptr; + dma::DMAIndexes txDmaIndex; + dma::DMAIndexes rxDmaIndex; + dma::DMAStreams txDmaStream; + dma::DMAStreams rxDmaStream; + IRQn_Type txDmaIrqNumber = DMA1_Stream0_IRQn; + IRQn_Type rxDmaIrqNumber = DMA1_Stream1_IRQn; + // Priorities for NVIC + IrqPriorities txPreEmptPriority = IrqPriorities::LOWEST; + IrqPriorities rxPreEmptPriority = IrqPriorities::LOWEST; + IrqPriorities txSubpriority = IrqPriorities::LOWEST; + IrqPriorities rxSubpriority = IrqPriorities::LOWEST; +}; + +using msp_func_t = void (*) (SPI_HandleTypeDef* hspi, MspCfgBase* cfg); + + +void getMspInitFunction(msp_func_t* init_func, MspCfgBase **args); +void getMspDeinitFunction(msp_func_t* deinit_func, MspCfgBase **args); + +void halMspInitDma(SPI_HandleTypeDef* hspi, MspCfgBase* cfg); +void halMspDeinitDma(SPI_HandleTypeDef* hspi, MspCfgBase* cfg); + +void halMspInitInterrupt(SPI_HandleTypeDef* hspi, MspCfgBase* cfg); +void halMspDeinitInterrupt(SPI_HandleTypeDef* hspi, MspCfgBase* cfg); + +void halMspInitPolling(SPI_HandleTypeDef* hspi, MspCfgBase* cfg); +void halMspDeinitPolling(SPI_HandleTypeDef* hspi, MspCfgBase* cfg); + +/** + * Assign MSP init functions. Important for SPI configuration + * @param init_func + * @param init_args + * @param deinit_func + * @param deinit_args + */ +void setSpiDmaMspFunctions(MspDmaConfigStruct* cfg, + msp_func_t initFunc = &spi::halMspInitDma, + msp_func_t deinitFunc= &spi::halMspDeinitDma +); +void setSpiIrqMspFunctions(MspIrqConfigStruct* cfg, + msp_func_t initFunc = &spi::halMspInitInterrupt, + msp_func_t deinitFunc= &spi::halMspDeinitInterrupt +); +void setSpiPollingMspFunctions(MspPollingConfigStruct* cfg, + msp_func_t initFunc = &spi::halMspInitPolling, + msp_func_t deinitFunc= &spi::halMspDeinitPolling +); + +void mspErrorHandler(const char* const function, const char *const message); + +} + + +#ifdef __cplusplus +} +#endif + +#endif /* FSFW_HAL_STM32H7_SPI_MSPINIT_H_ */ diff --git a/hal/inc/fsfw/stm32h7/spi/spiCore.h b/hal/inc/fsfw/stm32h7/spi/spiCore.h new file mode 100644 index 00000000..7a9a0e18 --- /dev/null +++ b/hal/inc/fsfw/stm32h7/spi/spiCore.h @@ -0,0 +1,53 @@ +#ifndef FSFW_HAL_STM32H7_SPI_SPICORE_H_ +#define FSFW_HAL_STM32H7_SPI_SPICORE_H_ + +#include +#include "stm32h7xx_hal.h" +#include "stm32h7xx_hal_dma.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +using spi_transfer_cb_t = void (*) (SPI_HandleTypeDef *hspi, void* userArgs); + +namespace spi { + +void configureDmaHandle(DMA_HandleTypeDef* handle, spi::SpiBus spiBus, + dma::DMAType dmaType, dma::DMAIndexes dmaIdx, + dma::DMAStreams dmaStream, IRQn_Type* dmaIrqNumber, uint32_t dmaMode = DMA_NORMAL, + uint32_t dmaPriority = DMA_PRIORITY_LOW); + +/** + * Assign DMA handles. Required to use DMA for SPI transfers. + * @param txHandle + * @param rxHandle + */ +void setDmaHandles(DMA_HandleTypeDef* txHandle, DMA_HandleTypeDef* rxHandle); +void getDmaHandles(DMA_HandleTypeDef** txHandle, DMA_HandleTypeDef** rxHandle); + +/** + * Assign SPI handle. Needs to be done before using the SPI + * @param spiHandle + */ +void setSpiHandle(SPI_HandleTypeDef *spiHandle); + +void assignTransferRxTxCompleteCallback(spi_transfer_cb_t callback, void* userArgs); +void assignTransferRxCompleteCallback(spi_transfer_cb_t callback, void* userArgs); +void assignTransferTxCompleteCallback(spi_transfer_cb_t callback, void* userArgs); +void assignTransferErrorCallback(spi_transfer_cb_t callback, void* userArgs); + +/** + * Get the assigned SPI handle. + * @return + */ +SPI_HandleTypeDef* getSpiHandle(); + +} + +#ifdef __cplusplus +} +#endif + +#endif /* FSFW_HAL_STM32H7_SPI_SPICORE_H_ */ diff --git a/hal/inc/fsfw/stm32h7/spi/spiDefinitions.h b/hal/inc/fsfw/stm32h7/spi/spiDefinitions.h new file mode 100644 index 00000000..772bf32d --- /dev/null +++ b/hal/inc/fsfw/stm32h7/spi/spiDefinitions.h @@ -0,0 +1,50 @@ +#ifndef FSFW_HAL_STM32H7_SPI_SPIDEFINITIONS_H_ +#define FSFW_HAL_STM32H7_SPI_SPIDEFINITIONS_H_ + +#include "../../common/spi/spiCommon.h" + +#include "fsfw/returnvalues/FwClassIds.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" + +#include "stm32h7xx_hal.h" +#include "stm32h7xx_hal_spi.h" + +namespace spi { + +static constexpr uint8_t HAL_SPI_ID = CLASS_ID::HAL_SPI; +static constexpr ReturnValue_t HAL_TIMEOUT_RETVAL = HasReturnvaluesIF::makeReturnCode(HAL_SPI_ID, 0); +static constexpr ReturnValue_t HAL_BUSY_RETVAL = HasReturnvaluesIF::makeReturnCode(HAL_SPI_ID, 1); +static constexpr ReturnValue_t HAL_ERROR_RETVAL = HasReturnvaluesIF::makeReturnCode(HAL_SPI_ID, 2); + +enum class TransferStates { + IDLE, + WAIT, + SUCCESS, + FAILURE +}; + +enum SpiBus { + SPI_1, + SPI_2 +}; + +enum TransferModes { + POLLING, + INTERRUPT, + DMA +}; + +void assignSpiMode(SpiModes spiMode, SPI_HandleTypeDef& spiHandle); + +/** + * @brief Set SPI frequency to calculate correspondent baud-rate prescaler. + * @param clock_src_freq Frequency of clock source + * @param baudrate_mbps Baudrate to set to set + * @retval Baudrate prescaler + */ +uint32_t getPrescaler(uint32_t clock_src_freq, uint32_t baudrate_mbps); + +} + + +#endif /* FSFW_HAL_STM32H7_SPI_SPIDEFINITIONS_H_ */ diff --git a/hal/inc/fsfw/stm32h7/spi/spiInterrupts.h b/hal/inc/fsfw/stm32h7/spi/spiInterrupts.h new file mode 100644 index 00000000..0b53f48b --- /dev/null +++ b/hal/inc/fsfw/stm32h7/spi/spiInterrupts.h @@ -0,0 +1,41 @@ +#ifndef FSFW_HAL_STM32H7_SPI_INTERRUPTS_H_ +#define FSFW_HAL_STM32H7_SPI_INTERRUPTS_H_ + +#include "../interrupts.h" +#include "spiDefinitions.h" + +#ifdef __cplusplus +extern "C" { +#endif + +namespace spi { + +void assignSpiUserArgs(spi::SpiBus spiBus, user_args_t userArgs); + +/** + * Assign a user interrupt handler for SPI bus 1, allowing to pass an arbitrary argument as well. + * Generally, this argument will be the related SPI handle. + * @param user_handler + * @param user_args + */ +void assignSpiUserHandler(spi::SpiBus spiBus, user_handler_t user_handler, + user_args_t user_args); +void getSpiUserHandler(spi::SpiBus spiBus, user_handler_t* user_handler, + user_args_t* user_args); + +/** + * Generic interrupt handlers supplied for convenience. Do not call these directly! Set them + * instead with assign_dma_user_handler and assign_spi_user_handler functions. + * @param dma_handle + */ +void dmaRxIrqHandler(void* dma_handle); +void dmaTxIrqHandler(void* dma_handle); +void spiIrqHandler(void* spi_handle); + +} + +#ifdef __cplusplus +} +#endif + +#endif /* FSFW_HAL_STM32H7_SPI_INTERRUPTS_H_ */ diff --git a/hal/inc/fsfw/stm32h7/spi/stm32h743ziSpi.h b/hal/inc/fsfw/stm32h7/spi/stm32h743ziSpi.h new file mode 100644 index 00000000..87689add --- /dev/null +++ b/hal/inc/fsfw/stm32h7/spi/stm32h743ziSpi.h @@ -0,0 +1,23 @@ +#ifndef FSFW_HAL_STM32H7_SPI_STM32H743ZISPI_H_ +#define FSFW_HAL_STM32H7_SPI_STM32H743ZISPI_H_ + +#include "mspInit.h" + +namespace spi { + +namespace h743zi { + +void standardPollingCfg(MspPollingConfigStruct& cfg); +void standardInterruptCfg(MspIrqConfigStruct& cfg, IrqPriorities spiIrqPrio, + IrqPriorities spiSubprio = HIGHEST); +void standardDmaCfg(MspDmaConfigStruct& cfg, IrqPriorities spiIrqPrio, + IrqPriorities txIrqPrio, IrqPriorities rxIrqPrio, + IrqPriorities spiSubprio = HIGHEST, IrqPriorities txSubPrio = HIGHEST, + IrqPriorities rxSubprio = HIGHEST); + +} +} + + + +#endif /* FSFW_HAL_STM32H7_SPI_STM32H743ZISPI_H_ */ diff --git a/hal/src/common/gpio/CMakeLists.txt b/hal/src/common/gpio/CMakeLists.txt new file mode 100644 index 00000000..9dbcdf9d --- /dev/null +++ b/hal/src/common/gpio/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${LIB_FSFW_HAL_NAME} PRIVATE + GpioCookie.cpp +) \ No newline at end of file diff --git a/hal/src/common/gpio/GpioCookie.cpp b/hal/src/common/gpio/GpioCookie.cpp new file mode 100644 index 00000000..da765cea --- /dev/null +++ b/hal/src/common/gpio/GpioCookie.cpp @@ -0,0 +1,50 @@ +#include "GpioCookie.h" +#include "fsfw/serviceinterface/ServiceInterface.h" + +GpioCookie::GpioCookie() { +} + +ReturnValue_t GpioCookie::addGpio(gpioId_t gpioId, GpioBase* gpioConfig) { + if (gpioConfig == nullptr) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "GpioCookie::addGpio: gpioConfig is nullpointer" << std::endl; +#else + sif::printWarning("GpioCookie::addGpio: gpioConfig is nullpointer\n"); +#endif + return HasReturnvaluesIF::RETURN_FAILED; + } + auto gpioMapIter = gpioMap.find(gpioId); + if(gpioMapIter == gpioMap.end()) { + auto statusPair = gpioMap.emplace(gpioId, gpioConfig); + if (statusPair.second == false) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "GpioCookie::addGpio: Failed to add GPIO " << gpioId << + " to GPIO map" << std::endl; +#else + sif::printWarning("GpioCookie::addGpio: Failed to add GPIO %d to GPIO map\n", gpioId); +#endif +#endif + return HasReturnvaluesIF::RETURN_FAILED; + } + return HasReturnvaluesIF::RETURN_OK; + } +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "GpioCookie::addGpio: GPIO already exists in GPIO map " << std::endl; +#else + sif::printWarning("GpioCookie::addGpio: GPIO already exists in GPIO map\n"); +#endif +#endif + return HasReturnvaluesIF::RETURN_FAILED; +} + +GpioMap GpioCookie::getGpioMap() const { + return gpioMap; +} + +GpioCookie::~GpioCookie() { + for(auto& config: gpioMap) { + delete(config.second); + } +} diff --git a/hal/src/devicehandlers/CMakeLists.txt b/hal/src/devicehandlers/CMakeLists.txt new file mode 100644 index 00000000..1cde7e49 --- /dev/null +++ b/hal/src/devicehandlers/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${LIB_FSFW_HAL_NAME} PRIVATE + GyroL3GD20Handler.cpp +) diff --git a/hal/src/devicehandlers/GyroL3GD20Handler.cpp b/hal/src/devicehandlers/GyroL3GD20Handler.cpp new file mode 100644 index 00000000..79cbe435 --- /dev/null +++ b/hal/src/devicehandlers/GyroL3GD20Handler.cpp @@ -0,0 +1,262 @@ +#include "GyroL3GD20Handler.h" + +#include + +GyroHandlerL3GD20H::GyroHandlerL3GD20H(object_id_t objectId, object_id_t deviceCommunication, + CookieIF *comCookie): + DeviceHandlerBase(objectId, deviceCommunication, comCookie), + dataset(this) { +#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 + debugDivider = new PeriodicOperationDivider(5); +#endif +} + +GyroHandlerL3GD20H::~GyroHandlerL3GD20H() {} + +void GyroHandlerL3GD20H::doStartUp() { + if(internalState == InternalState::NONE) { + internalState = InternalState::CONFIGURE; + } + + if(internalState == InternalState::CONFIGURE) { + if(commandExecuted) { + internalState = InternalState::CHECK_REGS; + commandExecuted = false; + } + } + + if(internalState == InternalState::CHECK_REGS) { + if(commandExecuted) { + internalState = InternalState::NORMAL; + if(goNormalModeImmediately) { + setMode(MODE_NORMAL); + } + else { + setMode(_MODE_TO_ON); + } + commandExecuted = false; + } + } +} + +void GyroHandlerL3GD20H::doShutDown() { + setMode(_MODE_POWER_DOWN); +} + +ReturnValue_t GyroHandlerL3GD20H::buildTransitionDeviceCommand(DeviceCommandId_t *id) { + switch(internalState) { + case(InternalState::NONE): + case(InternalState::NORMAL): { + return HasReturnvaluesIF::RETURN_OK; + } + case(InternalState::CONFIGURE): { + *id = L3GD20H::CONFIGURE_CTRL_REGS; + uint8_t command [5]; + command[0] = L3GD20H::CTRL_REG_1_VAL; + command[1] = L3GD20H::CTRL_REG_2_VAL; + command[2] = L3GD20H::CTRL_REG_3_VAL; + command[3] = L3GD20H::CTRL_REG_4_VAL; + command[4] = L3GD20H::CTRL_REG_5_VAL; + return buildCommandFromCommand(*id, command, 5); + } + case(InternalState::CHECK_REGS): { + *id = L3GD20H::READ_REGS; + return buildCommandFromCommand(*id, nullptr, 0); + } + default: +#if FSFW_CPP_OSTREAM_ENABLED == 1 + /* Might be a configuration error. */ + sif::debug << "GyroHandler::buildTransitionDeviceCommand: Unknown internal state!" << + std::endl; +#else + sif::printDebug("GyroHandler::buildTransitionDeviceCommand: Unknown internal state!\n"); +#endif + return HasReturnvaluesIF::RETURN_OK; + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t GyroHandlerL3GD20H::buildNormalDeviceCommand(DeviceCommandId_t *id) { + *id = L3GD20H::READ_REGS; + return buildCommandFromCommand(*id, nullptr, 0); +} + +ReturnValue_t GyroHandlerL3GD20H::buildCommandFromCommand( + DeviceCommandId_t deviceCommand, const uint8_t *commandData, + size_t commandDataLen) { + switch(deviceCommand) { + case(L3GD20H::READ_REGS): { + commandBuffer[0] = L3GD20H::READ_START | L3GD20H::AUTO_INCREMENT_MASK | L3GD20H::READ_MASK; + std::memset(commandBuffer + 1, 0, L3GD20H::READ_LEN); + rawPacket = commandBuffer; + rawPacketLen = L3GD20H::READ_LEN + 1; + break; + } + case(L3GD20H::CONFIGURE_CTRL_REGS): { + commandBuffer[0] = L3GD20H::CTRL_REG_1 | L3GD20H::AUTO_INCREMENT_MASK; + if(commandData == nullptr or commandDataLen != 5) { + return DeviceHandlerIF::INVALID_COMMAND_PARAMETER; + } + + ctrlReg1Value = commandData[0]; + ctrlReg2Value = commandData[1]; + ctrlReg3Value = commandData[2]; + ctrlReg4Value = commandData[3]; + ctrlReg5Value = commandData[4]; + + bool fsH = ctrlReg4Value & L3GD20H::SET_FS_1; + bool fsL = ctrlReg4Value & L3GD20H::SET_FS_0; + + if(not fsH and not fsL) { + sensitivity = L3GD20H::SENSITIVITY_00; + } + else if(not fsH and fsL) { + sensitivity = L3GD20H::SENSITIVITY_01; + } + else { + sensitivity = L3GD20H::SENSITIVITY_11; + } + + commandBuffer[1] = ctrlReg1Value; + commandBuffer[2] = ctrlReg2Value; + commandBuffer[3] = ctrlReg3Value; + commandBuffer[4] = ctrlReg4Value; + commandBuffer[5] = ctrlReg5Value; + + rawPacket = commandBuffer; + rawPacketLen = 6; + break; + } + case(L3GD20H::READ_CTRL_REGS): { + commandBuffer[0] = L3GD20H::READ_START | L3GD20H::AUTO_INCREMENT_MASK | + L3GD20H::READ_MASK; + + std::memset(commandBuffer + 1, 0, 5); + rawPacket = commandBuffer; + rawPacketLen = 6; + break; + } + default: + return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t GyroHandlerL3GD20H::scanForReply(const uint8_t *start, size_t len, + DeviceCommandId_t *foundId, size_t *foundLen) { + /* For SPI, the ID will always be the one of the last sent command. */ + *foundId = this->getPendingCommand(); + *foundLen = this->rawPacketLen; + + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t GyroHandlerL3GD20H::interpretDeviceReply(DeviceCommandId_t id, + const uint8_t *packet) { + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + switch(id) { + case(L3GD20H::CONFIGURE_CTRL_REGS): { + commandExecuted = true; + break; + } + case(L3GD20H::READ_CTRL_REGS): { + if(packet[1] == ctrlReg1Value and packet[2] == ctrlReg2Value and + packet[3] == ctrlReg3Value and packet[4] == ctrlReg4Value and + packet[5] == ctrlReg5Value) { + commandExecuted = true; + } + else { + /* Attempt reconfiguration. */ + internalState = InternalState::CONFIGURE; + return DeviceHandlerIF::DEVICE_REPLY_INVALID; + } + break; + } + case(L3GD20H::READ_REGS): { + if(packet[1] != ctrlReg1Value and packet[2] != ctrlReg2Value and + packet[3] != ctrlReg3Value and packet[4] != ctrlReg4Value and + packet[5] != ctrlReg5Value) { + return DeviceHandlerIF::DEVICE_REPLY_INVALID; + } + else { + if(internalState == InternalState::CHECK_REGS) { + commandExecuted = true; + } + } + + statusReg = packet[L3GD20H::STATUS_IDX]; + + int16_t angVelocXRaw = packet[L3GD20H::OUT_X_H] << 8 | packet[L3GD20H::OUT_X_L]; + int16_t angVelocYRaw = packet[L3GD20H::OUT_Y_H] << 8 | packet[L3GD20H::OUT_Y_L]; + int16_t angVelocZRaw = packet[L3GD20H::OUT_Z_H] << 8 | packet[L3GD20H::OUT_Z_L]; + float angVelocX = angVelocXRaw * sensitivity; + float angVelocY = angVelocYRaw * sensitivity; + float angVelocZ = angVelocZRaw * sensitivity; + + int8_t temperaturOffset = (-1) * packet[L3GD20H::TEMPERATURE_IDX]; + float temperature = 25.0 + temperaturOffset; +#if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 + if(debugDivider->checkAndIncrement()) { + /* Set terminal to utf-8 if there is an issue with micro printout. */ +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "GyroHandlerL3GD20H: Angular velocities in degrees per second:" << + std::endl; + sif::info << "X: " << angVelocX << " \xC2\xB0" << std::endl; + sif::info << "Y: " << angVelocY << " \xC2\xB0" << std::endl; + sif::info << "Z: " << angVelocZ << " \xC2\xB0" << std::endl; +#else + sif::printInfo("GyroHandlerL3GD20H: Angular velocities in degrees per second:\n"); + sif::printInfo("X: %f\n", angVelocX); + sif::printInfo("Y: %f\n", angVelocY); + sif::printInfo("Z: %f\n", angVelocZ); +#endif + } +#endif + + PoolReadGuard readSet(&dataset); + if(readSet.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + dataset.angVelocX = angVelocX; + dataset.angVelocY = angVelocY; + dataset.angVelocZ = angVelocZ; + dataset.temperature = temperature; + dataset.setValidity(true, true); + } + break; + } + default: + return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; + } + return result; +} + + +uint32_t GyroHandlerL3GD20H::getTransitionDelayMs(Mode_t from, Mode_t to) { + return 10000; +} + +void GyroHandlerL3GD20H::setGoNormalModeAtStartup() { + this->goNormalModeImmediately = true; +} + +ReturnValue_t GyroHandlerL3GD20H::initializeLocalDataPool( + localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { + localDataPoolMap.emplace(L3GD20H::ANG_VELOC_X, + new PoolEntry({0.0})); + localDataPoolMap.emplace(L3GD20H::ANG_VELOC_Y, + new PoolEntry({0.0})); + localDataPoolMap.emplace(L3GD20H::ANG_VELOC_Z, + new PoolEntry({0.0})); + localDataPoolMap.emplace(L3GD20H::TEMPERATURE, + new PoolEntry({0.0})); + return HasReturnvaluesIF::RETURN_OK; +} + +void GyroHandlerL3GD20H::fillCommandAndReplyMap() { + insertInCommandAndReplyMap(L3GD20H::READ_REGS, 1, &dataset); + insertInCommandAndReplyMap(L3GD20H::CONFIGURE_CTRL_REGS, 1); + insertInCommandAndReplyMap(L3GD20H::READ_CTRL_REGS, 1); +} + +void GyroHandlerL3GD20H::modeChanged() { + internalState = InternalState::NONE; +} diff --git a/hal/src/host/CMakeLists.txt b/hal/src/host/CMakeLists.txt new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/hal/src/host/CMakeLists.txt @@ -0,0 +1 @@ + diff --git a/hal/src/linux/CMakeLists.txt b/hal/src/linux/CMakeLists.txt new file mode 100644 index 00000000..6c2ec77e --- /dev/null +++ b/hal/src/linux/CMakeLists.txt @@ -0,0 +1,13 @@ +if(FSFW_HAL_ADD_RASPBERRY_PI) + add_subdirectory(rpi) +endif() + +target_sources(${LIB_FSFW_HAL_NAME} PRIVATE + UnixFileGuard.cpp + utility.cpp +) + +add_subdirectory(gpio) +add_subdirectory(spi) +add_subdirectory(i2c) +add_subdirectory(uart) \ No newline at end of file diff --git a/hal/src/linux/UnixFileGuard.cpp b/hal/src/linux/UnixFileGuard.cpp new file mode 100644 index 00000000..3aec58d8 --- /dev/null +++ b/hal/src/linux/UnixFileGuard.cpp @@ -0,0 +1,33 @@ +#include "UnixFileGuard.h" + +UnixFileGuard::UnixFileGuard(std::string device, int* fileDescriptor, int flags, + std::string diagnosticPrefix): + fileDescriptor(fileDescriptor) { + if(fileDescriptor == nullptr) { + return; + } + *fileDescriptor = open(device.c_str(), flags); + if (*fileDescriptor < 0) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << diagnosticPrefix <<"Opening device failed with error code " << errno << + "." << std::endl; + sif::warning << "Error description: " << strerror(errno) << std::endl; +#else + sif::printError("%sOpening device failed with error code %d.\n", diagnosticPrefix); + sif::printWarning("Error description: %s\n", strerror(errno)); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + openStatus = OPEN_FILE_FAILED; + } +} + +UnixFileGuard::~UnixFileGuard() { + if(fileDescriptor != nullptr) { + close(*fileDescriptor); + } +} + +ReturnValue_t UnixFileGuard::getOpenResult() const { + return openStatus; +} diff --git a/hal/src/linux/gpio/CMakeLists.txt b/hal/src/linux/gpio/CMakeLists.txt new file mode 100644 index 00000000..b2041b40 --- /dev/null +++ b/hal/src/linux/gpio/CMakeLists.txt @@ -0,0 +1,12 @@ +target_sources(${LIB_FSFW_HAL_NAME} PRIVATE + LinuxLibgpioIF.cpp +) + +# This abstraction layer requires the gpiod library. You can install this library +# with "sudo apt-get install -y libgpiod-dev". If you are cross-compiling, you need +# to install the package before syncing the sysroot to your host computer. +find_library(LIB_GPIO gpiod REQUIRED) + +target_link_libraries(${LIB_FSFW_HAL_NAME} PRIVATE + ${LIB_GPIO} +) \ No newline at end of file diff --git a/hal/src/linux/gpio/LinuxLibgpioIF.cpp b/hal/src/linux/gpio/LinuxLibgpioIF.cpp new file mode 100644 index 00000000..cfdac2bf --- /dev/null +++ b/hal/src/linux/gpio/LinuxLibgpioIF.cpp @@ -0,0 +1,305 @@ +#include "LinuxLibgpioIF.h" +#include +#include + +#include + +#include +#include +#include + +LinuxLibgpioIF::LinuxLibgpioIF(object_id_t objectId) : SystemObject(objectId) { +} + +LinuxLibgpioIF::~LinuxLibgpioIF() { + for(auto& config: gpioMap) { + delete(config.second); + } +} + +ReturnValue_t LinuxLibgpioIF::addGpios(GpioCookie* gpioCookie) { + ReturnValue_t result; + if(gpioCookie == nullptr) { + sif::error << "LinuxLibgpioIF::initialize: Invalid cookie" << std::endl; + return RETURN_FAILED; + } + + GpioMap mapToAdd = gpioCookie->getGpioMap(); + + /* Check whether this ID already exists in the map and remove duplicates */ + result = checkForConflicts(mapToAdd); + if (result != RETURN_OK){ + return result; + } + + result = configureGpios(mapToAdd); + if (result != RETURN_OK) { + return RETURN_FAILED; + } + + /* Register new GPIOs in gpioMap */ + gpioMap.insert(mapToAdd.begin(), mapToAdd.end()); + + return RETURN_OK; +} + +ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap& mapToAdd) { + for(auto& gpioConfig: mapToAdd) { + switch(gpioConfig.second->gpioType) { + case(gpio::GpioTypes::NONE): { + return GPIO_INVALID_INSTANCE; + } + case(gpio::GpioTypes::GPIO_REGULAR): { + GpiodRegular* regularGpio = dynamic_cast(gpioConfig.second); + if(regularGpio == nullptr) { + return GPIO_INVALID_INSTANCE; + } + configureRegularGpio(gpioConfig.first, regularGpio); + break; + } + case(gpio::GpioTypes::CALLBACK): { + auto gpioCallback = dynamic_cast(gpioConfig.second); + if(gpioCallback->callback == nullptr) { + return GPIO_INVALID_INSTANCE; + } + gpioCallback->callback(gpioConfig.first, gpio::GpioOperation::WRITE, + gpioCallback->initValue, gpioCallback->callbackArgs); + } + } + } + return RETURN_OK; +} + +ReturnValue_t LinuxLibgpioIF::configureRegularGpio(gpioId_t gpioId, GpiodRegular *regularGpio) { + std::string chipname; + unsigned int lineNum; + struct gpiod_chip *chip; + gpio::Direction direction; + std::string consumer; + struct gpiod_line *lineHandle; + int result = 0; + + chipname = regularGpio->chipname; + chip = gpiod_chip_open_by_name(chipname.c_str()); + if (!chip) { + sif::warning << "LinuxLibgpioIF::configureRegularGpio: Failed to open chip " + << chipname << ". Gpio ID: " << gpioId << std::endl; + return RETURN_FAILED; + } + + lineNum = regularGpio->lineNum; + lineHandle = gpiod_chip_get_line(chip, lineNum); + if (!lineHandle) { + sif::debug << "LinuxLibgpioIF::configureRegularGpio: Failed to open line " << std::endl; + sif::debug << "GPIO ID: " << gpioId << ", line number: " << lineNum << + ", chipname: " << chipname << std::endl; + sif::debug << "Check if linux GPIO configuration has changed. " << std::endl; + gpiod_chip_close(chip); + return RETURN_FAILED; + } + + direction = regularGpio->direction; + consumer = regularGpio->consumer; + /* Configure direction and add a description to the GPIO */ + switch (direction) { + case(gpio::OUT): { + result = gpiod_line_request_output(lineHandle, consumer.c_str(), + regularGpio->initValue); + if (result < 0) { + sif::error << "LinuxLibgpioIF::configureRegularGpio: Failed to request line " << lineNum << + " from GPIO instance with ID: " << gpioId << std::endl; + gpiod_line_release(lineHandle); + return RETURN_FAILED; + } + break; + } + case(gpio::IN): { + result = gpiod_line_request_input(lineHandle, consumer.c_str()); + if (result < 0) { + sif::error << "LinuxLibgpioIF::configureGpios: Failed to request line " + << lineNum << " from GPIO instance with ID: " << gpioId << std::endl; + gpiod_line_release(lineHandle); + return RETURN_FAILED; + } + break; + } + default: { + sif::error << "LinuxLibgpioIF::configureGpios: Invalid direction specified" + << std::endl; + return GPIO_INVALID_INSTANCE; + } + + } + /** + * Write line handle to GPIO configuration instance so it can later be used to set or + * read states of GPIOs. + */ + regularGpio->lineHandle = lineHandle; + return RETURN_OK; +} + +ReturnValue_t LinuxLibgpioIF::pullHigh(gpioId_t gpioId) { + gpioMapIter = gpioMap.find(gpioId); + if (gpioMapIter == gpioMap.end()) { + sif::warning << "LinuxLibgpioIF::pullHigh: Unknown GPIO ID " << gpioId << std::endl; + return UNKNOWN_GPIO_ID; + } + + if(gpioMapIter->second->gpioType == gpio::GpioTypes::GPIO_REGULAR) { + return driveGpio(gpioId, dynamic_cast(gpioMapIter->second), 1); + } + else { + auto gpioCallback = dynamic_cast(gpioMapIter->second); + if(gpioCallback->callback == nullptr) { + return GPIO_INVALID_INSTANCE; + } + gpioCallback->callback(gpioMapIter->first, gpio::GpioOperation::WRITE, + 1, gpioCallback->callbackArgs); + return RETURN_OK; + } + return GPIO_TYPE_FAILURE; +} + +ReturnValue_t LinuxLibgpioIF::pullLow(gpioId_t gpioId) { + gpioMapIter = gpioMap.find(gpioId); + if (gpioMapIter == gpioMap.end()) { + sif::warning << "LinuxLibgpioIF::pullLow: Unknown GPIO ID " << gpioId << std::endl; + return UNKNOWN_GPIO_ID; + } + + if(gpioMapIter->second->gpioType == gpio::GpioTypes::GPIO_REGULAR) { + return driveGpio(gpioId, dynamic_cast(gpioMapIter->second), 0); + } + else { + auto gpioCallback = dynamic_cast(gpioMapIter->second); + if(gpioCallback->callback == nullptr) { + return GPIO_INVALID_INSTANCE; + } + gpioCallback->callback(gpioMapIter->first, gpio::GpioOperation::WRITE, + 0, gpioCallback->callbackArgs); + return RETURN_OK; + } + return GPIO_TYPE_FAILURE; +} + +ReturnValue_t LinuxLibgpioIF::driveGpio(gpioId_t gpioId, + GpiodRegular* regularGpio, unsigned int logicLevel) { + if(regularGpio == nullptr) { + return GPIO_TYPE_FAILURE; + } + + int result = gpiod_line_set_value(regularGpio->lineHandle, logicLevel); + if (result < 0) { + sif::warning << "LinuxLibgpioIF::driveGpio: Failed to pull GPIO with ID " << gpioId << + " to logic level " << logicLevel << std::endl; + return DRIVE_GPIO_FAILURE; + } + + return RETURN_OK; +} + +ReturnValue_t LinuxLibgpioIF::readGpio(gpioId_t gpioId, int* gpioState) { + gpioMapIter = gpioMap.find(gpioId); + if (gpioMapIter == gpioMap.end()){ + sif::warning << "LinuxLibgpioIF::readGpio: Unknown GPIOD ID " << gpioId << std::endl; + return UNKNOWN_GPIO_ID; + } + + if(gpioMapIter->second->gpioType == gpio::GpioTypes::GPIO_REGULAR) { + GpiodRegular* regularGpio = dynamic_cast(gpioMapIter->second); + if(regularGpio == nullptr) { + return GPIO_TYPE_FAILURE; + } + *gpioState = gpiod_line_get_value(regularGpio->lineHandle); + } + else { + + } + + + return RETURN_OK; +} + +ReturnValue_t LinuxLibgpioIF::checkForConflicts(GpioMap& mapToAdd){ + ReturnValue_t status = HasReturnvaluesIF::RETURN_OK; + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + for(auto& gpioConfig: mapToAdd) { + switch(gpioConfig.second->gpioType) { + case(gpio::GpioTypes::GPIO_REGULAR): { + auto regularGpio = dynamic_cast(gpioConfig.second); + if(regularGpio == nullptr) { + return GPIO_TYPE_FAILURE; + } + /* Check for conflicts and remove duplicates if necessary */ + result = checkForConflictsRegularGpio(gpioConfig.first, regularGpio, mapToAdd); + if(result != HasReturnvaluesIF::RETURN_OK) { + status = result; + } + break; + } + case(gpio::GpioTypes::CALLBACK): { + auto callbackGpio = dynamic_cast(gpioConfig.second); + if(callbackGpio == nullptr) { + return GPIO_TYPE_FAILURE; + } + /* Check for conflicts and remove duplicates if necessary */ + result = checkForConflictsCallbackGpio(gpioConfig.first, callbackGpio, mapToAdd); + if(result != HasReturnvaluesIF::RETURN_OK) { + status = result; + } + break; + } + default: { + + } + } + } + return status; +} + + +ReturnValue_t LinuxLibgpioIF::checkForConflictsRegularGpio(gpioId_t gpioIdToCheck, + GpiodRegular* gpioToCheck, GpioMap& mapToAdd) { + /* Cross check with private map */ + gpioMapIter = gpioMap.find(gpioIdToCheck); + if(gpioMapIter != gpioMap.end()) { + if(gpioMapIter->second->gpioType != gpio::GpioTypes::GPIO_REGULAR) { + sif::warning << "LinuxLibgpioIF::checkForConflicts: ID already exists for different " + "GPIO type" << gpioIdToCheck << ". Removing duplicate." << std::endl; + mapToAdd.erase(gpioIdToCheck); + return HasReturnvaluesIF::RETURN_OK; + } + auto ownRegularGpio = dynamic_cast(gpioMapIter->second); + if(ownRegularGpio == nullptr) { + return GPIO_TYPE_FAILURE; + } + + /* Remove element from map to add because a entry for this GPIO + already exists */ + sif::warning << "LinuxLibgpioIF::checkForConflictsRegularGpio: Duplicate GPIO definition" + << " detected. Duplicate will be removed from map to add." << std::endl; + mapToAdd.erase(gpioIdToCheck); + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t LinuxLibgpioIF::checkForConflictsCallbackGpio(gpioId_t gpioIdToCheck, + GpioCallback *callbackGpio, GpioMap& mapToAdd) { + /* Cross check with private map */ + gpioMapIter = gpioMap.find(gpioIdToCheck); + if(gpioMapIter != gpioMap.end()) { + if(gpioMapIter->second->gpioType != gpio::GpioTypes::CALLBACK) { + sif::warning << "LinuxLibgpioIF::checkForConflicts: ID already exists for different " + "GPIO type" << gpioIdToCheck << ". Removing duplicate." << std::endl; + mapToAdd.erase(gpioIdToCheck); + return HasReturnvaluesIF::RETURN_OK; + } + + /* Remove element from map to add because a entry for this GPIO + already exists */ + sif::warning << "LinuxLibgpioIF::checkForConflictsRegularGpio: Duplicate GPIO definition" + << " detected. Duplicate will be removed from map to add." << std::endl; + mapToAdd.erase(gpioIdToCheck); + } + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/hal/src/linux/i2c/CMakeLists.txt b/hal/src/linux/i2c/CMakeLists.txt new file mode 100644 index 00000000..0e50313c --- /dev/null +++ b/hal/src/linux/i2c/CMakeLists.txt @@ -0,0 +1,8 @@ +target_sources(${LIB_FSFW_HAL_NAME} PUBLIC + I2cComIF.cpp + I2cCookie.cpp +) + + + + diff --git a/hal/src/linux/i2c/I2cComIF.cpp b/hal/src/linux/i2c/I2cComIF.cpp new file mode 100644 index 00000000..aa336c7b --- /dev/null +++ b/hal/src/linux/i2c/I2cComIF.cpp @@ -0,0 +1,205 @@ +#include "I2cComIF.h" +#include "../utility.h" +#include "../UnixFileGuard.h" + +#include + +#include +#include +#include +#include +#include + +#include + + +I2cComIF::I2cComIF(object_id_t objectId): SystemObject(objectId){ +} + +I2cComIF::~I2cComIF() {} + +ReturnValue_t I2cComIF::initializeInterface(CookieIF* cookie) { + + address_t i2cAddress; + std::string deviceFile; + + if(cookie == nullptr) { + sif::error << "I2cComIF::initializeInterface: Invalid cookie!" << std::endl; + return NULLPOINTER; + } + I2cCookie* i2cCookie = dynamic_cast(cookie); + if(i2cCookie == nullptr) { + sif::error << "I2cComIF::initializeInterface: Invalid I2C cookie!" << std::endl; + return NULLPOINTER; + } + + i2cAddress = i2cCookie->getAddress(); + + i2cDeviceMapIter = i2cDeviceMap.find(i2cAddress); + if(i2cDeviceMapIter == i2cDeviceMap.end()) { + size_t maxReplyLen = i2cCookie->getMaxReplyLen(); + I2cInstance i2cInstance = {std::vector(maxReplyLen), 0}; + auto statusPair = i2cDeviceMap.emplace(i2cAddress, i2cInstance); + if (not statusPair.second) { + sif::error << "I2cComIF::initializeInterface: Failed to insert device with address " << + i2cAddress << "to I2C device " << "map" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + return HasReturnvaluesIF::RETURN_OK; + } + + sif::error << "I2cComIF::initializeInterface: Device with address " << i2cAddress << + "already in use" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; +} + +ReturnValue_t I2cComIF::sendMessage(CookieIF *cookie, + const uint8_t *sendData, size_t sendLen) { + + ReturnValue_t result; + int fd; + std::string deviceFile; + + if(sendData == nullptr) { + sif::error << "I2cComIF::sendMessage: Send Data is nullptr" + << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + + if(sendLen == 0) { + return HasReturnvaluesIF::RETURN_OK; + } + + I2cCookie* i2cCookie = dynamic_cast(cookie); + if(i2cCookie == nullptr) { + sif::error << "I2cComIF::sendMessage: Invalid I2C Cookie!" << std::endl; + return NULLPOINTER; + } + + address_t i2cAddress = i2cCookie->getAddress(); + i2cDeviceMapIter = i2cDeviceMap.find(i2cAddress); + if (i2cDeviceMapIter == i2cDeviceMap.end()) { + sif::error << "I2cComIF::sendMessage: i2cAddress of Cookie not " + << "registered in i2cDeviceMap" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + + deviceFile = i2cCookie->getDeviceFile(); + UnixFileGuard fileHelper(deviceFile, &fd, O_RDWR, "I2cComIF::sendMessage"); + if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) { + return fileHelper.getOpenResult(); + } + result = openDevice(deviceFile, i2cAddress, &fd); + if (result != HasReturnvaluesIF::RETURN_OK){ + return result; + } + + if (write(fd, sendData, sendLen) != (int)sendLen) { + sif::error << "I2cComIF::sendMessage: Failed to send data to I2C " + "device with error code " << errno << ". Error description: " + << strerror(errno) << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t I2cComIF::getSendSuccess(CookieIF *cookie) { + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t I2cComIF::requestReceiveMessage(CookieIF *cookie, + size_t requestLen) { + ReturnValue_t result; + int fd; + std::string deviceFile; + + if (requestLen == 0) { + return HasReturnvaluesIF::RETURN_OK; + } + + I2cCookie* i2cCookie = dynamic_cast(cookie); + if(i2cCookie == nullptr) { + sif::error << "I2cComIF::requestReceiveMessage: Invalid I2C Cookie!" << std::endl; + i2cDeviceMapIter->second.replyLen = 0; + return NULLPOINTER; + } + + address_t i2cAddress = i2cCookie->getAddress(); + i2cDeviceMapIter = i2cDeviceMap.find(i2cAddress); + if (i2cDeviceMapIter == i2cDeviceMap.end()) { + sif::error << "I2cComIF::requestReceiveMessage: i2cAddress of Cookie not " + << "registered in i2cDeviceMap" << std::endl; + i2cDeviceMapIter->second.replyLen = 0; + return HasReturnvaluesIF::RETURN_FAILED; + } + + deviceFile = i2cCookie->getDeviceFile(); + UnixFileGuard fileHelper(deviceFile, &fd, O_RDWR, "I2cComIF::requestReceiveMessage"); + if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) { + return fileHelper.getOpenResult(); + } + result = openDevice(deviceFile, i2cAddress, &fd); + if (result != HasReturnvaluesIF::RETURN_OK){ + i2cDeviceMapIter->second.replyLen = 0; + return result; + } + + uint8_t* replyBuffer = i2cDeviceMapIter->second.replyBuffer.data(); + + int readLen = read(fd, replyBuffer, requestLen); + if (readLen != static_cast(requestLen)) { +#if FSFW_VERBOSE_LEVEL >= 1 and FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "I2cComIF::requestReceiveMessage: Reading from I2C " + << "device failed with error code " << errno <<". Description" + << " of error: " << strerror(errno) << std::endl; + sif::error << "I2cComIF::requestReceiveMessage: Read only " << readLen << " from " + << requestLen << " bytes" << std::endl; +#endif + i2cDeviceMapIter->second.replyLen = 0; + sif::debug << "I2cComIF::requestReceiveMessage: Read " << readLen << " of " << requestLen << " bytes" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + + i2cDeviceMapIter->second.replyLen = requestLen; + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t I2cComIF::readReceivedMessage(CookieIF *cookie, + uint8_t **buffer, size_t* size) { + I2cCookie* i2cCookie = dynamic_cast(cookie); + if(i2cCookie == nullptr) { + sif::error << "I2cComIF::readReceivedMessage: Invalid I2C Cookie!" << std::endl; + return NULLPOINTER; + } + + address_t i2cAddress = i2cCookie->getAddress(); + i2cDeviceMapIter = i2cDeviceMap.find(i2cAddress); + if (i2cDeviceMapIter == i2cDeviceMap.end()) { + sif::error << "I2cComIF::readReceivedMessage: i2cAddress of Cookie not " + << "found in i2cDeviceMap" << std::endl; + return HasReturnvaluesIF::RETURN_FAILED; + } + *buffer = i2cDeviceMapIter->second.replyBuffer.data(); + *size = i2cDeviceMapIter->second.replyLen; + + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t I2cComIF::openDevice(std::string deviceFile, + address_t i2cAddress, int* fileDescriptor) { + + if (ioctl(*fileDescriptor, I2C_SLAVE, i2cAddress) < 0) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "I2cComIF: Specifying target device failed with error code " << errno << "." + << std::endl; + sif::warning << "Error description " << strerror(errno) << std::endl; +#else + sif::printWarning("I2cComIF: Specifying target device failed with error code %d.\n"); + sif::printWarning("Error description: %s\n", strerror(errno)); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + return HasReturnvaluesIF::RETURN_FAILED; + } + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/hal/src/linux/i2c/I2cCookie.cpp b/hal/src/linux/i2c/I2cCookie.cpp new file mode 100644 index 00000000..fe0f3f92 --- /dev/null +++ b/hal/src/linux/i2c/I2cCookie.cpp @@ -0,0 +1,20 @@ +#include "I2cCookie.h" + +I2cCookie::I2cCookie(address_t i2cAddress_, size_t maxReplyLen_, + std::string deviceFile_) : + i2cAddress(i2cAddress_), maxReplyLen(maxReplyLen_), deviceFile(deviceFile_) { +} + +address_t I2cCookie::getAddress() const { + return i2cAddress; +} + +size_t I2cCookie::getMaxReplyLen() const { + return maxReplyLen; +} + +std::string I2cCookie::getDeviceFile() const { + return deviceFile; +} + +I2cCookie::~I2cCookie() {} diff --git a/hal/src/linux/rpi/CMakeLists.txt b/hal/src/linux/rpi/CMakeLists.txt new file mode 100644 index 00000000..053583aa --- /dev/null +++ b/hal/src/linux/rpi/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${LIB_FSFW_HAL_NAME} PRIVATE + GpioRPi.cpp +) \ No newline at end of file diff --git a/hal/src/linux/rpi/GpioRPi.cpp b/hal/src/linux/rpi/GpioRPi.cpp new file mode 100644 index 00000000..64b6fcaa --- /dev/null +++ b/hal/src/linux/rpi/GpioRPi.cpp @@ -0,0 +1,37 @@ +#include "GpioRPi.h" +#include "../../common/gpio/GpioCookie.h" +#include + +#include + + +ReturnValue_t gpio::createRpiGpioConfig(GpioCookie* cookie, gpioId_t gpioId, int bcmPin, + std::string consumer, gpio::Direction direction, int initValue) { + if(cookie == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } + + GpiodRegular* config = new GpiodRegular(); + /* Default chipname for Raspberry Pi. There is still gpiochip1 for expansion, but most users + will not need this */ + config->chipname = "gpiochip0"; + + config->consumer = consumer; + config->direction = direction; + config->initValue = initValue; + + /* Sanity check for the BCM pins before assigning it */ + if(bcmPin > 27) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "createRpiGpioConfig: BCM pin " << bcmPin << " invalid!" << std::endl; +#else + sif::printError("createRpiGpioConfig: BCM pin %d invalid!\n", bcmPin); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + return HasReturnvaluesIF::RETURN_FAILED; + } + config->lineNum = bcmPin; + cookie->addGpio(gpioId, config); + return HasReturnvaluesIF::RETURN_OK; +} diff --git a/hal/src/linux/spi/CMakeLists.txt b/hal/src/linux/spi/CMakeLists.txt new file mode 100644 index 00000000..5794547c --- /dev/null +++ b/hal/src/linux/spi/CMakeLists.txt @@ -0,0 +1,8 @@ +target_sources(${LIB_FSFW_HAL_NAME} PUBLIC + SpiComIF.cpp + SpiCookie.cpp +) + + + + diff --git a/hal/src/linux/spi/SpiComIF.cpp b/hal/src/linux/spi/SpiComIF.cpp new file mode 100644 index 00000000..9dc44295 --- /dev/null +++ b/hal/src/linux/spi/SpiComIF.cpp @@ -0,0 +1,398 @@ +#include "SpiComIF.h" +#include "SpiCookie.h" +#include "../utility.h" +#include "../UnixFileGuard.h" +#include "FSFWConfig.h" + +#include +#include + +#include +#include +#include +#include + +#include +#include + +/* Can be used for low-level debugging of the SPI bus */ +#ifndef FSFW_HAL_LINUX_SPI_WIRETAPPING +#define FSFW_HAL_LINUX_SPI_WIRETAPPING 0 +#endif + +SpiComIF::SpiComIF(object_id_t objectId, GpioIF* gpioComIF): + SystemObject(objectId), gpioComIF(gpioComIF) { + if(gpioComIF == nullptr) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "SpiComIF::SpiComIF: GPIO communication interface invalid!" << std::endl; +#else + sif::printError("SpiComIF::SpiComIF: GPIO communication interface invalid!\n"); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + } + + spiMutex = MutexFactory::instance()->createMutex(); +} + +ReturnValue_t SpiComIF::initializeInterface(CookieIF *cookie) { + int retval = 0; + SpiCookie* spiCookie = dynamic_cast(cookie); + if(spiCookie == nullptr) { + return NULLPOINTER; + } + + address_t spiAddress = spiCookie->getSpiAddress(); + + auto iter = spiDeviceMap.find(spiAddress); + if(iter == spiDeviceMap.end()) { + size_t bufferSize = spiCookie->getMaxBufferSize(); + SpiInstance spiInstance(bufferSize); + auto statusPair = spiDeviceMap.emplace(spiAddress, spiInstance); + if (not statusPair.second) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "SpiComIF::initializeInterface: Failed to insert device with address " << + spiAddress << "to SPI device map" << std::endl; +#else + sif::printError("SpiComIF::initializeInterface: Failed to insert device with address " + "%lu to SPI device map\n", static_cast(spiAddress)); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + return HasReturnvaluesIF::RETURN_FAILED; + } + /* Now we emplaced the read buffer in the map, we still need to assign that location + to the SPI driver transfer struct */ + spiCookie->assignReadBuffer(statusPair.first->second.replyBuffer.data()); + } + else { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "SpiComIF::initializeInterface: SPI address already exists!" << std::endl; +#else + sif::printError("SpiComIF::initializeInterface: SPI address already exists!\n"); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + return HasReturnvaluesIF::RETURN_FAILED; + } + + /* Pull CS high in any case to be sure that device is inactive */ + gpioId_t gpioId = spiCookie->getChipSelectPin(); + if(gpioId != gpio::NO_GPIO) { + gpioComIF->pullHigh(gpioId); + } + + size_t spiSpeed = 0; + spi::SpiModes spiMode = spi::SpiModes::MODE_0; + + SpiCookie::UncommonParameters params; + spiCookie->getSpiParameters(spiMode, spiSpeed, ¶ms); + + int fileDescriptor = 0; + UnixFileGuard fileHelper(spiCookie->getSpiDevice(), &fileDescriptor, O_RDWR, + "SpiComIF::initializeInterface: "); + if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) { + return fileHelper.getOpenResult(); + } + + /* These flags are rather uncommon */ + if(params.threeWireSpi or params.noCs or params.csHigh) { + uint32_t currentMode = 0; + retval = ioctl(fileDescriptor, SPI_IOC_RD_MODE32, ¤tMode); + if(retval != 0) { + utility::handleIoctlError("SpiComIF::initialiezInterface: Could not read full mode!"); + } + + if(params.threeWireSpi) { + currentMode |= SPI_3WIRE; + } + if(params.noCs) { + /* Some drivers like the Raspberry Pi ignore this flag in any case */ + currentMode |= SPI_NO_CS; + } + if(params.csHigh) { + currentMode |= SPI_CS_HIGH; + } + /* Write adapted mode */ + retval = ioctl(fileDescriptor, SPI_IOC_WR_MODE32, ¤tMode); + if(retval != 0) { + utility::handleIoctlError("SpiComIF::initialiezInterface: Could not write full mode!"); + } + } + if(params.lsbFirst) { + retval = ioctl(fileDescriptor, SPI_IOC_WR_LSB_FIRST, ¶ms.lsbFirst); + if(retval != 0) { + utility::handleIoctlError("SpiComIF::initializeInterface: Setting LSB first failed"); + } + } + if(params.bitsPerWord != 8) { + retval = ioctl(fileDescriptor, SPI_IOC_WR_BITS_PER_WORD, ¶ms.bitsPerWord); + if(retval != 0) { + utility::handleIoctlError("SpiComIF::initializeInterface: " + "Could not write bits per word!"); + } + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t SpiComIF::sendMessage(CookieIF *cookie, const uint8_t *sendData, size_t sendLen) { + SpiCookie* spiCookie = dynamic_cast(cookie); + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + + if(spiCookie == nullptr) { + return NULLPOINTER; + } + + if(sendLen > spiCookie->getMaxBufferSize()) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "SpiComIF::sendMessage: Too much data sent, send length" << sendLen << + "larger than maximum buffer length" << spiCookie->getMaxBufferSize() << std::endl; +#else + sif::printWarning("SpiComIF::sendMessage: Too much data sent, send length %lu larger " + "than maximum buffer length %lu!\n", static_cast(sendLen), + static_cast(spiCookie->getMaxBufferSize())); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + return DeviceCommunicationIF::TOO_MUCH_DATA; + } + + if(spiCookie->getComIfMode() == spi::SpiComIfModes::REGULAR) { + result = performRegularSendOperation(spiCookie, sendData, sendLen); + } + else if(spiCookie->getComIfMode() == spi::SpiComIfModes::CALLBACK) { + spi::send_callback_function_t sendFunc = nullptr; + void* funcArgs = nullptr; + spiCookie->getCallback(&sendFunc, &funcArgs); + if(sendFunc != nullptr) { + result = sendFunc(this, spiCookie, sendData, sendLen, funcArgs); + } + } + return result; +} + +ReturnValue_t SpiComIF::performRegularSendOperation(SpiCookie *spiCookie, const uint8_t *sendData, + size_t sendLen) { + address_t spiAddress = spiCookie->getSpiAddress(); + auto iter = spiDeviceMap.find(spiAddress); + if(iter != spiDeviceMap.end()) { + spiCookie->assignReadBuffer(iter->second.replyBuffer.data()); + } + + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + int retval = 0; + /* Prepare transfer */ + int fileDescriptor = 0; + std::string device = spiCookie->getSpiDevice(); + UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, "SpiComIF::sendMessage: "); + if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) { + return OPENING_FILE_FAILED; + } + spi::SpiModes spiMode = spi::SpiModes::MODE_0; + uint32_t spiSpeed = 0; + spiCookie->getSpiParameters(spiMode, spiSpeed, nullptr); + setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed); + spiCookie->assignWriteBuffer(sendData); + spiCookie->assignTransferSize(sendLen); + + bool fullDuplex = spiCookie->isFullDuplex(); + gpioId_t gpioId = spiCookie->getChipSelectPin(); + + /* Pull SPI CS low. For now, no support for active high given */ + if(gpioId != gpio::NO_GPIO) { + result = spiMutex->lockMutex(timeoutType, timeoutMs); + if (result != RETURN_OK) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "SpiComIF::sendMessage: Failed to lock mutex" << std::endl; +#endif + return result; + } + gpioComIF->pullLow(gpioId); + } + + /* Execute transfer */ + if(fullDuplex) { + /* Initiate a full duplex SPI transfer. */ + retval = ioctl(fileDescriptor, SPI_IOC_MESSAGE(1), spiCookie->getTransferStructHandle()); + if(retval < 0) { + utility::handleIoctlError("SpiComIF::sendMessage: ioctl error."); + result = FULL_DUPLEX_TRANSFER_FAILED; + } +#if FSFW_HAL_LINUX_SPI_WIRETAPPING == 1 + performSpiWiretapping(spiCookie); +#endif /* FSFW_LINUX_SPI_WIRETAPPING == 1 */ + } + else { + /* We write with a blocking half-duplex transfer here */ + if (write(fileDescriptor, sendData, sendLen) != static_cast(sendLen)) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "SpiComIF::sendMessage: Half-Duplex write operation failed!" << + std::endl; +#else + sif::printWarning("SpiComIF::sendMessage: Half-Duplex write operation failed!\n"); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + result = HALF_DUPLEX_TRANSFER_FAILED; + } + } + + if(gpioId != gpio::NO_GPIO) { + gpioComIF->pullHigh(gpioId); + result = spiMutex->unlockMutex(); + if (result != RETURN_OK) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "SpiComIF::sendMessage: Failed to unlock mutex" << std::endl; +#endif + return result; + } + } + return result; +} + +ReturnValue_t SpiComIF::getSendSuccess(CookieIF *cookie) { + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t SpiComIF::requestReceiveMessage(CookieIF *cookie, size_t requestLen) { + SpiCookie* spiCookie = dynamic_cast(cookie); + if(spiCookie == nullptr) { + return NULLPOINTER; + } + + if(spiCookie->isFullDuplex()) { + return HasReturnvaluesIF::RETURN_OK; + } + + return performHalfDuplexReception(spiCookie); +} + + +ReturnValue_t SpiComIF::performHalfDuplexReception(SpiCookie* spiCookie) { + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + std::string device = spiCookie->getSpiDevice(); + int fileDescriptor = 0; + UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, + "SpiComIF::requestReceiveMessage: "); + if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) { + return OPENING_FILE_FAILED; + } + + uint8_t* rxBuf = nullptr; + size_t readSize = spiCookie->getCurrentTransferSize(); + result = getReadBuffer(spiCookie->getSpiAddress(), &rxBuf); + if(result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + + gpioId_t gpioId = spiCookie->getChipSelectPin(); + if(gpioId != gpio::NO_GPIO) { + result = spiMutex->lockMutex(timeoutType, timeoutMs); + if (result != RETURN_OK) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "SpiComIF::getSendSuccess: Failed to lock mutex" << std::endl; +#endif + return result; + } + gpioComIF->pullLow(gpioId); + } + + if(read(fileDescriptor, rxBuf, readSize) != static_cast(readSize)) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "SpiComIF::sendMessage: Half-Duplex read operation failed!" << std::endl; +#else + sif::printWarning("SpiComIF::sendMessage: Half-Duplex read operation failed!\n"); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + result = HALF_DUPLEX_TRANSFER_FAILED; + } + + if(gpioId != gpio::NO_GPIO) { + gpioComIF->pullHigh(gpioId); + result = spiMutex->unlockMutex(); + if (result != RETURN_OK) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "SpiComIF::getSendSuccess: Failed to unlock mutex" << std::endl; +#endif + return result; + } + } + + return result; +} + +ReturnValue_t SpiComIF::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) { + SpiCookie* spiCookie = dynamic_cast(cookie); + if(spiCookie == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } + uint8_t* rxBuf = nullptr; + ReturnValue_t result = getReadBuffer(spiCookie->getSpiAddress(), &rxBuf); + if(result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + + *buffer = rxBuf; + *size = spiCookie->getCurrentTransferSize(); + return HasReturnvaluesIF::RETURN_OK; +} + +MutexIF* SpiComIF::getMutex(MutexIF::TimeoutType* timeoutType, uint32_t* timeoutMs) { + if(timeoutType != nullptr) { + *timeoutType = this->timeoutType; + } + if(timeoutMs != nullptr) { + *timeoutMs = this->timeoutMs; + } + return spiMutex; +} + +void SpiComIF::performSpiWiretapping(SpiCookie* spiCookie) { + if(spiCookie == nullptr) { + return; + } + size_t dataLen = spiCookie->getTransferStructHandle()->len; + uint8_t* dataPtr = reinterpret_cast(spiCookie->getTransferStructHandle()->tx_buf); +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "Sent SPI data: " << std::endl; + arrayprinter::print(dataPtr, dataLen, OutputType::HEX, false); + sif::info << "Received SPI data: " << std::endl; +#else + sif::printInfo("Sent SPI data: \n"); + arrayprinter::print(dataPtr, dataLen, OutputType::HEX, false); + sif::printInfo("Received SPI data: \n"); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ + dataPtr = reinterpret_cast(spiCookie->getTransferStructHandle()->rx_buf); + arrayprinter::print(dataPtr, dataLen, OutputType::HEX, false); +} + +ReturnValue_t SpiComIF::getReadBuffer(address_t spiAddress, uint8_t** buffer) { + if(buffer == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } + + auto iter = spiDeviceMap.find(spiAddress); + if(iter == spiDeviceMap.end()) { + return HasReturnvaluesIF::RETURN_FAILED; + } + + *buffer = iter->second.replyBuffer.data(); + return HasReturnvaluesIF::RETURN_OK; +} + +GpioIF* SpiComIF::getGpioInterface() { + return gpioComIF; +} + +void SpiComIF::setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed) { + int retval = ioctl(spiFd, SPI_IOC_WR_MODE, reinterpret_cast(&mode)); + if(retval != 0) { + utility::handleIoctlError("SpiTestClass::performRm3100Test: Setting SPI mode failed!"); + } + + retval = ioctl(spiFd, SPI_IOC_WR_MAX_SPEED_HZ, &speed); + if(retval != 0) { + utility::handleIoctlError("SpiTestClass::performRm3100Test: Setting SPI speed failed!"); + } +} diff --git a/hal/src/linux/spi/SpiCookie.cpp b/hal/src/linux/spi/SpiCookie.cpp new file mode 100644 index 00000000..e34ea36a --- /dev/null +++ b/hal/src/linux/spi/SpiCookie.cpp @@ -0,0 +1,144 @@ +#include "SpiCookie.h" + +SpiCookie::SpiCookie(address_t spiAddress, gpioId_t chipSelect, std::string spiDev, + const size_t maxSize, spi::SpiModes spiMode, uint32_t spiSpeed): + SpiCookie(spi::SpiComIfModes::REGULAR, spiAddress, chipSelect, spiDev, maxSize, spiMode, + spiSpeed, nullptr, nullptr) { + +} + +SpiCookie::SpiCookie(address_t spiAddress, std::string spiDev, const size_t maxSize, + spi::SpiModes spiMode, uint32_t spiSpeed): + SpiCookie(spiAddress, gpio::NO_GPIO, spiDev, maxSize, spiMode, spiSpeed) { +} + +SpiCookie::SpiCookie(address_t spiAddress, gpioId_t chipSelect, std::string spiDev, + const size_t maxSize, spi::SpiModes spiMode, uint32_t spiSpeed, + spi::send_callback_function_t callback, void *args): + SpiCookie(spi::SpiComIfModes::CALLBACK, spiAddress, chipSelect, spiDev, maxSize, + spiMode, spiSpeed, callback, args) { +} + +SpiCookie::SpiCookie(spi::SpiComIfModes comIfMode, address_t spiAddress, gpioId_t chipSelect, + std::string spiDev, const size_t maxSize, spi::SpiModes spiMode, uint32_t spiSpeed, + spi::send_callback_function_t callback, void* args): + spiAddress(spiAddress), chipSelectPin(chipSelect), spiDevice(spiDev), + comIfMode(comIfMode), maxSize(maxSize), spiMode(spiMode), spiSpeed(spiSpeed), + sendCallback(callback), callbackArgs(args) { +} + +spi::SpiComIfModes SpiCookie::getComIfMode() const { + return this->comIfMode; +} + +void SpiCookie::getSpiParameters(spi::SpiModes& spiMode, uint32_t& spiSpeed, + UncommonParameters* parameters) const { + spiMode = this->spiMode; + spiSpeed = this->spiSpeed; + + if(parameters != nullptr) { + parameters->threeWireSpi = uncommonParameters.threeWireSpi; + parameters->lsbFirst = uncommonParameters.lsbFirst; + parameters->noCs = uncommonParameters.noCs; + parameters->bitsPerWord = uncommonParameters.bitsPerWord; + parameters->csHigh = uncommonParameters.csHigh; + } +} + +gpioId_t SpiCookie::getChipSelectPin() const { + return chipSelectPin; +} + +size_t SpiCookie::getMaxBufferSize() const { + return maxSize; +} + +address_t SpiCookie::getSpiAddress() const { + return spiAddress; +} + +std::string SpiCookie::getSpiDevice() const { + return spiDevice; +} + +void SpiCookie::setThreeWireSpi(bool enable) { + uncommonParameters.threeWireSpi = enable; +} + +void SpiCookie::setLsbFirst(bool enable) { + uncommonParameters.lsbFirst = enable; +} + +void SpiCookie::setNoCs(bool enable) { + uncommonParameters.noCs = enable; +} + +void SpiCookie::setBitsPerWord(uint8_t bitsPerWord) { + uncommonParameters.bitsPerWord = bitsPerWord; +} + +void SpiCookie::setCsHigh(bool enable) { + uncommonParameters.csHigh = enable; +} + +void SpiCookie::activateCsDeselect(bool deselectCs, uint16_t delayUsecs) { + spiTransferStruct.cs_change = deselectCs; + spiTransferStruct.delay_usecs = delayUsecs; +} + +void SpiCookie::assignReadBuffer(uint8_t* rx) { + if(rx != nullptr) { + spiTransferStruct.rx_buf = reinterpret_cast<__u64>(rx); + } +} + +void SpiCookie::assignWriteBuffer(const uint8_t* tx) { + if(tx != nullptr) { + spiTransferStruct.tx_buf = reinterpret_cast<__u64>(tx); + } +} + +void SpiCookie::setCallbackMode(spi::send_callback_function_t callback, + void *args) { + this->comIfMode = spi::SpiComIfModes::CALLBACK; + this->sendCallback = callback; + this->callbackArgs = args; +} + +void SpiCookie::setCallbackArgs(void *args) { + this->callbackArgs = args; +} + +spi_ioc_transfer* SpiCookie::getTransferStructHandle() { + return &spiTransferStruct; +} + +void SpiCookie::setFullOrHalfDuplex(bool halfDuplex) { + this->halfDuplex = halfDuplex; +} + +bool SpiCookie::isFullDuplex() const { + return not this->halfDuplex; +} + +void SpiCookie::assignTransferSize(size_t transferSize) { + spiTransferStruct.len = transferSize; +} + +size_t SpiCookie::getCurrentTransferSize() const { + return spiTransferStruct.len; +} + +void SpiCookie::setSpiSpeed(uint32_t newSpeed) { + this->spiSpeed = newSpeed; +} + +void SpiCookie::setSpiMode(spi::SpiModes newMode) { + this->spiMode = newMode; +} + +void SpiCookie::getCallback(spi::send_callback_function_t *callback, + void **args) { + *callback = this->sendCallback; + *args = this->callbackArgs; +} diff --git a/hal/src/linux/uart/CMakeLists.txt b/hal/src/linux/uart/CMakeLists.txt new file mode 100644 index 00000000..7b503d02 --- /dev/null +++ b/hal/src/linux/uart/CMakeLists.txt @@ -0,0 +1,8 @@ +target_sources(${TARGET_NAME} PUBLIC + UartComIF.cpp + UartCookie.cpp +) + + + + diff --git a/hal/src/linux/uart/UartComIF.cpp b/hal/src/linux/uart/UartComIF.cpp new file mode 100644 index 00000000..c84affa9 --- /dev/null +++ b/hal/src/linux/uart/UartComIF.cpp @@ -0,0 +1,455 @@ +#include "UartComIF.h" +#include "OBSWConfig.h" + +#include "fsfw/serviceinterface/ServiceInterface.h" + +#include +#include +#include +#include +#include + +UartComIF::UartComIF(object_id_t objectId): SystemObject(objectId){ +} + +UartComIF::~UartComIF() {} + +ReturnValue_t UartComIF::initializeInterface(CookieIF* cookie) { + + std::string deviceFile; + UartDeviceMapIter uartDeviceMapIter; + + if(cookie == nullptr) { + return NULLPOINTER; + } + + UartCookie* uartCookie = dynamic_cast(cookie); + if (uartCookie == nullptr) { + sif::error << "UartComIF::initializeInterface: Invalid UART Cookie!" << std::endl; + return NULLPOINTER; + } + + deviceFile = uartCookie->getDeviceFile(); + + uartDeviceMapIter = uartDeviceMap.find(deviceFile); + if(uartDeviceMapIter == uartDeviceMap.end()) { + int fileDescriptor = configureUartPort(uartCookie); + if (fileDescriptor < 0) { + return RETURN_FAILED; + } + size_t maxReplyLen = uartCookie->getMaxReplyLen(); + UartElements uartElements = {fileDescriptor, std::vector(maxReplyLen), 0}; + auto status = uartDeviceMap.emplace(deviceFile, uartElements); + if (status.second == false) { + sif::warning << "UartComIF::initializeInterface: Failed to insert device " << + deviceFile << "to UART device map" << std::endl; + return RETURN_FAILED; + } + } + else { + sif::warning << "UartComIF::initializeInterface: UART device " << deviceFile << + " already in use" << std::endl; + return RETURN_FAILED; + } + + return RETURN_OK; +} + +int UartComIF::configureUartPort(UartCookie* uartCookie) { + + struct termios options = {}; + + std::string deviceFile = uartCookie->getDeviceFile(); + int fd = open(deviceFile.c_str(), O_RDWR); + + if (fd < 0) { + sif::warning << "UartComIF::configureUartPort: Failed to open uart " << deviceFile << + "with error code " << errno << strerror(errno) << std::endl; + return fd; + } + + /* Read in existing settings */ + if(tcgetattr(fd, &options) != 0) { + sif::warning << "UartComIF::configureUartPort: Error " << errno << "from tcgetattr: " + << strerror(errno) << std::endl; + return fd; + } + + setParityOptions(&options, uartCookie); + setStopBitOptions(&options, uartCookie); + setDatasizeOptions(&options, uartCookie); + setFixedOptions(&options); + setUartMode(&options, *uartCookie); + if(uartCookie->getInputShouldBeFlushed()) { + tcflush(fd, TCIFLUSH); + } + + /* Sets uart to non-blocking mode. Read returns immediately when there are no data available */ + options.c_cc[VTIME] = 0; + options.c_cc[VMIN] = 0; + + configureBaudrate(&options, uartCookie); + + /* Save option settings */ + if (tcsetattr(fd, TCSANOW, &options) != 0) { + sif::warning << "UartComIF::configureUartPort: Failed to set options with error " << + errno << ": " << strerror(errno); + return fd; + } + return fd; +} + +void UartComIF::setParityOptions(struct termios* options, UartCookie* uartCookie) { + /* Clear parity bit */ + options->c_cflag &= ~PARENB; + switch (uartCookie->getParity()) { + case Parity::EVEN: + options->c_cflag |= PARENB; + options->c_cflag &= ~PARODD; + break; + case Parity::ODD: + options->c_cflag |= PARENB; + options->c_cflag |= PARODD; + break; + default: + break; + } +} + +void UartComIF::setStopBitOptions(struct termios* options, UartCookie* uartCookie) { + /* Clear stop field. Sets stop bit to one bit */ + options->c_cflag &= ~CSTOPB; + switch (uartCookie->getStopBits()) { + case StopBits::TWO_STOP_BITS: + options->c_cflag |= CSTOPB; + break; + default: + break; + } +} + +void UartComIF::setDatasizeOptions(struct termios* options, UartCookie* uartCookie) { + /* Clear size bits */ + options->c_cflag &= ~CSIZE; + switch (uartCookie->getBitsPerWord()) { + case 5: + options->c_cflag |= CS5; + break; + case 6: + options->c_cflag |= CS6; + break; + case 7: + options->c_cflag |= CS7; + break; + case 8: + options->c_cflag |= CS8; + break; + default: + sif::warning << "UartComIF::setDatasizeOptions: Invalid size specified" << std::endl; + break; + } +} + +void UartComIF::setFixedOptions(struct termios* options) { + /* Disable RTS/CTS hardware flow control */ + options->c_cflag &= ~CRTSCTS; + /* Turn on READ & ignore ctrl lines (CLOCAL = 1) */ + options->c_cflag |= CREAD | CLOCAL; + /* Disable echo */ + options->c_lflag &= ~ECHO; + /* Disable erasure */ + options->c_lflag &= ~ECHOE; + /* Disable new-line echo */ + options->c_lflag &= ~ECHONL; + /* Disable interpretation of INTR, QUIT and SUSP */ + options->c_lflag &= ~ISIG; + /* Turn off s/w flow ctrl */ + options->c_iflag &= ~(IXON | IXOFF | IXANY); + /* Disable any special handling of received bytes */ + options->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL); + /* Prevent special interpretation of output bytes (e.g. newline chars) */ + options->c_oflag &= ~OPOST; + /* Prevent conversion of newline to carriage return/line feed */ + options->c_oflag &= ~ONLCR; +} + +void UartComIF::configureBaudrate(struct termios* options, UartCookie* uartCookie) { + switch (uartCookie->getBaudrate()) { + case 50: + cfsetispeed(options, B50); + cfsetospeed(options, B50); + break; + case 75: + cfsetispeed(options, B75); + cfsetospeed(options, B75); + break; + case 110: + cfsetispeed(options, B110); + cfsetospeed(options, B110); + break; + case 134: + cfsetispeed(options, B134); + cfsetospeed(options, B134); + break; + case 150: + cfsetispeed(options, B150); + cfsetospeed(options, B150); + break; + case 200: + cfsetispeed(options, B200); + cfsetospeed(options, B200); + break; + case 300: + cfsetispeed(options, B300); + cfsetospeed(options, B300); + break; + case 600: + cfsetispeed(options, B600); + cfsetospeed(options, B600); + break; + case 1200: + cfsetispeed(options, B1200); + cfsetospeed(options, B1200); + break; + case 1800: + cfsetispeed(options, B1800); + cfsetospeed(options, B1800); + break; + case 2400: + cfsetispeed(options, B2400); + cfsetospeed(options, B2400); + break; + case 4800: + cfsetispeed(options, B4800); + cfsetospeed(options, B4800); + break; + case 9600: + cfsetispeed(options, B9600); + cfsetospeed(options, B9600); + break; + case 19200: + cfsetispeed(options, B19200); + cfsetospeed(options, B19200); + break; + case 38400: + cfsetispeed(options, B38400); + cfsetospeed(options, B38400); + break; + case 57600: + cfsetispeed(options, B57600); + cfsetospeed(options, B57600); + break; + case 115200: + cfsetispeed(options, B115200); + cfsetospeed(options, B115200); + break; + case 230400: + cfsetispeed(options, B230400); + cfsetospeed(options, B230400); + break; + case 460800: + cfsetispeed(options, B460800); + cfsetospeed(options, B460800); + break; + default: + sif::warning << "UartComIF::configureBaudrate: Baudrate not supported" << std::endl; + break; + } +} + +ReturnValue_t UartComIF::sendMessage(CookieIF *cookie, + const uint8_t *sendData, size_t sendLen) { + + int fd = 0; + std::string deviceFile; + UartDeviceMapIter uartDeviceMapIter; + + if(sendData == nullptr) { + sif::debug << "UartComIF::sendMessage: Send Data is nullptr" << std::endl; + return RETURN_FAILED; + } + + if(sendLen == 0) { + return RETURN_OK; + } + + UartCookie* uartCookie = dynamic_cast(cookie); + if(uartCookie == nullptr) { + sif::debug << "UartComIF::sendMessasge: Invalid UART Cookie!" << std::endl; + return NULLPOINTER; + } + + deviceFile = uartCookie->getDeviceFile(); + uartDeviceMapIter = uartDeviceMap.find(deviceFile); + if (uartDeviceMapIter == uartDeviceMap.end()) { + sif::debug << "UartComIF::sendMessage: Device file " << deviceFile << + "not in UART map" << std::endl; + return RETURN_FAILED; + } + + fd = uartDeviceMapIter->second.fileDescriptor; + + if (write(fd, sendData, sendLen) != (int)sendLen) { + sif::error << "UartComIF::sendMessage: Failed to send data with error code " << + errno << ": Error description: " << strerror(errno) << std::endl; + return RETURN_FAILED; + } + + return RETURN_OK; +} + +ReturnValue_t UartComIF::getSendSuccess(CookieIF *cookie) { + return RETURN_OK; +} + +ReturnValue_t UartComIF::requestReceiveMessage(CookieIF *cookie, size_t requestLen) { + std::string deviceFile; + UartDeviceMapIter uartDeviceMapIter; + + UartCookie* uartCookie = dynamic_cast(cookie); + if(uartCookie == nullptr) { + sif::debug << "UartComIF::requestReceiveMessage: Invalid Uart Cookie!" << std::endl; + return NULLPOINTER; + } + + UartModes uartMode = uartCookie->getUartMode(); + deviceFile = uartCookie->getDeviceFile(); + uartDeviceMapIter = uartDeviceMap.find(deviceFile); + + if(uartMode == UartModes::NON_CANONICAL and requestLen == 0) { + return RETURN_OK; + } + + if (uartDeviceMapIter == uartDeviceMap.end()) { + sif::debug << "UartComIF::requestReceiveMessage: Device file " << deviceFile + << " not in uart map" << std::endl; + return RETURN_FAILED; + } + + if (uartMode == UartModes::CANONICAL) { + return handleCanonicalRead(*uartCookie, uartDeviceMapIter, requestLen); + } + else if (uartMode == UartModes::NON_CANONICAL) { + return handleNoncanonicalRead(*uartCookie, uartDeviceMapIter, requestLen); + } + else { + return HasReturnvaluesIF::RETURN_FAILED; + } +} + +ReturnValue_t UartComIF::handleCanonicalRead(UartCookie& uartCookie, UartDeviceMapIter& iter, + size_t requestLen) { + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + uint8_t maxReadCycles = uartCookie.getReadCycles(); + uint8_t currentReadCycles = 0; + int bytesRead = 0; + size_t currentBytesRead = 0; + size_t maxReplySize = uartCookie.getMaxReplyLen(); + int fd = iter->second.fileDescriptor; + auto bufferPtr = iter->second.replyBuffer.data(); + do { + size_t allowedReadSize = 0; + if(currentBytesRead >= maxReplySize) { + // Overflow risk. Emit warning, trigger event and break. If this happens, + // the reception buffer is not large enough or data is not polled often enough. +#if OBSW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "UartComIF::requestReceiveMessage: Next read would cause overflow!" + << std::endl; +#else + sif::printWarning("UartComIF::requestReceiveMessage: " + "Next read would cause overflow!"); +#endif +#endif + result = UART_RX_BUFFER_TOO_SMALL; + break; + } + else { + allowedReadSize = maxReplySize - currentBytesRead; + } + + bytesRead = read(fd, bufferPtr, allowedReadSize); + if (bytesRead < 0) { + return RETURN_FAILED; + } + else if(bytesRead > 0) { + iter->second.replyLen += bytesRead; + bufferPtr += bytesRead; + currentBytesRead += bytesRead; + } + currentReadCycles++; + } while(bytesRead > 0 and currentReadCycles < maxReadCycles); + return result; +} + +ReturnValue_t UartComIF::handleNoncanonicalRead(UartCookie &uartCookie, UartDeviceMapIter &iter, + size_t requestLen) { + int fd = iter->second.fileDescriptor; + auto bufferPtr = iter->second.replyBuffer.data(); + // Size check to prevent buffer overflow + if(requestLen > uartCookie.getMaxReplyLen()) { +#if OBSW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "UartComIF::requestReceiveMessage: Next read would cause overflow!" + << std::endl; +#else + sif::printWarning("UartComIF::requestReceiveMessage: " + "Next read would cause overflow!"); +#endif +#endif + return UART_RX_BUFFER_TOO_SMALL; + } + int bytesRead = read(fd, bufferPtr, requestLen); + if (bytesRead < 0) { + return RETURN_FAILED; + } + else if (bytesRead != static_cast(requestLen)) { + if(uartCookie.isReplySizeFixed()) { + sif::warning << "UartComIF::requestReceiveMessage: Only read " << bytesRead << + " of " << requestLen << " bytes" << std::endl; + return RETURN_FAILED; + } + } + iter->second.replyLen = bytesRead; + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t UartComIF::readReceivedMessage(CookieIF *cookie, + uint8_t **buffer, size_t* size) { + + std::string deviceFile; + UartDeviceMapIter uartDeviceMapIter; + + UartCookie* uartCookie = dynamic_cast(cookie); + if(uartCookie == nullptr) { + sif::debug << "UartComIF::readReceivedMessage: Invalid uart cookie!" << std::endl; + return NULLPOINTER; + } + + deviceFile = uartCookie->getDeviceFile(); + uartDeviceMapIter = uartDeviceMap.find(deviceFile); + if (uartDeviceMapIter == uartDeviceMap.end()) { + sif::debug << "UartComIF::readReceivedMessage: Device file " << deviceFile << + " not in uart map" << std::endl; + return RETURN_FAILED; + } + + *buffer = uartDeviceMapIter->second.replyBuffer.data(); + *size = uartDeviceMapIter->second.replyLen; + + /* Length is reset to 0 to prevent reading the same data twice */ + uartDeviceMapIter->second.replyLen = 0; + + return RETURN_OK; +} + +void UartComIF::setUartMode(struct termios *options, UartCookie &uartCookie) { + UartModes uartMode = uartCookie.getUartMode(); + if(uartMode == UartModes::NON_CANONICAL) { + /* Disable canonical mode */ + options->c_lflag &= ~ICANON; + } + else if(uartMode == UartModes::CANONICAL) { + options->c_lflag |= ICANON; + } +} diff --git a/hal/src/linux/uart/UartCookie.cpp b/hal/src/linux/uart/UartCookie.cpp new file mode 100644 index 00000000..2e9cede9 --- /dev/null +++ b/hal/src/linux/uart/UartCookie.cpp @@ -0,0 +1,97 @@ +#include "UartCookie.h" + +#include + +UartCookie::UartCookie(object_id_t handlerId, std::string deviceFile, UartModes uartMode, + uint32_t baudrate, size_t maxReplyLen): + handlerId(handlerId), deviceFile(deviceFile), uartMode(uartMode), baudrate(baudrate), + maxReplyLen(maxReplyLen) { +} + +UartCookie::~UartCookie() {} + +uint32_t UartCookie::getBaudrate() const { + return baudrate; +} + +size_t UartCookie::getMaxReplyLen() const { + return maxReplyLen; +} + +std::string UartCookie::getDeviceFile() const { + return deviceFile; +} + +void UartCookie::setParityOdd() { + parity = Parity::ODD; +} + +void UartCookie::setParityEven() { + parity = Parity::EVEN; +} + +Parity UartCookie::getParity() const { + return parity; +} + +void UartCookie::setBitsPerWord(uint8_t bitsPerWord_) { + switch(bitsPerWord_) { + case 5: + case 6: + case 7: + case 8: + break; + default: + sif::debug << "UartCookie::setBitsPerWord: Invalid bits per word specified" << std::endl; + return; + } + bitsPerWord = bitsPerWord_; +} + +uint8_t UartCookie::getBitsPerWord() const { + return bitsPerWord; +} + +StopBits UartCookie::getStopBits() const { + return stopBits; +} + +void UartCookie::setTwoStopBits() { + stopBits = StopBits::TWO_STOP_BITS; +} + +void UartCookie::setOneStopBit() { + stopBits = StopBits::ONE_STOP_BIT; +} + +UartModes UartCookie::getUartMode() const { + return uartMode; +} + +void UartCookie::setReadCycles(uint8_t readCycles) { + this->readCycles = readCycles; +} + +void UartCookie::setToFlushInput(bool enable) { + this->flushInput = enable; +} + +uint8_t UartCookie::getReadCycles() const { + return readCycles; +} + +bool UartCookie::getInputShouldBeFlushed() { + return this->flushInput; +} + +object_id_t UartCookie::getHandlerId() const { + return this->handlerId; +} + +void UartCookie::setNoFixedSizeReply() { + replySizeFixed = false; +} + +bool UartCookie::isReplySizeFixed() { + return replySizeFixed; +} diff --git a/hal/src/linux/utility.cpp b/hal/src/linux/utility.cpp new file mode 100644 index 00000000..c63b8014 --- /dev/null +++ b/hal/src/linux/utility.cpp @@ -0,0 +1,21 @@ +#include + +void utility::handleIoctlError(const char* const customPrintout) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + if(customPrintout != nullptr) { + sif::warning << customPrintout << std::endl; + } + sif::warning << "handleIoctlError: Error code " << errno << ", "<< strerror(errno) << + std::endl; +#else + if(customPrintout != nullptr) { + sif::printWarning("%s\n", customPrintout); + } + sif::printWarning("handleIoctlError: Error code %d, %s\n", errno, strerror(errno)); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + +} + + diff --git a/hal/src/stm32h7/CMakeLists.txt b/hal/src/stm32h7/CMakeLists.txt new file mode 100644 index 00000000..63c13734 --- /dev/null +++ b/hal/src/stm32h7/CMakeLists.txt @@ -0,0 +1,7 @@ +add_subdirectory(spi) +add_subdirectory(gpio) +add_subdirectory(devicetest) + +target_sources(${LIB_FSFW_HAL_NAME} PRIVATE + dma.cpp +) diff --git a/hal/src/stm32h7/devicetest/CMakeLists.txt b/hal/src/stm32h7/devicetest/CMakeLists.txt new file mode 100644 index 00000000..1ee43134 --- /dev/null +++ b/hal/src/stm32h7/devicetest/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${LIB_FSFW_HAL_NAME} PRIVATE + GyroL3GD20H.cpp +) \ No newline at end of file diff --git a/hal/src/stm32h7/devicetest/GyroL3GD20H.cpp b/hal/src/stm32h7/devicetest/GyroL3GD20H.cpp new file mode 100644 index 00000000..8176c3c2 --- /dev/null +++ b/hal/src/stm32h7/devicetest/GyroL3GD20H.cpp @@ -0,0 +1,559 @@ +#include "GyroL3GD20H.h" + +#include "../spi/mspInit.h" +#include "../spi/spiDefinitions.h" +#include "../spi/spiCore.h" +#include "../spi/spiInterrupts.h" +#include "../spi/stm32h743ziSpi.h" + +#include "fsfw/tasks/TaskFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" + +#include "stm32h7xx_nucleo.h" +#include "stm32h7xx_hal_spi.h" +#include "stm32h7xx_hal_rcc.h" + +#include + +alignas(32) std::array GyroL3GD20H::rxBuffer; +alignas(32) std::array +GyroL3GD20H::txBuffer __attribute__((section(".dma_buffer"))); + +TransferStates transferState = TransferStates::IDLE; +spi::TransferModes GyroL3GD20H::transferMode = spi::TransferModes::POLLING; + + +GyroL3GD20H::GyroL3GD20H(SPI_HandleTypeDef *spiHandle, spi::TransferModes transferMode_): + spiHandle(spiHandle) { + txDmaHandle = new DMA_HandleTypeDef(); + rxDmaHandle = new DMA_HandleTypeDef(); + spi::setSpiHandle(spiHandle); + spi::assignSpiUserArgs(spi::SpiBus::SPI_1, spiHandle); + transferMode = transferMode_; + if(transferMode == spi::TransferModes::DMA) { + mspCfg = new spi::MspDmaConfigStruct(); + auto typedCfg = dynamic_cast(mspCfg); + spi::setDmaHandles(txDmaHandle, rxDmaHandle); + spi::h743zi::standardDmaCfg(*typedCfg, IrqPriorities::HIGHEST_FREERTOS, + IrqPriorities::HIGHEST_FREERTOS, IrqPriorities::HIGHEST_FREERTOS); + spi::setSpiDmaMspFunctions(typedCfg); + } + else if(transferMode == spi::TransferModes::INTERRUPT) { + mspCfg = new spi::MspIrqConfigStruct(); + auto typedCfg = dynamic_cast(mspCfg); + spi::h743zi::standardInterruptCfg(*typedCfg, IrqPriorities::HIGHEST_FREERTOS); + spi::setSpiIrqMspFunctions(typedCfg); + } + else if(transferMode == spi::TransferModes::POLLING) { + mspCfg = new spi::MspPollingConfigStruct(); + auto typedCfg = dynamic_cast(mspCfg); + spi::h743zi::standardPollingCfg(*typedCfg); + spi::setSpiPollingMspFunctions(typedCfg); + } + + spi::assignTransferRxTxCompleteCallback(&spiTransferCompleteCallback, nullptr); + spi::assignTransferErrorCallback(&spiTransferErrorCallback, nullptr); + + GPIO_InitTypeDef chipSelect = {}; + __HAL_RCC_GPIOD_CLK_ENABLE(); + chipSelect.Pin = GPIO_PIN_14; + chipSelect.Mode = GPIO_MODE_OUTPUT_PP; + HAL_GPIO_Init(GPIOD, &chipSelect); + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_SET); +} + +GyroL3GD20H::~GyroL3GD20H() { + delete txDmaHandle; + delete rxDmaHandle; + if(mspCfg != nullptr) { + delete mspCfg; + } +} + +ReturnValue_t GyroL3GD20H::initialize() { + // Configure the SPI peripheral + spiHandle->Instance = SPI1; + spiHandle->Init.BaudRatePrescaler = spi::getPrescaler(HAL_RCC_GetHCLKFreq(), 3900000); + spiHandle->Init.Direction = SPI_DIRECTION_2LINES; + spi::assignSpiMode(spi::SpiModes::MODE_3, *spiHandle); + spiHandle->Init.DataSize = SPI_DATASIZE_8BIT; + spiHandle->Init.FirstBit = SPI_FIRSTBIT_MSB; + spiHandle->Init.TIMode = SPI_TIMODE_DISABLE; + spiHandle->Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE; + spiHandle->Init.CRCPolynomial = 7; + spiHandle->Init.CRCLength = SPI_CRC_LENGTH_8BIT; + spiHandle->Init.NSS = SPI_NSS_SOFT; + spiHandle->Init.NSSPMode = SPI_NSS_PULSE_DISABLE; + // Recommended setting to avoid glitches + spiHandle->Init.MasterKeepIOState = SPI_MASTER_KEEP_IO_STATE_ENABLE; + spiHandle->Init.Mode = SPI_MODE_MASTER; + if(HAL_SPI_Init(spiHandle) != HAL_OK) { + sif::printWarning("Error initializing SPI\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + + delete mspCfg; + transferState = TransferStates::WAIT; + + sif::printInfo("GyroL3GD20H::performOperation: Reading WHO AM I register\n"); + + txBuffer[0] = WHO_AM_I_REG | STM_READ_MASK; + txBuffer[1] = 0; + + switch(transferMode) { + case(spi::TransferModes::DMA): { + return handleDmaTransferInit(); + } + case(spi::TransferModes::INTERRUPT): { + return handleInterruptTransferInit(); + } + case(spi::TransferModes::POLLING): { + return handlePollingTransferInit(); + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t GyroL3GD20H::performOperation() { + switch(transferMode) { + case(spi::TransferModes::DMA): { + return handleDmaSensorRead(); + } + case(spi::TransferModes::POLLING): { + return handlePollingSensorRead(); + } + case(spi::TransferModes::INTERRUPT): { + return handleInterruptSensorRead(); + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t GyroL3GD20H::handleDmaTransferInit() { + /* Clean D-cache */ + /* Make sure the address is 32-byte aligned and add 32-bytes to length, + in case it overlaps cacheline */ + // See https://community.st.com/s/article/FAQ-DMA-is-not-working-on-STM32H7-devices + HAL_StatusTypeDef result = performDmaTransfer(2); + if(result != HAL_OK) { + // Transfer error in transmission process + sif::printWarning("GyroL3GD20H::initialize: Error transmitting SPI with DMA\n"); + } + + // Wait for the transfer to complete + while (transferState == TransferStates::WAIT) { + TaskFactory::delayTask(1); + } + + switch(transferState) { + case(TransferStates::SUCCESS): { + uint8_t whoAmIVal = rxBuffer[1]; + if(whoAmIVal != EXPECTED_WHO_AM_I_VAL) { + sif::printDebug("GyroL3GD20H::initialize: " + "Read WHO AM I value %d not equal to expected value!\n", whoAmIVal); + } + transferState = TransferStates::IDLE; + break; + } + case(TransferStates::FAILURE): { + sif::printWarning("Transfer failure\n"); + transferState = TransferStates::FAILURE; + return HasReturnvaluesIF::RETURN_FAILED; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + + sif::printInfo("GyroL3GD20H::initialize: Configuring device\n"); + // Configure the 5 configuration registers + uint8_t configRegs[5]; + prepareConfigRegs(configRegs); + + result = performDmaTransfer(6); + if(result != HAL_OK) { + // Transfer error in transmission process + sif::printWarning("Error transmitting SPI with DMA\n"); + } + + // Wait for the transfer to complete + while (transferState == TransferStates::WAIT) { + TaskFactory::delayTask(1); + } + + switch(transferState) { + case(TransferStates::SUCCESS): { + sif::printInfo("GyroL3GD20H::initialize: Configuration transfer success\n"); + transferState = TransferStates::IDLE; + break; + } + case(TransferStates::FAILURE): { + sif::printWarning("GyroL3GD20H::initialize: Configuration transfer failure\n"); + transferState = TransferStates::FAILURE; + return HasReturnvaluesIF::RETURN_FAILED; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + + + txBuffer[0] = CTRL_REG_1 | STM_AUTO_INCREMENT_MASK | STM_READ_MASK; + std::memset(txBuffer.data() + 1, 0 , 5); + result = performDmaTransfer(6); + if(result != HAL_OK) { + // Transfer error in transmission process + sif::printWarning("Error transmitting SPI with DMA\n"); + } + // Wait for the transfer to complete + while (transferState == TransferStates::WAIT) { + TaskFactory::delayTask(1); + } + + switch(transferState) { + case(TransferStates::SUCCESS): { + if(rxBuffer[1] != configRegs[0] or rxBuffer[2] != configRegs[1] or + rxBuffer[3] != configRegs[2] or rxBuffer[4] != configRegs[3] or + rxBuffer[5] != configRegs[4]) { + sif::printWarning("GyroL3GD20H::initialize: Configuration failure\n"); + } + else { + sif::printInfo("GyroL3GD20H::initialize: Configuration success\n"); + } + transferState = TransferStates::IDLE; + break; + } + case(TransferStates::FAILURE): { + sif::printWarning("GyroL3GD20H::initialize: Configuration transfer failure\n"); + transferState = TransferStates::FAILURE; + return HasReturnvaluesIF::RETURN_FAILED; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t GyroL3GD20H::handleDmaSensorRead() { + txBuffer[0] = CTRL_REG_1 | STM_AUTO_INCREMENT_MASK | STM_READ_MASK; + std::memset(txBuffer.data() + 1, 0 , 14); + + HAL_StatusTypeDef result = performDmaTransfer(15); + if(result != HAL_OK) { + // Transfer error in transmission process + sif::printDebug("GyroL3GD20H::handleDmaSensorRead: Error transmitting SPI with DMA\n"); + } + // Wait for the transfer to complete + while (transferState == TransferStates::WAIT) { + TaskFactory::delayTask(1); + } + + switch(transferState) { + case(TransferStates::SUCCESS): { + handleSensorReadout(); + break; + } + case(TransferStates::FAILURE): { + sif::printWarning("GyroL3GD20H::handleDmaSensorRead: Sensor read failure\n"); + transferState = TransferStates::FAILURE; + return HasReturnvaluesIF::RETURN_FAILED; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + return HasReturnvaluesIF::RETURN_OK; +} + +HAL_StatusTypeDef GyroL3GD20H::performDmaTransfer(size_t sendSize) { + transferState = TransferStates::WAIT; +#if STM_USE_PERIPHERAL_TX_BUFFER_MPU_PROTECTION == 0 + SCB_CleanDCache_by_Addr((uint32_t*)(((uint32_t)txBuffer.data()) & ~(uint32_t)0x1F), + txBuffer.size()+32); +#endif + + // Start SPI transfer via DMA + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_RESET); + return HAL_SPI_TransmitReceive_DMA(spiHandle, txBuffer.data(), rxBuffer.data(), sendSize); +} + +ReturnValue_t GyroL3GD20H::handlePollingTransferInit() { + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_RESET); + auto result = HAL_SPI_TransmitReceive(spiHandle, txBuffer.data(), rxBuffer.data(), 2, 1000); + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_SET); + switch(result) { + case(HAL_OK): { + sif::printInfo("GyroL3GD20H::initialize: Polling transfer success\n"); + uint8_t whoAmIVal = rxBuffer[1]; + if(whoAmIVal != EXPECTED_WHO_AM_I_VAL) { + sif::printDebug("GyroL3GD20H::performOperation: " + "Read WHO AM I value %d not equal to expected value!\n", whoAmIVal); + } + break; + } + case(HAL_TIMEOUT): { + sif::printDebug("GyroL3GD20H::initialize: Polling transfer timeout\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + case(HAL_ERROR): { + sif::printDebug("GyroL3GD20H::initialize: Polling transfer failure\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + + sif::printInfo("GyroL3GD20H::initialize: Configuring device\n"); + // Configure the 5 configuration registers + uint8_t configRegs[5]; + prepareConfigRegs(configRegs); + + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_RESET); + result = HAL_SPI_TransmitReceive(spiHandle, txBuffer.data(), rxBuffer.data(), 6, 1000); + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_SET); + switch(result) { + case(HAL_OK): { + break; + } + case(HAL_TIMEOUT): { + sif::printDebug("GyroL3GD20H::initialize: Polling transfer timeout\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + case(HAL_ERROR): { + sif::printDebug("GyroL3GD20H::initialize: Polling transfer failure\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + + txBuffer[0] = CTRL_REG_1 | STM_AUTO_INCREMENT_MASK | STM_READ_MASK; + std::memset(txBuffer.data() + 1, 0 , 5); + + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_RESET); + result = HAL_SPI_TransmitReceive(spiHandle, txBuffer.data(), rxBuffer.data(), 6, 1000); + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_SET); + switch(result) { + case(HAL_OK): { + if(rxBuffer[1] != configRegs[0] or rxBuffer[2] != configRegs[1] or + rxBuffer[3] != configRegs[2] or rxBuffer[4] != configRegs[3] or + rxBuffer[5] != configRegs[4]) { + sif::printWarning("GyroL3GD20H::initialize: Configuration failure\n"); + } + else { + sif::printInfo("GyroL3GD20H::initialize: Configuration success\n"); + } + break; + } + case(HAL_TIMEOUT): { + sif::printDebug("GyroL3GD20H::initialize: Polling transfer timeout\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + case(HAL_ERROR): { + sif::printDebug("GyroL3GD20H::initialize: Polling transfer failure\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t GyroL3GD20H::handlePollingSensorRead() { + txBuffer[0] = CTRL_REG_1 | STM_AUTO_INCREMENT_MASK | STM_READ_MASK; + std::memset(txBuffer.data() + 1, 0 , 14); + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_RESET); + auto result = HAL_SPI_TransmitReceive(spiHandle, txBuffer.data(), rxBuffer.data(), 15, 1000); + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_SET); + + switch(result) { + case(HAL_OK): { + handleSensorReadout(); + break; + } + case(HAL_TIMEOUT): { + sif::printDebug("GyroL3GD20H::initialize: Polling transfer timeout\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + case(HAL_ERROR): { + sif::printDebug("GyroL3GD20H::initialize: Polling transfer failure\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t GyroL3GD20H::handleInterruptTransferInit() { + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_RESET); + switch(HAL_SPI_TransmitReceive_IT(spiHandle, txBuffer.data(), rxBuffer.data(), 2)) { + case(HAL_OK): { + sif::printInfo("GyroL3GD20H::initialize: Interrupt transfer success\n"); + // Wait for the transfer to complete + while (transferState == TransferStates::WAIT) { + TaskFactory::delayTask(1); + } + + uint8_t whoAmIVal = rxBuffer[1]; + if(whoAmIVal != EXPECTED_WHO_AM_I_VAL) { + sif::printDebug("GyroL3GD20H::initialize: " + "Read WHO AM I value %d not equal to expected value!\n", whoAmIVal); + } + break; + } + case(HAL_BUSY): + case(HAL_ERROR): + case(HAL_TIMEOUT): { + sif::printDebug("GyroL3GD20H::initialize: Initialization failure using interrupts\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + } + + sif::printInfo("GyroL3GD20H::initialize: Configuring device\n"); + transferState = TransferStates::WAIT; + // Configure the 5 configuration registers + uint8_t configRegs[5]; + prepareConfigRegs(configRegs); + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_RESET); + switch(HAL_SPI_TransmitReceive_IT(spiHandle, txBuffer.data(), rxBuffer.data(), 6)) { + case(HAL_OK): { + // Wait for the transfer to complete + while (transferState == TransferStates::WAIT) { + TaskFactory::delayTask(1); + } + break; + } + case(HAL_BUSY): + case(HAL_ERROR): + case(HAL_TIMEOUT): { + sif::printDebug("GyroL3GD20H::initialize: Initialization failure using interrupts\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + } + + txBuffer[0] = CTRL_REG_1 | STM_AUTO_INCREMENT_MASK | STM_READ_MASK; + std::memset(txBuffer.data() + 1, 0 , 5); + transferState = TransferStates::WAIT; + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_RESET); + switch(HAL_SPI_TransmitReceive_IT(spiHandle, txBuffer.data(), rxBuffer.data(), 6)) { + case(HAL_OK): { + // Wait for the transfer to complete + while (transferState == TransferStates::WAIT) { + TaskFactory::delayTask(1); + } + if(rxBuffer[1] != configRegs[0] or rxBuffer[2] != configRegs[1] or + rxBuffer[3] != configRegs[2] or rxBuffer[4] != configRegs[3] or + rxBuffer[5] != configRegs[4]) { + sif::printWarning("GyroL3GD20H::initialize: Configuration failure\n"); + } + else { + sif::printInfo("GyroL3GD20H::initialize: Configuration success\n"); + } + break; + } + case(HAL_BUSY): + case(HAL_ERROR): + case(HAL_TIMEOUT): { + sif::printDebug("GyroL3GD20H::initialize: Initialization failure using interrupts\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t GyroL3GD20H::handleInterruptSensorRead() { + transferState = TransferStates::WAIT; + txBuffer[0] = CTRL_REG_1 | STM_AUTO_INCREMENT_MASK | STM_READ_MASK; + std::memset(txBuffer.data() + 1, 0 , 14); + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_RESET); + switch(HAL_SPI_TransmitReceive_IT(spiHandle, txBuffer.data(), rxBuffer.data(), 15)) { + case(HAL_OK): { + // Wait for the transfer to complete + while (transferState == TransferStates::WAIT) { + TaskFactory::delayTask(1); + } + handleSensorReadout(); + break; + } + case(HAL_BUSY): + case(HAL_ERROR): + case(HAL_TIMEOUT): { + sif::printDebug("GyroL3GD20H::initialize: Sensor read failure using interrupts\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + } + return HasReturnvaluesIF::RETURN_OK; +} + +void GyroL3GD20H::prepareConfigRegs(uint8_t* configRegs) { + // Enable sensor + configRegs[0] = 0b00001111; + configRegs[1] = 0b00000000; + configRegs[2] = 0b00000000; + // Big endian select + configRegs[3] = 0b01000000; + configRegs[4] = 0b00000000; + + txBuffer[0] = CTRL_REG_1 | STM_AUTO_INCREMENT_MASK; + std::memcpy(txBuffer.data() + 1, configRegs, 5); +} + +uint8_t GyroL3GD20H::readRegPolling(uint8_t reg) { + uint8_t rxBuf[2] = {}; + uint8_t txBuf[2] = {}; + txBuf[0] = reg | STM_READ_MASK; + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_RESET); + auto result = HAL_SPI_TransmitReceive(spiHandle, txBuf, rxBuf, 2, 1000); + if(result) {}; + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_SET); + return rxBuf[1]; +} + +void GyroL3GD20H::handleSensorReadout() { + uint8_t statusReg = rxBuffer[8]; + int16_t gyroXRaw = rxBuffer[9] << 8 | rxBuffer[10]; + float gyroX = static_cast(gyroXRaw) * 0.00875; + int16_t gyroYRaw = rxBuffer[11] << 8 | rxBuffer[12]; + float gyroY = static_cast(gyroYRaw) * 0.00875; + int16_t gyroZRaw = rxBuffer[13] << 8 | rxBuffer[14]; + float gyroZ = static_cast(gyroZRaw) * 0.00875; + sif::printInfo("Status register: 0b" BYTE_TO_BINARY_PATTERN "\n", BYTE_TO_BINARY(statusReg)); + sif::printInfo("Gyro X: %f\n", gyroX); + sif::printInfo("Gyro Y: %f\n", gyroY); + sif::printInfo("Gyro Z: %f\n", gyroZ); +} + + +void GyroL3GD20H::spiTransferCompleteCallback(SPI_HandleTypeDef *hspi, void* args) { + transferState = TransferStates::SUCCESS; + HAL_GPIO_WritePin(GPIOD, GPIO_PIN_14, GPIO_PIN_SET); + if(GyroL3GD20H::transferMode == spi::TransferModes::DMA) { + // Invalidate cache prior to access by CPU + SCB_InvalidateDCache_by_Addr ((uint32_t *)GyroL3GD20H::rxBuffer.data(), + GyroL3GD20H::recvBufferSize); + } +} + +/** + * @brief SPI error callbacks. + * @param hspi: SPI handle + * @note This example shows a simple way to report transfer error, and you can + * add your own implementation. + * @retval None + */ +void GyroL3GD20H::spiTransferErrorCallback(SPI_HandleTypeDef *hspi, void* args) { + transferState = TransferStates::FAILURE; +} diff --git a/hal/src/stm32h7/dma.cpp b/hal/src/stm32h7/dma.cpp new file mode 100644 index 00000000..91fb3382 --- /dev/null +++ b/hal/src/stm32h7/dma.cpp @@ -0,0 +1,83 @@ +#include +#include +#include + +user_handler_t DMA_1_USER_HANDLERS[8]; +user_args_t DMA_1_USER_ARGS[8]; + +user_handler_t DMA_2_USER_HANDLERS[8]; +user_args_t DMA_2_USER_ARGS[8]; + +void dma::assignDmaUserHandler(DMAIndexes dma_idx, DMAStreams stream_idx, + user_handler_t user_handler, user_args_t user_args) { + if(dma_idx == DMA_1) { + DMA_1_USER_HANDLERS[stream_idx] = user_handler; + DMA_1_USER_ARGS[stream_idx] = user_args; + } + else if(dma_idx == DMA_2) { + DMA_2_USER_HANDLERS[stream_idx] = user_handler; + DMA_2_USER_ARGS[stream_idx] = user_args; + } +} + +// The interrupt handlers in the format required for the IRQ vector table + +/* Do not change these function names! They need to be exactly equal to the name of the functions +defined in the startup_stm32h743xx.s files! */ + +#define GENERIC_DMA_IRQ_HANDLER(DMA_IDX, STREAM_IDX) \ + if(DMA_##DMA_IDX##_USER_HANDLERS[STREAM_IDX] != NULL) { \ + DMA_##DMA_IDX##_USER_HANDLERS[STREAM_IDX](DMA_##DMA_IDX##_USER_ARGS[STREAM_IDX]); \ + return; \ + } \ + Default_Handler() \ + +extern"C" void DMA1_Stream0_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(1, 0); +} +extern"C" void DMA1_Stream1_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(1, 1); +} +extern"C" void DMA1_Stream2_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(1, 2); +} +extern"C" void DMA1_Stream3_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(1, 3); +} +extern"C" void DMA1_Stream4_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(1, 4); +} +extern"C" void DMA1_Stream5_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(1, 5); +} +extern"C" void DMA1_Stream6_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(1, 6); +} +extern"C" void DMA1_Stream7_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(1, 7); +} + +extern"C" void DMA2_Stream0_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(2, 0); +} +extern"C" void DMA2_Stream1_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(2, 1); +} +extern"C" void DMA2_Stream2_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(2, 2); +} +extern"C" void DMA2_Stream3_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(2, 3); +} +extern"C" void DMA2_Stream4_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(2, 4); +} +extern"C" void DMA2_Stream5_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(2, 5); +} +extern"C" void DMA2_Stream6_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(2, 6); +} +extern"C" void DMA2_Stream7_IRQHandler() { + GENERIC_DMA_IRQ_HANDLER(2, 7); +} diff --git a/hal/src/stm32h7/gpio/CMakeLists.txt b/hal/src/stm32h7/gpio/CMakeLists.txt new file mode 100644 index 00000000..66027dd9 --- /dev/null +++ b/hal/src/stm32h7/gpio/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${LIB_FSFW_HAL_NAME} PRIVATE + gpio.cpp +) diff --git a/hal/src/stm32h7/gpio/gpio.cpp b/hal/src/stm32h7/gpio/gpio.cpp new file mode 100644 index 00000000..50873f75 --- /dev/null +++ b/hal/src/stm32h7/gpio/gpio.cpp @@ -0,0 +1,71 @@ +#include "gpio.h" + +#include "stm32h7xx_hal_rcc.h" + +void gpio::initializeGpioClock(GPIO_TypeDef* gpioPort) { +#ifdef GPIOA + if(gpioPort == GPIOA) { + __HAL_RCC_GPIOA_CLK_ENABLE(); + } +#endif + +#ifdef GPIOB + if(gpioPort == GPIOB) { + __HAL_RCC_GPIOB_CLK_ENABLE(); + } +#endif + +#ifdef GPIOC + if(gpioPort == GPIOC) { + __HAL_RCC_GPIOC_CLK_ENABLE(); + } +#endif + +#ifdef GPIOD + if(gpioPort == GPIOD) { + __HAL_RCC_GPIOD_CLK_ENABLE(); + } +#endif + +#ifdef GPIOE + if(gpioPort == GPIOE) { + __HAL_RCC_GPIOE_CLK_ENABLE(); + } +#endif + +#ifdef GPIOF + if(gpioPort == GPIOF) { + __HAL_RCC_GPIOF_CLK_ENABLE(); + } +#endif + +#ifdef GPIOG + if(gpioPort == GPIOG) { + __HAL_RCC_GPIOG_CLK_ENABLE(); + } +#endif + +#ifdef GPIOH + if(gpioPort == GPIOH) { + __HAL_RCC_GPIOH_CLK_ENABLE(); + } +#endif + +#ifdef GPIOI + if(gpioPort == GPIOI) { + __HAL_RCC_GPIOI_CLK_ENABLE(); + } +#endif + +#ifdef GPIOJ + if(gpioPort == GPIOJ) { + __HAL_RCC_GPIOJ_CLK_ENABLE(); + } +#endif + +#ifdef GPIOK + if(gpioPort == GPIOK) { + __HAL_RCC_GPIOK_CLK_ENABLE(); + } +#endif +} diff --git a/hal/src/stm32h7/i2c/CMakeLists.txt b/hal/src/stm32h7/i2c/CMakeLists.txt new file mode 100644 index 00000000..aa3194a9 --- /dev/null +++ b/hal/src/stm32h7/i2c/CMakeLists.txt @@ -0,0 +1,2 @@ +target_sources(${LIB_FSFW_HAL_NAME} PRIVATE +) diff --git a/hal/src/stm32h7/spi/CMakeLists.txt b/hal/src/stm32h7/spi/CMakeLists.txt new file mode 100644 index 00000000..fb4f6474 --- /dev/null +++ b/hal/src/stm32h7/spi/CMakeLists.txt @@ -0,0 +1,9 @@ +target_sources(${LIB_FSFW_HAL_NAME} PRIVATE + spiCore.cpp + spiDefinitions.cpp + spiInterrupts.cpp + mspInit.cpp + SpiCookie.cpp + SpiComIF.cpp + stm32h743ziSpi.cpp +) diff --git a/hal/src/stm32h7/spi/SpiComIF.cpp b/hal/src/stm32h7/spi/SpiComIF.cpp new file mode 100644 index 00000000..732fb5ea --- /dev/null +++ b/hal/src/stm32h7/spi/SpiComIF.cpp @@ -0,0 +1,453 @@ +#include "SpiComIF.h" +#include "SpiCookie.h" + +#include "fsfw/tasks/SemaphoreFactory.h" +#include "fsfw/osal/FreeRTOS/TaskManagement.h" +#include "fsfw_hal/stm32h7/spi/spiCore.h" +#include "fsfw_hal/stm32h7/spi/spiInterrupts.h" +#include "fsfw_hal/stm32h7/spi/mspInit.h" +#include "fsfw_hal/stm32h7/gpio/gpio.h" + +#include "stm32h7xx_hal_gpio.h" + +SpiComIF::SpiComIF(object_id_t objectId): SystemObject(objectId) { + void* irqArgsVoided = reinterpret_cast(&irqArgs); + spi::assignTransferRxTxCompleteCallback(&spiTransferCompleteCallback, irqArgsVoided); + spi::assignTransferRxCompleteCallback(&spiTransferRxCompleteCallback, irqArgsVoided); + spi::assignTransferTxCompleteCallback(&spiTransferTxCompleteCallback, irqArgsVoided); + spi::assignTransferErrorCallback(&spiTransferErrorCallback, irqArgsVoided); +} + +void SpiComIF::configureCacheMaintenanceOnTxBuffer(bool enable) { + this->cacheMaintenanceOnTxBuffer = enable; +} + +void SpiComIF::addDmaHandles(DMA_HandleTypeDef *txHandle, DMA_HandleTypeDef *rxHandle) { + spi::setDmaHandles(txHandle, rxHandle); +} + +ReturnValue_t SpiComIF::initialize() { + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t SpiComIF::initializeInterface(CookieIF *cookie) { + SpiCookie* spiCookie = dynamic_cast(cookie); + if(spiCookie == nullptr) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error < "SpiComIF::initializeInterface: Invalid cookie" << std::endl; +#else + sif::printError("SpiComIF::initializeInterface: Invalid cookie\n"); +#endif + return NULLPOINTER; + } + auto transferMode = spiCookie->getTransferMode(); + + if(transferMode == spi::TransferModes::DMA) { + DMA_HandleTypeDef *txHandle = nullptr; + DMA_HandleTypeDef *rxHandle = nullptr; + spi::getDmaHandles(&txHandle, &rxHandle); + if(txHandle == nullptr or rxHandle == nullptr) { + sif::printError("SpiComIF::initialize: DMA handles not set!\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + } + // This semaphore ensures thread-safety for a given bus + spiSemaphore = dynamic_cast( + SemaphoreFactory::instance()->createBinarySemaphore()); + address_t spiAddress = spiCookie->getDeviceAddress(); + + auto iter = spiDeviceMap.find(spiAddress); + if(iter == spiDeviceMap.end()) { + size_t bufferSize = spiCookie->getMaxRecvSize(); + auto statusPair = spiDeviceMap.emplace(spiAddress, SpiInstance(bufferSize)); + if (not statusPair.second) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "SpiComIF::initializeInterface: Failed to insert device with address " << + spiAddress << "to SPI device map" << std::endl; +#else + sif::printError("SpiComIF::initializeInterface: Failed to insert device with address " + "%lu to SPI device map\n", static_cast(spiAddress)); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + return HasReturnvaluesIF::RETURN_FAILED; + } + } + auto gpioPin = spiCookie->getChipSelectGpioPin(); + auto gpioPort = spiCookie->getChipSelectGpioPort(); + + SPI_HandleTypeDef& spiHandle = spiCookie->getSpiHandle(); + + auto spiIdx = spiCookie->getSpiIdx(); + if(spiIdx == spi::SpiBus::SPI_1) { +#ifdef SPI1 + spiHandle.Instance = SPI1; +#endif + } + else if(spiIdx == spi::SpiBus::SPI_2) { +#ifdef SPI2 + spiHandle.Instance = SPI2; +#endif + } + else { + printCfgError("SPI Bus Index"); + return HasReturnvaluesIF::RETURN_FAILED; + } + + auto mspCfg = spiCookie->getMspCfg(); + + if(transferMode == spi::TransferModes::POLLING) { + auto typedCfg = dynamic_cast(mspCfg); + if(typedCfg == nullptr) { + printCfgError("Polling MSP"); + return HasReturnvaluesIF::RETURN_FAILED; + } + spi::setSpiPollingMspFunctions(typedCfg); + } + else if(transferMode == spi::TransferModes::INTERRUPT) { + auto typedCfg = dynamic_cast(mspCfg); + if(typedCfg == nullptr) { + printCfgError("IRQ MSP"); + return HasReturnvaluesIF::RETURN_FAILED; + } + spi::setSpiIrqMspFunctions(typedCfg); + } + else if(transferMode == spi::TransferModes::DMA) { + auto typedCfg = dynamic_cast(mspCfg); + if(typedCfg == nullptr) { + printCfgError("DMA MSP"); + return HasReturnvaluesIF::RETURN_FAILED; + } + // Check DMA handles + DMA_HandleTypeDef* txHandle = nullptr; + DMA_HandleTypeDef* rxHandle = nullptr; + spi::getDmaHandles(&txHandle, &rxHandle); + if(txHandle == nullptr or rxHandle == nullptr) { + printCfgError("DMA Handle"); + return HasReturnvaluesIF::RETURN_FAILED; + } + spi::setSpiDmaMspFunctions(typedCfg); + } + + gpio::initializeGpioClock(gpioPort); + GPIO_InitTypeDef chipSelect = {}; + chipSelect.Pin = gpioPin; + chipSelect.Mode = GPIO_MODE_OUTPUT_PP; + HAL_GPIO_Init(gpioPort, &chipSelect); + HAL_GPIO_WritePin(gpioPort, gpioPin, GPIO_PIN_SET); + + if(HAL_SPI_Init(&spiHandle) != HAL_OK) { + sif::printWarning("SpiComIF::initialize: Error initializing SPI\n"); + return HasReturnvaluesIF::RETURN_FAILED; + } + // The MSP configuration struct is not required anymore + spiCookie->deleteMspCfg(); + + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t SpiComIF::sendMessage(CookieIF *cookie, const uint8_t *sendData, size_t sendLen) { + SpiCookie* spiCookie = dynamic_cast(cookie); + if(spiCookie == nullptr) { + return NULLPOINTER; + } + + SPI_HandleTypeDef& spiHandle = spiCookie->getSpiHandle(); + + auto iter = spiDeviceMap.find(spiCookie->getDeviceAddress()); + if(iter == spiDeviceMap.end()) { + return HasReturnvaluesIF::RETURN_FAILED; + } + iter->second.currentTransferLen = sendLen; + + auto transferMode = spiCookie->getTransferMode(); + switch(spiCookie->getTransferState()) { + case(spi::TransferStates::IDLE): { + break; + } + case(spi::TransferStates::WAIT): + case(spi::TransferStates::FAILURE): + case(spi::TransferStates::SUCCESS): + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + + switch(transferMode) { + case(spi::TransferModes::POLLING): { + return handlePollingSendOperation(iter->second.replyBuffer.data(), spiHandle, *spiCookie, + sendData, sendLen); + } + case(spi::TransferModes::INTERRUPT): { + return handleInterruptSendOperation(iter->second.replyBuffer.data(), spiHandle, *spiCookie, + sendData, sendLen); + } + case(spi::TransferModes::DMA): { + return handleDmaSendOperation(iter->second.replyBuffer.data(), spiHandle, *spiCookie, + sendData, sendLen); + } + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t SpiComIF::getSendSuccess(CookieIF *cookie) { + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t SpiComIF::requestReceiveMessage(CookieIF *cookie, size_t requestLen) { + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t SpiComIF::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) { + SpiCookie* spiCookie = dynamic_cast(cookie); + if(spiCookie == nullptr) { + return NULLPOINTER; + } + switch(spiCookie->getTransferState()) { + case(spi::TransferStates::SUCCESS): { + auto iter = spiDeviceMap.find(spiCookie->getDeviceAddress()); + if(iter == spiDeviceMap.end()) { + return HasReturnvaluesIF::RETURN_FAILED; + } + *buffer = iter->second.replyBuffer.data(); + *size = iter->second.currentTransferLen; + spiCookie->setTransferState(spi::TransferStates::IDLE); + break; + } + case(spi::TransferStates::FAILURE): { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "SpiComIF::readReceivedMessage: Transfer failure" << std::endl; +#else + sif::printWarning("SpiComIF::readReceivedMessage: Transfer failure\n"); +#endif +#endif + spiCookie->setTransferState(spi::TransferStates::IDLE); + return HasReturnvaluesIF::RETURN_FAILED; + } + case(spi::TransferStates::WAIT): + case(spi::TransferStates::IDLE): { + break; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } + + return HasReturnvaluesIF::RETURN_OK; +} + +void SpiComIF::setDefaultPollingTimeout(dur_millis_t timeout) { + this->defaultPollingTimeout = timeout; +} + +ReturnValue_t SpiComIF::handlePollingSendOperation(uint8_t* recvPtr, SPI_HandleTypeDef& spiHandle, + SpiCookie& spiCookie, const uint8_t *sendData, size_t sendLen) { + auto gpioPort = spiCookie.getChipSelectGpioPort(); + auto gpioPin = spiCookie.getChipSelectGpioPin(); + auto returnval = spiSemaphore->acquire(timeoutType, timeoutMs); + if(returnval != HasReturnvaluesIF::RETURN_OK) { + return returnval; + } + spiCookie.setTransferState(spi::TransferStates::WAIT); + HAL_GPIO_WritePin(gpioPort, gpioPin, GPIO_PIN_RESET); + auto result = HAL_SPI_TransmitReceive(&spiHandle, const_cast(sendData), + recvPtr, sendLen, defaultPollingTimeout); + HAL_GPIO_WritePin(gpioPort, gpioPin, GPIO_PIN_SET); + spiSemaphore->release(); + switch(result) { + case(HAL_OK): { + spiCookie.setTransferState(spi::TransferStates::SUCCESS); + break; + } + case(HAL_TIMEOUT): { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "SpiComIF::sendMessage: Polling Mode | Timeout for SPI device" << + spiCookie->getDeviceAddress() << std::endl; +#else + sif::printWarning("SpiComIF::sendMessage: Polling Mode | Timeout for SPI device %d\n", + spiCookie.getDeviceAddress()); +#endif +#endif + spiCookie.setTransferState(spi::TransferStates::FAILURE); + return spi::HAL_TIMEOUT_RETVAL; + } + case(HAL_ERROR): + default: { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "SpiComIF::sendMessage: Polling Mode | HAL error for SPI device" << + spiCookie->getDeviceAddress() << std::endl; +#else + sif::printWarning("SpiComIF::sendMessage: Polling Mode | HAL error for SPI device %d\n", + spiCookie.getDeviceAddress()); +#endif +#endif + spiCookie.setTransferState(spi::TransferStates::FAILURE); + return spi::HAL_ERROR_RETVAL; + } + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t SpiComIF::handleInterruptSendOperation(uint8_t* recvPtr, SPI_HandleTypeDef& spiHandle, + SpiCookie& spiCookie, const uint8_t * sendData, size_t sendLen) { + return handleIrqSendOperation(recvPtr, spiHandle, spiCookie, sendData, sendLen); +} + +ReturnValue_t SpiComIF::handleDmaSendOperation(uint8_t* recvPtr, SPI_HandleTypeDef& spiHandle, + SpiCookie& spiCookie, const uint8_t * sendData, size_t sendLen) { + return handleIrqSendOperation(recvPtr, spiHandle, spiCookie, sendData, sendLen); +} + +ReturnValue_t SpiComIF::handleIrqSendOperation(uint8_t *recvPtr, SPI_HandleTypeDef& spiHandle, + SpiCookie& spiCookie, const uint8_t *sendData, size_t sendLen) { + ReturnValue_t result = genericIrqSendSetup(recvPtr, spiHandle, spiCookie, sendData, sendLen); + if(result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + // yet another HAL driver which is not const-correct.. + HAL_StatusTypeDef status = HAL_OK; + auto transferMode = spiCookie.getTransferMode(); + if(transferMode == spi::TransferModes::DMA) { + if(cacheMaintenanceOnTxBuffer) { + /* Clean D-cache. Make sure the address is 32-byte aligned and add 32-bytes to length, + in case it overlaps cacheline */ + SCB_CleanDCache_by_Addr((uint32_t*)(((uint32_t) sendData ) & ~(uint32_t)0x1F), + sendLen + 32); + } + status = HAL_SPI_TransmitReceive_DMA(&spiHandle, const_cast(sendData), + currentRecvPtr, sendLen); + } + else { + status = HAL_SPI_TransmitReceive_IT(&spiHandle, const_cast(sendData), + currentRecvPtr, sendLen); + } + switch(status) { + case(HAL_OK): { + break; + } + default: { + return halErrorHandler(status, transferMode); + } + } + return result; +} + +ReturnValue_t SpiComIF::halErrorHandler(HAL_StatusTypeDef status, spi::TransferModes transferMode) { + char modeString[10]; + if(transferMode == spi::TransferModes::DMA) { + std::snprintf(modeString, sizeof(modeString), "Dma"); + } + else { + std::snprintf(modeString, sizeof(modeString), "Interrupt"); + } + sif::printWarning("SpiComIF::handle%sSendOperation: HAL error %d occured\n", modeString, + status); + switch(status) { + case(HAL_BUSY): { + return spi::HAL_BUSY_RETVAL; + } + case(HAL_ERROR): { + return spi::HAL_ERROR_RETVAL; + } + case(HAL_TIMEOUT): { + return spi::HAL_TIMEOUT_RETVAL; + } + default: { + return HasReturnvaluesIF::RETURN_FAILED; + } + } +} + + +ReturnValue_t SpiComIF::genericIrqSendSetup(uint8_t *recvPtr, SPI_HandleTypeDef& spiHandle, + SpiCookie& spiCookie, const uint8_t *sendData, size_t sendLen) { + currentRecvPtr = recvPtr; + currentRecvBuffSize = sendLen; + + // Take the semaphore which will be released by a callback when the transfer is complete + ReturnValue_t result = spiSemaphore->acquire(SemaphoreIF::TimeoutType::WAITING, timeoutMs); + if(result != HasReturnvaluesIF::RETURN_OK) { + // Configuration error + sif::printWarning("SpiComIF::handleInterruptSendOperation: Semaphore " + "could not be acquired after %d ms\n", timeoutMs); + return result; + } + // Cache the current SPI handle in any case + spi::setSpiHandle(&spiHandle); + // Assign the IRQ arguments for the user callbacks + irqArgs.comIF = this; + irqArgs.spiCookie = &spiCookie; + // The SPI handle is passed to the default SPI callback as a void argument. This callback + // is different from the user callbacks specified above! + spi::assignSpiUserArgs(spiCookie.getSpiIdx(), reinterpret_cast(&spiHandle)); + HAL_GPIO_WritePin(spiCookie.getChipSelectGpioPort(), spiCookie.getChipSelectGpioPin(), + GPIO_PIN_RESET); + return HasReturnvaluesIF::RETURN_OK; +} + +void SpiComIF::spiTransferTxCompleteCallback(SPI_HandleTypeDef *hspi, void *args) { + genericIrqHandler(args, spi::TransferStates::SUCCESS); +} + +void SpiComIF::spiTransferRxCompleteCallback(SPI_HandleTypeDef *hspi, void *args) { + genericIrqHandler(args, spi::TransferStates::SUCCESS); +} + +void SpiComIF::spiTransferCompleteCallback(SPI_HandleTypeDef *hspi, void *args) { + genericIrqHandler(args, spi::TransferStates::SUCCESS); +} + +void SpiComIF::spiTransferErrorCallback(SPI_HandleTypeDef *hspi, void *args) { + genericIrqHandler(args, spi::TransferStates::FAILURE); +} + +void SpiComIF::genericIrqHandler(void *irqArgsVoid, spi::TransferStates targetState) { + IrqArgs* irqArgs = reinterpret_cast(irqArgsVoid); + if(irqArgs == nullptr) { + return; + } + SpiCookie* spiCookie = irqArgs->spiCookie; + SpiComIF* comIF = irqArgs->comIF; + if(spiCookie == nullptr or comIF == nullptr) { + return; + } + + spiCookie->setTransferState(targetState); + + // Pull CS pin high again + HAL_GPIO_WritePin(spiCookie->getChipSelectGpioPort(), spiCookie->getChipSelectGpioPin(), + GPIO_PIN_SET); + + // Release the task semaphore + BaseType_t taskWoken = pdFALSE; + ReturnValue_t result = BinarySemaphore::releaseFromISR(comIF->spiSemaphore->getSemaphore(), + &taskWoken); + if(result != HasReturnvaluesIF::RETURN_OK) { + // Configuration error + printf("SpiComIF::genericIrqHandler: Failure releasing Semaphore!\n"); + } + + // Perform cache maintenance operation for DMA transfers + if(spiCookie->getTransferMode() == spi::TransferModes::DMA) { + // Invalidate cache prior to access by CPU + SCB_InvalidateDCache_by_Addr ((uint32_t *) comIF->currentRecvPtr, + comIF->currentRecvBuffSize); + } + /* Request a context switch if the SPI ComIF task was woken up and has a higher priority + than the currently running task */ + if(taskWoken == pdTRUE) { + TaskManagement::requestContextSwitch(CallContext::ISR); + } +} + +void SpiComIF::printCfgError(const char *const type) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "SpiComIF::initializeInterface: Invalid " << type << " configuration" + << std::endl; +#else + sif::printWarning("SpiComIF::initializeInterface: Invalid %s configuration\n", type); +#endif +} diff --git a/hal/src/stm32h7/spi/SpiCookie.cpp b/hal/src/stm32h7/spi/SpiCookie.cpp new file mode 100644 index 00000000..06c0ac5f --- /dev/null +++ b/hal/src/stm32h7/spi/SpiCookie.cpp @@ -0,0 +1,78 @@ +#include "SpiCookie.h" + + +SpiCookie::SpiCookie(address_t deviceAddress, spi::SpiBus spiIdx, spi::TransferModes transferMode, + spi::MspCfgBase* mspCfg, uint32_t spiSpeed, spi::SpiModes spiMode, + uint16_t chipSelectGpioPin, GPIO_TypeDef* chipSelectGpioPort, size_t maxRecvSize): + deviceAddress(deviceAddress), spiIdx(spiIdx), spiSpeed(spiSpeed), spiMode(spiMode), + transferMode(transferMode), chipSelectGpioPin(chipSelectGpioPin), + chipSelectGpioPort(chipSelectGpioPort), mspCfg(mspCfg), maxRecvSize(maxRecvSize) { + spiHandle.Init.DataSize = SPI_DATASIZE_8BIT; + spiHandle.Init.FirstBit = SPI_FIRSTBIT_MSB; + spiHandle.Init.TIMode = SPI_TIMODE_DISABLE; + spiHandle.Init.CRCCalculation = SPI_CRCCALCULATION_DISABLE; + spiHandle.Init.CRCPolynomial = 7; + spiHandle.Init.CRCLength = SPI_CRC_LENGTH_8BIT; + spiHandle.Init.NSS = SPI_NSS_SOFT; + spiHandle.Init.NSSPMode = SPI_NSS_PULSE_DISABLE; + spiHandle.Init.Direction = SPI_DIRECTION_2LINES; + // Recommended setting to avoid glitches + spiHandle.Init.MasterKeepIOState = SPI_MASTER_KEEP_IO_STATE_ENABLE; + spiHandle.Init.Mode = SPI_MODE_MASTER; + spi::assignSpiMode(spiMode, spiHandle); + spiHandle.Init.BaudRatePrescaler = spi::getPrescaler(HAL_RCC_GetHCLKFreq(), spiSpeed); +} + +uint16_t SpiCookie::getChipSelectGpioPin() const { + return chipSelectGpioPin; +} + +GPIO_TypeDef* SpiCookie::getChipSelectGpioPort() { + return chipSelectGpioPort; +} + +address_t SpiCookie::getDeviceAddress() const { + return deviceAddress; +} + +spi::SpiBus SpiCookie::getSpiIdx() const { + return spiIdx; +} + +spi::SpiModes SpiCookie::getSpiMode() const { + return spiMode; +} + +uint32_t SpiCookie::getSpiSpeed() const { + return spiSpeed; +} + +size_t SpiCookie::getMaxRecvSize() const { + return maxRecvSize; +} + +SPI_HandleTypeDef& SpiCookie::getSpiHandle() { + return spiHandle; +} + +spi::MspCfgBase* SpiCookie::getMspCfg() { + return mspCfg; +} + +void SpiCookie::deleteMspCfg() { + if(mspCfg != nullptr) { + delete mspCfg; + } +} + +spi::TransferModes SpiCookie::getTransferMode() const { + return transferMode; +} + +void SpiCookie::setTransferState(spi::TransferStates transferState) { + this->transferState = transferState; +} + +spi::TransferStates SpiCookie::getTransferState() const { + return this->transferState; +} diff --git a/hal/src/stm32h7/spi/mspInit.cpp b/hal/src/stm32h7/spi/mspInit.cpp new file mode 100644 index 00000000..80d2ffe0 --- /dev/null +++ b/hal/src/stm32h7/spi/mspInit.cpp @@ -0,0 +1,252 @@ +#include +#include "mspInit.h" +#include "spiCore.h" +#include "spiInterrupts.h" +#include "stm32h743xx.h" +#include "stm32h7xx_hal_spi.h" +#include "stm32h7xx_hal_dma.h" +#include "stm32h7xx_hal_def.h" + +#include + +spi::msp_func_t mspInitFunc = nullptr; +spi::MspCfgBase* mspInitArgs = nullptr; + +spi::msp_func_t mspDeinitFunc = nullptr; +spi::MspCfgBase* mspDeinitArgs = nullptr; + +/** + * @brief SPI MSP Initialization + * This function configures the hardware resources used in this example: + * - Peripheral's clock enable + * - Peripheral's GPIO Configuration + * - DMA configuration for transmission request by peripheral + * - NVIC configuration for DMA interrupt request enable + * @param hspi: SPI handle pointer + * @retval None + */ +void spi::halMspInitDma(SPI_HandleTypeDef* hspi, MspCfgBase* cfgBase) { + auto cfg = dynamic_cast(cfgBase); + if(hspi == nullptr or cfg == nullptr) { + return; + } + setSpiHandle(hspi); + + DMA_HandleTypeDef* hdma_tx = nullptr; + DMA_HandleTypeDef* hdma_rx = nullptr; + spi::getDmaHandles(&hdma_tx, &hdma_rx); + if(hdma_tx == nullptr or hdma_rx == nullptr) { + printf("HAL_SPI_MspInit: Invalid DMA handles. Make sure to call setDmaHandles!\n"); + return; + } + + spi::halMspInitInterrupt(hspi, cfg); + + // DMA setup + if(cfg->dmaClkEnableWrapper == nullptr) { + mspErrorHandler("spi::halMspInitDma", "DMA Clock init invalid"); + } + cfg->dmaClkEnableWrapper(); + + // Configure the DMA + /* Configure the DMA handler for Transmission process */ + if(hdma_tx->Instance == nullptr) { + // Assume it was not configured properly + mspErrorHandler("spi::halMspInitDma", "DMA TX handle invalid"); + } + + HAL_DMA_Init(hdma_tx); + /* Associate the initialized DMA handle to the the SPI handle */ + __HAL_LINKDMA(hspi, hdmatx, *hdma_tx); + + HAL_DMA_Init(hdma_rx); + /* Associate the initialized DMA handle to the the SPI handle */ + __HAL_LINKDMA(hspi, hdmarx, *hdma_rx); + + /*##-4- Configure the NVIC for DMA #########################################*/ + /* NVIC configuration for DMA transfer complete interrupt (SPI1_RX) */ + // Assign the interrupt handler + dma::assignDmaUserHandler(cfg->rxDmaIndex, cfg->rxDmaStream, &spi::dmaRxIrqHandler, hdma_rx); + HAL_NVIC_SetPriority(cfg->rxDmaIrqNumber, cfg->rxPreEmptPriority, cfg->rxSubpriority); + HAL_NVIC_EnableIRQ(cfg->rxDmaIrqNumber); + + /* NVIC configuration for DMA transfer complete interrupt (SPI1_TX) */ + // Assign the interrupt handler + dma::assignDmaUserHandler(cfg->txDmaIndex, cfg->txDmaStream, + &spi::dmaTxIrqHandler, hdma_tx); + HAL_NVIC_SetPriority(cfg->txDmaIrqNumber, cfg->txPreEmptPriority, cfg->txSubpriority); + HAL_NVIC_EnableIRQ(cfg->txDmaIrqNumber); +} + +/** + * @brief SPI MSP De-Initialization + * This function frees the hardware resources used in this example: + * - Disable the Peripheral's clock + * - Revert GPIO, DMA and NVIC configuration to their default state + * @param hspi: SPI handle pointer + * @retval None + */ +void spi::halMspDeinitDma(SPI_HandleTypeDef* hspi, MspCfgBase* cfgBase) { + auto cfg = dynamic_cast(cfgBase); + if(hspi == nullptr or cfg == nullptr) { + return; + } + spi::halMspDeinitInterrupt(hspi, cfgBase); + DMA_HandleTypeDef* hdma_tx = NULL; + DMA_HandleTypeDef* hdma_rx = NULL; + spi::getDmaHandles(&hdma_tx, &hdma_rx); + if(hdma_tx == NULL || hdma_rx == NULL) { + printf("HAL_SPI_MspInit: Invalid DMA handles. Make sure to call setDmaHandles!\n"); + } + else { + // Disable the DMA + /* De-Initialize the DMA associated to transmission process */ + HAL_DMA_DeInit(hdma_tx); + /* De-Initialize the DMA associated to reception process */ + HAL_DMA_DeInit(hdma_rx); + } + + // Disable the NVIC for DMA + HAL_NVIC_DisableIRQ(cfg->txDmaIrqNumber); + HAL_NVIC_DisableIRQ(cfg->rxDmaIrqNumber); + +} + +void spi::halMspInitPolling(SPI_HandleTypeDef* hspi, MspCfgBase* cfgBase) { + auto cfg = dynamic_cast(cfgBase); + GPIO_InitTypeDef GPIO_InitStruct = {}; + /*##-1- Enable peripherals and GPIO Clocks #################################*/ + /* Enable GPIO TX/RX clock */ + cfg->setupMacroWrapper(); + + /*##-2- Configure peripheral GPIO ##########################################*/ + /* SPI SCK GPIO pin configuration */ + GPIO_InitStruct.Pin = cfg->sckPin; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_PULLDOWN; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; + GPIO_InitStruct.Alternate = cfg->sckAlternateFunction; + HAL_GPIO_Init(cfg->sckPort, &GPIO_InitStruct); + + /* SPI MISO GPIO pin configuration */ + GPIO_InitStruct.Pin = cfg->misoPin; + GPIO_InitStruct.Alternate = cfg->misoAlternateFunction; + HAL_GPIO_Init(cfg->misoPort, &GPIO_InitStruct); + + /* SPI MOSI GPIO pin configuration */ + GPIO_InitStruct.Pin = cfg->mosiPin; + GPIO_InitStruct.Alternate = cfg->mosiAlternateFunction; + HAL_GPIO_Init(cfg->mosiPort, &GPIO_InitStruct); +} + +void spi::halMspDeinitPolling(SPI_HandleTypeDef* hspi, MspCfgBase* cfgBase) { + auto cfg = reinterpret_cast(cfgBase); + // Reset peripherals + cfg->cleanUpMacroWrapper(); + + // Disable peripherals and GPIO Clocks + /* Configure SPI SCK as alternate function */ + HAL_GPIO_DeInit(cfg->sckPort, cfg->sckPin); + /* Configure SPI MISO as alternate function */ + HAL_GPIO_DeInit(cfg->misoPort, cfg->misoPin); + /* Configure SPI MOSI as alternate function */ + HAL_GPIO_DeInit(cfg->mosiPort, cfg->mosiPin); +} + +void spi::halMspInitInterrupt(SPI_HandleTypeDef* hspi, MspCfgBase* cfgBase) { + auto cfg = dynamic_cast(cfgBase); + if(cfg == nullptr or hspi == nullptr) { + return; + } + + spi::halMspInitPolling(hspi, cfg); + // Configure the NVIC for SPI + spi::assignSpiUserHandler(cfg->spiBus, cfg->spiIrqHandler, cfg->spiUserArgs); + HAL_NVIC_SetPriority(cfg->spiIrqNumber, cfg->preEmptPriority, cfg->subpriority); + HAL_NVIC_EnableIRQ(cfg->spiIrqNumber); +} + +void spi::halMspDeinitInterrupt(SPI_HandleTypeDef* hspi, MspCfgBase* cfgBase) { + auto cfg = dynamic_cast(cfgBase); + spi::halMspDeinitPolling(hspi, cfg); + // Disable the NVIC for SPI + HAL_NVIC_DisableIRQ(cfg->spiIrqNumber); +} + +void spi::getMspInitFunction(msp_func_t* init_func, MspCfgBase** args) { + if(init_func != NULL && args != NULL) { + *init_func = mspInitFunc; + *args = mspInitArgs; + } +} + +void spi::getMspDeinitFunction(msp_func_t* deinit_func, MspCfgBase** args) { + if(deinit_func != NULL && args != NULL) { + *deinit_func = mspDeinitFunc; + *args = mspDeinitArgs; + } +} + +void spi::setSpiDmaMspFunctions(MspDmaConfigStruct* cfg, + msp_func_t initFunc, msp_func_t deinitFunc) { + mspInitFunc = initFunc; + mspDeinitFunc = deinitFunc; + mspInitArgs = cfg; + mspDeinitArgs = cfg; +} + +void spi::setSpiIrqMspFunctions(MspIrqConfigStruct *cfg, msp_func_t initFunc, + msp_func_t deinitFunc) { + mspInitFunc = initFunc; + mspDeinitFunc = deinitFunc; + mspInitArgs = cfg; + mspDeinitArgs = cfg; +} + +void spi::setSpiPollingMspFunctions(MspPollingConfigStruct *cfg, msp_func_t initFunc, + msp_func_t deinitFunc) { + mspInitFunc = initFunc; + mspDeinitFunc = deinitFunc; + mspInitArgs = cfg; + mspDeinitArgs = cfg; +} + +/** + * @brief SPI MSP Initialization + * This function configures the hardware resources used in this example: + * - Peripheral's clock enable + * - Peripheral's GPIO Configuration + * - DMA configuration for transmission request by peripheral + * - NVIC configuration for DMA interrupt request enable + * @param hspi: SPI handle pointer + * @retval None + */ +extern "C" void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi) { + if(mspInitFunc != NULL) { + mspInitFunc(hspi, mspInitArgs); + } + else { + printf("HAL_SPI_MspInit: Please call set_msp_functions to assign SPI MSP functions\n"); + } +} + +/** + * @brief SPI MSP De-Initialization + * This function frees the hardware resources used in this example: + * - Disable the Peripheral's clock + * - Revert GPIO, DMA and NVIC configuration to their default state + * @param hspi: SPI handle pointer + * @retval None + */ +extern "C" void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi) { + if(mspDeinitFunc != NULL) { + mspDeinitFunc(hspi, mspDeinitArgs); + } + else { + printf("HAL_SPI_MspDeInit: Please call set_msp_functions to assign SPI MSP functions\n"); + } +} + +void spi::mspErrorHandler(const char* const function, const char *const message) { + printf("%s failure: %s\n", function, message); +} diff --git a/hal/src/stm32h7/spi/spiCore.cpp b/hal/src/stm32h7/spi/spiCore.cpp new file mode 100644 index 00000000..feec65f0 --- /dev/null +++ b/hal/src/stm32h7/spi/spiCore.cpp @@ -0,0 +1,340 @@ +#include "spiDefinitions.h" +#include "spiCore.h" +#include + +SPI_HandleTypeDef* spiHandle = nullptr; +DMA_HandleTypeDef* hdmaTx = nullptr; +DMA_HandleTypeDef* hdmaRx = nullptr; + +spi_transfer_cb_t rxTxCb = nullptr; +void* rxTxArgs = nullptr; +spi_transfer_cb_t txCb = nullptr; +void* txArgs = nullptr; +spi_transfer_cb_t rxCb = nullptr; +void* rxArgs = nullptr; +spi_transfer_cb_t errorCb = nullptr; +void* errorArgs = nullptr; + +void mapIndexAndStream(DMA_HandleTypeDef* handle, dma::DMAType dmaType, dma::DMAIndexes dmaIdx, + dma::DMAStreams dmaStream, IRQn_Type* dmaIrqNumber); +void mapSpiBus(DMA_HandleTypeDef *handle, dma::DMAType dmaType, spi::SpiBus spiBus); + +void spi::configureDmaHandle(DMA_HandleTypeDef *handle, spi::SpiBus spiBus, dma::DMAType dmaType, + dma::DMAIndexes dmaIdx, dma::DMAStreams dmaStream, IRQn_Type* dmaIrqNumber, + uint32_t dmaMode, uint32_t dmaPriority) { + using namespace dma; + mapIndexAndStream(handle, dmaType, dmaIdx, dmaStream, dmaIrqNumber); + mapSpiBus(handle, dmaType, spiBus); + + if(dmaType == DMAType::TX) { + handle->Init.Direction = DMA_MEMORY_TO_PERIPH; + } + else { + handle->Init.Direction = DMA_PERIPH_TO_MEMORY; + } + + handle->Init.Priority = dmaPriority; + handle->Init.Mode = dmaMode; + + // Standard settings for the rest for now + handle->Init.FIFOMode = DMA_FIFOMODE_DISABLE; + handle->Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL; + handle->Init.MemBurst = DMA_MBURST_INC4; + handle->Init.PeriphBurst = DMA_PBURST_INC4; + handle->Init.PeriphInc = DMA_PINC_DISABLE; + handle->Init.MemInc = DMA_MINC_ENABLE; + handle->Init.PeriphDataAlignment = DMA_PDATAALIGN_BYTE; + handle->Init.MemDataAlignment = DMA_MDATAALIGN_BYTE; +} + +void spi::setDmaHandles(DMA_HandleTypeDef* txHandle, DMA_HandleTypeDef* rxHandle) { + hdmaTx = txHandle; + hdmaRx = rxHandle; +} + +void spi::getDmaHandles(DMA_HandleTypeDef** txHandle, DMA_HandleTypeDef** rxHandle) { + *txHandle = hdmaTx; + *rxHandle = hdmaRx; +} + +void spi::setSpiHandle(SPI_HandleTypeDef *spiHandle_) { + if(spiHandle_ == NULL) { + return; + } + spiHandle = spiHandle_; +} + +void spi::assignTransferRxTxCompleteCallback(spi_transfer_cb_t callback, void *userArgs) { + rxTxCb = callback; + rxTxArgs = userArgs; +} + +void spi::assignTransferRxCompleteCallback(spi_transfer_cb_t callback, void *userArgs) { + rxCb = callback; + rxArgs = userArgs; +} + +void spi::assignTransferTxCompleteCallback(spi_transfer_cb_t callback, void *userArgs) { + txCb = callback; + txArgs = userArgs; +} + +void spi::assignTransferErrorCallback(spi_transfer_cb_t callback, void *userArgs) { + errorCb = callback; + errorArgs = userArgs; +} + +SPI_HandleTypeDef* spi::getSpiHandle() { + return spiHandle; +} + + + +/** + * @brief TxRx Transfer completed callback. + * @param hspi: SPI handle + */ +extern "C" void HAL_SPI_TxRxCpltCallback(SPI_HandleTypeDef *hspi) { + if(rxTxCb != NULL) { + rxTxCb(hspi, rxTxArgs); + } + else { + printf("HAL_SPI_TxRxCpltCallback: No user callback specified\n"); + } +} + +/** + * @brief TxRx Transfer completed callback. + * @param hspi: SPI handle + */ +extern "C" void HAL_SPI_TxCpltCallback(SPI_HandleTypeDef *hspi) { + if(txCb != NULL) { + txCb(hspi, txArgs); + } + else { + printf("HAL_SPI_TxCpltCallback: No user callback specified\n"); + } +} + +/** + * @brief TxRx Transfer completed callback. + * @param hspi: SPI handle + */ +extern "C" void HAL_SPI_RxCpltCallback(SPI_HandleTypeDef *hspi) { + if(rxCb != nullptr) { + rxCb(hspi, rxArgs); + } + else { + printf("HAL_SPI_RxCpltCallback: No user callback specified\n"); + } +} + +/** + * @brief SPI error callbacks. + * @param hspi: SPI handle + * @note This example shows a simple way to report transfer error, and you can + * add your own implementation. + * @retval None + */ +extern "C" void HAL_SPI_ErrorCallback(SPI_HandleTypeDef *hspi) { + if(errorCb != nullptr) { + errorCb(hspi, rxArgs); + } + else { + printf("HAL_SPI_ErrorCallback: No user callback specified\n"); + } +} + +void mapIndexAndStream(DMA_HandleTypeDef* handle, dma::DMAType dmaType, dma::DMAIndexes dmaIdx, + dma::DMAStreams dmaStream, IRQn_Type* dmaIrqNumber) { + using namespace dma; + if(dmaIdx == DMAIndexes::DMA_1) { +#ifdef DMA1 + switch(dmaStream) { + case(DMAStreams::STREAM_0): { +#ifdef DMA1_Stream0 + handle->Instance = DMA1_Stream0; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA1_Stream0_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_1): { +#ifdef DMA1_Stream1 + handle->Instance = DMA1_Stream1; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA1_Stream1_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_2): { +#ifdef DMA1_Stream2 + handle->Instance = DMA1_Stream2; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA1_Stream2_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_3): { +#ifdef DMA1_Stream3 + handle->Instance = DMA1_Stream3; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA1_Stream3_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_4): { +#ifdef DMA1_Stream4 + handle->Instance = DMA1_Stream4; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA1_Stream4_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_5): { +#ifdef DMA1_Stream5 + handle->Instance = DMA1_Stream5; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA1_Stream5_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_6): { +#ifdef DMA1_Stream6 + handle->Instance = DMA1_Stream6; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA1_Stream6_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_7): { +#ifdef DMA1_Stream7 + handle->Instance = DMA1_Stream7; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA1_Stream7_IRQn; + } +#endif + break; + } + } + if(dmaType == DMAType::TX) { + handle->Init.Request = DMA_REQUEST_SPI1_TX; + } + else { + handle->Init.Request = DMA_REQUEST_SPI1_RX; + } +#endif /* DMA1 */ + } + if(dmaIdx == DMAIndexes::DMA_2) { +#ifdef DMA2 + switch(dmaStream) { + case(DMAStreams::STREAM_0): { +#ifdef DMA2_Stream0 + handle->Instance = DMA2_Stream0; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA2_Stream0_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_1): { +#ifdef DMA2_Stream1 + handle->Instance = DMA2_Stream1; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA2_Stream1_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_2): { +#ifdef DMA2_Stream2 + handle->Instance = DMA2_Stream2; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA2_Stream2_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_3): { +#ifdef DMA2_Stream3 + handle->Instance = DMA2_Stream3; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA2_Stream3_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_4): { +#ifdef DMA2_Stream4 + handle->Instance = DMA2_Stream4; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA2_Stream4_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_5): { +#ifdef DMA2_Stream5 + handle->Instance = DMA2_Stream5; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA2_Stream5_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_6): { +#ifdef DMA2_Stream6 + handle->Instance = DMA2_Stream6; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA2_Stream6_IRQn; + } +#endif + break; + } + case(DMAStreams::STREAM_7): { +#ifdef DMA2_Stream7 + handle->Instance = DMA2_Stream7; + if(dmaIrqNumber != nullptr) { + *dmaIrqNumber = DMA2_Stream7_IRQn; + } +#endif + break; + } + } +#endif /* DMA2 */ + } +} + +void mapSpiBus(DMA_HandleTypeDef *handle, dma::DMAType dmaType, spi::SpiBus spiBus) { + if(dmaType == dma::DMAType::TX) { + if(spiBus == spi::SpiBus::SPI_1) { +#ifdef DMA_REQUEST_SPI1_TX + handle->Init.Request = DMA_REQUEST_SPI1_TX; +#endif + } + else if(spiBus == spi::SpiBus::SPI_2) { +#ifdef DMA_REQUEST_SPI2_TX + handle->Init.Request = DMA_REQUEST_SPI2_TX; +#endif + } + } + else { + if(spiBus == spi::SpiBus::SPI_1) { +#ifdef DMA_REQUEST_SPI1_RX + handle->Init.Request = DMA_REQUEST_SPI1_RX; +#endif + } + else if(spiBus == spi::SpiBus::SPI_2) { +#ifdef DMA_REQUEST_SPI2_RX + handle->Init.Request = DMA_REQUEST_SPI2_RX; +#endif + } + } +} diff --git a/hal/src/stm32h7/spi/spiDefinitions.cpp b/hal/src/stm32h7/spi/spiDefinitions.cpp new file mode 100644 index 00000000..fbceb934 --- /dev/null +++ b/hal/src/stm32h7/spi/spiDefinitions.cpp @@ -0,0 +1,52 @@ +#include "spiDefinitions.h" + +void spi::assignSpiMode(SpiModes spiMode, SPI_HandleTypeDef& spiHandle) { + switch(spiMode) { + case(SpiModes::MODE_0): { + spiHandle.Init.CLKPolarity = SPI_POLARITY_LOW; + spiHandle.Init.CLKPhase = SPI_PHASE_1EDGE; + break; + } + case(SpiModes::MODE_1): { + spiHandle.Init.CLKPolarity = SPI_POLARITY_LOW; + spiHandle.Init.CLKPhase = SPI_PHASE_2EDGE; + break; + } + case(SpiModes::MODE_2): { + spiHandle.Init.CLKPolarity = SPI_POLARITY_HIGH; + spiHandle.Init.CLKPhase = SPI_PHASE_1EDGE; + break; + } + case(SpiModes::MODE_3): { + spiHandle.Init.CLKPolarity = SPI_POLARITY_HIGH; + spiHandle.Init.CLKPhase = SPI_PHASE_2EDGE; + break; + } + } +} + +uint32_t spi::getPrescaler(uint32_t clock_src_freq, uint32_t baudrate_mbps) { + uint32_t divisor = 0; + uint32_t spi_clk = clock_src_freq; + uint32_t presc = 0; + static const uint32_t baudrate[] = { + SPI_BAUDRATEPRESCALER_2, + SPI_BAUDRATEPRESCALER_4, + SPI_BAUDRATEPRESCALER_8, + SPI_BAUDRATEPRESCALER_16, + SPI_BAUDRATEPRESCALER_32, + SPI_BAUDRATEPRESCALER_64, + SPI_BAUDRATEPRESCALER_128, + SPI_BAUDRATEPRESCALER_256, + }; + + while( spi_clk > baudrate_mbps) { + presc = baudrate[divisor]; + if (++divisor > 7) + break; + + spi_clk = ( spi_clk >> 1); + } + + return presc; +} diff --git a/hal/src/stm32h7/spi/spiInterrupts.cpp b/hal/src/stm32h7/spi/spiInterrupts.cpp new file mode 100644 index 00000000..83ba7322 --- /dev/null +++ b/hal/src/stm32h7/spi/spiInterrupts.cpp @@ -0,0 +1,106 @@ +#include "spiInterrupts.h" +#include "spiCore.h" + +#include "stm32h7xx_hal.h" +#include "stm32h7xx_hal_dma.h" +#include "stm32h7xx_hal_spi.h" + +#include + +user_handler_t spi1UserHandler = &spi::spiIrqHandler; +user_args_t spi1UserArgs = nullptr; + +user_handler_t spi2UserHandler = &spi::spiIrqHandler; +user_args_t spi2UserArgs = nullptr; + +/** + * @brief This function handles DMA Rx interrupt request. + * @param None + * @retval None + */ +void spi::dmaRxIrqHandler(void* dmaHandle) { + if(dmaHandle == nullptr) { + return; + } + HAL_DMA_IRQHandler((DMA_HandleTypeDef *) dmaHandle); +} + +/** + * @brief This function handles DMA Rx interrupt request. + * @param None + * @retval None + */ +void spi::dmaTxIrqHandler(void* dmaHandle) { + if(dmaHandle == nullptr) { + return; + } + HAL_DMA_IRQHandler((DMA_HandleTypeDef *) dmaHandle); +} + +/** + * @brief This function handles SPIx interrupt request. + * @param None + * @retval None + */ +void spi::spiIrqHandler(void* spiHandle) { + if(spiHandle == nullptr) { + return; + } + //auto currentSpiHandle = spi::getSpiHandle(); + HAL_SPI_IRQHandler((SPI_HandleTypeDef *) spiHandle); +} + +void spi::assignSpiUserHandler(spi::SpiBus spiIdx, user_handler_t userHandler, + user_args_t userArgs) { + if(spiIdx == spi::SpiBus::SPI_1) { + spi1UserHandler = userHandler; + spi1UserArgs = userArgs; + } + else { + spi2UserHandler = userHandler; + spi2UserArgs = userArgs; + } +} + +void spi::getSpiUserHandler(spi::SpiBus spiBus, user_handler_t *userHandler, + user_args_t *userArgs) { + if(userHandler == nullptr or userArgs == nullptr) { + return; + } + if(spiBus == spi::SpiBus::SPI_1) { + *userArgs = spi1UserArgs; + *userHandler = spi1UserHandler; + } + else { + *userArgs = spi2UserArgs; + *userHandler = spi2UserHandler; + } +} + +void spi::assignSpiUserArgs(spi::SpiBus spiBus, user_args_t userArgs) { + if(spiBus == spi::SpiBus::SPI_1) { + spi1UserArgs = userArgs; + } + else { + spi2UserArgs = userArgs; + } +} + +/* Do not change these function names! They need to be exactly equal to the name of the functions +defined in the startup_stm32h743xx.s files! */ + +extern "C" void SPI1_IRQHandler() { + if(spi1UserHandler != NULL) { + spi1UserHandler(spi1UserArgs); + return; + } + Default_Handler(); +} + +extern "C" void SPI2_IRQHandler() { + if(spi2UserHandler != nullptr) { + spi2UserHandler(spi2UserArgs); + return; + } + Default_Handler(); +} diff --git a/hal/src/stm32h7/spi/stm32h743ziSpi.cpp b/hal/src/stm32h7/spi/stm32h743ziSpi.cpp new file mode 100644 index 00000000..826ecb23 --- /dev/null +++ b/hal/src/stm32h7/spi/stm32h743ziSpi.cpp @@ -0,0 +1,81 @@ +#include "stm32h743ziSpi.h" +#include "spiCore.h" +#include "spiInterrupts.h" +#include "stm32h7xx_hal.h" +#include "stm32h7xx_hal_rcc.h" + +#include + +void spiSetupWrapper() { + __HAL_RCC_GPIOA_CLK_ENABLE(); + __HAL_RCC_GPIOB_CLK_ENABLE(); + __HAL_RCC_SPI1_CLK_ENABLE(); +} + +void spiCleanUpWrapper() { + __HAL_RCC_SPI1_FORCE_RESET(); + __HAL_RCC_SPI1_RELEASE_RESET(); +} + +void spiDmaClockEnableWrapper() { + __HAL_RCC_DMA2_CLK_ENABLE(); +} + +void spi::h743zi::standardPollingCfg(MspPollingConfigStruct& cfg) { + cfg.setupMacroWrapper = &spiSetupWrapper; + cfg.cleanUpMacroWrapper = &spiCleanUpWrapper; + cfg.sckPort = GPIOA; + cfg.sckPin = GPIO_PIN_5; + cfg.misoPort = GPIOA; + cfg.misoPin = GPIO_PIN_6; + cfg.mosiPort = GPIOA; + cfg.mosiPin = GPIO_PIN_7; + cfg.sckAlternateFunction = GPIO_AF5_SPI1; + cfg.mosiAlternateFunction = GPIO_AF5_SPI1; + cfg.misoAlternateFunction = GPIO_AF5_SPI1; +} + +void spi::h743zi::standardInterruptCfg(MspIrqConfigStruct& cfg, IrqPriorities spiIrqPrio, + IrqPriorities spiSubprio) { + // High, but works on FreeRTOS as well (priorities range from 0 to 15) + cfg.preEmptPriority = spiIrqPrio; + cfg.subpriority = spiSubprio; + cfg.spiIrqNumber = SPI1_IRQn; + cfg.spiBus = SpiBus::SPI_1; + user_handler_t spiUserHandler = nullptr; + user_args_t spiUserArgs = nullptr; + getSpiUserHandler(spi::SpiBus::SPI_1, &spiUserHandler, &spiUserArgs); + if(spiUserHandler == nullptr) { + printf("spi::h743zi::standardInterruptCfg: Invalid SPI user handlers\n"); + return; + } + cfg.spiUserArgs = spiUserArgs; + cfg.spiIrqHandler = spiUserHandler; + standardPollingCfg(cfg); +} + +void spi::h743zi::standardDmaCfg(MspDmaConfigStruct& cfg, IrqPriorities spiIrqPrio, + IrqPriorities txIrqPrio, IrqPriorities rxIrqPrio, IrqPriorities spiSubprio, + IrqPriorities txSubprio, IrqPriorities rxSubprio) { + cfg.dmaClkEnableWrapper = &spiDmaClockEnableWrapper; + cfg.rxDmaIndex = dma::DMAIndexes::DMA_2; + cfg.txDmaIndex = dma::DMAIndexes::DMA_2; + cfg.txDmaStream = dma::DMAStreams::STREAM_3; + cfg.rxDmaStream = dma::DMAStreams::STREAM_2; + DMA_HandleTypeDef* txHandle; + DMA_HandleTypeDef* rxHandle; + spi::getDmaHandles(&txHandle, &rxHandle); + if(txHandle == nullptr or rxHandle == nullptr) { + printf("spi::h743zi::standardDmaCfg: Invalid DMA handles\n"); + return; + } + spi::configureDmaHandle(txHandle, spi::SpiBus::SPI_1, dma::DMAType::TX, cfg.txDmaIndex, + cfg.txDmaStream, &cfg.txDmaIrqNumber); + spi::configureDmaHandle(rxHandle, spi::SpiBus::SPI_1, dma::DMAType::RX, cfg.rxDmaIndex, + cfg.rxDmaStream, &cfg.rxDmaIrqNumber, DMA_NORMAL, DMA_PRIORITY_HIGH); + cfg.txPreEmptPriority = txIrqPrio; + cfg.rxPreEmptPriority = txSubprio; + cfg.txSubpriority = rxIrqPrio; + cfg.rxSubpriority = rxSubprio; + standardInterruptCfg(cfg, spiIrqPrio, spiSubprio); +} diff --git a/hal/src/stm32h7/uart/CMakeLists.txt b/hal/src/stm32h7/uart/CMakeLists.txt new file mode 100644 index 00000000..aa3194a9 --- /dev/null +++ b/hal/src/stm32h7/uart/CMakeLists.txt @@ -0,0 +1,2 @@ +target_sources(${LIB_FSFW_HAL_NAME} PRIVATE +) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b4f52cb1..4d5bfc5a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,4 @@ add_subdirectory(core) -add_subdirectory(hal) add_subdirectory(opt) add_subdirectory(osal) # add_subdirectory(tests) From 936d0e9f0ce217709cf71ddc9be502526cf03e01 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 13 Jul 2021 20:22:54 +0200 Subject: [PATCH 175/389] a lot of internal include replacements --- CMakeLists.txt | 3 +++ hal/src/linux/uart/CMakeLists.txt | 4 --- inc/fsfw/action.h | 11 ++++++++ inc/fsfw/action/ActionMessage.h | 6 ++--- inc/fsfw/action/CommandActionHelper.h | 10 +++---- inc/fsfw/container/SharedRingBuffer.h | 7 ++--- inc/fsfw/controller/ControllerBase.h | 16 ++++++------ inc/fsfw/controller/ExtendedControllerBase.h | 7 +++-- .../coordinates/CoordinateTransformations.h | 2 +- inc/fsfw/coordinates/Sgp4Propagator.h | 7 ++--- inc/fsfw/datalinklayer/Clcw.h | 7 ----- inc/fsfw/datalinklayer/Farm1StateLockout.h | 7 ----- inc/fsfw/datapool/HkSwitchHelper.h | 6 ++--- inc/fsfw/datapool/PoolDataSetBase.h | 5 ++-- inc/fsfw/datapoollocal/LocalDataPoolManager.h | 22 ++++++++-------- inc/fsfw/datapoollocal/LocalPoolDataSetBase.h | 4 +-- inc/fsfw/datapoollocal/LocalPoolObjectBase.h | 6 ++--- .../internal/LocalDpManagerAttorney.h | 0 inc/fsfw/devicehandlers/HealthDevice.h | 10 +++---- inc/fsfw/events/EventMessage.h | 10 +++---- inc/fsfw/fdir/FaultCounter.h | 10 +++---- inc/fsfw/globalfunctions/Type.h | 5 ++-- inc/fsfw/health/HealthMessage.h | 2 +- inc/fsfw/housekeeping/HousekeepingMessage.h | 10 +++---- .../housekeeping/PeriodicHousekeepingHelper.h | 2 +- .../InternalErrorDataset.h | 0 .../InternalErrorReporter.h | 12 ++++----- .../InternalErrorReporterIF.h | 0 inc/fsfw/ipc/MessageQueueMessage.h | 2 +- inc/fsfw/modes/ModeHelper.h | 6 ++--- inc/fsfw/objectmanager/SystemObject.h | 6 ++--- inc/fsfw/power/PowerComponent.h | 4 +-- inc/fsfw/power/PowerSensor.h | 12 ++++----- inc/fsfw/serialize/SerialBufferAdapter.h | 4 +-- inc/fsfw/storagemanager/LocalPool.h | 13 +++++----- .../subsystem/modes/ModeSequenceMessage.h | 4 +-- inc/fsfw/tasks/FixedSequenceSlot.h | 2 +- inc/fsfw/tcdistribution/PUSDistributor.h | 8 +++--- inc/fsfw/tcdistribution/TcDistributor.h | 14 +++++----- inc/fsfw/thermal/AbstractTemperatureSensor.h | 12 ++++----- inc/fsfw/thermal/Heater.h | 11 ++++---- inc/fsfw/timemanager/Clock.h | 6 ++--- .../packetmatcher/PacketMatchTree.h | 8 +++--- inc/fsfw/tmtcpacket/pus/tc/TcPacketBase.h | 2 +- .../tmtcpacket/pus/tm/TmPacketStoredBase.h | 10 +++---- inc/fsfw/tmtcservices/CommandingServiceBase.h | 19 +++++++------- inc/fsfw/tmtcservices/PusServiceBase.h | 12 ++++----- inc/fsfw/tmtcservices/PusVerificationReport.h | 6 ++--- src/core/CMakeLists.txt | 3 +-- src/core/action/ActionHelper.cpp | 9 +++---- src/core/action/ActionMessage.cpp | 7 +++-- src/core/action/CommandActionHelper.cpp | 7 ++--- src/core/action/SimpleActionHelper.cpp | 3 +-- src/core/container/SharedRingBuffer.cpp | 6 ++--- src/core/container/SimpleRingBuffer.cpp | 3 ++- src/core/controller/ControllerBase.cpp | 10 +++---- .../controller/ExtendedControllerBase.cpp | 3 +-- src/core/datapool/HkSwitchHelper.cpp | 4 +-- src/core/datapool/PoolDataSetBase.cpp | 6 ++--- src/core/datapool/PoolEntry.cpp | 7 ++--- .../datapoollocal/LocalDataPoolManager.cpp | 22 +++++++--------- src/core/datapoollocal/LocalDataSet.cpp | 7 ++--- .../datapoollocal/LocalPoolDataSetBase.cpp | 15 +++++------ .../datapoollocal/LocalPoolObjectBase.cpp | 10 +++---- src/core/datapoollocal/SharedLocalDataSet.cpp | 2 +- .../internal/HasLocalDpIFManagerAttorney.cpp | 6 ++--- .../internal/HasLocalDpIFManagerAttorney.h | 2 +- .../internal/HasLocalDpIFUserAttorney.cpp | 4 +-- .../internal/LocalPoolDataSetAttorney.h | 2 +- src/core/devicehandlers/AssemblyBase.cpp | 2 +- src/core/devicehandlers/CMakeLists.txt | 10 +++++++ src/core/devicehandlers/ChildHandlerBase.cpp | 4 +-- src/core/devicehandlers/ChildHandlerFDIR.cpp | 2 +- src/core/devicehandlers/DeviceHandlerBase.cpp | 26 +++++++++---------- .../DeviceHandlerFailureIsolation.cpp | 16 ++++++------ .../devicehandlers/DeviceHandlerMessage.cpp | 4 +-- .../DeviceTmReportingWrapper.cpp | 4 +-- src/core/devicehandlers/HealthDevice.cpp | 4 +-- src/core/events/CMakeLists.txt | 9 +++---- src/core/events/EventManager.cpp | 8 +++--- src/core/events/EventMessage.cpp | 2 +- .../core}/events/eventmatching/CMakeLists.txt | 0 .../eventmatching/EventIdRangeMatcher.cpp | 2 +- .../events/eventmatching/EventMatchTree.cpp | 8 +++--- .../eventmatching/ReporterRangeMatcher.cpp | 2 +- .../eventmatching/SeverityRangeMatcher.cpp | 6 ++--- src/core/fdir/EventCorrelation.cpp | 2 +- src/core/fdir/FailureIsolationBase.cpp | 12 ++++----- src/core/fdir/FaultCounter.cpp | 2 +- src/core/globalfunctions/AsciiConverter.cpp | 3 ++- src/core/globalfunctions/CRC.cpp | 2 +- src/core/globalfunctions/DleEncoder.cpp | 2 +- .../PeriodicOperationDivider.cpp | 2 +- src/core/globalfunctions/Type.cpp | 4 +-- src/core/globalfunctions/arrayprinter.cpp | 5 ++-- src/core/globalfunctions/bitutility.cpp | 2 +- .../math/QuaternionOperations.cpp | 4 +-- .../globalfunctions/timevalOperations.cpp | 2 +- src/core/health/HealthHelper.cpp | 5 ++-- src/core/health/HealthMessage.cpp | 2 +- src/core/health/HealthTable.cpp | 9 ++++--- src/core/housekeeping/CMakeLists.txt | 4 +++ src/core/housekeeping/HousekeepingMessage.cpp | 5 ++-- .../PeriodicHousekeepingHelper.cpp | 4 +-- .../CMakeLists.txt | 0 .../InternalErrorReporter.cpp | 10 +++---- src/core/ipc/CommandMessage.cpp | 5 ++-- src/core/ipc/CommandMessageCleaner.cpp | 22 ++++++++-------- src/core/ipc/MessageQueueMessage.cpp | 7 ++--- src/core/memory/GenericFileSystemMessage.cpp | 6 ++--- src/core/memory/MemoryHelper.cpp | 12 ++++----- src/core/memory/MemoryMessage.cpp | 4 +-- src/core/modes/ModeHelper.cpp | 8 +++--- src/core/modes/ModeMessage.cpp | 2 +- src/core/objectmanager/ObjectManager.cpp | 4 +-- src/core/objectmanager/SystemObject.cpp | 6 ++--- src/core/parameters/ParameterHelper.cpp | 6 ++--- src/core/parameters/ParameterMessage.cpp | 4 +-- src/core/parameters/ParameterWrapper.cpp | 6 ++--- src/core/power/Fuse.cpp | 12 ++++----- src/core/power/PowerComponent.cpp | 4 +-- src/core/power/PowerSensor.cpp | 4 +-- src/core/power/PowerSwitcher.cpp | 6 ++--- src/core/serialize/SerialBufferAdapter.cpp | 4 +-- .../ServiceInterfaceBuffer.cpp | 6 ++--- .../ServiceInterfacePrinter.cpp | 8 +++--- .../ServiceInterfaceStream.cpp | 2 +- .../storagemanager/ConstStorageAccessor.cpp | 8 +++--- src/core/storagemanager/LocalPool.cpp | 6 ++--- src/core/storagemanager/PoolManager.cpp | 5 ++-- src/core/storagemanager/StorageAccessor.cpp | 7 ++--- src/core/subsystem/Subsystem.cpp | 14 +++++----- src/core/subsystem/SubsystemBase.cpp | 8 +++--- .../subsystem/modes/ModeSequenceMessage.cpp | 6 ++--- src/core/subsystem/modes/ModeStore.cpp | 2 +- src/core/tasks/FixedSequenceSlot.cpp | 5 ++-- src/core/tasks/FixedSlotSequence.cpp | 4 +-- src/core/tcdistribution/CCSDSDistributor.cpp | 8 +++--- src/core/tcdistribution/PUSDistributor.cpp | 10 +++---- src/core/tcdistribution/TcDistributor.cpp | 8 +++--- src/core/tcdistribution/TcPacketCheck.cpp | 14 +++++----- .../thermal/AbstractTemperatureSensor.cpp | 4 +-- src/core/thermal/Heater.cpp | 10 +++---- src/core/thermal/RedundantHeater.cpp | 2 +- src/core/thermal/ThermalComponent.cpp | 2 +- src/core/thermal/ThermalModule.cpp | 8 +++--- src/core/timemanager/CCSDSTime.cpp | 5 ++-- src/core/timemanager/ClockCommon.cpp | 4 +-- src/core/timemanager/Countdown.cpp | 2 +- src/core/timemanager/Stopwatch.cpp | 4 +-- src/core/tmtcpacket/SpacePacket.cpp | 12 ++++----- src/core/tmtcpacket/SpacePacketBase.cpp | 5 ++-- .../packetmatcher/PacketMatchTree.cpp | 8 +++--- src/core/tmtcpacket/pus/tc/TcPacketBase.cpp | 8 +++--- .../tmtcservices/CommandingServiceBase.cpp | 19 +++++++------- src/core/tmtcservices/PusServiceBase.cpp | 16 ++++++------ .../tmtcservices/PusVerificationReport.cpp | 4 +-- .../coordinates/CoordinateTransformations.cpp | 17 +++++++----- src/opt/coordinates/Sgp4Propagator.cpp | 15 ++++++----- src/opt/datalinklayer/Clcw.cpp | 13 ++-------- src/opt/datalinklayer/DataLinkLayer.cpp | 6 ++--- src/opt/datalinklayer/Farm1StateLockout.cpp | 16 +++--------- src/opt/datalinklayer/Farm1StateOpen.cpp | 18 +++---------- 163 files changed, 558 insertions(+), 563 deletions(-) create mode 100644 inc/fsfw/action.h rename {src/core => inc/fsfw}/datapoollocal/internal/LocalDpManagerAttorney.h (100%) rename inc/fsfw/{internalError => internalerror}/InternalErrorDataset.h (100%) rename inc/fsfw/{internalError => internalerror}/InternalErrorReporter.h (91%) rename inc/fsfw/{internalError => internalerror}/InternalErrorReporterIF.h (100%) create mode 100644 src/core/devicehandlers/CMakeLists.txt rename {inc/fsfw => src/core}/events/eventmatching/CMakeLists.txt (100%) rename {inc/fsfw => src/core}/events/eventmatching/EventIdRangeMatcher.cpp (84%) rename {inc/fsfw => src/core}/events/eventmatching/EventMatchTree.cpp (94%) rename {inc/fsfw => src/core}/events/eventmatching/ReporterRangeMatcher.cpp (84%) rename {inc/fsfw => src/core}/events/eventmatching/SeverityRangeMatcher.cpp (70%) create mode 100644 src/core/housekeeping/CMakeLists.txt rename src/core/{internalError => internalerror}/CMakeLists.txt (100%) rename src/core/{internalError => internalerror}/InternalErrorReporter.cpp (96%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1efb856f..021c3d0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,7 @@ option(FSFW_USE_DATALINKLAYER "Compile with Data Link Layer" ON) set(LIB_FSFW_NAME fsfw) add_library(${LIB_FSFW_NAME}) +set(FSFW_CORE_INC_PATH "inc") set_property(CACHE FSFW_OSAL PROPERTY STRINGS host linux rtems freertos) @@ -154,6 +155,7 @@ endif() target_include_directories(${LIB_FSFW_NAME} INTERFACE ${CMAKE_SOURCE_DIR} ${FSFW_CONFIG_PATH_ABSOLUTE} + ${FSFW_CORE_INC_PATH} ${FSFW_ADD_INC_PATHS_ABS} ) @@ -163,6 +165,7 @@ target_include_directories(${LIB_FSFW_NAME} INTERFACE target_include_directories(${LIB_FSFW_NAME} PRIVATE ${CMAKE_SOURCE_DIR} ${FSFW_CONFIG_PATH_ABSOLUTE} + ${FSFW_CORE_INC_PATH} ${FSFW_ADD_INC_PATHS_ABS} ) diff --git a/hal/src/linux/uart/CMakeLists.txt b/hal/src/linux/uart/CMakeLists.txt index 7b503d02..d8cea5a8 100644 --- a/hal/src/linux/uart/CMakeLists.txt +++ b/hal/src/linux/uart/CMakeLists.txt @@ -2,7 +2,3 @@ target_sources(${TARGET_NAME} PUBLIC UartComIF.cpp UartCookie.cpp ) - - - - diff --git a/inc/fsfw/action.h b/inc/fsfw/action.h new file mode 100644 index 00000000..543ccb0c --- /dev/null +++ b/inc/fsfw/action.h @@ -0,0 +1,11 @@ +#ifndef FSFW_INC_FSFW_ACTION_H_ +#define FSFW_INC_FSFW_ACTION_H_ + +#include "action/ActionHelper.h" +#include "action/ActionMessage.h" +#include "action/CommandActionHelper.h" +#include "action/HasActionsIF.h" +#include "action/CommandsActionsIF.h" +#include "action/SimpleActionHelper.h" + +#endif /* FSFW_INC_FSFW_ACTION_H_ */ diff --git a/inc/fsfw/action/ActionMessage.h b/inc/fsfw/action/ActionMessage.h index 0c64588c..c7570c9d 100644 --- a/inc/fsfw/action/ActionMessage.h +++ b/inc/fsfw/action/ActionMessage.h @@ -1,9 +1,9 @@ #ifndef FSFW_ACTION_ACTIONMESSAGE_H_ #define FSFW_ACTION_ACTIONMESSAGE_H_ -#include "../ipc/CommandMessage.h" -#include "../objectmanager/ObjectManagerIF.h" -#include "../storagemanager/StorageManagerIF.h" +#include "fsfw/ipc/CommandMessage.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" +#include "fsfw/storagemanager/StorageManagerIF.h" using ActionId_t = uint32_t; diff --git a/inc/fsfw/action/CommandActionHelper.h b/inc/fsfw/action/CommandActionHelper.h index 96ef1763..ce297e66 100644 --- a/inc/fsfw/action/CommandActionHelper.h +++ b/inc/fsfw/action/CommandActionHelper.h @@ -2,11 +2,11 @@ #define COMMANDACTIONHELPER_H_ #include "ActionMessage.h" -#include "../objectmanager/ObjectManagerIF.h" -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../serialize/SerializeIF.h" -#include "../storagemanager/StorageManagerIF.h" -#include "../ipc/MessageQueueIF.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/serialize/SerializeIF.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/ipc/MessageQueueIF.h" class CommandsActionsIF; diff --git a/inc/fsfw/container/SharedRingBuffer.h b/inc/fsfw/container/SharedRingBuffer.h index 9d6ea56c..26aa45c1 100644 --- a/inc/fsfw/container/SharedRingBuffer.h +++ b/inc/fsfw/container/SharedRingBuffer.h @@ -3,9 +3,10 @@ #include "SimpleRingBuffer.h" #include "DynamicFIFO.h" -#include "../ipc/MutexIF.h" -#include "../objectmanager/SystemObject.h" -#include "../timemanager/Clock.h" + +#include "fsfw/ipc/MutexIF.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/timemanager/Clock.h" /** * @brief Ring buffer which can be shared among multiple objects diff --git a/inc/fsfw/controller/ControllerBase.h b/inc/fsfw/controller/ControllerBase.h index f583342f..1efe0cc1 100644 --- a/inc/fsfw/controller/ControllerBase.h +++ b/inc/fsfw/controller/ControllerBase.h @@ -1,14 +1,14 @@ #ifndef FSFW_CONTROLLER_CONTROLLERBASE_H_ #define FSFW_CONTROLLER_CONTROLLERBASE_H_ -#include "../health/HasHealthIF.h" -#include "../health/HealthHelper.h" -#include "../modes/HasModesIF.h" -#include "../modes/ModeHelper.h" -#include "../objectmanager/SystemObject.h" -#include "../tasks/ExecutableObjectIF.h" -#include "../tasks/PeriodicTaskIF.h" -#include "../datapool/HkSwitchHelper.h" +#include "fsfw/health/HasHealthIF.h" +#include "fsfw/health/HealthHelper.h" +#include "fsfw/modes/HasModesIF.h" +#include "fsfw/modes/ModeHelper.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/tasks/PeriodicTaskIF.h" +#include "fsfw/datapool/HkSwitchHelper.h" /** * @brief Generic base class for controller classes diff --git a/inc/fsfw/controller/ExtendedControllerBase.h b/inc/fsfw/controller/ExtendedControllerBase.h index 63c350e2..4172e03e 100644 --- a/inc/fsfw/controller/ExtendedControllerBase.h +++ b/inc/fsfw/controller/ExtendedControllerBase.h @@ -3,10 +3,9 @@ #include "ControllerBase.h" -#include "../action/HasActionsIF.h" -#include "../datapoollocal/HasLocalDataPoolIF.h" -#include "../action/ActionHelper.h" -#include "../datapoollocal/LocalDataPoolManager.h" +#include "fsfw/action.h" +#include "fsfw/datapoollocal/HasLocalDataPoolIF.h" +#include "fsfw/datapoollocal/LocalDataPoolManager.h" /** * @brief Extendes the basic ControllerBase with the common components diff --git a/inc/fsfw/coordinates/CoordinateTransformations.h b/inc/fsfw/coordinates/CoordinateTransformations.h index 09ea2c48..a22e0bd4 100644 --- a/inc/fsfw/coordinates/CoordinateTransformations.h +++ b/inc/fsfw/coordinates/CoordinateTransformations.h @@ -1,7 +1,7 @@ #ifndef COORDINATETRANSFORMATIONS_H_ #define COORDINATETRANSFORMATIONS_H_ -#include "../timemanager/Clock.h" +#include "fsfw/timemanager/Clock.h" #include class CoordinateTransformations { diff --git a/inc/fsfw/coordinates/Sgp4Propagator.h b/inc/fsfw/coordinates/Sgp4Propagator.h index f813c6f4..53c5d3e5 100644 --- a/inc/fsfw/coordinates/Sgp4Propagator.h +++ b/inc/fsfw/coordinates/Sgp4Propagator.h @@ -1,11 +1,12 @@ #ifndef SGP4PROPAGATOR_H_ #define SGP4PROPAGATOR_H_ -#ifndef WIN32 +#include "fsfw/platform.h" +#ifndef PLATFORM_WIN #include #endif -#include "../contrib/sgp4/sgp4unit.h" -#include "../returnvalues/HasReturnvaluesIF.h" +#include "fsfw/contrib/sgp4/sgp4unit.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" class Sgp4Propagator { public: diff --git a/inc/fsfw/datalinklayer/Clcw.h b/inc/fsfw/datalinklayer/Clcw.h index 8116d63b..f6c77230 100644 --- a/inc/fsfw/datalinklayer/Clcw.h +++ b/inc/fsfw/datalinklayer/Clcw.h @@ -1,10 +1,3 @@ -/** - * @file Clcw.h - * @brief This file defines the Clcw class. - * @date 17.04.2013 - * @author baetz - */ - #ifndef CLCW_H_ #define CLCW_H_ diff --git a/inc/fsfw/datalinklayer/Farm1StateLockout.h b/inc/fsfw/datalinklayer/Farm1StateLockout.h index 63cdc4d2..28abf4e6 100644 --- a/inc/fsfw/datalinklayer/Farm1StateLockout.h +++ b/inc/fsfw/datalinklayer/Farm1StateLockout.h @@ -1,10 +1,3 @@ -/** - * @file Farm1StateLockout.h - * @brief This file defines the Farm1StateLockout class. - * @date 24.04.2013 - * @author baetz - */ - #ifndef FARM1STATELOCKOUT_H_ #define FARM1STATELOCKOUT_H_ diff --git a/inc/fsfw/datapool/HkSwitchHelper.h b/inc/fsfw/datapool/HkSwitchHelper.h index bb9e7dc6..611c5d86 100644 --- a/inc/fsfw/datapool/HkSwitchHelper.h +++ b/inc/fsfw/datapool/HkSwitchHelper.h @@ -1,9 +1,9 @@ #ifndef FRAMEWORK_DATAPOOL_HKSWITCHHELPER_H_ #define FRAMEWORK_DATAPOOL_HKSWITCHHELPER_H_ -#include "../tasks/ExecutableObjectIF.h" -#include "../action/CommandsActionsIF.h" -#include "../events/EventReportingProxyIF.h" +#include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/action/CommandsActionsIF.h" +#include "fsfw/events/EventReportingProxyIF.h" //TODO this class violations separation between mission and framework //but it is only a transitional solution until the Datapool is diff --git a/inc/fsfw/datapool/PoolDataSetBase.h b/inc/fsfw/datapool/PoolDataSetBase.h index 043c860a..36cf2a30 100644 --- a/inc/fsfw/datapool/PoolDataSetBase.h +++ b/inc/fsfw/datapool/PoolDataSetBase.h @@ -3,8 +3,9 @@ #include "PoolDataSetIF.h" #include "PoolVariableIF.h" -#include "../serialize/SerializeIF.h" -#include "../ipc/MutexIF.h" + +#include "fsfw/serialize/SerializeIF.h" +#include "fsfw/ipc/MutexIF.h" /** * @brief The DataSetBase class manages a set of locally checked out variables. diff --git a/inc/fsfw/datapoollocal/LocalDataPoolManager.h b/inc/fsfw/datapoollocal/LocalDataPoolManager.h index 2ec81f1c..9f91613b 100644 --- a/inc/fsfw/datapoollocal/LocalDataPoolManager.h +++ b/inc/fsfw/datapoollocal/LocalDataPoolManager.h @@ -4,17 +4,17 @@ #include "ProvidesDataPoolSubscriptionIF.h" #include "AccessLocalPoolF.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../housekeeping/HousekeepingPacketDownlink.h" -#include "../housekeeping/HousekeepingMessage.h" -#include "../housekeeping/PeriodicHousekeepingHelper.h" -#include "../datapool/DataSetIF.h" -#include "../datapool/PoolEntry.h" -#include "../objectmanager/SystemObjectIF.h" -#include "../ipc/MutexIF.h" -#include "../ipc/CommandMessage.h" -#include "../ipc/MessageQueueIF.h" -#include "../ipc/MutexGuard.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/housekeeping/HousekeepingPacketDownlink.h" +#include "fsfw/housekeeping/HousekeepingMessage.h" +#include "fsfw/housekeeping/PeriodicHousekeepingHelper.h" +#include "fsfw/datapool/DataSetIF.h" +#include "fsfw/datapool/PoolEntry.h" +#include "fsfw/objectmanager/SystemObjectIF.h" +#include "fsfw/ipc/MutexIF.h" +#include "fsfw/ipc/CommandMessage.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/ipc/MutexGuard.h" #include #include diff --git a/inc/fsfw/datapoollocal/LocalPoolDataSetBase.h b/inc/fsfw/datapoollocal/LocalPoolDataSetBase.h index ab67dc3f..822e2cb8 100644 --- a/inc/fsfw/datapoollocal/LocalPoolDataSetBase.h +++ b/inc/fsfw/datapoollocal/LocalPoolDataSetBase.h @@ -4,8 +4,8 @@ #include "MarkChangedIF.h" #include "localPoolDefinitions.h" -#include "../datapool/DataSetIF.h" -#include "../datapool/PoolDataSetBase.h" +#include "fsfw/datapool/DataSetIF.h" +#include "fsfw/datapool/PoolDataSetBase.h" #include diff --git a/inc/fsfw/datapoollocal/LocalPoolObjectBase.h b/inc/fsfw/datapoollocal/LocalPoolObjectBase.h index 3f7fb6dd..72275646 100644 --- a/inc/fsfw/datapoollocal/LocalPoolObjectBase.h +++ b/inc/fsfw/datapoollocal/LocalPoolObjectBase.h @@ -4,9 +4,9 @@ #include "MarkChangedIF.h" #include "localPoolDefinitions.h" -#include "../objectmanager/SystemObjectIF.h" -#include "../datapool/PoolVariableIF.h" -#include "../returnvalues/HasReturnvaluesIF.h" +#include "fsfw/objectmanager/SystemObjectIF.h" +#include "fsfw/datapool/PoolVariableIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" class LocalDataPoolManager; class DataSetIF; diff --git a/src/core/datapoollocal/internal/LocalDpManagerAttorney.h b/inc/fsfw/datapoollocal/internal/LocalDpManagerAttorney.h similarity index 100% rename from src/core/datapoollocal/internal/LocalDpManagerAttorney.h rename to inc/fsfw/datapoollocal/internal/LocalDpManagerAttorney.h diff --git a/inc/fsfw/devicehandlers/HealthDevice.h b/inc/fsfw/devicehandlers/HealthDevice.h index 738f0c7e..bf9cdb82 100644 --- a/inc/fsfw/devicehandlers/HealthDevice.h +++ b/inc/fsfw/devicehandlers/HealthDevice.h @@ -1,11 +1,11 @@ #ifndef FSFW_DEVICEHANDLERS_HEALTHDEVICE_H_ #define FSFW_DEVICEHANDLERS_HEALTHDEVICE_H_ -#include "../health/HasHealthIF.h" -#include "../health/HealthHelper.h" -#include "../objectmanager/SystemObject.h" -#include "../tasks/ExecutableObjectIF.h" -#include "../ipc/MessageQueueIF.h" +#include "fsfw/health/HasHealthIF.h" +#include "fsfw/health/HealthHelper.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/ipc/MessageQueueIF.h" class HealthDevice: public SystemObject, public ExecutableObjectIF, diff --git a/inc/fsfw/events/EventMessage.h b/inc/fsfw/events/EventMessage.h index f2f5ffb5..36e261bd 100644 --- a/inc/fsfw/events/EventMessage.h +++ b/inc/fsfw/events/EventMessage.h @@ -1,9 +1,9 @@ -#ifndef EVENTMESSAGE_H_ -#define EVENTMESSAGE_H_ +#ifndef FSFW_EVENTS_EVENTMESSAGE_H_ +#define FSFW_EVENTS_EVENTMESSAGE_H_ #include "Event.h" -#include "../ipc/MessageQueueMessage.h" -#include "../objectmanager/ObjectManagerIF.h" +#include "fsfw/ipc/MessageQueueMessage.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" /** * Passing on events through IPC. @@ -49,4 +49,4 @@ protected: }; -#endif /* EVENTMESSAGE_H_ */ +#endif /* FSFW_EVENTS_EVENTMESSAGE_H_ */ diff --git a/inc/fsfw/fdir/FaultCounter.h b/inc/fsfw/fdir/FaultCounter.h index e0670c4b..a85e8cf7 100644 --- a/inc/fsfw/fdir/FaultCounter.h +++ b/inc/fsfw/fdir/FaultCounter.h @@ -1,8 +1,8 @@ -#ifndef FRAMEWORK_FDIR_FAULTCOUNTER_H_ -#define FRAMEWORK_FDIR_FAULTCOUNTER_H_ +#ifndef FSFW_FDIR_FAULTCOUNTER_H_ +#define FSFW_FDIR_FAULTCOUNTER_H_ -#include "../parameters/HasParametersIF.h" -#include "../timemanager/Countdown.h" +#include "fsfw/parameters/HasParametersIF.h" +#include "fsfw/timemanager/Countdown.h" class FaultCounter: public HasParametersIF { public: @@ -35,4 +35,4 @@ private: uint32_t failureThreshold; }; -#endif /* FRAMEWORK_FDIR_FAULTCOUNTER_H_ */ +#endif /* FSFW_FDIR_FAULTCOUNTER_H_ */ diff --git a/inc/fsfw/globalfunctions/Type.h b/inc/fsfw/globalfunctions/Type.h index fa894e3e..cfbb3cfa 100644 --- a/inc/fsfw/globalfunctions/Type.h +++ b/inc/fsfw/globalfunctions/Type.h @@ -1,8 +1,9 @@ #ifndef FSFW_GLOBALFUNCTIONS_TYPE_H_ #define FSFW_GLOBALFUNCTIONS_TYPE_H_ -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../serialize/SerializeIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/serialize/SerializeIF.h" + #include /** diff --git a/inc/fsfw/health/HealthMessage.h b/inc/fsfw/health/HealthMessage.h index fb979c66..3dc58977 100644 --- a/inc/fsfw/health/HealthMessage.h +++ b/inc/fsfw/health/HealthMessage.h @@ -2,7 +2,7 @@ #define FSFW_HEALTH_HEALTHMESSAGE_H_ #include "HasHealthIF.h" -#include "../ipc/CommandMessage.h" +#include "fsfw/ipc/CommandMessage.h" class HealthMessage { public: diff --git a/inc/fsfw/housekeeping/HousekeepingMessage.h b/inc/fsfw/housekeeping/HousekeepingMessage.h index a38ff73f..509a68c9 100644 --- a/inc/fsfw/housekeeping/HousekeepingMessage.h +++ b/inc/fsfw/housekeeping/HousekeepingMessage.h @@ -1,11 +1,11 @@ #ifndef FSFW_HOUSEKEEPING_HOUSEKEEPINGMESSAGE_H_ #define FSFW_HOUSEKEEPING_HOUSEKEEPINGMESSAGE_H_ -#include "../datapoollocal/localPoolDefinitions.h" -#include "../ipc/CommandMessage.h" -#include "../ipc/FwMessageTypes.h" -#include "../objectmanager/frameworkObjects.h" -#include "../storagemanager/StorageManagerIF.h" +#include "fsfw/datapoollocal/localPoolDefinitions.h" +#include "fsfw/ipc/CommandMessage.h" +#include "fsfw/ipc/FwMessageTypes.h" +#include "fsfw/objectmanager/frameworkObjects.h" +#include "fsfw/storagemanager/StorageManagerIF.h" /** diff --git a/inc/fsfw/housekeeping/PeriodicHousekeepingHelper.h b/inc/fsfw/housekeeping/PeriodicHousekeepingHelper.h index 3256fbff..4e93308b 100644 --- a/inc/fsfw/housekeeping/PeriodicHousekeepingHelper.h +++ b/inc/fsfw/housekeeping/PeriodicHousekeepingHelper.h @@ -1,7 +1,7 @@ #ifndef FSFW_HOUSEKEEPING_PERIODICHOUSEKEEPINGHELPER_H_ #define FSFW_HOUSEKEEPING_PERIODICHOUSEKEEPINGHELPER_H_ -#include "../timemanager/Clock.h" +#include "fsfw/timemanager/Clock.h" #include class LocalPoolDataSetBase; diff --git a/inc/fsfw/internalError/InternalErrorDataset.h b/inc/fsfw/internalerror/InternalErrorDataset.h similarity index 100% rename from inc/fsfw/internalError/InternalErrorDataset.h rename to inc/fsfw/internalerror/InternalErrorDataset.h diff --git a/inc/fsfw/internalError/InternalErrorReporter.h b/inc/fsfw/internalerror/InternalErrorReporter.h similarity index 91% rename from inc/fsfw/internalError/InternalErrorReporter.h rename to inc/fsfw/internalerror/InternalErrorReporter.h index 580cb8f6..57a6a135 100644 --- a/inc/fsfw/internalError/InternalErrorReporter.h +++ b/inc/fsfw/internalerror/InternalErrorReporter.h @@ -3,12 +3,12 @@ #include "InternalErrorReporterIF.h" -#include "../tasks/PeriodicTaskIF.h" -#include "../internalError/InternalErrorDataset.h" -#include "../datapoollocal/LocalDataPoolManager.h" -#include "../tasks/ExecutableObjectIF.h" -#include "../objectmanager/SystemObject.h" -#include "../ipc/MutexIF.h" +#include "fsfw/tasks/PeriodicTaskIF.h" +#include "fsfw/internalerror/InternalErrorDataset.h" +#include "fsfw/datapoollocal/LocalDataPoolManager.h" +#include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/ipc/MutexIF.h" /** * @brief This class is used to track internal errors like lost telemetry, diff --git a/inc/fsfw/internalError/InternalErrorReporterIF.h b/inc/fsfw/internalerror/InternalErrorReporterIF.h similarity index 100% rename from inc/fsfw/internalError/InternalErrorReporterIF.h rename to inc/fsfw/internalerror/InternalErrorReporterIF.h diff --git a/inc/fsfw/ipc/MessageQueueMessage.h b/inc/fsfw/ipc/MessageQueueMessage.h index 111056ca..e9ef6756 100644 --- a/inc/fsfw/ipc/MessageQueueMessage.h +++ b/inc/fsfw/ipc/MessageQueueMessage.h @@ -1,7 +1,7 @@ #ifndef FSFW_IPC_MESSAGEQUEUEMESSAGE_H_ #define FSFW_IPC_MESSAGEQUEUEMESSAGE_H_ -#include "../ipc/MessageQueueMessageIF.h" +#include "fsfw/ipc/MessageQueueMessageIF.h" #include /** diff --git a/inc/fsfw/modes/ModeHelper.h b/inc/fsfw/modes/ModeHelper.h index c2f089ec..27928a29 100644 --- a/inc/fsfw/modes/ModeHelper.h +++ b/inc/fsfw/modes/ModeHelper.h @@ -2,9 +2,9 @@ #define FSFW_MODES_MODEHELPER_H_ #include "ModeMessage.h" -#include "../ipc/MessageQueueIF.h" -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../timemanager/Countdown.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/timemanager/Countdown.h" class HasModesIF; diff --git a/inc/fsfw/objectmanager/SystemObject.h b/inc/fsfw/objectmanager/SystemObject.h index d9c4236d..e7d2ae2b 100644 --- a/inc/fsfw/objectmanager/SystemObject.h +++ b/inc/fsfw/objectmanager/SystemObject.h @@ -2,9 +2,9 @@ #define FSFW_OBJECTMANAGER_SYSTEMOBJECT_H_ #include "SystemObjectIF.h" -#include "../events/Event.h" -#include "../events/EventReportingProxyIF.h" -#include "../timemanager/Clock.h" +#include "fsfw/events/Event.h" +#include "fsfw/events/EventReportingProxyIF.h" +#include "fsfw/timemanager/Clock.h" /** * @brief This class automates insertion into the ObjectManager and diff --git a/inc/fsfw/power/PowerComponent.h b/inc/fsfw/power/PowerComponent.h index 6b9778a5..3889a2ae 100644 --- a/inc/fsfw/power/PowerComponent.h +++ b/inc/fsfw/power/PowerComponent.h @@ -3,8 +3,8 @@ #include "PowerComponentIF.h" -#include "../objectmanager/frameworkObjects.h" -#include "../objectmanager/SystemObjectIF.h" +#include "fsfw/objectmanager/frameworkObjects.h" +#include "fsfw/objectmanager/SystemObjectIF.h" class PowerComponent: public PowerComponentIF { diff --git a/inc/fsfw/power/PowerSensor.h b/inc/fsfw/power/PowerSensor.h index 5a21ab10..d00c5420 100644 --- a/inc/fsfw/power/PowerSensor.h +++ b/inc/fsfw/power/PowerSensor.h @@ -1,12 +1,12 @@ #ifndef FSFW_POWER_POWERSENSOR_H_ #define FSFW_POWER_POWERSENSOR_H_ -#include "../datapoollocal/StaticLocalDataSet.h" -#include "../devicehandlers/HealthDevice.h" -#include "../monitoring/LimitMonitor.h" -#include "../parameters/ParameterHelper.h" -#include "../objectmanager/SystemObject.h" -#include "../ipc/MessageQueueIF.h" +#include "fsfw/datapoollocal/StaticLocalDataSet.h" +#include "fsfw/devicehandlers/HealthDevice.h" +#include "fsfw/monitoring/LimitMonitor.h" +#include "fsfw/parameters/ParameterHelper.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/ipc/MessageQueueIF.h" class PowerController; diff --git a/inc/fsfw/serialize/SerialBufferAdapter.h b/inc/fsfw/serialize/SerialBufferAdapter.h index 9a89e18b..6c79cd03 100644 --- a/inc/fsfw/serialize/SerialBufferAdapter.h +++ b/inc/fsfw/serialize/SerialBufferAdapter.h @@ -1,8 +1,8 @@ #ifndef SERIALBUFFERADAPTER_H_ #define SERIALBUFFERADAPTER_H_ -#include "../serialize/SerializeIF.h" -#include "../serialize/SerializeAdapter.h" +#include "fsfw/serialize/SerializeIF.h" +#include "fsfw/serialize/SerializeAdapter.h" /** * This adapter provides an interface for SerializeIF to serialize or deserialize diff --git a/inc/fsfw/storagemanager/LocalPool.h b/inc/fsfw/storagemanager/LocalPool.h index 6a666485..383d8a94 100644 --- a/inc/fsfw/storagemanager/LocalPool.h +++ b/inc/fsfw/storagemanager/LocalPool.h @@ -1,12 +1,13 @@ #ifndef FSFW_STORAGEMANAGER_LOCALPOOL_H_ #define FSFW_STORAGEMANAGER_LOCALPOOL_H_ -#include "StorageManagerIF.h" -#include "../objectmanager/SystemObject.h" -#include "../objectmanager/ObjectManagerIF.h" -#include "../serviceinterface/ServiceInterfaceStream.h" -#include "../internalError/InternalErrorReporterIF.h" -#include "../storagemanager/StorageAccessor.h" +#include "fsfw/storagemanager/StorageManagerIF.h" + +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" +#include "fsfw/serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/internalerror/InternalErrorReporterIF.h" +#include "fsfw/storagemanager/StorageAccessor.h" #include #include diff --git a/inc/fsfw/subsystem/modes/ModeSequenceMessage.h b/inc/fsfw/subsystem/modes/ModeSequenceMessage.h index 7852c984..0dbe7ffb 100644 --- a/inc/fsfw/subsystem/modes/ModeSequenceMessage.h +++ b/inc/fsfw/subsystem/modes/ModeSequenceMessage.h @@ -3,8 +3,8 @@ #include "ModeDefinitions.h" -#include "../../ipc/CommandMessage.h" -#include "../../storagemanager/StorageManagerIF.h" +#include "fsfw/ipc/CommandMessage.h" +#include "fsfw/storagemanager/StorageManagerIF.h" class ModeSequenceMessage { diff --git a/inc/fsfw/tasks/FixedSequenceSlot.h b/inc/fsfw/tasks/FixedSequenceSlot.h index 1744ec19..aea77dfe 100644 --- a/inc/fsfw/tasks/FixedSequenceSlot.h +++ b/inc/fsfw/tasks/FixedSequenceSlot.h @@ -2,7 +2,7 @@ #define FSFW_TASKS_FIXEDSEQUENCESLOT_H_ #include "ExecutableObjectIF.h" -#include "../objectmanager/ObjectManagerIF.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" class PeriodicTaskIF; diff --git a/inc/fsfw/tcdistribution/PUSDistributor.h b/inc/fsfw/tcdistribution/PUSDistributor.h index c6f863f0..53a996ca 100644 --- a/inc/fsfw/tcdistribution/PUSDistributor.h +++ b/inc/fsfw/tcdistribution/PUSDistributor.h @@ -5,10 +5,10 @@ #include "TcDistributor.h" #include "TcPacketCheck.h" -#include "../tmtcpacket/pus/tc.h" -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../tmtcservices/AcceptsTelecommandsIF.h" -#include "../tmtcservices/VerificationReporter.h" +#include "fsfw/tmtcpacket/pus/tc.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h" +#include "fsfw/tmtcservices/VerificationReporter.h" /** * This class accepts PUS Telecommands and forwards them to Application diff --git a/inc/fsfw/tcdistribution/TcDistributor.h b/inc/fsfw/tcdistribution/TcDistributor.h index 5d0ca45d..14b532bd 100644 --- a/inc/fsfw/tcdistribution/TcDistributor.h +++ b/inc/fsfw/tcdistribution/TcDistributor.h @@ -1,13 +1,13 @@ #ifndef FSFW_TMTCSERVICES_TCDISTRIBUTOR_H_ #define FSFW_TMTCSERVICES_TCDISTRIBUTOR_H_ -#include "../objectmanager/ObjectManagerIF.h" -#include "../objectmanager/SystemObject.h" -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../storagemanager/StorageManagerIF.h" -#include "../tasks/ExecutableObjectIF.h" -#include "../tmtcservices/TmTcMessage.h" -#include "../ipc/MessageQueueIF.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/tmtcservices/TmTcMessage.h" +#include "fsfw/ipc/MessageQueueIF.h" #include /** diff --git a/inc/fsfw/thermal/AbstractTemperatureSensor.h b/inc/fsfw/thermal/AbstractTemperatureSensor.h index a1153314..719d84fe 100644 --- a/inc/fsfw/thermal/AbstractTemperatureSensor.h +++ b/inc/fsfw/thermal/AbstractTemperatureSensor.h @@ -1,12 +1,12 @@ #ifndef ABSTRACTSENSOR_H_ #define ABSTRACTSENSOR_H_ -#include "../health/HasHealthIF.h" -#include "../health/HealthHelper.h" -#include "../objectmanager/SystemObject.h" -#include "../tasks/ExecutableObjectIF.h" -#include "../parameters/ParameterHelper.h" -#include "../ipc/MessageQueueIF.h" +#include "fsfw/health/HasHealthIF.h" +#include "fsfw/health/HealthHelper.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/parameters/ParameterHelper.h" +#include "fsfw/ipc/MessageQueueIF.h" #include "ThermalModuleIF.h" #include "tcsDefinitions.h" diff --git a/inc/fsfw/thermal/Heater.h b/inc/fsfw/thermal/Heater.h index 2caddd85..2a40cac6 100644 --- a/inc/fsfw/thermal/Heater.h +++ b/inc/fsfw/thermal/Heater.h @@ -1,11 +1,12 @@ #ifndef FSFW_THERMAL_HEATER_H_ #define FSFW_THERMAL_HEATER_H_ -#include "../devicehandlers/HealthDevice.h" -#include "../parameters/ParameterHelper.h" -#include "../power/PowerSwitchIF.h" -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../timemanager/Countdown.h" +#include "fsfw/devicehandlers/HealthDevice.h" +#include "fsfw/parameters/ParameterHelper.h" +#include "fsfw/power/PowerSwitchIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/timemanager/Countdown.h" + #include diff --git a/inc/fsfw/timemanager/Clock.h b/inc/fsfw/timemanager/Clock.h index 6a76c86d..b1d6bfaf 100644 --- a/inc/fsfw/timemanager/Clock.h +++ b/inc/fsfw/timemanager/Clock.h @@ -2,9 +2,9 @@ #define FSFW_TIMEMANAGER_CLOCK_H_ #include "clockDefinitions.h" -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../ipc/MutexFactory.h" -#include "../globalfunctions/timevalOperations.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/ipc/MutexFactory.h" +#include "fsfw/globalfunctions/timevalOperations.h" #include diff --git a/inc/fsfw/tmtcpacket/packetmatcher/PacketMatchTree.h b/inc/fsfw/tmtcpacket/packetmatcher/PacketMatchTree.h index a40b5099..e2439c74 100644 --- a/inc/fsfw/tmtcpacket/packetmatcher/PacketMatchTree.h +++ b/inc/fsfw/tmtcpacket/packetmatcher/PacketMatchTree.h @@ -1,10 +1,10 @@ #ifndef FSFW_TMTCPACKET_PACKETMATCHER_PACKETMATCHTREE_H_ #define FSFW_TMTCPACKET_PACKETMATCHER_PACKETMATCHTREE_H_ -#include "../../container/PlacementFactory.h" -#include "../../globalfunctions/matching/MatchTree.h" -#include "../../storagemanager/LocalPool.h" -#include "../../tmtcpacket/pus/tm/TmPacketMinimal.h" +#include "fsfw/container/PlacementFactory.h" +#include "fsfw/globalfunctions/matching/MatchTree.h" +#include "fsfw/storagemanager/LocalPool.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketMinimal.h" class PacketMatchTree: public MatchTree, public HasReturnvaluesIF { public: diff --git a/inc/fsfw/tmtcpacket/pus/tc/TcPacketBase.h b/inc/fsfw/tmtcpacket/pus/tc/TcPacketBase.h index e2872246..14356c8c 100644 --- a/inc/fsfw/tmtcpacket/pus/tc/TcPacketBase.h +++ b/inc/fsfw/tmtcpacket/pus/tc/TcPacketBase.h @@ -1,7 +1,7 @@ #ifndef TMTCPACKET_PUS_TCPACKETBASE_H_ #define TMTCPACKET_PUS_TCPACKETBASE_H_ -#include "../../../tmtcpacket/SpacePacketBase.h" +#include "fsfw/tmtcpacket/SpacePacketBase.h" #include /** diff --git a/inc/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.h b/inc/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.h index 1bc092dd..8e8b9c70 100644 --- a/inc/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.h +++ b/inc/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.h @@ -1,15 +1,15 @@ #ifndef FSFW_TMTCPACKET_PUS_TMPACKETSTOREDBASE_H_ #define FSFW_TMTCPACKET_PUS_TMPACKETSTOREDBASE_H_ -#include "../../../FSFW.h" +#include "fsfw/FSFW.h" #include "TmPacketBase.h" #include "TmPacketStoredBase.h" #include "TmPacketPusA.h" -#include "../../../serialize/SerializeIF.h" -#include "../../../storagemanager/StorageManagerIF.h" -#include "../../../internalError/InternalErrorReporterIF.h" -#include "../../../ipc/MessageQueueSenderIF.h" +#include "fsfw/serialize/SerializeIF.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/internalerror/InternalErrorReporterIF.h" +#include "fsfw/ipc/MessageQueueSenderIF.h" /** * This class generates a ECSS PUS Telemetry packet within a given diff --git a/inc/fsfw/tmtcservices/CommandingServiceBase.h b/inc/fsfw/tmtcservices/CommandingServiceBase.h index 4ee4a21a..b6709693 100644 --- a/inc/fsfw/tmtcservices/CommandingServiceBase.h +++ b/inc/fsfw/tmtcservices/CommandingServiceBase.h @@ -3,17 +3,16 @@ #include "AcceptsTelecommandsIF.h" #include "VerificationReporter.h" +#include "fsfw/FSFW.h" -#include "../objectmanager/SystemObject.h" -#include "../storagemanager/StorageManagerIF.h" -#include "../tasks/ExecutableObjectIF.h" -#include "../ipc/MessageQueueIF.h" -#include "../ipc/CommandMessage.h" -#include "../container/FixedMap.h" -#include "../container/FIFO.h" -#include "../serialize/SerializeIF.h" - -#include +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/ipc/CommandMessage.h" +#include "fsfw/container/FixedMap.h" +#include "fsfw/container/FIFO.h" +#include "fsfw/serialize/SerializeIF.h" class TcPacketStored; class TcPacketStoredBase; diff --git a/inc/fsfw/tmtcservices/PusServiceBase.h b/inc/fsfw/tmtcservices/PusServiceBase.h index 6cde6fb4..ea4147fe 100644 --- a/inc/fsfw/tmtcservices/PusServiceBase.h +++ b/inc/fsfw/tmtcservices/PusServiceBase.h @@ -5,12 +5,12 @@ #include "VerificationCodes.h" #include "VerificationReporter.h" -#include "../objectmanager/ObjectManagerIF.h" -#include "../objectmanager/SystemObject.h" -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../tasks/ExecutableObjectIF.h" -#include "../tmtcpacket/pus/tc.h" -#include "../ipc/MessageQueueIF.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/tmtcpacket/pus/tc.h" +#include "fsfw/ipc/MessageQueueIF.h" namespace Factory{ void setStaticFrameworkObjectIds(); diff --git a/inc/fsfw/tmtcservices/PusVerificationReport.h b/inc/fsfw/tmtcservices/PusVerificationReport.h index 0e1732ef..c22ba535 100644 --- a/inc/fsfw/tmtcservices/PusVerificationReport.h +++ b/inc/fsfw/tmtcservices/PusVerificationReport.h @@ -3,9 +3,9 @@ #include "VerificationCodes.h" -#include "../ipc/MessageQueueMessage.h" -#include "../tmtcpacket/pus/tc/TcPacketBase.h" -#include "../returnvalues/HasReturnvaluesIF.h" +#include "fsfw/ipc/MessageQueueMessage.h" +#include "fsfw/tmtcpacket/pus/tc/TcPacketBase.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" class PusVerificationMessage: public MessageQueueMessage { private: diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 6240d8f2..4a2f7a2c 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -9,7 +9,7 @@ add_subdirectory(fdir) add_subdirectory(globalfunctions) add_subdirectory(health) add_subdirectory(housekeeping) -add_subdirectory(internalError) +add_subdirectory(internalerror) add_subdirectory(ipc) add_subdirectory(memory) add_subdirectory(modes) @@ -24,6 +24,5 @@ add_subdirectory(tasks) add_subdirectory(tcdistribution) add_subdirectory(thermal) add_subdirectory(timemanager) -add_subdirectory(tmstorage) add_subdirectory(tmtcpacket) add_subdirectory(tmtcservices) diff --git a/src/core/action/ActionHelper.cpp b/src/core/action/ActionHelper.cpp index 73007ea3..3dfe8b50 100644 --- a/src/core/action/ActionHelper.cpp +++ b/src/core/action/ActionHelper.cpp @@ -1,9 +1,8 @@ -#include "ActionHelper.h" -#include "HasActionsIF.h" +#include "fsfw/action.h" -#include "../ipc/MessageQueueSenderIF.h" -#include "../objectmanager/ObjectManager.h" -#include "../serviceinterface/ServiceInterface.h" +#include "fsfw/ipc/MessageQueueSenderIF.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" ActionHelper::ActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue) : diff --git a/src/core/action/ActionMessage.cpp b/src/core/action/ActionMessage.cpp index f25858af..7d66c57f 100644 --- a/src/core/action/ActionMessage.cpp +++ b/src/core/action/ActionMessage.cpp @@ -1,8 +1,7 @@ -#include "ActionMessage.h" -#include "HasActionsIF.h" +#include "fsfw/action.h" -#include "../objectmanager/ObjectManager.h" -#include "../storagemanager/StorageManagerIF.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/storagemanager/StorageManagerIF.h" ActionMessage::ActionMessage() { } diff --git a/src/core/action/CommandActionHelper.cpp b/src/core/action/CommandActionHelper.cpp index 31650cae..b46dcceb 100644 --- a/src/core/action/CommandActionHelper.cpp +++ b/src/core/action/CommandActionHelper.cpp @@ -1,9 +1,6 @@ -#include "ActionMessage.h" -#include "CommandActionHelper.h" -#include "CommandsActionsIF.h" -#include "HasActionsIF.h" +#include "fsfw/action.h" -#include "../objectmanager/ObjectManager.h" +#include "fsfw/objectmanager/ObjectManager.h" CommandActionHelper::CommandActionHelper(CommandsActionsIF *setOwner) : owner(setOwner), queueToUse(NULL), ipcStore( diff --git a/src/core/action/SimpleActionHelper.cpp b/src/core/action/SimpleActionHelper.cpp index 8d34f40f..7135ea62 100644 --- a/src/core/action/SimpleActionHelper.cpp +++ b/src/core/action/SimpleActionHelper.cpp @@ -1,5 +1,4 @@ -#include "HasActionsIF.h" -#include "SimpleActionHelper.h" +#include "fsfw/action.h" SimpleActionHelper::SimpleActionHelper(HasActionsIF* setOwner, MessageQueueIF* useThisQueue) : diff --git a/src/core/container/SharedRingBuffer.cpp b/src/core/container/SharedRingBuffer.cpp index fe36341d..f7c97802 100644 --- a/src/core/container/SharedRingBuffer.cpp +++ b/src/core/container/SharedRingBuffer.cpp @@ -1,6 +1,6 @@ -#include "SharedRingBuffer.h" -#include "../ipc/MutexFactory.h" -#include "../ipc/MutexGuard.h" +#include "fsfw/container/SharedRingBuffer.h" +#include "fsfw/ipc/MutexFactory.h" +#include "fsfw/ipc/MutexGuard.h" SharedRingBuffer::SharedRingBuffer(object_id_t objectId, const size_t size, bool overwriteOld, size_t maxExcessBytes): diff --git a/src/core/container/SimpleRingBuffer.cpp b/src/core/container/SimpleRingBuffer.cpp index 8544acbf..8de9cf08 100644 --- a/src/core/container/SimpleRingBuffer.cpp +++ b/src/core/container/SimpleRingBuffer.cpp @@ -1,4 +1,5 @@ -#include "SimpleRingBuffer.h" +#include "fsfw/container/SimpleRingBuffer.h" + #include SimpleRingBuffer::SimpleRingBuffer(const size_t size, bool overwriteOld, diff --git a/src/core/controller/ControllerBase.cpp b/src/core/controller/ControllerBase.cpp index 5a94c082..86838068 100644 --- a/src/core/controller/ControllerBase.cpp +++ b/src/core/controller/ControllerBase.cpp @@ -1,9 +1,9 @@ -#include "ControllerBase.h" +#include "fsfw/controller/ControllerBase.h" -#include "../subsystem/SubsystemBase.h" -#include "../ipc/QueueFactory.h" -#include "../action/HasActionsIF.h" -#include "../objectmanager/ObjectManager.h" +#include "fsfw/subsystem/SubsystemBase.h" +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/action/HasActionsIF.h" +#include "fsfw/objectmanager/ObjectManager.h" ControllerBase::ControllerBase(object_id_t setObjectId, object_id_t parentId, size_t commandQueueDepth) : diff --git a/src/core/controller/ExtendedControllerBase.cpp b/src/core/controller/ExtendedControllerBase.cpp index b5b8c660..f59c50a9 100644 --- a/src/core/controller/ExtendedControllerBase.cpp +++ b/src/core/controller/ExtendedControllerBase.cpp @@ -1,5 +1,4 @@ -#include "ExtendedControllerBase.h" - +#include "fsfw/controller/ExtendedControllerBase.h" ExtendedControllerBase::ExtendedControllerBase(object_id_t objectId, object_id_t parentId, size_t commandQueueDepth): diff --git a/src/core/datapool/HkSwitchHelper.cpp b/src/core/datapool/HkSwitchHelper.cpp index 21e37f59..bcf237ba 100644 --- a/src/core/datapool/HkSwitchHelper.cpp +++ b/src/core/datapool/HkSwitchHelper.cpp @@ -1,5 +1,5 @@ -#include "../datapool/HkSwitchHelper.h" -#include "../ipc/QueueFactory.h" +#include "fsfw/datapool/HkSwitchHelper.h" +#include "fsfw/ipc/QueueFactory.h" HkSwitchHelper::HkSwitchHelper(EventReportingProxyIF* eventProxy) : commandActionHelper(this), eventProxy(eventProxy) { diff --git a/src/core/datapool/PoolDataSetBase.cpp b/src/core/datapool/PoolDataSetBase.cpp index 1bd58698..7856dc9a 100644 --- a/src/core/datapool/PoolDataSetBase.cpp +++ b/src/core/datapool/PoolDataSetBase.cpp @@ -1,7 +1,7 @@ -#include "PoolDataSetBase.h" -#include "ReadCommitIFAttorney.h" +#include "fsfw/datapool/PoolDataSetBase.h" +#include "fsfw/datapool/ReadCommitIFAttorney.h" -#include "../serviceinterface/ServiceInterface.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include diff --git a/src/core/datapool/PoolEntry.cpp b/src/core/datapool/PoolEntry.cpp index 6504e20c..0443aa11 100644 --- a/src/core/datapool/PoolEntry.cpp +++ b/src/core/datapool/PoolEntry.cpp @@ -1,7 +1,8 @@ -#include "PoolEntry.h" +#include "fsfw/datapool/PoolEntry.h" + +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/globalfunctions/arrayprinter.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../globalfunctions/arrayprinter.h" #include #include diff --git a/src/core/datapoollocal/LocalDataPoolManager.cpp b/src/core/datapoollocal/LocalDataPoolManager.cpp index 71997b9b..4a706657 100644 --- a/src/core/datapoollocal/LocalDataPoolManager.cpp +++ b/src/core/datapoollocal/LocalDataPoolManager.cpp @@ -1,18 +1,16 @@ -#include "HasLocalDataPoolIF.h" -#include "LocalDataPoolManager.h" -#include "LocalPoolObjectBase.h" -#include "LocalPoolDataSetBase.h" +#include "fsfw/datapoollocal/LocalDataPoolManager.h" +#include "fsfw/datapoollocal.h" #include "internal/LocalPoolDataSetAttorney.h" #include "internal/HasLocalDpIFManagerAttorney.h" -#include "../housekeeping/HousekeepingSetPacket.h" -#include "../objectmanager/ObjectManager.h" -#include "../housekeeping/HousekeepingSnapshot.h" -#include "../housekeeping/AcceptsHkPacketsIF.h" -#include "../timemanager/CCSDSTime.h" -#include "../ipc/MutexFactory.h" -#include "../ipc/MutexGuard.h" -#include "../ipc/QueueFactory.h" +#include "fsfw/housekeeping/HousekeepingSetPacket.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/housekeeping/HousekeepingSnapshot.h" +#include "fsfw/housekeeping/AcceptsHkPacketsIF.h" +#include "fsfw/timemanager/CCSDSTime.h" +#include "fsfw/ipc/MutexFactory.h" +#include "fsfw/ipc/MutexGuard.h" +#include "fsfw/ipc/QueueFactory.h" #include #include diff --git a/src/core/datapoollocal/LocalDataSet.cpp b/src/core/datapoollocal/LocalDataSet.cpp index aeb5c6b3..260f8500 100644 --- a/src/core/datapoollocal/LocalDataSet.cpp +++ b/src/core/datapoollocal/LocalDataSet.cpp @@ -1,6 +1,7 @@ -#include "LocalDataSet.h" -#include "../datapoollocal/LocalDataPoolManager.h" -#include "../serialize/SerializeAdapter.h" +#include "fsfw/datapoollocal/LocalDataSet.h" +#include "fsfw/datapoollocal/LocalDataPoolManager.h" + +#include "fsfw/serialize/SerializeAdapter.h" #include #include diff --git a/src/core/datapoollocal/LocalPoolDataSetBase.cpp b/src/core/datapoollocal/LocalPoolDataSetBase.cpp index a7a7e6c8..5422c68a 100644 --- a/src/core/datapoollocal/LocalPoolDataSetBase.cpp +++ b/src/core/datapoollocal/LocalPoolDataSetBase.cpp @@ -1,13 +1,12 @@ -#include "LocalPoolDataSetBase.h" -#include "HasLocalDataPoolIF.h" +#include "fsfw/datapoollocal.h" #include "internal/HasLocalDpIFUserAttorney.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../objectmanager/ObjectManager.h" -#include "../globalfunctions/bitutility.h" -#include "../datapoollocal/LocalDataPoolManager.h" -#include "../housekeeping/PeriodicHousekeepingHelper.h" -#include "../serialize/SerializeAdapter.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/globalfunctions/bitutility.h" +#include "fsfw/datapoollocal/LocalDataPoolManager.h" +#include "fsfw/housekeeping/PeriodicHousekeepingHelper.h" +#include "fsfw/serialize/SerializeAdapter.h" #include #include diff --git a/src/core/datapoollocal/LocalPoolObjectBase.cpp b/src/core/datapoollocal/LocalPoolObjectBase.cpp index 6920749b..96b849c6 100644 --- a/src/core/datapoollocal/LocalPoolObjectBase.cpp +++ b/src/core/datapoollocal/LocalPoolObjectBase.cpp @@ -1,10 +1,10 @@ -#include "LocalPoolObjectBase.h" -#include "LocalDataPoolManager.h" -#include "AccessLocalPoolF.h" -#include "HasLocalDataPoolIF.h" +#include "fsfw/datapoollocal/LocalPoolObjectBase.h" +#include "fsfw/datapoollocal/LocalDataPoolManager.h" +#include "fsfw/datapoollocal/AccessLocalPoolF.h" +#include "fsfw/datapoollocal/HasLocalDataPoolIF.h" #include "internal/HasLocalDpIFUserAttorney.h" -#include "../objectmanager/ObjectManager.h" +#include "fsfw/objectmanager/ObjectManager.h" LocalPoolObjectBase::LocalPoolObjectBase(lp_id_t poolId, HasLocalDataPoolIF* hkOwner, diff --git a/src/core/datapoollocal/SharedLocalDataSet.cpp b/src/core/datapoollocal/SharedLocalDataSet.cpp index 84c2d1c3..2ee00aca 100644 --- a/src/core/datapoollocal/SharedLocalDataSet.cpp +++ b/src/core/datapoollocal/SharedLocalDataSet.cpp @@ -1,4 +1,4 @@ -#include "SharedLocalDataSet.h" +#include "fsfw/datapoollocal/SharedLocalDataSet.h" SharedLocalDataSet::SharedLocalDataSet(object_id_t objectId, sid_t sid, diff --git a/src/core/datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp b/src/core/datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp index 65feda75..a275626b 100644 --- a/src/core/datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp +++ b/src/core/datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp @@ -1,7 +1,7 @@ #include "HasLocalDpIFManagerAttorney.h" -#include "../LocalPoolObjectBase.h" -#include "../LocalPoolDataSetBase.h" -#include "../HasLocalDataPoolIF.h" +#include "fsfw/datapoollocal/LocalPoolObjectBase.h" +#include "fsfw/datapoollocal/LocalPoolDataSetBase.h" +#include "fsfw/datapoollocal/HasLocalDataPoolIF.h" LocalPoolDataSetBase* HasLocalDpIFManagerAttorney::getDataSetHandle(HasLocalDataPoolIF* clientIF, sid_t sid) { diff --git a/src/core/datapoollocal/internal/HasLocalDpIFManagerAttorney.h b/src/core/datapoollocal/internal/HasLocalDpIFManagerAttorney.h index dfe333a6..a82ee489 100644 --- a/src/core/datapoollocal/internal/HasLocalDpIFManagerAttorney.h +++ b/src/core/datapoollocal/internal/HasLocalDpIFManagerAttorney.h @@ -1,7 +1,7 @@ #ifndef FSFW_DATAPOOLLOCAL_HASLOCALDPIFMANAGERATTORNEY_H_ #define FSFW_DATAPOOLLOCAL_HASLOCALDPIFMANAGERATTORNEY_H_ -#include "../localPoolDefinitions.h" +#include "fsfw/datapoollocal/localPoolDefinitions.h" class HasLocalDataPoolIF; class LocalPoolDataSetBase; diff --git a/src/core/datapoollocal/internal/HasLocalDpIFUserAttorney.cpp b/src/core/datapoollocal/internal/HasLocalDpIFUserAttorney.cpp index 838204a7..8c52fbfb 100644 --- a/src/core/datapoollocal/internal/HasLocalDpIFUserAttorney.cpp +++ b/src/core/datapoollocal/internal/HasLocalDpIFUserAttorney.cpp @@ -1,6 +1,6 @@ #include "HasLocalDpIFUserAttorney.h" -#include "../AccessLocalPoolF.h" -#include "../HasLocalDataPoolIF.h" +#include "fsfw/datapoollocal/AccessLocalPoolF.h" +#include "fsfw/datapoollocal/HasLocalDataPoolIF.h" AccessPoolManagerIF* HasLocalDpIFUserAttorney::getAccessorHandle(HasLocalDataPoolIF *clientIF) { return clientIF->getAccessorHandle(); diff --git a/src/core/datapoollocal/internal/LocalPoolDataSetAttorney.h b/src/core/datapoollocal/internal/LocalPoolDataSetAttorney.h index f81428cd..9e46cffd 100644 --- a/src/core/datapoollocal/internal/LocalPoolDataSetAttorney.h +++ b/src/core/datapoollocal/internal/LocalPoolDataSetAttorney.h @@ -1,7 +1,7 @@ #ifndef FSFW_DATAPOOLLOCAL_LOCALPOOLDATASETATTORNEY_H_ #define FSFW_DATAPOOLLOCAL_LOCALPOOLDATASETATTORNEY_H_ -#include "../LocalPoolDataSetBase.h" +#include "fsfw/datapoollocal/LocalPoolDataSetBase.h" class LocalPoolDataSetAttorney { private: diff --git a/src/core/devicehandlers/AssemblyBase.cpp b/src/core/devicehandlers/AssemblyBase.cpp index 46b2211a..146adfcb 100644 --- a/src/core/devicehandlers/AssemblyBase.cpp +++ b/src/core/devicehandlers/AssemblyBase.cpp @@ -1,4 +1,4 @@ -#include "AssemblyBase.h" +#include "fsfw/devicehandlers/AssemblyBase.h" AssemblyBase::AssemblyBase(object_id_t objectId, object_id_t parentId, uint16_t commandQueueDepth) : diff --git a/src/core/devicehandlers/CMakeLists.txt b/src/core/devicehandlers/CMakeLists.txt new file mode 100644 index 00000000..a3fb6d65 --- /dev/null +++ b/src/core/devicehandlers/CMakeLists.txt @@ -0,0 +1,10 @@ +target_sources(${LIB_FSFW_NAME} PRIVATE + AssemblyBase.cpp + ChildHandlerBase.cpp + ChildHandlerFDIR.cpp + DeviceHandlerBase.cpp + DeviceHandlerFailureIsolation.cpp + DeviceHandlerMessage.cpp + DeviceTmReportingWrapper.cpp + HealthDevice.cpp +) diff --git a/src/core/devicehandlers/ChildHandlerBase.cpp b/src/core/devicehandlers/ChildHandlerBase.cpp index 628ea3e0..e6508727 100644 --- a/src/core/devicehandlers/ChildHandlerBase.cpp +++ b/src/core/devicehandlers/ChildHandlerBase.cpp @@ -1,5 +1,5 @@ -#include "ChildHandlerBase.h" -#include "../subsystem/SubsystemBase.h" +#include "fsfw/devicehandlers/ChildHandlerBase.h" +#include "fsfw/subsystem/SubsystemBase.h" ChildHandlerBase::ChildHandlerBase(object_id_t setObjectId, object_id_t deviceCommunication, CookieIF * cookie, diff --git a/src/core/devicehandlers/ChildHandlerFDIR.cpp b/src/core/devicehandlers/ChildHandlerFDIR.cpp index cb4c75ea..e1d1321d 100644 --- a/src/core/devicehandlers/ChildHandlerFDIR.cpp +++ b/src/core/devicehandlers/ChildHandlerFDIR.cpp @@ -1,4 +1,4 @@ -#include "ChildHandlerFDIR.h" +#include "fsfw/devicehandlers/ChildHandlerFDIR.h" ChildHandlerFDIR::ChildHandlerFDIR(object_id_t owner, object_id_t faultTreeParent, uint32_t recoveryCount) : diff --git a/src/core/devicehandlers/DeviceHandlerBase.cpp b/src/core/devicehandlers/DeviceHandlerBase.cpp index 5665b101..96fe031a 100644 --- a/src/core/devicehandlers/DeviceHandlerBase.cpp +++ b/src/core/devicehandlers/DeviceHandlerBase.cpp @@ -1,17 +1,17 @@ -#include "DeviceHandlerBase.h" -#include "AcceptsDeviceResponsesIF.h" -#include "DeviceTmReportingWrapper.h" +#include "fsfw/devicehandlers/DeviceHandlerBase.h" +#include "fsfw/devicehandlers/AcceptsDeviceResponsesIF.h" +#include "fsfw/devicehandlers/DeviceTmReportingWrapper.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../objectmanager/ObjectManager.h" -#include "../storagemanager/StorageManagerIF.h" -#include "../thermal/ThermalComponentIF.h" -#include "../globalfunctions/CRC.h" -#include "../housekeeping/HousekeepingMessage.h" -#include "../ipc/MessageQueueMessage.h" -#include "../ipc/QueueFactory.h" -#include "../subsystem/SubsystemBase.h" -#include "../datapoollocal/LocalPoolVariable.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/thermal/ThermalComponentIF.h" +#include "fsfw/globalfunctions/CRC.h" +#include "fsfw/housekeeping/HousekeepingMessage.h" +#include "fsfw/ipc/MessageQueueMessage.h" +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/subsystem/SubsystemBase.h" +#include "fsfw/datapoollocal/LocalPoolVariable.h" object_id_t DeviceHandlerBase::powerSwitcherId = objects::NO_OBJECT; object_id_t DeviceHandlerBase::rawDataReceiverId = objects::NO_OBJECT; diff --git a/src/core/devicehandlers/DeviceHandlerFailureIsolation.cpp b/src/core/devicehandlers/DeviceHandlerFailureIsolation.cpp index b0708a59..8b1c1489 100644 --- a/src/core/devicehandlers/DeviceHandlerFailureIsolation.cpp +++ b/src/core/devicehandlers/DeviceHandlerFailureIsolation.cpp @@ -1,12 +1,12 @@ -#include "DeviceHandlerFailureIsolation.h" +#include "fsfw/devicehandlers/DeviceHandlerFailureIsolation.h" -#include "../devicehandlers/DeviceHandlerIF.h" -#include "../objectmanager/ObjectManager.h" -#include "../modes/HasModesIF.h" -#include "../health/HealthTableIF.h" -#include "../power/Fuse.h" -#include "../serviceinterface/ServiceInterfaceStream.h" -#include "../thermal/ThermalComponentIF.h" +#include "fsfw/devicehandlers/DeviceHandlerIF.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/modes/HasModesIF.h" +#include "fsfw/health/HealthTableIF.h" +#include "fsfw/power/Fuse.h" +#include "fsfw/serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/thermal/ThermalComponentIF.h" object_id_t DeviceHandlerFailureIsolation::powerConfirmationId = objects::NO_OBJECT; diff --git a/src/core/devicehandlers/DeviceHandlerMessage.cpp b/src/core/devicehandlers/DeviceHandlerMessage.cpp index 69c9deb9..48277c9a 100644 --- a/src/core/devicehandlers/DeviceHandlerMessage.cpp +++ b/src/core/devicehandlers/DeviceHandlerMessage.cpp @@ -1,5 +1,5 @@ -#include "DeviceHandlerMessage.h" -#include "../objectmanager/ObjectManager.h" +#include "fsfw/devicehandlers/DeviceHandlerMessage.h" +#include "fsfw/objectmanager/ObjectManager.h" store_address_t DeviceHandlerMessage::getStoreAddress( const CommandMessage* message) { diff --git a/src/core/devicehandlers/DeviceTmReportingWrapper.cpp b/src/core/devicehandlers/DeviceTmReportingWrapper.cpp index c70f57d6..0300a24a 100644 --- a/src/core/devicehandlers/DeviceTmReportingWrapper.cpp +++ b/src/core/devicehandlers/DeviceTmReportingWrapper.cpp @@ -1,5 +1,5 @@ -#include "DeviceTmReportingWrapper.h" -#include "../serialize/SerializeAdapter.h" +#include "fsfw/devicehandlers/DeviceTmReportingWrapper.h" +#include "fsfw/serialize/SerializeAdapter.h" DeviceTmReportingWrapper::DeviceTmReportingWrapper(object_id_t objectId, ActionId_t actionId, SerializeIF* data) : diff --git a/src/core/devicehandlers/HealthDevice.cpp b/src/core/devicehandlers/HealthDevice.cpp index e23dd5b6..2f6e1dfb 100644 --- a/src/core/devicehandlers/HealthDevice.cpp +++ b/src/core/devicehandlers/HealthDevice.cpp @@ -1,5 +1,5 @@ -#include "HealthDevice.h" -#include "../ipc/QueueFactory.h" +#include "fsfw/devicehandlers/HealthDevice.h" +#include "fsfw/ipc/QueueFactory.h" HealthDevice::HealthDevice(object_id_t setObjectId, MessageQueueId_t parentQueue) : diff --git a/src/core/events/CMakeLists.txt b/src/core/events/CMakeLists.txt index 4e935167..28eec772 100644 --- a/src/core/events/CMakeLists.txt +++ b/src/core/events/CMakeLists.txt @@ -1,7 +1,6 @@ -target_sources(${LIB_FSFW_NAME} - PRIVATE - EventManager.cpp - EventMessage.cpp +target_sources(${LIB_FSFW_NAME} PRIVATE + EventManager.cpp + EventMessage.cpp ) -add_subdirectory(eventmatching) \ No newline at end of file +add_subdirectory(eventmatching) diff --git a/src/core/events/EventManager.cpp b/src/core/events/EventManager.cpp index 8e2a2a82..5aa82434 100644 --- a/src/core/events/EventManager.cpp +++ b/src/core/events/EventManager.cpp @@ -1,8 +1,8 @@ -#include "EventManager.h" -#include "EventMessage.h" +#include "fsfw/events/EventManager.h" +#include "fsfw/events/EventMessage.h" -#include "../ipc/QueueFactory.h" -#include "../ipc/MutexFactory.h" +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/ipc/MutexFactory.h" MessageQueueId_t EventManagerIF::eventmanagerQueue = MessageQueueIF::NO_QUEUE; diff --git a/src/core/events/EventMessage.cpp b/src/core/events/EventMessage.cpp index 548b4f0f..74f42b06 100644 --- a/src/core/events/EventMessage.cpp +++ b/src/core/events/EventMessage.cpp @@ -1,4 +1,4 @@ -#include "EventMessage.h" +#include "fsfw/events/EventMessage.h" #include EventMessage::EventMessage() { diff --git a/inc/fsfw/events/eventmatching/CMakeLists.txt b/src/core/events/eventmatching/CMakeLists.txt similarity index 100% rename from inc/fsfw/events/eventmatching/CMakeLists.txt rename to src/core/events/eventmatching/CMakeLists.txt diff --git a/inc/fsfw/events/eventmatching/EventIdRangeMatcher.cpp b/src/core/events/eventmatching/EventIdRangeMatcher.cpp similarity index 84% rename from inc/fsfw/events/eventmatching/EventIdRangeMatcher.cpp rename to src/core/events/eventmatching/EventIdRangeMatcher.cpp index 974567d4..92089f7c 100644 --- a/inc/fsfw/events/eventmatching/EventIdRangeMatcher.cpp +++ b/src/core/events/eventmatching/EventIdRangeMatcher.cpp @@ -1,4 +1,4 @@ -#include "EventIdRangeMatcher.h" +#include "fsfw/events/eventmatching/EventIdRangeMatcher.h" EventIdRangeMatcher::EventIdRangeMatcher(EventId_t lower, EventId_t upper, bool inverted) : EventRangeMatcherBase(lower, upper, inverted) { diff --git a/inc/fsfw/events/eventmatching/EventMatchTree.cpp b/src/core/events/eventmatching/EventMatchTree.cpp similarity index 94% rename from inc/fsfw/events/eventmatching/EventMatchTree.cpp rename to src/core/events/eventmatching/EventMatchTree.cpp index 55e4083f..66e9e91a 100644 --- a/inc/fsfw/events/eventmatching/EventMatchTree.cpp +++ b/src/core/events/eventmatching/EventMatchTree.cpp @@ -1,7 +1,7 @@ -#include "EventIdRangeMatcher.h" -#include "EventMatchTree.h" -#include "ReporterRangeMatcher.h" -#include "SeverityRangeMatcher.h" +#include "fsfw/events/eventmatching/EventIdRangeMatcher.h" +#include "fsfw/events/eventmatching/EventMatchTree.h" +#include "fsfw/events/eventmatching/ReporterRangeMatcher.h" +#include "fsfw/events/eventmatching/SeverityRangeMatcher.h" EventMatchTree::EventMatchTree(StorageManagerIF* storageBackend, bool invertedMatch) : diff --git a/inc/fsfw/events/eventmatching/ReporterRangeMatcher.cpp b/src/core/events/eventmatching/ReporterRangeMatcher.cpp similarity index 84% rename from inc/fsfw/events/eventmatching/ReporterRangeMatcher.cpp rename to src/core/events/eventmatching/ReporterRangeMatcher.cpp index 61179726..fc3a2f9f 100644 --- a/inc/fsfw/events/eventmatching/ReporterRangeMatcher.cpp +++ b/src/core/events/eventmatching/ReporterRangeMatcher.cpp @@ -1,4 +1,4 @@ -#include "ReporterRangeMatcher.h" +#include "fsfw/events/eventmatching/ReporterRangeMatcher.h" ReporterRangeMatcher::ReporterRangeMatcher(object_id_t lower, object_id_t upper, bool inverted) : EventRangeMatcherBase(lower, upper, inverted) { diff --git a/inc/fsfw/events/eventmatching/SeverityRangeMatcher.cpp b/src/core/events/eventmatching/SeverityRangeMatcher.cpp similarity index 70% rename from inc/fsfw/events/eventmatching/SeverityRangeMatcher.cpp rename to src/core/events/eventmatching/SeverityRangeMatcher.cpp index 6fd38271..230e4e77 100644 --- a/inc/fsfw/events/eventmatching/SeverityRangeMatcher.cpp +++ b/src/core/events/eventmatching/SeverityRangeMatcher.cpp @@ -1,6 +1,6 @@ -#include "SeverityRangeMatcher.h" -#include "../../events/EventMessage.h" -#include "../../serialize/SerializeAdapter.h" +#include "fsfw/events/eventmatching/SeverityRangeMatcher.h" +#include "fsfw/events/EventMessage.h" +#include "fsfw/serialize/SerializeAdapter.h" SeverityRangeMatcher::SeverityRangeMatcher(EventSeverity_t from, EventSeverity_t till, bool inverted) : EventRangeMatcherBase(from, till, inverted) { diff --git a/src/core/fdir/EventCorrelation.cpp b/src/core/fdir/EventCorrelation.cpp index d60fc6ca..5b023334 100644 --- a/src/core/fdir/EventCorrelation.cpp +++ b/src/core/fdir/EventCorrelation.cpp @@ -1,4 +1,4 @@ -#include "EventCorrelation.h" +#include "fsfw/fdir/EventCorrelation.h" EventCorrelation::EventCorrelation(uint32_t timeout) : eventPending(false) { diff --git a/src/core/fdir/FailureIsolationBase.cpp b/src/core/fdir/FailureIsolationBase.cpp index 764fc918..717e5072 100644 --- a/src/core/fdir/FailureIsolationBase.cpp +++ b/src/core/fdir/FailureIsolationBase.cpp @@ -1,9 +1,9 @@ -#include "../events/EventManagerIF.h" -#include "FailureIsolationBase.h" -#include "../health/HasHealthIF.h" -#include "../health/HealthMessage.h" -#include "../ipc/QueueFactory.h" -#include "../objectmanager/ObjectManager.h" +#include "fsfw/events/EventManagerIF.h" +#include "fsfw/fdir/FailureIsolationBase.h" +#include "fsfw/health/HasHealthIF.h" +#include "fsfw/health/HealthMessage.h" +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/objectmanager/ObjectManager.h" FailureIsolationBase::FailureIsolationBase(object_id_t owner, object_id_t parent, uint8_t messageDepth, uint8_t parameterDomainBase) : diff --git a/src/core/fdir/FaultCounter.cpp b/src/core/fdir/FaultCounter.cpp index 53c1dd7d..0b30a67d 100644 --- a/src/core/fdir/FaultCounter.cpp +++ b/src/core/fdir/FaultCounter.cpp @@ -1,4 +1,4 @@ -#include "FaultCounter.h" +#include "fsfw/fdir/FaultCounter.h" FaultCounter::FaultCounter(uint32_t failureThreshold, uint32_t decrementAfterMs, uint8_t setParameterDomain) : diff --git a/src/core/globalfunctions/AsciiConverter.cpp b/src/core/globalfunctions/AsciiConverter.cpp index 9eb3698f..09908815 100644 --- a/src/core/globalfunctions/AsciiConverter.cpp +++ b/src/core/globalfunctions/AsciiConverter.cpp @@ -1,4 +1,5 @@ -#include "AsciiConverter.h" +#include "fsfw/globalfunctions/AsciiConverter.h" + #include #include diff --git a/src/core/globalfunctions/CRC.cpp b/src/core/globalfunctions/CRC.cpp index 7bb56806..3df6018c 100644 --- a/src/core/globalfunctions/CRC.cpp +++ b/src/core/globalfunctions/CRC.cpp @@ -1,4 +1,4 @@ -#include "CRC.h" +#include "fsfw/globalfunctions/CRC.h" #include const uint16_t CRC::crc16ccitt_table[256] = { diff --git a/src/core/globalfunctions/DleEncoder.cpp b/src/core/globalfunctions/DleEncoder.cpp index 8520389d..11df8ad7 100644 --- a/src/core/globalfunctions/DleEncoder.cpp +++ b/src/core/globalfunctions/DleEncoder.cpp @@ -1,4 +1,4 @@ -#include "../globalfunctions/DleEncoder.h" +#include "fsfw/globalfunctions/DleEncoder.h" DleEncoder::DleEncoder() {} diff --git a/src/core/globalfunctions/PeriodicOperationDivider.cpp b/src/core/globalfunctions/PeriodicOperationDivider.cpp index 28e98feb..62cc6f4c 100644 --- a/src/core/globalfunctions/PeriodicOperationDivider.cpp +++ b/src/core/globalfunctions/PeriodicOperationDivider.cpp @@ -1,4 +1,4 @@ -#include "PeriodicOperationDivider.h" +#include "fsfw/globalfunctions/PeriodicOperationDivider.h" PeriodicOperationDivider::PeriodicOperationDivider(uint32_t divider, diff --git a/src/core/globalfunctions/Type.cpp b/src/core/globalfunctions/Type.cpp index fa6d2f28..5f1e05d1 100644 --- a/src/core/globalfunctions/Type.cpp +++ b/src/core/globalfunctions/Type.cpp @@ -1,5 +1,5 @@ -#include "Type.h" -#include "../serialize/SerializeAdapter.h" +#include "fsfw/globalfunctions/Type.h" +#include "fsfw/serialize/SerializeAdapter.h" Type::Type() : actualType(UNKNOWN_TYPE) { diff --git a/src/core/globalfunctions/arrayprinter.cpp b/src/core/globalfunctions/arrayprinter.cpp index 3c729c6b..45a1cb38 100644 --- a/src/core/globalfunctions/arrayprinter.cpp +++ b/src/core/globalfunctions/arrayprinter.cpp @@ -1,5 +1,6 @@ -#include "arrayprinter.h" -#include "../serviceinterface/ServiceInterface.h" +#include "fsfw/globalfunctions/arrayprinter.h" +#include "fsfw/serviceinterface/ServiceInterface.h" + #include diff --git a/src/core/globalfunctions/bitutility.cpp b/src/core/globalfunctions/bitutility.cpp index 5cc92dac..628e30c2 100644 --- a/src/core/globalfunctions/bitutility.cpp +++ b/src/core/globalfunctions/bitutility.cpp @@ -1,4 +1,4 @@ -#include "bitutility.h" +#include "fsfw/globalfunctions/bitutility.h" void bitutil::bitSet(uint8_t *byte, uint8_t position) { if(position > 7) { diff --git a/src/core/globalfunctions/math/QuaternionOperations.cpp b/src/core/globalfunctions/math/QuaternionOperations.cpp index c09426da..31ba2044 100644 --- a/src/core/globalfunctions/math/QuaternionOperations.cpp +++ b/src/core/globalfunctions/math/QuaternionOperations.cpp @@ -1,5 +1,5 @@ -#include "QuaternionOperations.h" -#include "VectorOperations.h" +#include "fsfw/globalfunctions/math/QuaternionOperations.h" +#include "fsfw/globalfunctions/math/VectorOperations.h" #include #include diff --git a/src/core/globalfunctions/timevalOperations.cpp b/src/core/globalfunctions/timevalOperations.cpp index 1228da04..e91e7f57 100644 --- a/src/core/globalfunctions/timevalOperations.cpp +++ b/src/core/globalfunctions/timevalOperations.cpp @@ -1,4 +1,4 @@ -#include "timevalOperations.h" +#include "fsfw/globalfunctions/timevalOperations.h" timeval& operator+=(timeval& lhs, const timeval& rhs) { int64_t sum = lhs.tv_sec * 1000000. + lhs.tv_usec; diff --git a/src/core/health/HealthHelper.cpp b/src/core/health/HealthHelper.cpp index 28419108..6bbbe25b 100644 --- a/src/core/health/HealthHelper.cpp +++ b/src/core/health/HealthHelper.cpp @@ -1,5 +1,6 @@ -#include "HealthHelper.h" -#include "../serviceinterface/ServiceInterface.h" +#include "fsfw/health/HealthHelper.h" + +#include "fsfw/serviceinterface/ServiceInterface.h" HealthHelper::HealthHelper(HasHealthIF* owner, object_id_t objectId) : objectId(objectId), owner(owner) { diff --git a/src/core/health/HealthMessage.cpp b/src/core/health/HealthMessage.cpp index 52479c26..31b6273b 100644 --- a/src/core/health/HealthMessage.cpp +++ b/src/core/health/HealthMessage.cpp @@ -1,4 +1,4 @@ -#include "HealthMessage.h" +#include "fsfw/health/HealthMessage.h" void HealthMessage::setHealthMessage(CommandMessage* message, Command_t command, HasHealthIF::HealthState health, HasHealthIF::HealthState oldHealth) { diff --git a/src/core/health/HealthTable.cpp b/src/core/health/HealthTable.cpp index 3fed1deb..a3300462 100644 --- a/src/core/health/HealthTable.cpp +++ b/src/core/health/HealthTable.cpp @@ -1,7 +1,8 @@ -#include "HealthTable.h" -#include "../ipc/MutexGuard.h" -#include "../ipc/MutexFactory.h" -#include "../serialize/SerializeAdapter.h" +#include "fsfw/health/HealthTable.h" + +#include "fsfw/ipc/MutexGuard.h" +#include "fsfw/ipc/MutexFactory.h" +#include "fsfw/serialize/SerializeAdapter.h" HealthTable::HealthTable(object_id_t objectid) : SystemObject(objectid) { diff --git a/src/core/housekeeping/CMakeLists.txt b/src/core/housekeeping/CMakeLists.txt new file mode 100644 index 00000000..0a3e7bd1 --- /dev/null +++ b/src/core/housekeeping/CMakeLists.txt @@ -0,0 +1,4 @@ +target_sources(${LIB_FSFW_NAME} PRIVATE + HousekeepingMessage.cpp + PeriodicHousekeepingHelper.cpp +) \ No newline at end of file diff --git a/src/core/housekeeping/HousekeepingMessage.cpp b/src/core/housekeeping/HousekeepingMessage.cpp index 71f7ff17..432a8620 100644 --- a/src/core/housekeeping/HousekeepingMessage.cpp +++ b/src/core/housekeeping/HousekeepingMessage.cpp @@ -1,6 +1,7 @@ -#include "HousekeepingMessage.h" +#include "fsfw/housekeeping/HousekeepingMessage.h" + +#include "fsfw/objectmanager/ObjectManager.h" -#include "../objectmanager/ObjectManager.h" #include HousekeepingMessage::~HousekeepingMessage() {} diff --git a/src/core/housekeeping/PeriodicHousekeepingHelper.cpp b/src/core/housekeeping/PeriodicHousekeepingHelper.cpp index 892eb354..68740d33 100644 --- a/src/core/housekeeping/PeriodicHousekeepingHelper.cpp +++ b/src/core/housekeeping/PeriodicHousekeepingHelper.cpp @@ -1,6 +1,6 @@ -#include "PeriodicHousekeepingHelper.h" +#include "fsfw/housekeeping/PeriodicHousekeepingHelper.h" -#include "../datapoollocal/LocalPoolDataSetBase.h" +#include "fsfw/datapoollocal/LocalPoolDataSetBase.h" #include PeriodicHousekeepingHelper::PeriodicHousekeepingHelper( diff --git a/src/core/internalError/CMakeLists.txt b/src/core/internalerror/CMakeLists.txt similarity index 100% rename from src/core/internalError/CMakeLists.txt rename to src/core/internalerror/CMakeLists.txt diff --git a/src/core/internalError/InternalErrorReporter.cpp b/src/core/internalerror/InternalErrorReporter.cpp similarity index 96% rename from src/core/internalError/InternalErrorReporter.cpp rename to src/core/internalerror/InternalErrorReporter.cpp index 78618448..8689ab3e 100644 --- a/src/core/internalError/InternalErrorReporter.cpp +++ b/src/core/internalerror/InternalErrorReporter.cpp @@ -1,9 +1,9 @@ -#include "InternalErrorReporter.h" +#include "fsfw/internalerror/InternalErrorReporter.h" -#include "../ipc/QueueFactory.h" -#include "../ipc/MutexFactory.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../datapool/PoolReadGuard.h" +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/ipc/MutexFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/datapool/PoolReadGuard.h" InternalErrorReporter::InternalErrorReporter(object_id_t setObjectId, uint32_t messageQueueDepth): SystemObject(setObjectId), diff --git a/src/core/ipc/CommandMessage.cpp b/src/core/ipc/CommandMessage.cpp index 513debd3..9448d152 100644 --- a/src/core/ipc/CommandMessage.cpp +++ b/src/core/ipc/CommandMessage.cpp @@ -1,5 +1,6 @@ -#include "CommandMessage.h" -#include "CommandMessageCleaner.h" +#include "fsfw/ipc/CommandMessage.h" +#include "fsfw/ipc/CommandMessageCleaner.h" + #include CommandMessage::CommandMessage() { diff --git a/src/core/ipc/CommandMessageCleaner.cpp b/src/core/ipc/CommandMessageCleaner.cpp index 29998124..ca835509 100644 --- a/src/core/ipc/CommandMessageCleaner.cpp +++ b/src/core/ipc/CommandMessageCleaner.cpp @@ -1,15 +1,15 @@ -#include "CommandMessageCleaner.h" +#include "fsfw/ipc/CommandMessageCleaner.h" -#include "../memory/GenericFileSystemMessage.h" -#include "../devicehandlers/DeviceHandlerMessage.h" -#include "../health/HealthMessage.h" -#include "../memory/MemoryMessage.h" -#include "../modes/ModeMessage.h" -#include "../monitoring/MonitoringMessage.h" -#include "../subsystem/modes/ModeSequenceMessage.h" -#include "../tmstorage/TmStoreMessage.h" -#include "../housekeeping/HousekeepingMessage.h" -#include "../parameters/ParameterMessage.h" +#include "fsfw/memory/GenericFileSystemMessage.h" +#include "fsfw/devicehandlers/DeviceHandlerMessage.h" +#include "fsfw/health/HealthMessage.h" +#include "fsfw/memory/MemoryMessage.h" +#include "fsfw/modes/ModeMessage.h" +#include "fsfw/monitoring/MonitoringMessage.h" +#include "fsfw/subsystem/modes/ModeSequenceMessage.h" +#include "fsfw/tmstorage/TmStoreMessage.h" +#include "fsfw/housekeeping/HousekeepingMessage.h" +#include "fsfw/parameters/ParameterMessage.h" void CommandMessageCleaner::clearCommandMessage(CommandMessage* message) { switch(message->getMessageType()){ diff --git a/src/core/ipc/MessageQueueMessage.cpp b/src/core/ipc/MessageQueueMessage.cpp index 1958af54..62b826e9 100644 --- a/src/core/ipc/MessageQueueMessage.cpp +++ b/src/core/ipc/MessageQueueMessage.cpp @@ -1,6 +1,7 @@ -#include "MessageQueueMessage.h" -#include "../serviceinterface/ServiceInterfaceStream.h" -#include "../globalfunctions/arrayprinter.h" +#include "fsfw/ipc/MessageQueueMessage.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/globalfunctions/arrayprinter.h" + #include MessageQueueMessage::MessageQueueMessage() : diff --git a/src/core/memory/GenericFileSystemMessage.cpp b/src/core/memory/GenericFileSystemMessage.cpp index b0e1a9ec..abf04c4e 100644 --- a/src/core/memory/GenericFileSystemMessage.cpp +++ b/src/core/memory/GenericFileSystemMessage.cpp @@ -1,7 +1,7 @@ -#include "GenericFileSystemMessage.h" +#include "fsfw/memory/GenericFileSystemMessage.h" -#include "../objectmanager/ObjectManager.h" -#include "../storagemanager/StorageManagerIF.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/storagemanager/StorageManagerIF.h" void GenericFileSystemMessage::setCreateFileCommand(CommandMessage* message, store_address_t storeId) { diff --git a/src/core/memory/MemoryHelper.cpp b/src/core/memory/MemoryHelper.cpp index d83a9fab..2039a488 100644 --- a/src/core/memory/MemoryHelper.cpp +++ b/src/core/memory/MemoryHelper.cpp @@ -1,10 +1,10 @@ -#include "MemoryHelper.h" -#include "MemoryMessage.h" +#include "fsfw/memory/MemoryHelper.h" +#include "fsfw/memory/MemoryMessage.h" -#include "../globalfunctions/CRC.h" -#include "../objectmanager/ObjectManager.h" -#include "../serialize/EndianConverter.h" -#include "../serviceinterface/ServiceInterface.h" +#include "fsfw/globalfunctions/CRC.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serialize/EndianConverter.h" +#include "fsfw/serviceinterface/ServiceInterface.h" MemoryHelper::MemoryHelper(HasMemoryIF* workOnThis, MessageQueueIF* useThisQueue): diff --git a/src/core/memory/MemoryMessage.cpp b/src/core/memory/MemoryMessage.cpp index 1f050ef8..9df52609 100644 --- a/src/core/memory/MemoryMessage.cpp +++ b/src/core/memory/MemoryMessage.cpp @@ -1,6 +1,6 @@ -#include "MemoryMessage.h" +#include "fsfw/memory/MemoryMessage.h" -#include "../objectmanager/ObjectManager.h" +#include "fsfw/objectmanager/ObjectManager.h" uint32_t MemoryMessage::getAddress(const CommandMessage* message) { return message->getParameter(); diff --git a/src/core/modes/ModeHelper.cpp b/src/core/modes/ModeHelper.cpp index 6be4f776..d2c5067d 100644 --- a/src/core/modes/ModeHelper.cpp +++ b/src/core/modes/ModeHelper.cpp @@ -1,8 +1,8 @@ -#include "HasModesIF.h" -#include "ModeHelper.h" +#include "fsfw/modes/HasModesIF.h" +#include "fsfw/modes/ModeHelper.h" -#include "../ipc/MessageQueueSenderIF.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/ipc/MessageQueueSenderIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" ModeHelper::ModeHelper(HasModesIF *owner) : commandedMode(HasModesIF::MODE_OFF), diff --git a/src/core/modes/ModeMessage.cpp b/src/core/modes/ModeMessage.cpp index b33bba60..a228304d 100644 --- a/src/core/modes/ModeMessage.cpp +++ b/src/core/modes/ModeMessage.cpp @@ -1,4 +1,4 @@ -#include "ModeMessage.h" +#include "fsfw/modes/ModeMessage.h" Mode_t ModeMessage::getMode(const CommandMessage* message) { return message->getParameter(); diff --git a/src/core/objectmanager/ObjectManager.cpp b/src/core/objectmanager/ObjectManager.cpp index 3e6820a7..639688ab 100644 --- a/src/core/objectmanager/ObjectManager.cpp +++ b/src/core/objectmanager/ObjectManager.cpp @@ -1,5 +1,5 @@ -#include "ObjectManager.h" -#include "../serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #if FSFW_CPP_OSTREAM_ENABLED == 1 #include diff --git a/src/core/objectmanager/SystemObject.cpp b/src/core/objectmanager/SystemObject.cpp index 123bbe65..bad38975 100644 --- a/src/core/objectmanager/SystemObject.cpp +++ b/src/core/objectmanager/SystemObject.cpp @@ -1,6 +1,6 @@ -#include "ObjectManager.h" -#include "SystemObject.h" -#include "../events/EventManagerIF.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/events/EventManagerIF.h" SystemObject::SystemObject(object_id_t setObjectId, bool doRegister) : objectId(setObjectId), registered(doRegister) { diff --git a/src/core/parameters/ParameterHelper.cpp b/src/core/parameters/ParameterHelper.cpp index 694ec5a4..9250a1d4 100644 --- a/src/core/parameters/ParameterHelper.cpp +++ b/src/core/parameters/ParameterHelper.cpp @@ -1,7 +1,7 @@ -#include "ParameterHelper.h" -#include "ParameterMessage.h" +#include "fsfw/parameters/ParameterHelper.h" +#include "fsfw/parameters/ParameterMessage.h" -#include "../objectmanager/ObjectManager.h" +#include "fsfw/objectmanager/ObjectManager.h" ParameterHelper::ParameterHelper(ReceivesParameterMessagesIF* owner): owner(owner) {} diff --git a/src/core/parameters/ParameterMessage.cpp b/src/core/parameters/ParameterMessage.cpp index 8a5835ff..ee58339c 100644 --- a/src/core/parameters/ParameterMessage.cpp +++ b/src/core/parameters/ParameterMessage.cpp @@ -1,6 +1,6 @@ -#include "ParameterMessage.h" +#include "fsfw/parameters/ParameterMessage.h" -#include "../objectmanager/ObjectManager.h" +#include "fsfw/objectmanager/ObjectManager.h" ParameterId_t ParameterMessage::getParameterId(const CommandMessage* message) { return message->getParameter(); diff --git a/src/core/parameters/ParameterWrapper.cpp b/src/core/parameters/ParameterWrapper.cpp index 660d7db7..8c09a822 100644 --- a/src/core/parameters/ParameterWrapper.cpp +++ b/src/core/parameters/ParameterWrapper.cpp @@ -1,6 +1,6 @@ -#include "ParameterWrapper.h" -#include -#include +#include "fsfw/FSFW.h" +#include "fsfw/parameters/ParameterWrapper.h" +#include "fsfw/serviceinterface/ServiceInterface.h" ParameterWrapper::ParameterWrapper() : pointsToStream(false), type(Type::UNKNOWN_TYPE) { diff --git a/src/core/power/Fuse.cpp b/src/core/power/Fuse.cpp index 0cb1385b..821bdbc5 100644 --- a/src/core/power/Fuse.cpp +++ b/src/core/power/Fuse.cpp @@ -1,10 +1,10 @@ -#include "Fuse.h" +#include "fsfw/power/Fuse.h" -#include "../monitoring/LimitViolationReporter.h" -#include "../monitoring/MonitoringMessageContent.h" -#include "../objectmanager/ObjectManager.h" -#include "../serialize/SerialFixedArrayListAdapter.h" -#include "../ipc/QueueFactory.h" +#include "fsfw/monitoring/LimitViolationReporter.h" +#include "fsfw/monitoring/MonitoringMessageContent.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serialize/SerialFixedArrayListAdapter.h" +#include "fsfw/ipc/QueueFactory.h" object_id_t Fuse::powerSwitchId = 0; diff --git a/src/core/power/PowerComponent.cpp b/src/core/power/PowerComponent.cpp index 9ea84dad..fb66748a 100644 --- a/src/core/power/PowerComponent.cpp +++ b/src/core/power/PowerComponent.cpp @@ -1,5 +1,5 @@ -#include "PowerComponent.h" -#include "../serialize/SerializeAdapter.h" +#include "fsfw/power/PowerComponent.h" +#include "fsfw/serialize/SerializeAdapter.h" PowerComponent::PowerComponent(): switchId1(0xFF), switchId2(0xFF), diff --git a/src/core/power/PowerSensor.cpp b/src/core/power/PowerSensor.cpp index 40d7afc6..e1e31353 100644 --- a/src/core/power/PowerSensor.cpp +++ b/src/core/power/PowerSensor.cpp @@ -1,6 +1,6 @@ -#include "PowerSensor.h" +#include "fsfw/power/PowerSensor.h" -#include "../ipc/QueueFactory.h" +#include "fsfw/ipc/QueueFactory.h" PowerSensor::PowerSensor(object_id_t objectId, sid_t setId, VariableIds ids, DefaultLimits limits, SensorEvents events, uint16_t confirmationCount) : diff --git a/src/core/power/PowerSwitcher.cpp b/src/core/power/PowerSwitcher.cpp index 642a2697..f849a7fb 100644 --- a/src/core/power/PowerSwitcher.cpp +++ b/src/core/power/PowerSwitcher.cpp @@ -1,7 +1,7 @@ -#include "PowerSwitcher.h" +#include "fsfw/power/PowerSwitcher.h" -#include "../objectmanager/ObjectManager.h" -#include "../serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" PowerSwitcher::PowerSwitcher(uint8_t setSwitch1, uint8_t setSwitch2, PowerSwitcher::State_t setStartState): diff --git a/src/core/serialize/SerialBufferAdapter.cpp b/src/core/serialize/SerialBufferAdapter.cpp index 53b8c3d5..4f03658a 100644 --- a/src/core/serialize/SerialBufferAdapter.cpp +++ b/src/core/serialize/SerialBufferAdapter.cpp @@ -1,5 +1,5 @@ -#include "../serialize/SerialBufferAdapter.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/serialize/SerialBufferAdapter.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include template diff --git a/src/core/serviceinterface/ServiceInterfaceBuffer.cpp b/src/core/serviceinterface/ServiceInterfaceBuffer.cpp index b85a43a4..7cba2145 100644 --- a/src/core/serviceinterface/ServiceInterfaceBuffer.cpp +++ b/src/core/serviceinterface/ServiceInterfaceBuffer.cpp @@ -1,10 +1,10 @@ -#include "ServiceInterfaceBuffer.h" +#include "fsfw/serviceinterface/ServiceInterfaceBuffer.h" #if FSFW_CPP_OSTREAM_ENABLED == 1 -#include "../timemanager/Clock.h" +#include "fsfw/timemanager/Clock.h" -#include "serviceInterfaceDefintions.h" +#include "fsfw/serviceinterface/serviceInterfaceDefintions.h" #include #include diff --git a/src/core/serviceinterface/ServiceInterfacePrinter.cpp b/src/core/serviceinterface/ServiceInterfacePrinter.cpp index ce797f1c..9b62e91d 100644 --- a/src/core/serviceinterface/ServiceInterfacePrinter.cpp +++ b/src/core/serviceinterface/ServiceInterfacePrinter.cpp @@ -1,7 +1,7 @@ -#include -#include "ServiceInterfacePrinter.h" -#include "serviceInterfaceDefintions.h" -#include "../timemanager/Clock.h" +#include "fsfw/FSFW.h" +#include "fsfw/serviceinterface/ServiceInterfacePrinter.h" +#include "fsfw/serviceinterface/serviceInterfaceDefintions.h" +#include "fsfw/timemanager/Clock.h" #include #include diff --git a/src/core/serviceinterface/ServiceInterfaceStream.cpp b/src/core/serviceinterface/ServiceInterfaceStream.cpp index 80942b88..fe45442d 100644 --- a/src/core/serviceinterface/ServiceInterfaceStream.cpp +++ b/src/core/serviceinterface/ServiceInterfaceStream.cpp @@ -1,4 +1,4 @@ -#include "ServiceInterfaceStream.h" +#include "fsfw/serviceinterface/ServiceInterfaceStream.h" #if FSFW_CPP_OSTREAM_ENABLED == 1 diff --git a/src/core/storagemanager/ConstStorageAccessor.cpp b/src/core/storagemanager/ConstStorageAccessor.cpp index aab84862..67736d51 100644 --- a/src/core/storagemanager/ConstStorageAccessor.cpp +++ b/src/core/storagemanager/ConstStorageAccessor.cpp @@ -1,8 +1,8 @@ -#include "ConstStorageAccessor.h" -#include "StorageManagerIF.h" +#include "fsfw/storagemanager/ConstStorageAccessor.h" +#include "fsfw/storagemanager/StorageManagerIF.h" -#include "../serviceinterface/ServiceInterfaceStream.h" -#include "../globalfunctions/arrayprinter.h" +#include "fsfw/serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/globalfunctions/arrayprinter.h" #include diff --git a/src/core/storagemanager/LocalPool.cpp b/src/core/storagemanager/LocalPool.cpp index 41c9250a..c5e74e08 100644 --- a/src/core/storagemanager/LocalPool.cpp +++ b/src/core/storagemanager/LocalPool.cpp @@ -1,7 +1,7 @@ -#include "LocalPool.h" -#include "FSFWConfig.h" +#include "fsfw/FSFW.h" +#include "fsfw/storagemanager/LocalPool.h" -#include "../objectmanager/ObjectManager.h" +#include "fsfw/objectmanager/ObjectManager.h" #include diff --git a/src/core/storagemanager/PoolManager.cpp b/src/core/storagemanager/PoolManager.cpp index eec84907..073371ad 100644 --- a/src/core/storagemanager/PoolManager.cpp +++ b/src/core/storagemanager/PoolManager.cpp @@ -1,5 +1,6 @@ -#include "PoolManager.h" -#include +#include "fsfw/FSFW.h" +#include "fsfw/storagemanager/PoolManager.h" + PoolManager::PoolManager(object_id_t setObjectId, const LocalPoolConfig& localPoolConfig): diff --git a/src/core/storagemanager/StorageAccessor.cpp b/src/core/storagemanager/StorageAccessor.cpp index a7b4fae4..95f61a75 100644 --- a/src/core/storagemanager/StorageAccessor.cpp +++ b/src/core/storagemanager/StorageAccessor.cpp @@ -1,6 +1,7 @@ -#include "StorageAccessor.h" -#include "StorageManagerIF.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/storagemanager/StorageAccessor.h" +#include "fsfw/storagemanager/StorageManagerIF.h" + +#include "fsfw/serviceinterface/ServiceInterface.h" #include diff --git a/src/core/subsystem/Subsystem.cpp b/src/core/subsystem/Subsystem.cpp index dffad034..0c8e3f35 100644 --- a/src/core/subsystem/Subsystem.cpp +++ b/src/core/subsystem/Subsystem.cpp @@ -1,11 +1,11 @@ -#include "Subsystem.h" +#include "fsfw/subsystem/Subsystem.h" -#include "../health/HealthMessage.h" -#include "../objectmanager/ObjectManager.h" -#include "../serialize/SerialArrayListAdapter.h" -#include "../serialize/SerialFixedArrayListAdapter.h" -#include "../serialize/SerializeElement.h" -#include "../serialize/SerialLinkedListAdapter.h" +#include "fsfw/health/HealthMessage.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serialize/SerialArrayListAdapter.h" +#include "fsfw/serialize/SerialFixedArrayListAdapter.h" +#include "fsfw/serialize/SerializeElement.h" +#include "fsfw/serialize/SerialLinkedListAdapter.h" #include diff --git a/src/core/subsystem/SubsystemBase.cpp b/src/core/subsystem/SubsystemBase.cpp index 0d459324..afcd43ad 100644 --- a/src/core/subsystem/SubsystemBase.cpp +++ b/src/core/subsystem/SubsystemBase.cpp @@ -1,8 +1,8 @@ -#include "SubsystemBase.h" +#include "fsfw/subsystem/SubsystemBase.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../objectmanager/ObjectManager.h" -#include "../ipc/QueueFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/ipc/QueueFactory.h" SubsystemBase::SubsystemBase(object_id_t setObjectId, object_id_t parent, Mode_t initialMode, uint16_t commandQueueDepth) : diff --git a/src/core/subsystem/modes/ModeSequenceMessage.cpp b/src/core/subsystem/modes/ModeSequenceMessage.cpp index 749a90bf..d7570276 100644 --- a/src/core/subsystem/modes/ModeSequenceMessage.cpp +++ b/src/core/subsystem/modes/ModeSequenceMessage.cpp @@ -1,7 +1,7 @@ -#include "ModeSequenceMessage.h" +#include "fsfw/subsystem/modes/ModeSequenceMessage.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../storagemanager/StorageManagerIF.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/storagemanager/StorageManagerIF.h" void ModeSequenceMessage::setModeSequenceMessage(CommandMessage* message, Command_t command, Mode_t sequence, store_address_t storeAddress) { diff --git a/src/core/subsystem/modes/ModeStore.cpp b/src/core/subsystem/modes/ModeStore.cpp index e216a167..e28bbc4f 100644 --- a/src/core/subsystem/modes/ModeStore.cpp +++ b/src/core/subsystem/modes/ModeStore.cpp @@ -1,4 +1,4 @@ -#include "ModeStore.h" +#include "fsfw/subsystem/modes/ModeStore.h" // todo: I think some parts are deprecated. If this is used, the define // USE_MODESTORE could be part of the new FSFWConfig.h file. diff --git a/src/core/tasks/FixedSequenceSlot.cpp b/src/core/tasks/FixedSequenceSlot.cpp index f5d82178..9f617b58 100644 --- a/src/core/tasks/FixedSequenceSlot.cpp +++ b/src/core/tasks/FixedSequenceSlot.cpp @@ -1,5 +1,6 @@ -#include "FixedSequenceSlot.h" -#include "PeriodicTaskIF.h" +#include "fsfw/tasks/FixedSequenceSlot.h" +#include "fsfw/tasks/PeriodicTaskIF.h" + #include FixedSequenceSlot::FixedSequenceSlot(object_id_t handlerId, uint32_t setTime, diff --git a/src/core/tasks/FixedSlotSequence.cpp b/src/core/tasks/FixedSlotSequence.cpp index 54b6ae6d..2e5384b7 100644 --- a/src/core/tasks/FixedSlotSequence.cpp +++ b/src/core/tasks/FixedSlotSequence.cpp @@ -1,5 +1,5 @@ -#include "FixedSlotSequence.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/tasks/FixedSlotSequence.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include FixedSlotSequence::FixedSlotSequence(uint32_t setLengthMs) : diff --git a/src/core/tcdistribution/CCSDSDistributor.cpp b/src/core/tcdistribution/CCSDSDistributor.cpp index 7380866a..ffceaecc 100644 --- a/src/core/tcdistribution/CCSDSDistributor.cpp +++ b/src/core/tcdistribution/CCSDSDistributor.cpp @@ -1,8 +1,8 @@ -#include "CCSDSDistributor.h" +#include "fsfw/tcdistribution/CCSDSDistributor.h" -#include "../objectmanager/ObjectManager.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../tmtcpacket/SpacePacketBase.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tmtcpacket/SpacePacketBase.h" #define CCSDS_DISTRIBUTOR_DEBUGGING 0 diff --git a/src/core/tcdistribution/PUSDistributor.cpp b/src/core/tcdistribution/PUSDistributor.cpp index 955a8093..eec02429 100644 --- a/src/core/tcdistribution/PUSDistributor.cpp +++ b/src/core/tcdistribution/PUSDistributor.cpp @@ -1,9 +1,9 @@ -#include "CCSDSDistributorIF.h" -#include "PUSDistributor.h" +#include "fsfw/tcdistribution/CCSDSDistributorIF.h" +#include "fsfw/tcdistribution/PUSDistributor.h" -#include "../objectmanager/ObjectManager.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../tmtcservices/PusVerificationReport.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tmtcservices/PusVerificationReport.h" #define PUS_DISTRIBUTOR_DEBUGGING 0 diff --git a/src/core/tcdistribution/TcDistributor.cpp b/src/core/tcdistribution/TcDistributor.cpp index df069556..8384e6ee 100644 --- a/src/core/tcdistribution/TcDistributor.cpp +++ b/src/core/tcdistribution/TcDistributor.cpp @@ -1,8 +1,8 @@ -#include "TcDistributor.h" +#include "fsfw/tcdistribution/TcDistributor.h" -#include "../serviceinterface/ServiceInterfaceStream.h" -#include "../tmtcservices/TmTcMessage.h" -#include "../ipc/QueueFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tmtcservices/TmTcMessage.h" +#include "fsfw/ipc/QueueFactory.h" TcDistributor::TcDistributor(object_id_t objectId) : SystemObject(objectId) { diff --git a/src/core/tcdistribution/TcPacketCheck.cpp b/src/core/tcdistribution/TcPacketCheck.cpp index b3a025a4..44501c58 100644 --- a/src/core/tcdistribution/TcPacketCheck.cpp +++ b/src/core/tcdistribution/TcPacketCheck.cpp @@ -1,11 +1,11 @@ -#include "TcPacketCheck.h" +#include "fsfw/tcdistribution/TcPacketCheck.h" -#include "../globalfunctions/CRC.h" -#include "../tmtcpacket/pus/tc/TcPacketBase.h" -#include "../tmtcpacket/pus/tc/TcPacketStoredBase.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../storagemanager/StorageManagerIF.h" -#include "../tmtcservices/VerificationCodes.h" +#include "fsfw/globalfunctions/CRC.h" +#include "fsfw/tmtcpacket/pus/tc/TcPacketBase.h" +#include "fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/tmtcservices/VerificationCodes.h" TcPacketCheck::TcPacketCheck(uint16_t setApid): apid(setApid) { } diff --git a/src/core/thermal/AbstractTemperatureSensor.cpp b/src/core/thermal/AbstractTemperatureSensor.cpp index 40b305af..68e8d1c0 100644 --- a/src/core/thermal/AbstractTemperatureSensor.cpp +++ b/src/core/thermal/AbstractTemperatureSensor.cpp @@ -1,5 +1,5 @@ -#include "AbstractTemperatureSensor.h" -#include "../ipc/QueueFactory.h" +#include "fsfw/thermal/AbstractTemperatureSensor.h" +#include "fsfw/ipc/QueueFactory.h" AbstractTemperatureSensor::AbstractTemperatureSensor(object_id_t setObjectid, ThermalModuleIF *thermalModule) : diff --git a/src/core/thermal/Heater.cpp b/src/core/thermal/Heater.cpp index f97cb543..e6acba13 100644 --- a/src/core/thermal/Heater.cpp +++ b/src/core/thermal/Heater.cpp @@ -1,9 +1,9 @@ -#include "Heater.h" +#include "fsfw/thermal/Heater.h" -#include "../objectmanager/ObjectManager.h" -#include "../devicehandlers/DeviceHandlerFailureIsolation.h" -#include "../power/Fuse.h" -#include "../ipc/QueueFactory.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/devicehandlers/DeviceHandlerFailureIsolation.h" +#include "fsfw/power/Fuse.h" +#include "fsfw/ipc/QueueFactory.h" Heater::Heater(uint32_t objectId, uint8_t switch0, uint8_t switch1) : HealthDevice(objectId, 0), internalState(STATE_OFF), switch0(switch0), switch1(switch1), diff --git a/src/core/thermal/RedundantHeater.cpp b/src/core/thermal/RedundantHeater.cpp index 6463fcc8..e7b774cb 100644 --- a/src/core/thermal/RedundantHeater.cpp +++ b/src/core/thermal/RedundantHeater.cpp @@ -1,4 +1,4 @@ -#include "RedundantHeater.h" +#include "fsfw/thermal/RedundantHeater.h" RedundantHeater::~RedundantHeater() { } diff --git a/src/core/thermal/ThermalComponent.cpp b/src/core/thermal/ThermalComponent.cpp index d42c34b3..8d4b7bbd 100644 --- a/src/core/thermal/ThermalComponent.cpp +++ b/src/core/thermal/ThermalComponent.cpp @@ -1,4 +1,4 @@ -#include "ThermalComponent.h" +#include "fsfw/thermal/ThermalComponent.h" ThermalComponent::ThermalComponent(object_id_t reportingObjectId, uint8_t domainId, gp_id_t temperaturePoolId, diff --git a/src/core/thermal/ThermalModule.cpp b/src/core/thermal/ThermalModule.cpp index de347542..d8108ab3 100644 --- a/src/core/thermal/ThermalModule.cpp +++ b/src/core/thermal/ThermalModule.cpp @@ -1,8 +1,8 @@ -#include "ThermalModule.h" -#include "AbstractTemperatureSensor.h" +#include "fsfw/thermal/ThermalModule.h" +#include "fsfw/thermal/AbstractTemperatureSensor.h" -#include "../monitoring/LimitViolationReporter.h" -#include "../monitoring/MonitoringMessageContent.h" +#include "fsfw/monitoring/LimitViolationReporter.h" +#include "fsfw/monitoring/MonitoringMessageContent.h" ThermalModule::ThermalModule(gp_id_t moduleTemperaturePoolId, diff --git a/src/core/timemanager/CCSDSTime.cpp b/src/core/timemanager/CCSDSTime.cpp index 192c1f57..2475a5eb 100644 --- a/src/core/timemanager/CCSDSTime.cpp +++ b/src/core/timemanager/CCSDSTime.cpp @@ -1,5 +1,6 @@ -#include "CCSDSTime.h" -#include +#include "fsfw/FSFW.h" +#include "fsfw/timemanager/CCSDSTime.h" + #include #include #include diff --git a/src/core/timemanager/ClockCommon.cpp b/src/core/timemanager/ClockCommon.cpp index e56d4953..82c65b96 100644 --- a/src/core/timemanager/ClockCommon.cpp +++ b/src/core/timemanager/ClockCommon.cpp @@ -1,5 +1,5 @@ -#include "Clock.h" -#include "../ipc/MutexGuard.h" +#include "fsfw/timemanager/Clock.h" +#include "fsfw/ipc/MutexGuard.h" ReturnValue_t Clock::convertUTCToTT(timeval utc, timeval *tt) { uint16_t leapSeconds; diff --git a/src/core/timemanager/Countdown.cpp b/src/core/timemanager/Countdown.cpp index 20b56189..c3499685 100644 --- a/src/core/timemanager/Countdown.cpp +++ b/src/core/timemanager/Countdown.cpp @@ -1,4 +1,4 @@ -#include "Countdown.h" +#include "fsfw/timemanager/Countdown.h" Countdown::Countdown(uint32_t initialTimeout): timeout(initialTimeout) { } diff --git a/src/core/timemanager/Stopwatch.cpp b/src/core/timemanager/Stopwatch.cpp index 04ccab72..a8f87029 100644 --- a/src/core/timemanager/Stopwatch.cpp +++ b/src/core/timemanager/Stopwatch.cpp @@ -1,5 +1,5 @@ -#include "Stopwatch.h" -#include "../serviceinterface/ServiceInterface.h" +#include "fsfw/timemanager/Stopwatch.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #if FSFW_CPP_OSTREAM_ENABLED == 1 #include diff --git a/src/core/tmtcpacket/SpacePacket.cpp b/src/core/tmtcpacket/SpacePacket.cpp index b8ba27e9..cbf82e0d 100644 --- a/src/core/tmtcpacket/SpacePacket.cpp +++ b/src/core/tmtcpacket/SpacePacket.cpp @@ -1,10 +1,10 @@ -#include "../serviceinterface/ServiceInterfaceStream.h" -#include "ccsds_header.h" -#include "SpacePacket.h" -#include +#include "fsfw/tmtcpacket/ccsds_header.h" +#include "fsfw/tmtcpacket/SpacePacket.h" +#include -SpacePacket::SpacePacket( uint16_t packetDataLength, bool isTelecommand, uint16_t apid, uint16_t sequenceCount ): -SpacePacketBase( (uint8_t*)&this->localData ) { +SpacePacket::SpacePacket(uint16_t packetDataLength, bool isTelecommand, uint16_t apid, + uint16_t sequenceCount): + SpacePacketBase( (uint8_t*)&this->localData ) { initSpacePacketHeader(isTelecommand, false, apid, sequenceCount); this->setPacketSequenceCount(sequenceCount); if ( packetDataLength <= sizeof(this->localData.fields.buffer) ) { diff --git a/src/core/tmtcpacket/SpacePacketBase.cpp b/src/core/tmtcpacket/SpacePacketBase.cpp index 14198027..e9a0b836 100644 --- a/src/core/tmtcpacket/SpacePacketBase.cpp +++ b/src/core/tmtcpacket/SpacePacketBase.cpp @@ -1,5 +1,6 @@ -#include "SpacePacketBase.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/tmtcpacket/SpacePacketBase.h" +#include "fsfw/serviceinterface/ServiceInterface.h" + #include SpacePacketBase::SpacePacketBase( const uint8_t* set_address ) { diff --git a/src/core/tmtcpacket/packetmatcher/PacketMatchTree.cpp b/src/core/tmtcpacket/packetmatcher/PacketMatchTree.cpp index 05e176ef..7f8aae9a 100644 --- a/src/core/tmtcpacket/packetmatcher/PacketMatchTree.cpp +++ b/src/core/tmtcpacket/packetmatcher/PacketMatchTree.cpp @@ -1,7 +1,7 @@ -#include "ApidMatcher.h" -#include "PacketMatchTree.h" -#include "ServiceMatcher.h" -#include "SubserviceMatcher.h" +#include "fsfw/tmtcpacket/packetmatcher/ApidMatcher.h" +#include "fsfw/tmtcpacket/packetmatcher/PacketMatchTree.h" +#include "fsfw/tmtcpacket/packetmatcher/ServiceMatcher.h" +#include "fsfw/tmtcpacket/packetmatcher/SubserviceMatcher.h" // This should be configurable.. const LocalPool::LocalPoolConfig PacketMatchTree::poolConfig = { diff --git a/src/core/tmtcpacket/pus/tc/TcPacketBase.cpp b/src/core/tmtcpacket/pus/tc/TcPacketBase.cpp index dd576fec..0c7a4183 100644 --- a/src/core/tmtcpacket/pus/tc/TcPacketBase.cpp +++ b/src/core/tmtcpacket/pus/tc/TcPacketBase.cpp @@ -1,8 +1,8 @@ -#include "TcPacketBase.h" +#include "fsfw/tmtcpacket/pus/tc/TcPacketBase.h" -#include "../../../globalfunctions/CRC.h" -#include "../../../globalfunctions/arrayprinter.h" -#include "../../../serviceinterface/ServiceInterface.h" +#include "fsfw/globalfunctions/CRC.h" +#include "fsfw/globalfunctions/arrayprinter.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include diff --git a/src/core/tmtcservices/CommandingServiceBase.cpp b/src/core/tmtcservices/CommandingServiceBase.cpp index 307a2a98..10805b47 100644 --- a/src/core/tmtcservices/CommandingServiceBase.cpp +++ b/src/core/tmtcservices/CommandingServiceBase.cpp @@ -1,14 +1,13 @@ -#include "AcceptsTelemetryIF.h" -#include "CommandingServiceBase.h" -#include "TmTcMessage.h" -#include +#include "fsfw/tmtcservices/CommandingServiceBase.h" +#include "fsfw/tmtcservices/AcceptsTelemetryIF.h" +#include "fsfw/tmtcservices/TmTcMessage.h" -#include "../tcdistribution/PUSDistributorIF.h" -#include "../objectmanager/ObjectManager.h" -#include "../ipc/QueueFactory.h" -#include "../tmtcpacket/pus/tc.h" -#include "../tmtcpacket/pus/tm.h" -#include "../serviceinterface/ServiceInterface.h" +#include "fsfw/tcdistribution/PUSDistributorIF.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/tmtcpacket/pus/tc.h" +#include "fsfw/tmtcpacket/pus/tm.h" +#include "fsfw/serviceinterface/ServiceInterface.h" object_id_t CommandingServiceBase::defaultPacketSource = objects::NO_OBJECT; object_id_t CommandingServiceBase::defaultPacketDestination = objects::NO_OBJECT; diff --git a/src/core/tmtcservices/PusServiceBase.cpp b/src/core/tmtcservices/PusServiceBase.cpp index 811c9bcb..866e0844 100644 --- a/src/core/tmtcservices/PusServiceBase.cpp +++ b/src/core/tmtcservices/PusServiceBase.cpp @@ -1,12 +1,12 @@ -#include "PusServiceBase.h" -#include "AcceptsTelemetryIF.h" -#include "PusVerificationReport.h" -#include "TmTcMessage.h" +#include "fsfw/tmtcservices/PusServiceBase.h" +#include "fsfw/tmtcservices/AcceptsTelemetryIF.h" +#include "fsfw/tmtcservices/PusVerificationReport.h" +#include "fsfw/tmtcservices/TmTcMessage.h" -#include "../objectmanager/ObjectManager.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../tcdistribution/PUSDistributorIF.h" -#include "../ipc/QueueFactory.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tcdistribution/PUSDistributorIF.h" +#include "fsfw/ipc/QueueFactory.h" object_id_t PusServiceBase::packetSource = 0; object_id_t PusServiceBase::packetDestination = 0; diff --git a/src/core/tmtcservices/PusVerificationReport.cpp b/src/core/tmtcservices/PusVerificationReport.cpp index c64e5feb..827486ce 100644 --- a/src/core/tmtcservices/PusVerificationReport.cpp +++ b/src/core/tmtcservices/PusVerificationReport.cpp @@ -1,5 +1,5 @@ -#include "../serialize/SerializeAdapter.h" -#include "../tmtcservices/PusVerificationReport.h" +#include "fsfw/serialize/SerializeAdapter.h" +#include "fsfw/tmtcservices/PusVerificationReport.h" PusVerificationMessage::PusVerificationMessage() { } diff --git a/src/opt/coordinates/CoordinateTransformations.cpp b/src/opt/coordinates/CoordinateTransformations.cpp index 4e2debbe..fe879dd1 100644 --- a/src/opt/coordinates/CoordinateTransformations.cpp +++ b/src/opt/coordinates/CoordinateTransformations.cpp @@ -1,8 +1,9 @@ -#include "CoordinateTransformations.h" -#include "../globalfunctions/constants.h" -#include "../globalfunctions/math/MatrixOperations.h" -#include "../globalfunctions/math/VectorOperations.h" -#include +#include "fsfw/coordinates/CoordinateTransformations.h" +#include "fsfw/globalfunctions/constants.h" +#include "fsfw/globalfunctions/math/MatrixOperations.h" +#include "fsfw/globalfunctions/math/VectorOperations.h" + +#include #include @@ -17,11 +18,13 @@ void CoordinateTransformations::velocityEcfToEci(const double* ecfVelocity, ecfToEci(ecfVelocity, eciVelocity, ecfPosition, timeUTC); } -void CoordinateTransformations::positionEciToEcf(const double* eciCoordinates, double* ecfCoordinates,timeval *timeUTC){ +void CoordinateTransformations::positionEciToEcf(const double* eciCoordinates, + double* ecfCoordinates,timeval *timeUTC){ eciToEcf(eciCoordinates,ecfCoordinates,NULL,timeUTC); }; -void CoordinateTransformations::velocityEciToEcf(const double* eciVelocity,const double* eciPosition, double* ecfVelocity,timeval* timeUTC){ +void CoordinateTransformations::velocityEciToEcf(const double* eciVelocity, + const double* eciPosition, double* ecfVelocity,timeval* timeUTC){ eciToEcf(eciVelocity,ecfVelocity,eciPosition,timeUTC); } diff --git a/src/opt/coordinates/Sgp4Propagator.cpp b/src/opt/coordinates/Sgp4Propagator.cpp index 5cb1497c..a0e66ebd 100644 --- a/src/opt/coordinates/Sgp4Propagator.cpp +++ b/src/opt/coordinates/Sgp4Propagator.cpp @@ -1,10 +1,13 @@ -#include "CoordinateTransformations.h" -#include "Sgp4Propagator.h" -#include "../globalfunctions/constants.h" -#include "../globalfunctions/math/MatrixOperations.h" -#include "../globalfunctions/math/VectorOperations.h" -#include "../globalfunctions/timevalOperations.h" +#include "fsfw/coordinates/CoordinateTransformations.h" +#include "fsfw/coordinates/Sgp4Propagator.h" + +#include "fsfw/globalfunctions/constants.h" +#include "fsfw/globalfunctions/math/MatrixOperations.h" +#include "fsfw/globalfunctions/math/VectorOperations.h" +#include "fsfw/globalfunctions/timevalOperations.h" + #include + Sgp4Propagator::Sgp4Propagator() : initialized(false), epoch({0, 0}), whichconst(wgs84) { diff --git a/src/opt/datalinklayer/Clcw.cpp b/src/opt/datalinklayer/Clcw.cpp index 13971929..9f2fe7d3 100644 --- a/src/opt/datalinklayer/Clcw.cpp +++ b/src/opt/datalinklayer/Clcw.cpp @@ -1,14 +1,5 @@ -/** - * @file Clcw.cpp - * @brief This file defines the Clcw class. - * @date 17.04.2013 - * @author baetz - */ - - - -#include "Clcw.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/datalinklayer/Clcw.h" +#include "fsfw/serviceinterface/ServiceInterface.h" Clcw::Clcw() { content.raw = 0; diff --git a/src/opt/datalinklayer/DataLinkLayer.cpp b/src/opt/datalinklayer/DataLinkLayer.cpp index 1bdaa4f5..94199bc4 100644 --- a/src/opt/datalinklayer/DataLinkLayer.cpp +++ b/src/opt/datalinklayer/DataLinkLayer.cpp @@ -1,6 +1,6 @@ -#include "DataLinkLayer.h" -#include "../globalfunctions/CRC.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/datalinklayer/DataLinkLayer.h" +#include "fsfw/globalfunctions/CRC.h" +#include "fsfw/serviceinterface/ServiceInterface.h" DataLinkLayer::DataLinkLayer(uint8_t* set_frame_buffer, ClcwIF* setClcw, uint8_t set_start_sequence_length, uint16_t set_scid) : diff --git a/src/opt/datalinklayer/Farm1StateLockout.cpp b/src/opt/datalinklayer/Farm1StateLockout.cpp index 1b339a85..b74d0a5f 100644 --- a/src/opt/datalinklayer/Farm1StateLockout.cpp +++ b/src/opt/datalinklayer/Farm1StateLockout.cpp @@ -1,16 +1,8 @@ -/** - * @file Farm1StateLockout.cpp - * @brief This file defines the Farm1StateLockout class. - * @date 24.04.2013 - * @author baetz - */ +#include "fsfw/datalinklayer/ClcwIF.h" +#include "fsfw/datalinklayer/Farm1StateLockout.h" +#include "fsfw/datalinklayer/TcTransferFrame.h" +#include "fsfw/datalinklayer/VirtualChannelReception.h" - - -#include "ClcwIF.h" -#include "Farm1StateLockout.h" -#include "TcTransferFrame.h" -#include "VirtualChannelReception.h" Farm1StateLockout::Farm1StateLockout(VirtualChannelReception* setMyVC) : myVC(setMyVC) { } diff --git a/src/opt/datalinklayer/Farm1StateOpen.cpp b/src/opt/datalinklayer/Farm1StateOpen.cpp index 61c0997f..6f91df47 100644 --- a/src/opt/datalinklayer/Farm1StateOpen.cpp +++ b/src/opt/datalinklayer/Farm1StateOpen.cpp @@ -1,17 +1,7 @@ -/** - * @file Farm1StateOpen.cpp - * @brief This file defines the Farm1StateOpen class. - * @date 24.04.2013 - * @author baetz - */ - - - - -#include "ClcwIF.h" -#include "Farm1StateOpen.h" -#include "TcTransferFrame.h" -#include "VirtualChannelReception.h" +#include "fsfw/datalinklayer/ClcwIF.h" +#include "fsfw/datalinklayer/Farm1StateOpen.h" +#include "fsfw/datalinklayer/TcTransferFrame.h" +#include "fsfw/datalinklayer/VirtualChannelReception.h" Farm1StateOpen::Farm1StateOpen(VirtualChannelReception* setMyVC) : myVC(setMyVC) { } From a6de52e21278458a69f2d1859bbea7c180a5cfa1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 13 Jul 2021 20:58:45 +0200 Subject: [PATCH 176/389] more include replacements --- inc/fsfw/datalinklayer/MapPacketExtraction.h | 6 +-- inc/fsfw/datalinklayer/TcTransferFrame.h | 4 +- inc/fsfw/osal/InternalErrorCodes.h | 52 +++++++++---------- inc/fsfw/osal/linux/MessageQueue.h | 6 +-- inc/fsfw/pus/CService200ModeCommanding.h | 2 +- inc/fsfw/pus/Service17Test.h | 4 +- .../pus/Service1TelecommandVerification.h | 12 ++--- inc/fsfw/pus/Service20ParameterManagement.h | 2 +- inc/fsfw/pus/Service2DeviceAccess.h | 6 +-- inc/fsfw/pus/Service3Housekeeping.h | 6 +-- inc/fsfw/pus/Service5EventReporting.h | 4 +- inc/fsfw/pus/Service8FunctionManagement.h | 4 +- inc/fsfw/pus/Service9TimeManagement.h | 2 +- inc/fsfw/rmap/RMAP.h | 4 +- inc/fsfw/rmap/RMAPCookie.h | 2 +- inc/fsfw/rmap/RmapDeviceCommunicationIF.h | 2 +- inc/fsfw/thermal/ThermalComponentCore.h | 2 +- .../pus/PacketTimestampInterpreterIF.h | 12 +++-- inc/fsfw/tmtcpacket/pus/tm/TmPacketBase.h | 12 +++-- inc/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h | 8 +-- inc/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h | 8 +-- inc/fsfw/tmtcservices/TmTcBridge.h | 12 ++--- inc/fsfw/tmtcservices/TmTcMessage.h | 4 +- inc/fsfw/tmtcservices/VerificationReporter.h | 2 +- src/core/thermal/ThermalComponentCore.cpp | 4 +- src/core/thermal/ThermalMonitorReporter.cpp | 6 +-- src/core/timemanager/TimeMessage.cpp | 2 +- src/core/timemanager/TimeStamper.cpp | 5 +- src/core/tmtcpacket/pus/tc/TcPacketPus.cpp | 4 +- .../tmtcpacket/pus/tc/TcPacketStoredBase.cpp | 8 +-- src/core/tmtcpacket/pus/tm/TmPacketBase.cpp | 12 ++--- .../tmtcpacket/pus/tm/TmPacketMinimal.cpp | 4 +- src/core/tmtcpacket/pus/tm/TmPacketPusA.cpp | 14 ++--- src/core/tmtcpacket/pus/tm/TmPacketPusC.cpp | 14 ++--- .../tmtcpacket/pus/tm/TmPacketStoredBase.cpp | 8 +-- .../tmtcpacket/pus/tm/TmPacketStoredPusA.cpp | 6 +-- src/core/tmtcservices/TmTcBridge.cpp | 10 ++-- src/core/tmtcservices/TmTcMessage.cpp | 2 +- .../tmtcservices/VerificationReporter.cpp | 14 ++--- src/opt/datalinklayer/Farm1StateWait.cpp | 16 ++---- src/opt/datalinklayer/MapPacketExtraction.cpp | 16 +++--- src/opt/datalinklayer/TcTransferFrame.cpp | 15 ++---- .../datalinklayer/TcTransferFrameLocal.cpp | 16 ++---- .../datalinklayer/VirtualChannelReception.cpp | 6 +-- src/opt/monitoring/LimitViolationReporter.cpp | 10 ++-- src/opt/monitoring/MonitoringMessage.cpp | 4 +- src/opt/pus/CService200ModeCommanding.cpp | 14 ++--- src/opt/pus/CService201HealthCommanding.cpp | 12 ++--- src/opt/pus/Service17Test.cpp | 10 ++-- .../pus/Service1TelecommandVerification.cpp | 16 +++--- src/opt/pus/Service20ParameterManagement.cpp | 14 ++--- src/opt/pus/Service2DeviceAccess.cpp | 22 ++++---- src/opt/pus/Service3Housekeeping.cpp | 8 +-- src/opt/pus/Service5EventReporting.cpp | 14 ++--- src/opt/pus/Service8FunctionManagement.cpp | 16 +++--- src/opt/pus/Service9TimeManagement.cpp | 10 ++-- src/opt/rmap/RMAP.cpp | 8 +-- src/opt/rmap/RMAPCookie.cpp | 5 +- src/opt/rmap/RmapDeviceCommunicationIF.cpp | 4 +- src/opt/tmstorage/TmStoreMessage.cpp | 4 +- src/osal/common/tcpipCommon.cpp | 7 +-- src/osal/freertos/MessageQueue.cpp | 4 +- src/osal/linux/BinarySemaphore.cpp | 10 ++-- src/osal/linux/Clock.cpp | 4 +- src/osal/linux/CountingSemaphore.cpp | 6 +-- src/osal/linux/FixedTimeslotTask.cpp | 6 +-- src/osal/linux/InternalErrorCodes.cpp | 2 +- src/osal/linux/MessageQueue.cpp | 8 +-- src/osal/linux/Mutex.cpp | 8 +-- src/osal/linux/MutexFactory.cpp | 4 +- src/osal/linux/QueueFactory.cpp | 10 ++-- src/osal/linux/SemaphoreFactory.cpp | 7 ++- src/osal/linux/TaskFactory.cpp | 10 ++-- src/osal/linux/Timer.cpp | 4 +- src/osal/linux/tcpipHelpers.cpp | 6 +-- 75 files changed, 304 insertions(+), 323 deletions(-) diff --git a/inc/fsfw/datalinklayer/MapPacketExtraction.h b/inc/fsfw/datalinklayer/MapPacketExtraction.h index ddb867fb..c74ab803 100644 --- a/inc/fsfw/datalinklayer/MapPacketExtraction.h +++ b/inc/fsfw/datalinklayer/MapPacketExtraction.h @@ -2,9 +2,9 @@ #define FSFW_DATALINKLAYER_MAPPACKETEXTRACTION_H_ #include "MapPacketExtractionIF.h" -#include "../objectmanager/ObjectManagerIF.h" -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../ipc/MessageQueueSenderIF.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/ipc/MessageQueueSenderIF.h" class StorageManagerIF; diff --git a/inc/fsfw/datalinklayer/TcTransferFrame.h b/inc/fsfw/datalinklayer/TcTransferFrame.h index b58441fc..ca96536f 100644 --- a/inc/fsfw/datalinklayer/TcTransferFrame.h +++ b/inc/fsfw/datalinklayer/TcTransferFrame.h @@ -1,8 +1,8 @@ #ifndef TCTRANSFERFRAME_H_ #define TCTRANSFERFRAME_H_ -#include -#include +#include +#include /** * The TcTransferFrame class simplifies handling of such Frames. diff --git a/inc/fsfw/osal/InternalErrorCodes.h b/inc/fsfw/osal/InternalErrorCodes.h index 1da116fa..e7522875 100644 --- a/inc/fsfw/osal/InternalErrorCodes.h +++ b/inc/fsfw/osal/InternalErrorCodes.h @@ -1,39 +1,39 @@ #ifndef INTERNALERRORCODES_H_ #define INTERNALERRORCODES_H_ -#include "../returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" class InternalErrorCodes { public: - static const uint8_t INTERFACE_ID = CLASS_ID::INTERNAL_ERROR_CODES; + static const uint8_t INTERFACE_ID = CLASS_ID::INTERNAL_ERROR_CODES; -static const ReturnValue_t NO_CONFIGURATION_TABLE = MAKE_RETURN_CODE(0x01 ); -static const ReturnValue_t NO_CPU_TABLE = MAKE_RETURN_CODE(0x02 ); -static const ReturnValue_t INVALID_WORKSPACE_ADDRESS = MAKE_RETURN_CODE(0x03 ); -static const ReturnValue_t TOO_LITTLE_WORKSPACE = MAKE_RETURN_CODE(0x04 ); -static const ReturnValue_t WORKSPACE_ALLOCATION = MAKE_RETURN_CODE(0x05 ); -static const ReturnValue_t INTERRUPT_STACK_TOO_SMALL = MAKE_RETURN_CODE(0x06 ); -static const ReturnValue_t THREAD_EXITTED = MAKE_RETURN_CODE(0x07 ); -static const ReturnValue_t INCONSISTENT_MP_INFORMATION = MAKE_RETURN_CODE(0x08 ); -static const ReturnValue_t INVALID_NODE = MAKE_RETURN_CODE(0x09 ); -static const ReturnValue_t NO_MPCI = MAKE_RETURN_CODE(0x0a ); -static const ReturnValue_t BAD_PACKET = MAKE_RETURN_CODE(0x0b ); -static const ReturnValue_t OUT_OF_PACKETS = MAKE_RETURN_CODE(0x0c ); -static const ReturnValue_t OUT_OF_GLOBAL_OBJECTS = MAKE_RETURN_CODE(0x0d ); -static const ReturnValue_t OUT_OF_PROXIES = MAKE_RETURN_CODE(0x0e ); -static const ReturnValue_t INVALID_GLOBAL_ID = MAKE_RETURN_CODE(0x0f ); -static const ReturnValue_t BAD_STACK_HOOK = MAKE_RETURN_CODE(0x10 ); -static const ReturnValue_t BAD_ATTRIBUTES = MAKE_RETURN_CODE(0x11 ); -static const ReturnValue_t IMPLEMENTATION_KEY_CREATE_INCONSISTENCY = MAKE_RETURN_CODE(0x12 ); -static const ReturnValue_t IMPLEMENTATION_BLOCKING_OPERATION_CANCEL = MAKE_RETURN_CODE(0x13 ); -static const ReturnValue_t MUTEX_OBTAIN_FROM_BAD_STATE = MAKE_RETURN_CODE(0x14 ); -static const ReturnValue_t UNLIMITED_AND_MAXIMUM_IS_0 = MAKE_RETURN_CODE(0x15 ); + static const ReturnValue_t NO_CONFIGURATION_TABLE = MAKE_RETURN_CODE(0x01 ); + static const ReturnValue_t NO_CPU_TABLE = MAKE_RETURN_CODE(0x02 ); + static const ReturnValue_t INVALID_WORKSPACE_ADDRESS = MAKE_RETURN_CODE(0x03 ); + static const ReturnValue_t TOO_LITTLE_WORKSPACE = MAKE_RETURN_CODE(0x04 ); + static const ReturnValue_t WORKSPACE_ALLOCATION = MAKE_RETURN_CODE(0x05 ); + static const ReturnValue_t INTERRUPT_STACK_TOO_SMALL = MAKE_RETURN_CODE(0x06 ); + static const ReturnValue_t THREAD_EXITTED = MAKE_RETURN_CODE(0x07 ); + static const ReturnValue_t INCONSISTENT_MP_INFORMATION = MAKE_RETURN_CODE(0x08 ); + static const ReturnValue_t INVALID_NODE = MAKE_RETURN_CODE(0x09 ); + static const ReturnValue_t NO_MPCI = MAKE_RETURN_CODE(0x0a ); + static const ReturnValue_t BAD_PACKET = MAKE_RETURN_CODE(0x0b ); + static const ReturnValue_t OUT_OF_PACKETS = MAKE_RETURN_CODE(0x0c ); + static const ReturnValue_t OUT_OF_GLOBAL_OBJECTS = MAKE_RETURN_CODE(0x0d ); + static const ReturnValue_t OUT_OF_PROXIES = MAKE_RETURN_CODE(0x0e ); + static const ReturnValue_t INVALID_GLOBAL_ID = MAKE_RETURN_CODE(0x0f ); + static const ReturnValue_t BAD_STACK_HOOK = MAKE_RETURN_CODE(0x10 ); + static const ReturnValue_t BAD_ATTRIBUTES = MAKE_RETURN_CODE(0x11 ); + static const ReturnValue_t IMPLEMENTATION_KEY_CREATE_INCONSISTENCY = MAKE_RETURN_CODE(0x12 ); + static const ReturnValue_t IMPLEMENTATION_BLOCKING_OPERATION_CANCEL = MAKE_RETURN_CODE(0x13 ); + static const ReturnValue_t MUTEX_OBTAIN_FROM_BAD_STATE = MAKE_RETURN_CODE(0x14 ); + static const ReturnValue_t UNLIMITED_AND_MAXIMUM_IS_0 = MAKE_RETURN_CODE(0x15 ); - virtual ~InternalErrorCodes(); + virtual ~InternalErrorCodes(); - static ReturnValue_t translate(uint8_t code); + static ReturnValue_t translate(uint8_t code); private: - InternalErrorCodes(); + InternalErrorCodes(); }; #endif /* INTERNALERRORCODES_H_ */ diff --git a/inc/fsfw/osal/linux/MessageQueue.h b/inc/fsfw/osal/linux/MessageQueue.h index 935ee948..cf0ac10c 100644 --- a/inc/fsfw/osal/linux/MessageQueue.h +++ b/inc/fsfw/osal/linux/MessageQueue.h @@ -1,9 +1,9 @@ #ifndef FSFW_OSAL_LINUX_MESSAGEQUEUE_H_ #define FSFW_OSAL_LINUX_MESSAGEQUEUE_H_ -#include "../../internalError/InternalErrorReporterIF.h" -#include "../../ipc/MessageQueueIF.h" -#include "../../ipc/MessageQueueMessage.h" +#include "fsfw/internalerror/InternalErrorReporterIF.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/ipc/MessageQueueMessage.h" #include /** diff --git a/inc/fsfw/pus/CService200ModeCommanding.h b/inc/fsfw/pus/CService200ModeCommanding.h index 84040212..d523d6c3 100644 --- a/inc/fsfw/pus/CService200ModeCommanding.h +++ b/inc/fsfw/pus/CService200ModeCommanding.h @@ -1,7 +1,7 @@ #ifndef FSFW_PUS_CSERVICE200MODECOMMANDING_H_ #define FSFW_PUS_CSERVICE200MODECOMMANDING_H_ -#include "../tmtcservices/CommandingServiceBase.h" +#include "fsfw/tmtcservices/CommandingServiceBase.h" /** * @brief Custom PUS service to set mode of all objects implementing HasModesIF diff --git a/inc/fsfw/pus/Service17Test.h b/inc/fsfw/pus/Service17Test.h index 83d436ea..d1e1ecce 100644 --- a/inc/fsfw/pus/Service17Test.h +++ b/inc/fsfw/pus/Service17Test.h @@ -1,8 +1,8 @@ #ifndef FSFW_PUS_SERVICE17TEST_H_ #define FSFW_PUS_SERVICE17TEST_H_ -#include "../tmtcservices/PusServiceBase.h" -#include "../objectmanager/SystemObject.h" +#include "fsfw/tmtcservices/PusServiceBase.h" +#include "fsfw/objectmanager/SystemObject.h" /** * @brief Test Service diff --git a/inc/fsfw/pus/Service1TelecommandVerification.h b/inc/fsfw/pus/Service1TelecommandVerification.h index 3d68a4e0..26284493 100644 --- a/inc/fsfw/pus/Service1TelecommandVerification.h +++ b/inc/fsfw/pus/Service1TelecommandVerification.h @@ -1,12 +1,12 @@ #ifndef FSFW_PUS_SERVICE1TELECOMMANDVERIFICATION_H_ #define FSFW_PUS_SERVICE1TELECOMMANDVERIFICATION_H_ -#include "../objectmanager/SystemObject.h" -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../tasks/ExecutableObjectIF.h" -#include "../tmtcservices/AcceptsVerifyMessageIF.h" -#include "../tmtcservices/PusVerificationReport.h" -#include "../ipc/MessageQueueIF.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/tmtcservices/AcceptsVerifyMessageIF.h" +#include "fsfw/tmtcservices/PusVerificationReport.h" +#include "fsfw/ipc/MessageQueueIF.h" /** * @brief Verify TC acceptance, start, progress and execution. diff --git a/inc/fsfw/pus/Service20ParameterManagement.h b/inc/fsfw/pus/Service20ParameterManagement.h index 5370bfcb..63ec199c 100644 --- a/inc/fsfw/pus/Service20ParameterManagement.h +++ b/inc/fsfw/pus/Service20ParameterManagement.h @@ -1,7 +1,7 @@ #ifndef FSFW_PUS_SERVICE20PARAMETERMANAGEMENT_H_ #define FSFW_PUS_SERVICE20PARAMETERMANAGEMENT_H_ -#include "../tmtcservices/CommandingServiceBase.h" +#include "fsfw/tmtcservices/CommandingServiceBase.h" /** * @brief PUS Service 20 Parameter Service implementation diff --git a/inc/fsfw/pus/Service2DeviceAccess.h b/inc/fsfw/pus/Service2DeviceAccess.h index b62e6854..e518863c 100644 --- a/inc/fsfw/pus/Service2DeviceAccess.h +++ b/inc/fsfw/pus/Service2DeviceAccess.h @@ -1,9 +1,9 @@ #ifndef FSFW_PUS_SERVICE2DEVICEACCESS_H_ #define FSFW_PUS_SERVICE2DEVICEACCESS_H_ -#include "../objectmanager/SystemObjectIF.h" -#include "../devicehandlers/AcceptsDeviceResponsesIF.h" -#include "../tmtcservices/CommandingServiceBase.h" +#include "fsfw/objectmanager/SystemObjectIF.h" +#include "fsfw/devicehandlers/AcceptsDeviceResponsesIF.h" +#include "fsfw/tmtcservices/CommandingServiceBase.h" /** * @brief Raw Commanding and Wiretapping of devices. diff --git a/inc/fsfw/pus/Service3Housekeeping.h b/inc/fsfw/pus/Service3Housekeeping.h index 269710ef..d2dc6066 100644 --- a/inc/fsfw/pus/Service3Housekeeping.h +++ b/inc/fsfw/pus/Service3Housekeeping.h @@ -1,9 +1,9 @@ #ifndef FSFW_PUS_SERVICE3HOUSEKEEPINGSERVICE_H_ #define FSFW_PUS_SERVICE3HOUSEKEEPINGSERVICE_H_ -#include "../housekeeping/AcceptsHkPacketsIF.h" -#include "../housekeeping/HousekeepingMessage.h" -#include "../tmtcservices/CommandingServiceBase.h" +#include "fsfw/housekeeping/AcceptsHkPacketsIF.h" +#include "fsfw/housekeeping/HousekeepingMessage.h" +#include "fsfw/tmtcservices/CommandingServiceBase.h" /** * @brief Manges spacecraft housekeeping reports and diff --git a/inc/fsfw/pus/Service5EventReporting.h b/inc/fsfw/pus/Service5EventReporting.h index 69242801..35ff34b6 100644 --- a/inc/fsfw/pus/Service5EventReporting.h +++ b/inc/fsfw/pus/Service5EventReporting.h @@ -1,8 +1,8 @@ #ifndef FSFW_PUS_SERVICE5EVENTREPORTING_H_ #define FSFW_PUS_SERVICE5EVENTREPORTING_H_ -#include "../tmtcservices/PusServiceBase.h" -#include "../events/EventMessage.h" +#include "fsfw/tmtcservices/PusServiceBase.h" +#include "fsfw/events/EventMessage.h" /** * @brief Report on-board events like information or errors diff --git a/inc/fsfw/pus/Service8FunctionManagement.h b/inc/fsfw/pus/Service8FunctionManagement.h index 00153cfb..debdf636 100644 --- a/inc/fsfw/pus/Service8FunctionManagement.h +++ b/inc/fsfw/pus/Service8FunctionManagement.h @@ -1,8 +1,8 @@ #ifndef FSFW_PUS_SERVICE8FUNCTIONMANAGEMENT_H_ #define FSFW_PUS_SERVICE8FUNCTIONMANAGEMENT_H_ -#include "../action/ActionMessage.h" -#include "../tmtcservices/CommandingServiceBase.h" +#include "fsfw/action/ActionMessage.h" +#include "fsfw/tmtcservices/CommandingServiceBase.h" /** * @brief Functional commanding. diff --git a/inc/fsfw/pus/Service9TimeManagement.h b/inc/fsfw/pus/Service9TimeManagement.h index 70b86966..d8e183a4 100644 --- a/inc/fsfw/pus/Service9TimeManagement.h +++ b/inc/fsfw/pus/Service9TimeManagement.h @@ -1,7 +1,7 @@ #ifndef FSFW_PUS_SERVICE9TIMEMANAGEMENT_H_ #define FSFW_PUS_SERVICE9TIMEMANAGEMENT_H_ -#include "../tmtcservices/PusServiceBase.h" +#include "fsfw/tmtcservices/PusServiceBase.h" class Service9TimeManagement: public PusServiceBase { public: diff --git a/inc/fsfw/rmap/RMAP.h b/inc/fsfw/rmap/RMAP.h index 83e29fed..7fa0021d 100644 --- a/inc/fsfw/rmap/RMAP.h +++ b/inc/fsfw/rmap/RMAP.h @@ -1,8 +1,8 @@ #ifndef FSFW_RMAP_RMAP_H_ #define FSFW_RMAP_RMAP_H_ -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../rmap/RMAPCookie.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/rmap/RMAPCookie.h" //SHOULDTODO: clean up includes for RMAP, should be enough to include RMAP.h but right now it's quite chaotic... diff --git a/inc/fsfw/rmap/RMAPCookie.h b/inc/fsfw/rmap/RMAPCookie.h index 38542646..97aaa6d0 100644 --- a/inc/fsfw/rmap/RMAPCookie.h +++ b/inc/fsfw/rmap/RMAPCookie.h @@ -2,7 +2,7 @@ #define FSFW_RMAP_RMAPCOOKIE_H_ #include "rmapStructs.h" -#include "../devicehandlers/CookieIF.h" +#include "fsfw/devicehandlers/CookieIF.h" #include class RMAPChannelIF; diff --git a/inc/fsfw/rmap/RmapDeviceCommunicationIF.h b/inc/fsfw/rmap/RmapDeviceCommunicationIF.h index 1333966a..3714b7e7 100644 --- a/inc/fsfw/rmap/RmapDeviceCommunicationIF.h +++ b/inc/fsfw/rmap/RmapDeviceCommunicationIF.h @@ -1,7 +1,7 @@ #ifndef FSFW_RMAP_RMAPDEVICECOMMUNICATIONINTERFACE_H_ #define FSFW_RMAP_RMAPDEVICECOMMUNICATIONINTERFACE_H_ -#include "../devicehandlers/DeviceCommunicationIF.h" +#include "fsfw/devicehandlers/DeviceCommunicationIF.h" /** * @brief This class is a implementation of a DeviceCommunicationIF for RMAP calls. diff --git a/inc/fsfw/thermal/ThermalComponentCore.h b/inc/fsfw/thermal/ThermalComponentCore.h index a1fa594a..19430015 100644 --- a/inc/fsfw/thermal/ThermalComponentCore.h +++ b/inc/fsfw/thermal/ThermalComponentCore.h @@ -6,7 +6,7 @@ #include "AbstractTemperatureSensor.h" #include "ThermalModule.h" -#include "../datapoollocal/LocalPoolVariable.h" +#include "fsfw/datapoollocal/LocalPoolVariable.h" /** * @brief diff --git a/inc/fsfw/tmtcpacket/pus/PacketTimestampInterpreterIF.h b/inc/fsfw/tmtcpacket/pus/PacketTimestampInterpreterIF.h index 40e7a2ea..b839223a 100644 --- a/inc/fsfw/tmtcpacket/pus/PacketTimestampInterpreterIF.h +++ b/inc/fsfw/tmtcpacket/pus/PacketTimestampInterpreterIF.h @@ -1,7 +1,8 @@ -#ifndef FRAMEWORK_TMTCPACKET_PUS_PACKETTIMESTAMPINTERPRETERIF_H_ -#define FRAMEWORK_TMTCPACKET_PUS_PACKETTIMESTAMPINTERPRETERIF_H_ +#ifndef FSFW_TMTCPACKET_PUS_PACKETTIMESTAMPINTERPRETERIF_H_ +#define FSFW_TMTCPACKET_PUS_PACKETTIMESTAMPINTERPRETERIF_H_ + +#include "fsfw/returnvalues/HasReturnvaluesIF.h" -#include "../../returnvalues/HasReturnvaluesIF.h" class TmPacketMinimal; class PacketTimestampInterpreterIF { @@ -9,9 +10,10 @@ public: virtual ~PacketTimestampInterpreterIF() {} virtual ReturnValue_t getPacketTime(TmPacketMinimal* packet, timeval* timestamp) const = 0; - virtual ReturnValue_t getPacketTimeRaw(TmPacketMinimal* packet, const uint8_t** timePtr, uint32_t* size) const = 0; + virtual ReturnValue_t getPacketTimeRaw(TmPacketMinimal* packet, const uint8_t** timePtr, + uint32_t* size) const = 0; }; -#endif /* FRAMEWORK_TMTCPACKET_PUS_PACKETTIMESTAMPINTERPRETERIF_H_ */ +#endif /* FSFW_TMTCPACKET_PUS_PACKETTIMESTAMPINTERPRETERIF_H_ */ diff --git a/inc/fsfw/tmtcpacket/pus/tm/TmPacketBase.h b/inc/fsfw/tmtcpacket/pus/tm/TmPacketBase.h index 9f534f29..0379b977 100644 --- a/inc/fsfw/tmtcpacket/pus/tm/TmPacketBase.h +++ b/inc/fsfw/tmtcpacket/pus/tm/TmPacketBase.h @@ -1,13 +1,15 @@ #ifndef TMTCPACKET_PUS_TMPACKETBASE_H_ #define TMTCPACKET_PUS_TMPACKETBASE_H_ -#include "../../SpacePacketBase.h" -#include "../../../timemanager/TimeStamperIF.h" -#include "../../../timemanager/Clock.h" -#include "../../../objectmanager/SystemObjectIF.h" +#include "fsfw/tmtcpacket/SpacePacketBase.h" +#include "fsfw/timemanager/TimeStamperIF.h" +#include "fsfw/timemanager/Clock.h" +#include "fsfw/objectmanager/SystemObjectIF.h" + +namespace Factory { -namespace Factory{ void setStaticFrameworkObjectIds(); + } diff --git a/inc/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h b/inc/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h index 49f26b34..3856c779 100644 --- a/inc/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h +++ b/inc/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h @@ -2,10 +2,10 @@ #define FSFW_TMTCPACKET_PUS_TMPACKETPUSA_H_ #include "TmPacketBase.h" -#include "../../SpacePacketBase.h" -#include "../../../timemanager/TimeStamperIF.h" -#include "../../../timemanager/Clock.h" -#include "../../../objectmanager/SystemObjectIF.h" +#include "fsfw/tmtcpacket/SpacePacketBase.h" +#include "fsfw/timemanager/TimeStamperIF.h" +#include "fsfw/timemanager/Clock.h" +#include "fsfw/objectmanager/SystemObjectIF.h" namespace Factory{ void setStaticFrameworkObjectIds(); diff --git a/inc/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h b/inc/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h index 2a6d3bf6..fe373c6f 100644 --- a/inc/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h +++ b/inc/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h @@ -2,10 +2,10 @@ #define FSFW_TMTCPACKET_PUS_TMPACKETPUSC_H_ #include "TmPacketBase.h" -#include "../../SpacePacketBase.h" -#include "../../../timemanager/TimeStamperIF.h" -#include "../../../timemanager/Clock.h" -#include "../../../objectmanager/SystemObjectIF.h" +#include "fsfw/tmtcpacket/SpacePacketBase.h" +#include "fsfw/timemanager/TimeStamperIF.h" +#include "fsfw/timemanager/Clock.h" +#include "fsfw/objectmanager/SystemObjectIF.h" namespace Factory{ void setStaticFrameworkObjectIds(); diff --git a/inc/fsfw/tmtcservices/TmTcBridge.h b/inc/fsfw/tmtcservices/TmTcBridge.h index d3e1c547..d3689d19 100644 --- a/inc/fsfw/tmtcservices/TmTcBridge.h +++ b/inc/fsfw/tmtcservices/TmTcBridge.h @@ -4,12 +4,12 @@ #include "AcceptsTelemetryIF.h" #include "AcceptsTelecommandsIF.h" -#include "../objectmanager/SystemObject.h" -#include "../tasks/ExecutableObjectIF.h" -#include "../ipc/MessageQueueIF.h" -#include "../storagemanager/StorageManagerIF.h" -#include "../container/DynamicFIFO.h" -#include "../tmtcservices/TmTcMessage.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/container/DynamicFIFO.h" +#include "fsfw/tmtcservices/TmTcMessage.h" class TmTcBridge : public AcceptsTelemetryIF, public AcceptsTelecommandsIF, diff --git a/inc/fsfw/tmtcservices/TmTcMessage.h b/inc/fsfw/tmtcservices/TmTcMessage.h index 7d2a7bdb..5e6647fe 100644 --- a/inc/fsfw/tmtcservices/TmTcMessage.h +++ b/inc/fsfw/tmtcservices/TmTcMessage.h @@ -1,8 +1,8 @@ #ifndef FSFW_TMTCSERVICES_TMTCMESSAGE_H_ #define FSFW_TMTCSERVICES_TMTCMESSAGE_H_ -#include "../ipc/MessageQueueMessage.h" -#include "../storagemanager/StorageManagerIF.h" +#include "fsfw/ipc/MessageQueueMessage.h" +#include "fsfw/storagemanager/StorageManagerIF.h" /** * @brief This message class is used to pass Telecommand and Telemetry * packets between tasks. diff --git a/inc/fsfw/tmtcservices/VerificationReporter.h b/inc/fsfw/tmtcservices/VerificationReporter.h index f26fa54f..4a64d3df 100644 --- a/inc/fsfw/tmtcservices/VerificationReporter.h +++ b/inc/fsfw/tmtcservices/VerificationReporter.h @@ -2,7 +2,7 @@ #define FSFW_TMTCSERVICES_VERIFICATIONREPORTER_H_ #include "PusVerificationReport.h" -#include "../objectmanager/ObjectManagerIF.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" namespace Factory{ void setStaticFrameworkObjectIds(); diff --git a/src/core/thermal/ThermalComponentCore.cpp b/src/core/thermal/ThermalComponentCore.cpp index 7df04b04..7718ac36 100644 --- a/src/core/thermal/ThermalComponentCore.cpp +++ b/src/core/thermal/ThermalComponentCore.cpp @@ -1,5 +1,5 @@ -#include "ThermalComponentCore.h" -#include "tcsDefinitions.h" +#include "fsfw/thermal/ThermalComponentCore.h" +#include "fsfw/thermal/tcsDefinitions.h" ThermalComponentCore::ThermalComponentCore(object_id_t reportingObjectId, uint8_t domainId, gp_id_t temperaturePoolId, diff --git a/src/core/thermal/ThermalMonitorReporter.cpp b/src/core/thermal/ThermalMonitorReporter.cpp index cefc6110..31503203 100644 --- a/src/core/thermal/ThermalMonitorReporter.cpp +++ b/src/core/thermal/ThermalMonitorReporter.cpp @@ -1,7 +1,7 @@ -#include "ThermalMonitorReporter.h" -#include "ThermalComponentIF.h" +#include "fsfw/thermal/ThermalMonitorReporter.h" +#include "fsfw/thermal/ThermalComponentIF.h" -#include "../monitoring/MonitoringIF.h" +#include "fsfw/monitoring/MonitoringIF.h" ThermalMonitorReporter::~ThermalMonitorReporter() { } diff --git a/src/core/timemanager/TimeMessage.cpp b/src/core/timemanager/TimeMessage.cpp index 66aea0f4..320f3000 100644 --- a/src/core/timemanager/TimeMessage.cpp +++ b/src/core/timemanager/TimeMessage.cpp @@ -1,4 +1,4 @@ -#include "TimeMessage.h" +#include "fsfw/timemanager/TimeMessage.h" TimeMessage::TimeMessage() { this->messageSize += sizeof(timeval) + sizeof(uint32_t); diff --git a/src/core/timemanager/TimeStamper.cpp b/src/core/timemanager/TimeStamper.cpp index d9f0f2f3..4926c2d5 100644 --- a/src/core/timemanager/TimeStamper.cpp +++ b/src/core/timemanager/TimeStamper.cpp @@ -1,5 +1,6 @@ -#include "TimeStamper.h" -#include "Clock.h" +#include "fsfw/timemanager/TimeStamper.h" +#include "fsfw/timemanager/Clock.h" + #include TimeStamper::TimeStamper(object_id_t objectId): SystemObject(objectId) {} diff --git a/src/core/tmtcpacket/pus/tc/TcPacketPus.cpp b/src/core/tmtcpacket/pus/tc/TcPacketPus.cpp index d2b19206..28533754 100644 --- a/src/core/tmtcpacket/pus/tc/TcPacketPus.cpp +++ b/src/core/tmtcpacket/pus/tc/TcPacketPus.cpp @@ -1,5 +1,5 @@ -#include "TcPacketPus.h" -#include "../../../globalfunctions/CRC.h" +#include "fsfw/tmtcpacket/pus/tc/TcPacketPus.h" +#include "fsfw/globalfunctions/CRC.h" #include diff --git a/src/core/tmtcpacket/pus/tc/TcPacketStoredBase.cpp b/src/core/tmtcpacket/pus/tc/TcPacketStoredBase.cpp index cf980e68..98ce1725 100644 --- a/src/core/tmtcpacket/pus/tc/TcPacketStoredBase.cpp +++ b/src/core/tmtcpacket/pus/tc/TcPacketStoredBase.cpp @@ -1,8 +1,8 @@ -#include "TcPacketStoredBase.h" +#include "fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.h" -#include "../../../objectmanager/ObjectManager.h" -#include "../../../serviceinterface/ServiceInterface.h" -#include "../../../objectmanager/frameworkObjects.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/frameworkObjects.h" #include diff --git a/src/core/tmtcpacket/pus/tm/TmPacketBase.cpp b/src/core/tmtcpacket/pus/tm/TmPacketBase.cpp index 3dd1749f..d448fe5e 100644 --- a/src/core/tmtcpacket/pus/tm/TmPacketBase.cpp +++ b/src/core/tmtcpacket/pus/tm/TmPacketBase.cpp @@ -1,10 +1,10 @@ -#include "TmPacketBase.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketBase.h" -#include "../../../globalfunctions/CRC.h" -#include "../../../globalfunctions/arrayprinter.h" -#include "../../../objectmanager/ObjectManager.h" -#include "../../../serviceinterface/ServiceInterface.h" -#include "../../../timemanager/CCSDSTime.h" +#include "fsfw/globalfunctions/CRC.h" +#include "fsfw/globalfunctions/arrayprinter.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/timemanager/CCSDSTime.h" #include diff --git a/src/core/tmtcpacket/pus/tm/TmPacketMinimal.cpp b/src/core/tmtcpacket/pus/tm/TmPacketMinimal.cpp index 3f785cde..25e159da 100644 --- a/src/core/tmtcpacket/pus/tm/TmPacketMinimal.cpp +++ b/src/core/tmtcpacket/pus/tm/TmPacketMinimal.cpp @@ -1,5 +1,5 @@ -#include "TmPacketMinimal.h" -#include "../PacketTimestampInterpreterIF.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketMinimal.h" +#include "fsfw/tmtcpacket/pus/PacketTimestampInterpreterIF.h" #include #include diff --git a/src/core/tmtcpacket/pus/tm/TmPacketPusA.cpp b/src/core/tmtcpacket/pus/tm/TmPacketPusA.cpp index bdc0a815..c6540af5 100644 --- a/src/core/tmtcpacket/pus/tm/TmPacketPusA.cpp +++ b/src/core/tmtcpacket/pus/tm/TmPacketPusA.cpp @@ -1,11 +1,11 @@ -#include "TmPacketPusA.h" -#include "TmPacketBase.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketPusA.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketBase.h" -#include "../../../globalfunctions/CRC.h" -#include "../../../globalfunctions/arrayprinter.h" -#include "../../../objectmanager/ObjectManagerIF.h" -#include "../../../serviceinterface/ServiceInterfaceStream.h" -#include "../../../timemanager/CCSDSTime.h" +#include "fsfw/globalfunctions/CRC.h" +#include "fsfw/globalfunctions/arrayprinter.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/timemanager/CCSDSTime.h" #include diff --git a/src/core/tmtcpacket/pus/tm/TmPacketPusC.cpp b/src/core/tmtcpacket/pus/tm/TmPacketPusC.cpp index 5090aaeb..ea25f5d2 100644 --- a/src/core/tmtcpacket/pus/tm/TmPacketPusC.cpp +++ b/src/core/tmtcpacket/pus/tm/TmPacketPusC.cpp @@ -1,11 +1,11 @@ -#include "TmPacketPusC.h" -#include "TmPacketBase.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketPusC.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketBase.h" -#include "../../../globalfunctions/CRC.h" -#include "../../../globalfunctions/arrayprinter.h" -#include "../../../objectmanager/ObjectManagerIF.h" -#include "../../../serviceinterface/ServiceInterfaceStream.h" -#include "../../../timemanager/CCSDSTime.h" +#include "fsfw/globalfunctions/CRC.h" +#include "fsfw/globalfunctions/arrayprinter.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/timemanager/CCSDSTime.h" #include diff --git a/src/core/tmtcpacket/pus/tm/TmPacketStoredBase.cpp b/src/core/tmtcpacket/pus/tm/TmPacketStoredBase.cpp index ba8b15d1..466e4cd2 100644 --- a/src/core/tmtcpacket/pus/tm/TmPacketStoredBase.cpp +++ b/src/core/tmtcpacket/pus/tm/TmPacketStoredBase.cpp @@ -1,8 +1,8 @@ -#include "TmPacketStoredBase.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.h" -#include "../../../objectmanager/ObjectManager.h" -#include "../../../serviceinterface/ServiceInterface.h" -#include "../../../tmtcservices/TmTcMessage.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tmtcservices/TmTcMessage.h" #include diff --git a/src/core/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp b/src/core/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp index 02fb77ef..538dc95e 100644 --- a/src/core/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp +++ b/src/core/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp @@ -1,7 +1,7 @@ -#include "TmPacketStoredPusA.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.h" -#include "../../../serviceinterface/ServiceInterface.h" -#include "../../../tmtcservices/TmTcMessage.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tmtcservices/TmTcMessage.h" #include diff --git a/src/core/tmtcservices/TmTcBridge.cpp b/src/core/tmtcservices/TmTcBridge.cpp index 7198bc76..7346cfe2 100644 --- a/src/core/tmtcservices/TmTcBridge.cpp +++ b/src/core/tmtcservices/TmTcBridge.cpp @@ -1,9 +1,9 @@ -#include "TmTcBridge.h" +#include "fsfw/tmtcservices/TmTcBridge.h" -#include "../objectmanager/ObjectManager.h" -#include "../ipc/QueueFactory.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../globalfunctions/arrayprinter.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/globalfunctions/arrayprinter.h" #define TMTCBRIDGE_WIRETAPPING 0 diff --git a/src/core/tmtcservices/TmTcMessage.cpp b/src/core/tmtcservices/TmTcMessage.cpp index c0f32aaa..9dbd8fd8 100644 --- a/src/core/tmtcservices/TmTcMessage.cpp +++ b/src/core/tmtcservices/TmTcMessage.cpp @@ -1,4 +1,4 @@ -#include "TmTcMessage.h" +#include "fsfw/tmtcservices/TmTcMessage.h" #include diff --git a/src/core/tmtcservices/VerificationReporter.cpp b/src/core/tmtcservices/VerificationReporter.cpp index 74e0719c..2b371d1e 100644 --- a/src/core/tmtcservices/VerificationReporter.cpp +++ b/src/core/tmtcservices/VerificationReporter.cpp @@ -1,11 +1,11 @@ -#include "VerificationReporter.h" -#include "AcceptsVerifyMessageIF.h" -#include "PusVerificationReport.h" +#include "fsfw/tmtcservices/VerificationReporter.h" +#include "fsfw/tmtcservices/AcceptsVerifyMessageIF.h" +#include "fsfw/tmtcservices/PusVerificationReport.h" -#include "../objectmanager/ObjectManager.h" -#include "../ipc/MessageQueueIF.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../objectmanager/frameworkObjects.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/frameworkObjects.h" object_id_t VerificationReporter::messageReceiver = objects::PUS_SERVICE_1_VERIFICATION; diff --git a/src/opt/datalinklayer/Farm1StateWait.cpp b/src/opt/datalinklayer/Farm1StateWait.cpp index 9001e1f5..8d3f97fc 100644 --- a/src/opt/datalinklayer/Farm1StateWait.cpp +++ b/src/opt/datalinklayer/Farm1StateWait.cpp @@ -1,15 +1,7 @@ -/** - * @file Farm1StateWait.cpp - * @brief This file defines the Farm1StateWait class. - * @date 24.04.2013 - * @author baetz - */ - - -#include "ClcwIF.h" -#include "Farm1StateWait.h" -#include "TcTransferFrame.h" -#include "VirtualChannelReception.h" +#include "fsfw/datalinklayer/ClcwIF.h" +#include "fsfw/datalinklayer/Farm1StateWait.h" +#include "fsfw/datalinklayer/TcTransferFrame.h" +#include "fsfw/datalinklayer/VirtualChannelReception.h" Farm1StateWait::Farm1StateWait(VirtualChannelReception* setMyVC) : myVC(setMyVC) { } diff --git a/src/opt/datalinklayer/MapPacketExtraction.cpp b/src/opt/datalinklayer/MapPacketExtraction.cpp index d377ca34..7d06695a 100644 --- a/src/opt/datalinklayer/MapPacketExtraction.cpp +++ b/src/opt/datalinklayer/MapPacketExtraction.cpp @@ -1,12 +1,12 @@ -#include "MapPacketExtraction.h" +#include "fsfw/datalinklayer/MapPacketExtraction.h" -#include "../ipc/QueueFactory.h" -#include "../serviceinterface/ServiceInterfaceStream.h" -#include "../storagemanager/StorageManagerIF.h" -#include "../tmtcpacket/SpacePacketBase.h" -#include "../tmtcservices/AcceptsTelecommandsIF.h" -#include "../tmtcservices/TmTcMessage.h" -#include "../objectmanager/ObjectManager.h" +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/tmtcpacket/SpacePacketBase.h" +#include "fsfw/tmtcservices/AcceptsTelecommandsIF.h" +#include "fsfw/tmtcservices/TmTcMessage.h" +#include "fsfw/objectmanager/ObjectManager.h" #include diff --git a/src/opt/datalinklayer/TcTransferFrame.cpp b/src/opt/datalinklayer/TcTransferFrame.cpp index ee094dc3..42ccf7ca 100644 --- a/src/opt/datalinklayer/TcTransferFrame.cpp +++ b/src/opt/datalinklayer/TcTransferFrame.cpp @@ -1,17 +1,8 @@ -/** - * @file TcTransferFrame.cpp - * @brief This file defines the TcTransferFrame class. - * @date 27.04.2013 - * @author baetz - */ - - - -#include "TcTransferFrame.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/datalinklayer/TcTransferFrame.h" +#include "fsfw/serviceinterface/ServiceInterface.h" TcTransferFrame::TcTransferFrame() { - frame = NULL; + frame = nullptr; } TcTransferFrame::TcTransferFrame(uint8_t* setData) { diff --git a/src/opt/datalinklayer/TcTransferFrameLocal.cpp b/src/opt/datalinklayer/TcTransferFrameLocal.cpp index de8f568f..f88f79e2 100644 --- a/src/opt/datalinklayer/TcTransferFrameLocal.cpp +++ b/src/opt/datalinklayer/TcTransferFrameLocal.cpp @@ -1,14 +1,8 @@ -/** - * @file TcTransferFrameLocal.cpp - * @brief This file defines the TcTransferFrameLocal class. - * @date 27.04.2013 - * @author baetz - */ +#include "fsfw/datalinklayer/TcTransferFrameLocal.h" +#include "fsfw/globalfunctions/CRC.h" +#include "fsfw/serviceinterface/ServiceInterface.h" -#include "TcTransferFrameLocal.h" -#include "../globalfunctions/CRC.h" -#include "../serviceinterface/ServiceInterfaceStream.h" -#include +#include TcTransferFrameLocal::TcTransferFrameLocal(bool bypass, bool controlCommand, uint16_t scid, uint8_t vcId, uint8_t sequenceNumber, uint8_t setSegmentHeader, uint8_t* data, uint16_t dataSize, uint16_t forceCrc) { @@ -38,7 +32,7 @@ TcTransferFrameLocal::TcTransferFrameLocal(bool bypass, bool controlCommand, uin this->getFullFrame()[getFullSize()-1] = (crc & 0x00FF); } else { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << "TcTransferFrameLocal: dataSize too large: " << dataSize << std::endl; + sif::warning << "TcTransferFrameLocal: dataSize too large: " << dataSize << std::endl; #endif } } else { diff --git a/src/opt/datalinklayer/VirtualChannelReception.cpp b/src/opt/datalinklayer/VirtualChannelReception.cpp index 3a56fe1e..e0a88e8e 100644 --- a/src/opt/datalinklayer/VirtualChannelReception.cpp +++ b/src/opt/datalinklayer/VirtualChannelReception.cpp @@ -5,9 +5,9 @@ * @author baetz */ -#include "BCFrame.h" -#include "VirtualChannelReception.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/datalinklayer/BCFrame.h" +#include "fsfw/datalinklayer/VirtualChannelReception.h" +#include "fsfw/serviceinterface/ServiceInterface.h" VirtualChannelReception::VirtualChannelReception(uint8_t setChannelId, uint8_t setSlidingWindowWidth) : diff --git a/src/opt/monitoring/LimitViolationReporter.cpp b/src/opt/monitoring/LimitViolationReporter.cpp index 2de1e008..a0b8a4cb 100644 --- a/src/opt/monitoring/LimitViolationReporter.cpp +++ b/src/opt/monitoring/LimitViolationReporter.cpp @@ -1,9 +1,9 @@ -#include "LimitViolationReporter.h" -#include "MonitoringIF.h" -#include "ReceivesMonitoringReportsIF.h" +#include "fsfw/monitoring/LimitViolationReporter.h" +#include "fsfw/monitoring/MonitoringIF.h" +#include "fsfw/monitoring/ReceivesMonitoringReportsIF.h" -#include "../objectmanager/ObjectManager.h" -#include "../serialize/SerializeAdapter.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serialize/SerializeAdapter.h" ReturnValue_t LimitViolationReporter::sendLimitViolationReport(const SerializeIF* data) { ReturnValue_t result = checkClassLoaded(); diff --git a/src/opt/monitoring/MonitoringMessage.cpp b/src/opt/monitoring/MonitoringMessage.cpp index 6e5f49cc..8bbb7765 100644 --- a/src/opt/monitoring/MonitoringMessage.cpp +++ b/src/opt/monitoring/MonitoringMessage.cpp @@ -1,5 +1,5 @@ -#include "MonitoringMessage.h" -#include "../objectmanager/ObjectManager.h" +#include "fsfw/monitoring/MonitoringMessage.h" +#include "fsfw/objectmanager/ObjectManager.h" MonitoringMessage::~MonitoringMessage() { } diff --git a/src/opt/pus/CService200ModeCommanding.cpp b/src/opt/pus/CService200ModeCommanding.cpp index d178b3a9..66c61dbe 100644 --- a/src/opt/pus/CService200ModeCommanding.cpp +++ b/src/opt/pus/CService200ModeCommanding.cpp @@ -1,11 +1,11 @@ -#include "CService200ModeCommanding.h" -#include "servicepackets/Service200Packets.h" +#include "fsfw/pus/CService200ModeCommanding.h" +#include "fsfw/pus/servicepackets/Service200Packets.h" -#include "../modes/HasModesIF.h" -#include "../objectmanager/ObjectManager.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../serialize/SerialLinkedListAdapter.h" -#include "../modes/ModeMessage.h" +#include "fsfw/modes/HasModesIF.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/serialize/SerialLinkedListAdapter.h" +#include "fsfw/modes/ModeMessage.h" CService200ModeCommanding::CService200ModeCommanding(object_id_t objectId, uint16_t apid, uint8_t serviceId, uint8_t numParallelCommands, diff --git a/src/opt/pus/CService201HealthCommanding.cpp b/src/opt/pus/CService201HealthCommanding.cpp index 52a8a603..1e414c82 100644 --- a/src/opt/pus/CService201HealthCommanding.cpp +++ b/src/opt/pus/CService201HealthCommanding.cpp @@ -1,10 +1,10 @@ -#include "CService201HealthCommanding.h" -#include "servicepackets/Service201Packets.h" +#include "fsfw/pus/CService201HealthCommanding.h" +#include "fsfw/pus/servicepackets/Service201Packets.h" -#include "../health/HasHealthIF.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../objectmanager/ObjectManager.h" -#include "../health/HealthMessage.h" +#include "fsfw/health/HasHealthIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/health/HealthMessage.h" CService201HealthCommanding::CService201HealthCommanding(object_id_t objectId, diff --git a/src/opt/pus/Service17Test.cpp b/src/opt/pus/Service17Test.cpp index 37258cc1..20227172 100644 --- a/src/opt/pus/Service17Test.cpp +++ b/src/opt/pus/Service17Test.cpp @@ -1,9 +1,9 @@ -#include "Service17Test.h" -#include +#include "fsfw/FSFW.h" +#include "fsfw/pus/Service17Test.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../objectmanager/SystemObject.h" -#include "../tmtcpacket/pus/tm/TmPacketStored.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketStored.h" Service17Test::Service17Test(object_id_t objectId, diff --git a/src/opt/pus/Service1TelecommandVerification.cpp b/src/opt/pus/Service1TelecommandVerification.cpp index 8aec6902..c6b024f9 100644 --- a/src/opt/pus/Service1TelecommandVerification.cpp +++ b/src/opt/pus/Service1TelecommandVerification.cpp @@ -1,12 +1,12 @@ -#include "Service1TelecommandVerification.h" -#include "servicepackets/Service1Packets.h" +#include "fsfw/pus/Service1TelecommandVerification.h" +#include "fsfw/pus/servicepackets/Service1Packets.h" -#include "../ipc/QueueFactory.h" -#include "../objectmanager/ObjectManager.h" -#include "../tmtcservices/PusVerificationReport.h" -#include "../tmtcpacket/pus/tm/TmPacketStored.h" -#include "../serviceinterface/ServiceInterfaceStream.h" -#include "../tmtcservices/AcceptsTelemetryIF.h" +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/tmtcservices/PusVerificationReport.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketStored.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tmtcservices/AcceptsTelemetryIF.h" Service1TelecommandVerification::Service1TelecommandVerification( object_id_t objectId, uint16_t apid, uint8_t serviceId, diff --git a/src/opt/pus/Service20ParameterManagement.cpp b/src/opt/pus/Service20ParameterManagement.cpp index c4e4b5eb..e28e7804 100644 --- a/src/opt/pus/Service20ParameterManagement.cpp +++ b/src/opt/pus/Service20ParameterManagement.cpp @@ -1,11 +1,11 @@ -#include "Service20ParameterManagement.h" -#include "servicepackets/Service20Packets.h" +#include "fsfw/pus/Service20ParameterManagement.h" +#include "fsfw/pus/servicepackets/Service20Packets.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../parameters/HasParametersIF.h" -#include "../parameters/ParameterMessage.h" -#include "../objectmanager/ObjectManager.h" -#include "../parameters/ReceivesParameterMessagesIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/parameters/HasParametersIF.h" +#include "fsfw/parameters/ParameterMessage.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/parameters/ReceivesParameterMessagesIF.h" Service20ParameterManagement::Service20ParameterManagement(object_id_t objectId, uint16_t apid, diff --git a/src/opt/pus/Service2DeviceAccess.cpp b/src/opt/pus/Service2DeviceAccess.cpp index 4cf75d32..0e5edfd3 100644 --- a/src/opt/pus/Service2DeviceAccess.cpp +++ b/src/opt/pus/Service2DeviceAccess.cpp @@ -1,15 +1,15 @@ -#include "Service2DeviceAccess.h" -#include "servicepackets/Service2Packets.h" +#include "fsfw/pus/Service2DeviceAccess.h" +#include "fsfw/pus/servicepackets/Service2Packets.h" -#include "../objectmanager/ObjectManager.h" -#include "../devicehandlers/DeviceHandlerIF.h" -#include "../storagemanager/StorageManagerIF.h" -#include "../devicehandlers/DeviceHandlerMessage.h" -#include "../serialize/EndianConverter.h" -#include "../action/ActionMessage.h" -#include "../serialize/SerializeAdapter.h" -#include "../serialize/SerialLinkedListAdapter.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/devicehandlers/DeviceHandlerIF.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/devicehandlers/DeviceHandlerMessage.h" +#include "fsfw/serialize/EndianConverter.h" +#include "fsfw/action/ActionMessage.h" +#include "fsfw/serialize/SerializeAdapter.h" +#include "fsfw/serialize/SerialLinkedListAdapter.h" +#include "fsfw/serviceinterface/ServiceInterface.h" Service2DeviceAccess::Service2DeviceAccess(object_id_t objectId, uint16_t apid, uint8_t serviceId, uint8_t numberOfParallelCommands, diff --git a/src/opt/pus/Service3Housekeeping.cpp b/src/opt/pus/Service3Housekeeping.cpp index 6b1275b3..2b91f366 100644 --- a/src/opt/pus/Service3Housekeeping.cpp +++ b/src/opt/pus/Service3Housekeeping.cpp @@ -1,8 +1,8 @@ -#include "Service3Housekeeping.h" -#include "servicepackets/Service3Packets.h" +#include "fsfw/pus/Service3Housekeeping.h" +#include "fsfw/pus/servicepackets/Service3Packets.h" -#include "../objectmanager/ObjectManager.h" -#include "../datapoollocal/HasLocalDataPoolIF.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/datapoollocal/HasLocalDataPoolIF.h" Service3Housekeeping::Service3Housekeeping(object_id_t objectId, uint16_t apid, uint8_t serviceId): diff --git a/src/opt/pus/Service5EventReporting.cpp b/src/opt/pus/Service5EventReporting.cpp index 0c139f3a..36aa7e70 100644 --- a/src/opt/pus/Service5EventReporting.cpp +++ b/src/opt/pus/Service5EventReporting.cpp @@ -1,11 +1,11 @@ -#include "Service5EventReporting.h" -#include "servicepackets/Service5Packets.h" +#include "fsfw/pus/Service5EventReporting.h" +#include "fsfw/pus/servicepackets/Service5Packets.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../objectmanager/ObjectManager.h" -#include "../events/EventManagerIF.h" -#include "../ipc/QueueFactory.h" -#include "../tmtcpacket/pus/tm/TmPacketStored.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/events/EventManagerIF.h" +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketStored.h" Service5EventReporting::Service5EventReporting(object_id_t objectId, diff --git a/src/opt/pus/Service8FunctionManagement.cpp b/src/opt/pus/Service8FunctionManagement.cpp index 77b7dc80..39e872a0 100644 --- a/src/opt/pus/Service8FunctionManagement.cpp +++ b/src/opt/pus/Service8FunctionManagement.cpp @@ -1,12 +1,12 @@ -#include "Service8FunctionManagement.h" -#include "servicepackets/Service8Packets.h" +#include "fsfw/pus/Service8FunctionManagement.h" +#include "fsfw/pus/servicepackets/Service8Packets.h" -#include "../objectmanager/ObjectManager.h" -#include "../objectmanager/SystemObjectIF.h" -#include "../action/HasActionsIF.h" -#include "../devicehandlers/DeviceHandlerIF.h" -#include "../serialize/SerializeAdapter.h" -#include "../serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/objectmanager/SystemObjectIF.h" +#include "fsfw/action/HasActionsIF.h" +#include "fsfw/devicehandlers/DeviceHandlerIF.h" +#include "fsfw/serialize/SerializeAdapter.h" +#include "fsfw/serviceinterface/ServiceInterface.h" Service8FunctionManagement::Service8FunctionManagement(object_id_t objectId, uint16_t apid, uint8_t serviceId, uint8_t numParallelCommands, diff --git a/src/opt/pus/Service9TimeManagement.cpp b/src/opt/pus/Service9TimeManagement.cpp index 5625bdd8..619b2405 100644 --- a/src/opt/pus/Service9TimeManagement.cpp +++ b/src/opt/pus/Service9TimeManagement.cpp @@ -1,9 +1,9 @@ -#include "Service9TimeManagement.h" -#include "servicepackets/Service9Packets.h" +#include "fsfw/pus/Service9TimeManagement.h" +#include "fsfw/pus/servicepackets/Service9Packets.h" -#include "../timemanager/CCSDSTime.h" -#include "../events/EventManagerIF.h" -#include "../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/timemanager/CCSDSTime.h" +#include "fsfw/events/EventManagerIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" Service9TimeManagement::Service9TimeManagement(object_id_t objectId, diff --git a/src/opt/rmap/RMAP.cpp b/src/opt/rmap/RMAP.cpp index 7ea6e532..6ac4904d 100644 --- a/src/opt/rmap/RMAP.cpp +++ b/src/opt/rmap/RMAP.cpp @@ -1,8 +1,8 @@ -#include "RMAP.h" -#include "rmapStructs.h" -#include "RMAPChannelIF.h" +#include "fsfw/rmap/RMAP.h" +#include "fsfw/rmap/rmapStructs.h" +#include "fsfw/rmap/RMAPChannelIF.h" -#include "../devicehandlers/DeviceCommunicationIF.h" +#include "fsfw/devicehandlers/DeviceCommunicationIF.h" #include diff --git a/src/opt/rmap/RMAPCookie.cpp b/src/opt/rmap/RMAPCookie.cpp index f8fe2d3e..393a5ce0 100644 --- a/src/opt/rmap/RMAPCookie.cpp +++ b/src/opt/rmap/RMAPCookie.cpp @@ -1,5 +1,6 @@ -#include "RMAPChannelIF.h" -#include "RMAPCookie.h" +#include "fsfw/rmap/RMAPChannelIF.h" +#include "fsfw/rmap/RMAPCookie.h" + #include diff --git a/src/opt/rmap/RmapDeviceCommunicationIF.cpp b/src/opt/rmap/RmapDeviceCommunicationIF.cpp index d81baabd..2fab613e 100644 --- a/src/opt/rmap/RmapDeviceCommunicationIF.cpp +++ b/src/opt/rmap/RmapDeviceCommunicationIF.cpp @@ -1,5 +1,5 @@ -#include "RmapDeviceCommunicationIF.h" -#include "RMAP.h" +#include "fsfw/rmap/RmapDeviceCommunicationIF.h" +#include "fsfw/rmap/RMAP.h" //TODO Cast here are all potential bugs RmapDeviceCommunicationIF::~RmapDeviceCommunicationIF() { diff --git a/src/opt/tmstorage/TmStoreMessage.cpp b/src/opt/tmstorage/TmStoreMessage.cpp index 11af6121..f63a4757 100644 --- a/src/opt/tmstorage/TmStoreMessage.cpp +++ b/src/opt/tmstorage/TmStoreMessage.cpp @@ -1,5 +1,5 @@ -#include "TmStoreMessage.h" -#include "../objectmanager/ObjectManager.h" +#include "fsfw/tmstorage/TmStoreMessage.h" +#include "fsfw/objectmanager/ObjectManager.h" TmStoreMessage::~TmStoreMessage() { diff --git a/src/osal/common/tcpipCommon.cpp b/src/osal/common/tcpipCommon.cpp index ca4dbf18..0fdbf867 100644 --- a/src/osal/common/tcpipCommon.cpp +++ b/src/osal/common/tcpipCommon.cpp @@ -1,7 +1,8 @@ -#include "tcpipCommon.h" -#include +#include "fsfw/platform.h" +#include "fsfw/osal/common/tcpipCommon.h" +#include "fsfw/serviceinterface/ServiceInterface.h" -#ifdef _WIN32 +#ifdef PLATFORM_WIN #include #endif diff --git a/src/osal/freertos/MessageQueue.cpp b/src/osal/freertos/MessageQueue.cpp index cc8bd6a7..017bac39 100644 --- a/src/osal/freertos/MessageQueue.cpp +++ b/src/osal/freertos/MessageQueue.cpp @@ -1,7 +1,7 @@ #include "MessageQueue.h" #include "QueueMapManager.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" MessageQueue::MessageQueue(size_t messageDepth, size_t maxMessageSize): maxMessageSize(maxMessageSize) { diff --git a/src/osal/linux/BinarySemaphore.cpp b/src/osal/linux/BinarySemaphore.cpp index 110b0a90..3ef04cf0 100644 --- a/src/osal/linux/BinarySemaphore.cpp +++ b/src/osal/linux/BinarySemaphore.cpp @@ -1,11 +1,11 @@ -#include "BinarySemaphore.h" -#include "unixUtility.h" -#include "../../serviceinterface/ServiceInterfacePrinter.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/osal/linux/BinarySemaphore.h" +#include "fsfw/osal/linux/unixUtility.h" +#include "fsfw/serviceinterface/ServiceInterfacePrinter.h" +#include "fsfw/serviceinterface/ServiceInterfaceStream.h" #include #include -#include +#include BinarySemaphore::BinarySemaphore() { diff --git a/src/osal/linux/Clock.cpp b/src/osal/linux/Clock.cpp index 960d9c0d..d79c72be 100644 --- a/src/osal/linux/Clock.cpp +++ b/src/osal/linux/Clock.cpp @@ -1,5 +1,5 @@ -#include "../../serviceinterface/ServiceInterfaceStream.h" -#include "../../timemanager/Clock.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/timemanager/Clock.h" #include #include diff --git a/src/osal/linux/CountingSemaphore.cpp b/src/osal/linux/CountingSemaphore.cpp index 752e150b..cc2117f3 100644 --- a/src/osal/linux/CountingSemaphore.cpp +++ b/src/osal/linux/CountingSemaphore.cpp @@ -1,7 +1,7 @@ -#include "CountingSemaphore.h" -#include "unixUtility.h" +#include "fsfw/osal/linux/CountingSemaphore.h" +#include "fsfw/osal/linux/unixUtility.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include diff --git a/src/osal/linux/FixedTimeslotTask.cpp b/src/osal/linux/FixedTimeslotTask.cpp index c60c287a..f6648299 100644 --- a/src/osal/linux/FixedTimeslotTask.cpp +++ b/src/osal/linux/FixedTimeslotTask.cpp @@ -1,7 +1,7 @@ -#include "FixedTimeslotTask.h" +#include "fsfw/osal/linux/FixedTimeslotTask.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include diff --git a/src/osal/linux/InternalErrorCodes.cpp b/src/osal/linux/InternalErrorCodes.cpp index a01cc72a..14274535 100644 --- a/src/osal/linux/InternalErrorCodes.cpp +++ b/src/osal/linux/InternalErrorCodes.cpp @@ -1,4 +1,4 @@ -#include "../../osal/InternalErrorCodes.h" +#include "fsfw/osal/InternalErrorCodes.h" ReturnValue_t InternalErrorCodes::translate(uint8_t code) { //TODO This class can be removed diff --git a/src/osal/linux/MessageQueue.cpp b/src/osal/linux/MessageQueue.cpp index 3c151143..b068c04f 100644 --- a/src/osal/linux/MessageQueue.cpp +++ b/src/osal/linux/MessageQueue.cpp @@ -1,8 +1,8 @@ -#include "MessageQueue.h" -#include "unixUtility.h" +#include "fsfw/osal/linux/MessageQueue.h" +#include "fsfw/osal/linux/unixUtility.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" #include diff --git a/src/osal/linux/Mutex.cpp b/src/osal/linux/Mutex.cpp index 33e84aac..7391c6b5 100644 --- a/src/osal/linux/Mutex.cpp +++ b/src/osal/linux/Mutex.cpp @@ -1,8 +1,8 @@ -#include "Mutex.h" -#include "unixUtility.h" +#include "fsfw/osal/linux/Mutex.h" +#include "fsfw/osal/linux/unixUtility.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../timemanager/Clock.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/timemanager/Clock.h" #include #include diff --git a/src/osal/linux/MutexFactory.cpp b/src/osal/linux/MutexFactory.cpp index 80211f8b..373ff7da 100644 --- a/src/osal/linux/MutexFactory.cpp +++ b/src/osal/linux/MutexFactory.cpp @@ -1,6 +1,6 @@ -#include "Mutex.h" +#include "fsfw/osal/linux/Mutex.h" -#include "../../ipc/MutexFactory.h" +#include "fsfw/ipc/MutexFactory.h" //TODO: Different variant than the lazy loading in QueueFactory. What's better and why? MutexFactory* MutexFactory::factoryInstance = new MutexFactory(); diff --git a/src/osal/linux/QueueFactory.cpp b/src/osal/linux/QueueFactory.cpp index 44def48a..1df26ca9 100644 --- a/src/osal/linux/QueueFactory.cpp +++ b/src/osal/linux/QueueFactory.cpp @@ -1,14 +1,12 @@ -#include "../../ipc/QueueFactory.h" -#include "MessageQueue.h" +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/osal/linux/MessageQueue.h" -#include "../../ipc/messageQueueDefinitions.h" -#include "../../ipc/MessageQueueSenderIF.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/ipc/messageQueueDefinitions.h" +#include "fsfw/ipc/MessageQueueSenderIF.h" #include #include - #include QueueFactory* QueueFactory::factoryInstance = nullptr; diff --git a/src/osal/linux/SemaphoreFactory.cpp b/src/osal/linux/SemaphoreFactory.cpp index cfb5f12d..0a0974be 100644 --- a/src/osal/linux/SemaphoreFactory.cpp +++ b/src/osal/linux/SemaphoreFactory.cpp @@ -1,8 +1,7 @@ -#include "BinarySemaphore.h" -#include "CountingSemaphore.h" +#include "fsfw/osal/linux/BinarySemaphore.h" +#include "fsfw/osal/linux/CountingSemaphore.h" -#include "../../tasks/SemaphoreFactory.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/tasks/SemaphoreFactory.h" SemaphoreFactory* SemaphoreFactory::factoryInstance = nullptr; diff --git a/src/osal/linux/TaskFactory.cpp b/src/osal/linux/TaskFactory.cpp index 80bf47b7..53aea0ac 100644 --- a/src/osal/linux/TaskFactory.cpp +++ b/src/osal/linux/TaskFactory.cpp @@ -1,9 +1,9 @@ -#include "FixedTimeslotTask.h" -#include "PeriodicPosixTask.h" +#include "fsfw/osal/linux/FixedTimeslotTask.h" +#include "fsfw/osal/linux/PeriodicPosixTask.h" -#include "../../tasks/TaskFactory.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../returnvalues/HasReturnvaluesIF.h" +#include "fsfw/tasks/TaskFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" //TODO: Different variant than the lazy loading in QueueFactory. What's better and why? TaskFactory* TaskFactory::factoryInstance = new TaskFactory(); diff --git a/src/osal/linux/Timer.cpp b/src/osal/linux/Timer.cpp index fe0fbebb..dca3112d 100644 --- a/src/osal/linux/Timer.cpp +++ b/src/osal/linux/Timer.cpp @@ -1,5 +1,5 @@ -#include "Timer.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/osal/linux/Timer.h" +#include "fsfw/serviceinterface/ServiceInterfaceStream.h" #include diff --git a/src/osal/linux/tcpipHelpers.cpp b/src/osal/linux/tcpipHelpers.cpp index d7c644ec..800c6fb7 100644 --- a/src/osal/linux/tcpipHelpers.cpp +++ b/src/osal/linux/tcpipHelpers.cpp @@ -1,7 +1,7 @@ -#include "../common/tcpipHelpers.h" +#include "fsfw/osal/common/tcpipHelpers.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../tasks/TaskFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tasks/TaskFactory.h" #include #include From 66a79cb86c061a7113a43a21035f1fdb1e082729 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 13 Jul 2021 21:02:53 +0200 Subject: [PATCH 177/389] done --- .../tmtcpacket/pus/tc/TcPacketStoredPus.cpp | 4 ++-- .../tmtcpacket/pus/tm/TmPacketStoredPusC.cpp | 6 +++--- src/osal/common/TcpIpBase.cpp | 4 ++-- src/osal/common/TcpTmTcBridge.cpp | 15 +++++++------- src/osal/common/TcpTmTcServer.cpp | 20 +++++++++---------- src/osal/common/UdpTcPollingTask.cpp | 13 ++++++------ src/osal/common/UdpTmTcBridge.cpp | 10 +++++----- src/osal/linux/PeriodicPosixTask.cpp | 8 ++++---- src/osal/linux/PosixThread.cpp | 6 +++--- src/osal/linux/unixUtility.cpp | 6 +++--- 10 files changed, 47 insertions(+), 45 deletions(-) diff --git a/src/core/tmtcpacket/pus/tc/TcPacketStoredPus.cpp b/src/core/tmtcpacket/pus/tc/TcPacketStoredPus.cpp index 426aafdb..5ea9f5b1 100644 --- a/src/core/tmtcpacket/pus/tc/TcPacketStoredPus.cpp +++ b/src/core/tmtcpacket/pus/tc/TcPacketStoredPus.cpp @@ -1,6 +1,6 @@ -#include "TcPacketStoredPus.h" +#include "fsfw/tmtcpacket/pus/tc/TcPacketStoredPus.h" -#include "../../../serviceinterface/ServiceInterface.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include diff --git a/src/core/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp b/src/core/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp index 6f8f7fa2..add4f4b9 100644 --- a/src/core/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp +++ b/src/core/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp @@ -1,7 +1,7 @@ -#include "TmPacketStoredPusC.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.h" -#include "../../../serviceinterface/ServiceInterface.h" -#include "../../../tmtcservices/TmTcMessage.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tmtcservices/TmTcMessage.h" #include diff --git a/src/osal/common/TcpIpBase.cpp b/src/osal/common/TcpIpBase.cpp index 0b37e38c..b6b64e13 100644 --- a/src/osal/common/TcpIpBase.cpp +++ b/src/osal/common/TcpIpBase.cpp @@ -1,5 +1,5 @@ -#include "TcpIpBase.h" -#include "../../platform.h" +#include "fsfw/osal/common/TcpIpBase.h" +#include "fsfw/platform.h" #ifdef PLATFORM_UNIX #include diff --git a/src/osal/common/TcpTmTcBridge.cpp b/src/osal/common/TcpTmTcBridge.cpp index 24fab9a9..24f1a281 100644 --- a/src/osal/common/TcpTmTcBridge.cpp +++ b/src/osal/common/TcpTmTcBridge.cpp @@ -1,15 +1,16 @@ -#include "TcpTmTcBridge.h" -#include "tcpipHelpers.h" +#include "fsfw/platform.h" +#include "fsfw/osal/common/TcpTmTcBridge.h" +#include "fsfw/osal/common/tcpipHelpers.h" -#include -#include -#include +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/ipc/MutexGuard.h" +#include "fsfw/osal/common/TcpTmTcBridge.h" -#ifdef _WIN32 +#ifdef PLATFORM_WIN #include -#elif defined(__unix__) +#elif defined PLATFORM_UNIX #include #include diff --git a/src/osal/common/TcpTmTcServer.cpp b/src/osal/common/TcpTmTcServer.cpp index 38f72647..f94449bb 100644 --- a/src/osal/common/TcpTmTcServer.cpp +++ b/src/osal/common/TcpTmTcServer.cpp @@ -1,15 +1,15 @@ -#include "TcpTmTcServer.h" -#include "TcpTmTcBridge.h" -#include "tcpipHelpers.h" +#include "fsfw/osal/common/TcpTmTcServer.h" +#include "fsfw/osal/common/TcpTmTcBridge.h" +#include "fsfw/osal/common/tcpipHelpers.h" -#include "../../platform.h" -#include "../../container/SharedRingBuffer.h" -#include "../../ipc/MessageQueueSenderIF.h" -#include "../../ipc/MutexGuard.h" -#include "../../objectmanager/ObjectManager.h" +#include "fsfw/platform.h" +#include "fsfw/container/SharedRingBuffer.h" +#include "fsfw/ipc/MessageQueueSenderIF.h" +#include "fsfw/ipc/MutexGuard.h" +#include "fsfw/objectmanager/ObjectManager.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../tmtcservices/TmTcMessage.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tmtcservices/TmTcMessage.h" #ifdef PLATFORM_WIN #include diff --git a/src/osal/common/UdpTcPollingTask.cpp b/src/osal/common/UdpTcPollingTask.cpp index 4453e1bc..35e086ee 100644 --- a/src/osal/common/UdpTcPollingTask.cpp +++ b/src/osal/common/UdpTcPollingTask.cpp @@ -1,9 +1,10 @@ -#include "UdpTcPollingTask.h" -#include "tcpipHelpers.h" -#include "../../platform.h" -#include "../../globalfunctions/arrayprinter.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../objectmanager/ObjectManager.h" +#include "fsfw/osal/common/UdpTcPollingTask.h" +#include "fsfw/osal/common/tcpipHelpers.h" + +#include "fsfw/platform.h" +#include "fsfw/globalfunctions/arrayprinter.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" #ifdef PLATFORM_WIN #include diff --git a/src/osal/common/UdpTmTcBridge.cpp b/src/osal/common/UdpTmTcBridge.cpp index 4c83385b..7015cf4a 100644 --- a/src/osal/common/UdpTmTcBridge.cpp +++ b/src/osal/common/UdpTmTcBridge.cpp @@ -1,9 +1,9 @@ -#include "UdpTmTcBridge.h" -#include "tcpipHelpers.h" +#include "fsfw/osal/common/UdpTmTcBridge.h" +#include "fsfw/osal/common/tcpipHelpers.h" -#include "../../platform.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../ipc/MutexGuard.h" +#include "fsfw/platform.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/ipc/MutexGuard.h" #ifdef PLATFORM_WIN #include diff --git a/src/osal/linux/PeriodicPosixTask.cpp b/src/osal/linux/PeriodicPosixTask.cpp index c0152bec..0603cf6a 100644 --- a/src/osal/linux/PeriodicPosixTask.cpp +++ b/src/osal/linux/PeriodicPosixTask.cpp @@ -1,8 +1,8 @@ -#include "PeriodicPosixTask.h" +#include "fsfw/osal/linux/PeriodicPosixTask.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../tasks/ExecutableObjectIF.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include diff --git a/src/osal/linux/PosixThread.cpp b/src/osal/linux/PosixThread.cpp index 36501282..5ca41d73 100644 --- a/src/osal/linux/PosixThread.cpp +++ b/src/osal/linux/PosixThread.cpp @@ -1,7 +1,7 @@ -#include "PosixThread.h" -#include "unixUtility.h" +#include "fsfw/osal/linux/PosixThread.h" +#include "fsfw/osal/linux/unixUtility.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include #include diff --git a/src/osal/linux/unixUtility.cpp b/src/osal/linux/unixUtility.cpp index d7aab4ba..40d8c212 100644 --- a/src/osal/linux/unixUtility.cpp +++ b/src/osal/linux/unixUtility.cpp @@ -1,6 +1,6 @@ -#include "FSFWConfig.h" -#include "unixUtility.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/FSFW.h" +#include "fsfw/osal/linux/unixUtility.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include #include From d5dfffda2dfca299038f3b9b096efcd315289fb7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 14 Jul 2021 00:54:39 +0200 Subject: [PATCH 178/389] corrections for freertos osal --- inc/fsfw/osal/freertos/BinSemaphUsingTask.h | 4 ++-- inc/fsfw/osal/freertos/BinarySemaphore.h | 4 ++-- inc/fsfw/osal/freertos/CountingSemaphUsingTask.h | 2 +- inc/fsfw/osal/freertos/FixedTimeslotTask.h | 6 +++--- inc/fsfw/osal/freertos/MessageQueue.h | 8 ++++---- inc/fsfw/osal/freertos/Mutex.h | 2 +- inc/fsfw/osal/freertos/PeriodicTask.h | 6 +++--- inc/fsfw/osal/freertos/QueueMapManager.h | 6 +++--- inc/fsfw/tasks/SemaphoreFactory.h | 2 +- src/osal/CMakeLists.txt | 2 +- src/osal/freertos/BinSemaphUsingTask.cpp | 6 +++--- src/osal/freertos/BinarySemaphore.cpp | 6 +++--- src/osal/freertos/Clock.cpp | 10 +++++----- src/osal/freertos/CountingSemaphUsingTask.cpp | 6 +++--- src/osal/freertos/CountingSemaphore.cpp | 6 +++--- src/osal/freertos/FixedTimeslotTask.cpp | 6 +++--- src/osal/freertos/MessageQueue.cpp | 5 +++-- src/osal/freertos/Mutex.cpp | 4 ++-- src/osal/freertos/MutexFactory.cpp | 4 ++-- src/osal/freertos/PeriodicTask.cpp | 8 ++++---- src/osal/freertos/QueueFactory.cpp | 6 +++--- src/osal/freertos/QueueMapManager.cpp | 6 +++--- src/osal/freertos/SemaphoreFactory.cpp | 12 ++++++------ src/osal/freertos/TaskFactory.cpp | 9 ++++----- src/osal/freertos/TaskManagement.cpp | 2 +- src/osal/freertos/Timekeeper.cpp | 2 +- 26 files changed, 70 insertions(+), 70 deletions(-) diff --git a/inc/fsfw/osal/freertos/BinSemaphUsingTask.h b/inc/fsfw/osal/freertos/BinSemaphUsingTask.h index 895ccefb..0645b1fa 100644 --- a/inc/fsfw/osal/freertos/BinSemaphUsingTask.h +++ b/inc/fsfw/osal/freertos/BinSemaphUsingTask.h @@ -1,8 +1,8 @@ #ifndef FSFW_OSAL_FREERTOS_BINSEMAPHUSINGTASK_H_ #define FSFW_OSAL_FREERTOS_BINSEMAPHUSINGTASK_H_ -#include "../../returnvalues/HasReturnvaluesIF.h" -#include "../../tasks/SemaphoreIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/tasks/SemaphoreIF.h" #include "FreeRTOS.h" #include "task.h" diff --git a/inc/fsfw/osal/freertos/BinarySemaphore.h b/inc/fsfw/osal/freertos/BinarySemaphore.h index 2335292b..1ae56ff6 100644 --- a/inc/fsfw/osal/freertos/BinarySemaphore.h +++ b/inc/fsfw/osal/freertos/BinarySemaphore.h @@ -1,8 +1,8 @@ #ifndef FSFW_OSAL_FREERTOS_BINARYSEMPAHORE_H_ #define FSFW_OSAL_FREERTOS_BINARYSEMPAHORE_H_ -#include "../../returnvalues/HasReturnvaluesIF.h" -#include "../../tasks/SemaphoreIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/tasks/SemaphoreIF.h" #include "FreeRTOS.h" #include "semphr.h" diff --git a/inc/fsfw/osal/freertos/CountingSemaphUsingTask.h b/inc/fsfw/osal/freertos/CountingSemaphUsingTask.h index 9ac99c31..eb2fc67b 100644 --- a/inc/fsfw/osal/freertos/CountingSemaphUsingTask.h +++ b/inc/fsfw/osal/freertos/CountingSemaphUsingTask.h @@ -2,7 +2,7 @@ #define FSFW_OSAL_FREERTOS_COUNTINGSEMAPHUSINGTASK_H_ #include "CountingSemaphUsingTask.h" -#include "../../tasks/SemaphoreIF.h" +#include "fsfw/tasks/SemaphoreIF.h" #include "FreeRTOS.h" #include "task.h" diff --git a/inc/fsfw/osal/freertos/FixedTimeslotTask.h b/inc/fsfw/osal/freertos/FixedTimeslotTask.h index 7494581c..ebd902cc 100644 --- a/inc/fsfw/osal/freertos/FixedTimeslotTask.h +++ b/inc/fsfw/osal/freertos/FixedTimeslotTask.h @@ -2,9 +2,9 @@ #define FSFW_OSAL_FREERTOS_FIXEDTIMESLOTTASK_H_ #include "FreeRTOSTaskIF.h" -#include "../../tasks/FixedSlotSequence.h" -#include "../../tasks/FixedTimeslotTaskIF.h" -#include "../../tasks/Typedef.h" +#include "fsfw/tasks/FixedSlotSequence.h" +#include "fsfw/tasks/FixedTimeslotTaskIF.h" +#include "fsfw/tasks/Typedef.h" #include "FreeRTOS.h" #include "task.h" diff --git a/inc/fsfw/osal/freertos/MessageQueue.h b/inc/fsfw/osal/freertos/MessageQueue.h index 58324cc6..ba835211 100644 --- a/inc/fsfw/osal/freertos/MessageQueue.h +++ b/inc/fsfw/osal/freertos/MessageQueue.h @@ -3,10 +3,10 @@ #include "TaskManagement.h" -#include "../../internalError/InternalErrorReporterIF.h" -#include "../../ipc/MessageQueueIF.h" -#include "../../ipc/MessageQueueMessageIF.h" -#include "../../ipc/MessageQueueMessage.h" +#include "fsfw/internalerror/InternalErrorReporterIF.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/ipc/MessageQueueMessageIF.h" +#include "fsfw/ipc/MessageQueueMessage.h" #include "FreeRTOS.h" #include "queue.h" diff --git a/inc/fsfw/osal/freertos/Mutex.h b/inc/fsfw/osal/freertos/Mutex.h index 877359d8..082679c7 100644 --- a/inc/fsfw/osal/freertos/Mutex.h +++ b/inc/fsfw/osal/freertos/Mutex.h @@ -1,7 +1,7 @@ #ifndef FRAMEWORK_FREERTOS_MUTEX_H_ #define FRAMEWORK_FREERTOS_MUTEX_H_ -#include "../../ipc/MutexIF.h" +#include "fsfw/ipc/MutexIF.h" #include "FreeRTOS.h" #include "semphr.h" diff --git a/inc/fsfw/osal/freertos/PeriodicTask.h b/inc/fsfw/osal/freertos/PeriodicTask.h index 04d40fcf..e910a0c6 100644 --- a/inc/fsfw/osal/freertos/PeriodicTask.h +++ b/inc/fsfw/osal/freertos/PeriodicTask.h @@ -2,9 +2,9 @@ #define FSFW_OSAL_FREERTOS_PERIODICTASK_H_ #include "FreeRTOSTaskIF.h" -#include "../../objectmanager/ObjectManagerIF.h" -#include "../../tasks/PeriodicTaskIF.h" -#include "../../tasks/Typedef.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" +#include "fsfw/tasks/PeriodicTaskIF.h" +#include "fsfw/tasks/Typedef.h" #include "FreeRTOS.h" #include "task.h" diff --git a/inc/fsfw/osal/freertos/QueueMapManager.h b/inc/fsfw/osal/freertos/QueueMapManager.h index 07ca8b9e..3aa82594 100644 --- a/inc/fsfw/osal/freertos/QueueMapManager.h +++ b/inc/fsfw/osal/freertos/QueueMapManager.h @@ -1,9 +1,9 @@ #ifndef FSFW_OSAL_FREERTOS_QUEUEMAPMANAGER_H_ #define FSFW_OSAL_FREERTOS_QUEUEMAPMANAGER_H_ -#include "../../ipc/MutexIF.h" -#include "../../ipc/messageQueueDefinitions.h" -#include "../../ipc/MessageQueueIF.h" +#include "fsfw/ipc/MutexIF.h" +#include "fsfw/ipc/messageQueueDefinitions.h" +#include "fsfw/ipc/MessageQueueIF.h" #include "FreeRTOS.h" #include "queue.h" diff --git a/inc/fsfw/tasks/SemaphoreFactory.h b/inc/fsfw/tasks/SemaphoreFactory.h index 01c09d1b..2df7d53f 100644 --- a/inc/fsfw/tasks/SemaphoreFactory.h +++ b/inc/fsfw/tasks/SemaphoreFactory.h @@ -1,7 +1,7 @@ #ifndef FSFW_TASKS_SEMAPHOREFACTORY_H_ #define FSFW_TASKS_SEMAPHOREFACTORY_H_ -#include "../tasks/SemaphoreIF.h" +#include "fsfw/tasks/SemaphoreIF.h" /** * Creates Semaphore. diff --git a/src/osal/CMakeLists.txt b/src/osal/CMakeLists.txt index 0e28bd3c..f3c5cfad 100644 --- a/src/osal/CMakeLists.txt +++ b/src/osal/CMakeLists.txt @@ -1,6 +1,6 @@ # Check the OS_FSFW variable if(FSFW_OSAL MATCHES "freertos") - add_subdirectory(FreeRTOS) + add_subdirectory(freertos) elseif(FSFW_OSAL MATCHES "rtems") add_subdirectory(rtems) elseif(FSFW_OSAL MATCHES "linux") diff --git a/src/osal/freertos/BinSemaphUsingTask.cpp b/src/osal/freertos/BinSemaphUsingTask.cpp index 7d609aee..637c1925 100644 --- a/src/osal/freertos/BinSemaphUsingTask.cpp +++ b/src/osal/freertos/BinSemaphUsingTask.cpp @@ -1,6 +1,6 @@ -#include "BinSemaphUsingTask.h" -#include "TaskManagement.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/osal/freertos/BinSemaphUsingTask.h" +#include "fsfw/osal/freertos/TaskManagement.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #if (tskKERNEL_VERSION_MAJOR == 8 && tskKERNEL_VERSION_MINOR > 2) || \ tskKERNEL_VERSION_MAJOR > 8 diff --git a/src/osal/freertos/BinarySemaphore.cpp b/src/osal/freertos/BinarySemaphore.cpp index c0349b7c..4ec5d30f 100644 --- a/src/osal/freertos/BinarySemaphore.cpp +++ b/src/osal/freertos/BinarySemaphore.cpp @@ -1,6 +1,6 @@ -#include "BinarySemaphore.h" -#include "TaskManagement.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/osal/freertos/BinarySemaphore.h" +#include "fsfw/osal/freertos/TaskManagement.h" +#include "fsfw/serviceinterface/ServiceInterface.h" BinarySemaphore::BinarySemaphore() { handle = xSemaphoreCreateBinary(); diff --git a/src/osal/freertos/Clock.cpp b/src/osal/freertos/Clock.cpp index a81f6985..eddf2fec 100644 --- a/src/osal/freertos/Clock.cpp +++ b/src/osal/freertos/Clock.cpp @@ -1,13 +1,13 @@ -#include "Timekeeper.h" +#include "fsfw/osal/freertos/Timekeeper.h" -#include "../../timemanager/Clock.h" -#include "../../globalfunctions/timevalOperations.h" +#include "fsfw/timemanager/Clock.h" +#include "fsfw/globalfunctions/timevalOperations.h" #include "FreeRTOS.h" #include "task.h" -#include -#include +#include +#include //TODO sanitize input? //TODO much of this code can be reused for tick-only systems diff --git a/src/osal/freertos/CountingSemaphUsingTask.cpp b/src/osal/freertos/CountingSemaphUsingTask.cpp index 750ea9d6..a34a6508 100644 --- a/src/osal/freertos/CountingSemaphUsingTask.cpp +++ b/src/osal/freertos/CountingSemaphUsingTask.cpp @@ -1,7 +1,7 @@ -#include "CountingSemaphUsingTask.h" -#include "TaskManagement.h" +#include "fsfw/osal/freertos/CountingSemaphUsingTask.h" +#include "fsfw/osal/freertos/TaskManagement.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #if (tskKERNEL_VERSION_MAJOR == 8 && tskKERNEL_VERSION_MINOR > 2) || \ tskKERNEL_VERSION_MAJOR > 8 diff --git a/src/osal/freertos/CountingSemaphore.cpp b/src/osal/freertos/CountingSemaphore.cpp index 148803a6..90dc771f 100644 --- a/src/osal/freertos/CountingSemaphore.cpp +++ b/src/osal/freertos/CountingSemaphore.cpp @@ -1,7 +1,7 @@ -#include "CountingSemaphore.h" -#include "TaskManagement.h" +#include "fsfw/osal/freertos/CountingSemaphore.h" +#include "fsfw/osal/freertos/TaskManagement.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include "FreeRTOS.h" #include "semphr.h" diff --git a/src/osal/freertos/FixedTimeslotTask.cpp b/src/osal/freertos/FixedTimeslotTask.cpp index a722c958..9690991d 100644 --- a/src/osal/freertos/FixedTimeslotTask.cpp +++ b/src/osal/freertos/FixedTimeslotTask.cpp @@ -1,7 +1,7 @@ -#include "FixedTimeslotTask.h" +#include "fsfw/osal/freertos/FixedTimeslotTask.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" uint32_t FixedTimeslotTask::deadlineMissedCount = 0; const size_t PeriodicTaskIF::MINIMUM_STACK_SIZE = configMINIMAL_STACK_SIZE; diff --git a/src/osal/freertos/MessageQueue.cpp b/src/osal/freertos/MessageQueue.cpp index 017bac39..487fa864 100644 --- a/src/osal/freertos/MessageQueue.cpp +++ b/src/osal/freertos/MessageQueue.cpp @@ -1,5 +1,6 @@ -#include "MessageQueue.h" -#include "QueueMapManager.h" +#include "fsfw/osal/freertos/MessageQueue.h" +#include "fsfw/osal/freertos/QueueMapManager.h" + #include "fsfw/objectmanager/ObjectManager.h" #include "fsfw/serviceinterface/ServiceInterface.h" diff --git a/src/osal/freertos/Mutex.cpp b/src/osal/freertos/Mutex.cpp index 0b85ca13..8d1313e6 100644 --- a/src/osal/freertos/Mutex.cpp +++ b/src/osal/freertos/Mutex.cpp @@ -1,6 +1,6 @@ -#include "Mutex.h" +#include "fsfw/osal/freertos/Mutex.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/serviceinterface/ServiceInterface.h" Mutex::Mutex() { handle = xSemaphoreCreateMutex(); diff --git a/src/osal/freertos/MutexFactory.cpp b/src/osal/freertos/MutexFactory.cpp index d9569e35..f8b48c7d 100644 --- a/src/osal/freertos/MutexFactory.cpp +++ b/src/osal/freertos/MutexFactory.cpp @@ -1,6 +1,6 @@ -#include "Mutex.h" +#include "fsfw/osal/freertos/Mutex.h" -#include "../../ipc/MutexFactory.h" +#include "fsfw/ipc/MutexFactory.h" //TODO: Different variant than the lazy loading in QueueFactory. diff --git a/src/osal/freertos/PeriodicTask.cpp b/src/osal/freertos/PeriodicTask.cpp index 42d6681d..7ef1c837 100644 --- a/src/osal/freertos/PeriodicTask.cpp +++ b/src/osal/freertos/PeriodicTask.cpp @@ -1,8 +1,8 @@ -#include "PeriodicTask.h" +#include "fsfw/osal/freertos/PeriodicTask.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../tasks/ExecutableObjectIF.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tasks/ExecutableObjectIF.h" PeriodicTask::PeriodicTask(const char *name, TaskPriority setPriority, TaskStackSize setStack, TaskPeriod setPeriod, diff --git a/src/osal/freertos/QueueFactory.cpp b/src/osal/freertos/QueueFactory.cpp index ed29e10c..536c16c0 100644 --- a/src/osal/freertos/QueueFactory.cpp +++ b/src/osal/freertos/QueueFactory.cpp @@ -1,7 +1,7 @@ -#include "MessageQueue.h" +#include "fsfw/osal/freertos/MessageQueue.h" -#include "../../ipc/MessageQueueSenderIF.h" -#include "../../ipc/QueueFactory.h" +#include "fsfw/ipc/MessageQueueSenderIF.h" +#include "fsfw/ipc/QueueFactory.h" QueueFactory* QueueFactory::factoryInstance = nullptr; diff --git a/src/osal/freertos/QueueMapManager.cpp b/src/osal/freertos/QueueMapManager.cpp index 51cfe11d..d2783f01 100644 --- a/src/osal/freertos/QueueMapManager.cpp +++ b/src/osal/freertos/QueueMapManager.cpp @@ -1,6 +1,6 @@ -#include "QueueMapManager.h" -#include "../../ipc/MutexFactory.h" -#include "../../ipc/MutexGuard.h" +#include "fsfw/osal/freertos/QueueMapManager.h" +#include "fsfw/ipc/MutexFactory.h" +#include "fsfw/ipc/MutexGuard.h" QueueMapManager* QueueMapManager::mqManagerInstance = nullptr; diff --git a/src/osal/freertos/SemaphoreFactory.cpp b/src/osal/freertos/SemaphoreFactory.cpp index 614af75d..b6e8f86e 100644 --- a/src/osal/freertos/SemaphoreFactory.cpp +++ b/src/osal/freertos/SemaphoreFactory.cpp @@ -1,10 +1,10 @@ -#include "BinarySemaphore.h" -#include "BinSemaphUsingTask.h" -#include "CountingSemaphore.h" -#include "CountingSemaphUsingTask.h" +#include "fsfw/osal/freertos/BinarySemaphore.h" +#include "fsfw/osal/freertos/BinSemaphUsingTask.h" +#include "fsfw/osal/freertos/CountingSemaphore.h" +#include "fsfw/osal/freertos/CountingSemaphUsingTask.h" -#include "../../tasks/SemaphoreFactory.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/tasks/SemaphoreFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" SemaphoreFactory* SemaphoreFactory::factoryInstance = nullptr; diff --git a/src/osal/freertos/TaskFactory.cpp b/src/osal/freertos/TaskFactory.cpp index 5b64811a..21ca80cb 100644 --- a/src/osal/freertos/TaskFactory.cpp +++ b/src/osal/freertos/TaskFactory.cpp @@ -1,9 +1,8 @@ -#include "../../tasks/TaskFactory.h" -#include "../../returnvalues/HasReturnvaluesIF.h" - -#include "PeriodicTask.h" -#include "FixedTimeslotTask.h" +#include "fsfw/tasks/TaskFactory.h" +#include "fsfw/osal/freertos/PeriodicTask.h" +#include "fsfw/osal/freertos/FixedTimeslotTask.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" TaskFactory* TaskFactory::factoryInstance = new TaskFactory(); diff --git a/src/osal/freertos/TaskManagement.cpp b/src/osal/freertos/TaskManagement.cpp index c0d0067e..f19aa4fd 100644 --- a/src/osal/freertos/TaskManagement.cpp +++ b/src/osal/freertos/TaskManagement.cpp @@ -1,4 +1,4 @@ -#include "TaskManagement.h" +#include "fsfw/osal/freertos/TaskManagement.h" void TaskManagement::vRequestContextSwitchFromTask() { vTaskDelay(0); diff --git a/src/osal/freertos/Timekeeper.cpp b/src/osal/freertos/Timekeeper.cpp index 1031f0c4..1b7dc741 100644 --- a/src/osal/freertos/Timekeeper.cpp +++ b/src/osal/freertos/Timekeeper.cpp @@ -1,4 +1,4 @@ -#include "Timekeeper.h" +#include "fsfw/osal/freertos/Timekeeper.h" #include "FreeRTOSConfig.h" From 4803fb2cbdc0c68230ddd8ad2f4244035bb8d5a0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 14 Jul 2021 01:27:15 +0200 Subject: [PATCH 179/389] important bugfix for queue map manager --- src/osal/freertos/QueueMapManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osal/freertos/QueueMapManager.cpp b/src/osal/freertos/QueueMapManager.cpp index d2783f01..dcb88a1e 100644 --- a/src/osal/freertos/QueueMapManager.cpp +++ b/src/osal/freertos/QueueMapManager.cpp @@ -17,7 +17,7 @@ QueueMapManager* QueueMapManager::instance() { ReturnValue_t QueueMapManager::addMessageQueue(QueueHandle_t queue, MessageQueueId_t* id) { MutexGuard lock(mapLock); - uint32_t currentId = queueCounter++; + uint32_t currentId = ++queueCounter; auto returnPair = queueMap.emplace(currentId, queue); if(not returnPair.second) { #if FSFW_CPP_OSTREAM_ENABLED == 1 From 82299c7e3e2df65f9dc6a8f8f1310bcfcda727b2 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 14 Jul 2021 10:22:58 +0200 Subject: [PATCH 180/389] new test folder --- CMakeLists.txt | 10 +++--- src/CMakeLists.txt | 1 - src/tests/CMakeLists.txt | 5 --- src/tests/internal/internal.mk | 4 --- src/tests/internal/serialize/CMakeLists.txt | 3 -- .../tests/globalfunctions/CMakeLists.txt | 3 -- src/tests/tests/tests.mk | 8 ----- src/tests/user/unlockRealtime.sh | 34 ------------------- tests/CMakeLists.txt | 2 ++ tests/inc/CMakeLists.txt | 3 ++ .../fsfw}/tests/internal/InternalUnitTester.h | 6 ++-- .../fsfw}/tests/internal/UnittDefinitions.h | 5 +-- .../globalfunctions/TestArrayPrinter.h | 0 .../inc/fsfw}/tests/internal/osal/IntTestMq.h | 0 .../fsfw}/tests/internal/osal/IntTestMutex.h | 0 .../tests/internal/osal/IntTestSemaphore.h | 0 .../internal/serialize/IntTestSerialization.h | 2 +- tests/src/CMakeLists.txt | 7 ++++ .../src}/internal/CMakeLists.txt | 2 +- .../src}/internal/InternalUnitTester.cpp | 17 +++++----- .../src}/internal/UnittDefinitions.cpp | 2 +- .../internal/globalfunctions/CMakeLists.txt | 3 ++ .../globalfunctions/TestArrayPrinter.cpp | 2 +- .../src}/internal/osal/CMakeLists.txt | 2 +- .../src}/internal/osal/IntTestMq.cpp | 5 ++- .../src}/internal/osal/IntTestMutex.cpp | 4 +-- .../src}/internal/osal/IntTestSemaphore.cpp | 6 ++-- tests/src/internal/serialize/CMakeLists.txt | 3 ++ .../serialize/IntTestSerialization.cpp | 4 +-- {src/tests => tests/src}/tests/CMakeLists.txt | 1 - .../src}/tests/action/CMakeLists.txt | 0 .../src}/tests/action/TestActionHelper.cpp | 0 .../src}/tests/action/TestActionHelper.h | 0 .../src}/tests/container/CMakeLists.txt | 0 .../src}/tests/container/RingBufferTest.cpp | 0 .../src}/tests/container/TestArrayList.cpp | 0 .../src}/tests/container/TestDynamicFifo.cpp | 0 .../src}/tests/container/TestFifo.cpp | 0 .../tests/container/TestFixedArrayList.cpp | 0 .../src}/tests/container/TestFixedMap.cpp | 0 .../container/TestFixedOrderedMultimap.cpp | 0 .../tests/container/TestPlacementFactory.cpp | 0 .../src}/tests/datapoollocal/CMakeLists.txt | 0 .../src}/tests/datapoollocal/DataSetTest.cpp | 0 .../datapoollocal/LocalPoolManagerTest.cpp | 0 .../datapoollocal/LocalPoolOwnerBase.cpp | 0 .../tests/datapoollocal/LocalPoolOwnerBase.h | 0 .../datapoollocal/LocalPoolVariableTest.cpp | 0 .../datapoollocal/LocalPoolVectorTest.cpp | 0 .../src/tests}/globalfunctions/CMakeLists.txt | 0 .../src}/tests/mocks/HkReceiverMock.h | 0 .../src}/tests/mocks/MessageQueueMockBase.h | 0 .../src}/tests/osal/CMakeLists.txt | 0 .../src}/tests/osal/TestMessageQueue.cpp | 0 .../src}/tests/osal/TestSemaphore.cpp | 0 .../src}/tests/serialize/CMakeLists.txt | 0 .../serialize/TestSerialBufferAdapter.cpp | 0 .../serialize/TestSerialLinkedPacket.cpp | 0 .../tests/serialize/TestSerialLinkedPacket.h | 0 .../tests/serialize/TestSerialization.cpp | 0 .../src}/tests/storagemanager/CMakeLists.txt | 0 .../tests/storagemanager/TestNewAccessor.cpp | 0 .../src}/tests/storagemanager/TestPool.cpp | 0 .../src}/tests/tmtcpacket/CMakeLists.txt | 0 .../src}/tests/tmtcpacket/PusTmTest.cpp | 0 {src/tests => tests}/user/CMakeLists.txt | 0 {src/tests => tests/user}/README.md | 0 {src/tests => tests/user}/lcov.sh | 0 .../user/testcfg/CMakeLists.txt | 0 .../tests => tests}/user/testcfg/FSFWConfig.h | 0 .../user/testcfg/Makefile-FSFW-Tests | 0 .../user/testcfg/TestsConfig.h | 0 .../user/testcfg/cdatapool/dataPoolInit.cpp | 0 .../user/testcfg/cdatapool/dataPoolInit.h | 0 .../user/testcfg/devices/logicalAddresses.cpp | 0 .../user/testcfg/devices/logicalAddresses.h | 0 .../testcfg/devices/powerSwitcherList.cpp | 0 .../user/testcfg/devices/powerSwitcherList.h | 0 .../user/testcfg/events/subsystemIdRanges.h | 0 .../user/testcfg/ipc/MissionMessageTypes.cpp | 0 .../user/testcfg/ipc/MissionMessageTypes.h | 0 .../user/testcfg/objects/systemObjectList.h | 0 .../PollingSequenceFactory.cpp | 0 .../pollingsequence/PollingSequenceFactory.h | 0 .../user/testcfg/returnvalues/classIds.h | 0 {src/tests => tests}/user/testcfg/testcfg.mk | 0 {src/tests => tests}/user/testcfg/tmtc/apid.h | 0 .../user/testcfg/tmtc/pusIds.h | 0 .../user/testtemplate/TestTemplate.cpp | 0 .../user/unittest/CMakeLists.txt | 0 .../user/unittest/core/CMakeLists.txt | 0 .../user/unittest/core/CatchDefinitions.cpp | 0 .../user/unittest/core/CatchDefinitions.h | 0 .../user/unittest/core/CatchFactory.cpp | 0 .../user/unittest/core/CatchFactory.h | 0 .../user/unittest/core/CatchRunner.cpp | 0 .../user/unittest/core/CatchSetup.cpp | 0 .../user/unittest/core/core.mk | 0 .../user/unittest/core/printChar.cpp | 0 .../user/unittest/core/printChar.h | 0 100 files changed, 53 insertions(+), 91 deletions(-) delete mode 100644 src/tests/CMakeLists.txt delete mode 100644 src/tests/internal/internal.mk delete mode 100644 src/tests/internal/serialize/CMakeLists.txt delete mode 100644 src/tests/tests/globalfunctions/CMakeLists.txt delete mode 100644 src/tests/tests/tests.mk delete mode 100644 src/tests/user/unlockRealtime.sh create mode 100644 tests/CMakeLists.txt create mode 100644 tests/inc/CMakeLists.txt rename {src => tests/inc/fsfw}/tests/internal/InternalUnitTester.h (80%) rename {src => tests/inc/fsfw}/tests/internal/UnittDefinitions.h (88%) rename {src => tests/inc/fsfw}/tests/internal/globalfunctions/TestArrayPrinter.h (100%) rename {src => tests/inc/fsfw}/tests/internal/osal/IntTestMq.h (100%) rename {src => tests/inc/fsfw}/tests/internal/osal/IntTestMutex.h (100%) rename {src => tests/inc/fsfw}/tests/internal/osal/IntTestSemaphore.h (100%) rename {src => tests/inc/fsfw}/tests/internal/serialize/IntTestSerialization.h (88%) create mode 100644 tests/src/CMakeLists.txt rename {src/tests => tests/src}/internal/CMakeLists.txt (57%) rename {src/tests => tests/src}/internal/InternalUnitTester.cpp (57%) rename {src/tests => tests/src}/internal/UnittDefinitions.cpp (87%) create mode 100644 tests/src/internal/globalfunctions/CMakeLists.txt rename {src/tests => tests/src}/internal/globalfunctions/TestArrayPrinter.cpp (94%) rename {src/tests => tests/src}/internal/osal/CMakeLists.txt (58%) rename {src/tests => tests/src}/internal/osal/IntTestMq.cpp (93%) rename {src/tests => tests/src}/internal/osal/IntTestMutex.cpp (92%) rename {src/tests => tests/src}/internal/osal/IntTestSemaphore.cpp (96%) create mode 100644 tests/src/internal/serialize/CMakeLists.txt rename {src/tests => tests/src}/internal/serialize/IntTestSerialization.cpp (98%) rename {src/tests => tests/src}/tests/CMakeLists.txt (99%) rename {src/tests => tests/src}/tests/action/CMakeLists.txt (100%) rename {src/tests => tests/src}/tests/action/TestActionHelper.cpp (100%) rename {src/tests => tests/src}/tests/action/TestActionHelper.h (100%) rename {src/tests => tests/src}/tests/container/CMakeLists.txt (100%) rename {src/tests => tests/src}/tests/container/RingBufferTest.cpp (100%) rename {src/tests => tests/src}/tests/container/TestArrayList.cpp (100%) rename {src/tests => tests/src}/tests/container/TestDynamicFifo.cpp (100%) rename {src/tests => tests/src}/tests/container/TestFifo.cpp (100%) rename {src/tests => tests/src}/tests/container/TestFixedArrayList.cpp (100%) rename {src/tests => tests/src}/tests/container/TestFixedMap.cpp (100%) rename {src/tests => tests/src}/tests/container/TestFixedOrderedMultimap.cpp (100%) rename {src/tests => tests/src}/tests/container/TestPlacementFactory.cpp (100%) rename {src/tests => tests/src}/tests/datapoollocal/CMakeLists.txt (100%) rename {src/tests => tests/src}/tests/datapoollocal/DataSetTest.cpp (100%) rename {src/tests => tests/src}/tests/datapoollocal/LocalPoolManagerTest.cpp (100%) rename {src/tests => tests/src}/tests/datapoollocal/LocalPoolOwnerBase.cpp (100%) rename {src/tests => tests/src}/tests/datapoollocal/LocalPoolOwnerBase.h (100%) rename {src/tests => tests/src}/tests/datapoollocal/LocalPoolVariableTest.cpp (100%) rename {src/tests => tests/src}/tests/datapoollocal/LocalPoolVectorTest.cpp (100%) rename {src/tests/internal => tests/src/tests}/globalfunctions/CMakeLists.txt (100%) rename {src/tests => tests/src}/tests/mocks/HkReceiverMock.h (100%) rename {src/tests => tests/src}/tests/mocks/MessageQueueMockBase.h (100%) rename {src/tests => tests/src}/tests/osal/CMakeLists.txt (100%) rename {src/tests => tests/src}/tests/osal/TestMessageQueue.cpp (100%) rename {src/tests => tests/src}/tests/osal/TestSemaphore.cpp (100%) rename {src/tests => tests/src}/tests/serialize/CMakeLists.txt (100%) rename {src/tests => tests/src}/tests/serialize/TestSerialBufferAdapter.cpp (100%) rename {src/tests => tests/src}/tests/serialize/TestSerialLinkedPacket.cpp (100%) rename {src/tests => tests/src}/tests/serialize/TestSerialLinkedPacket.h (100%) rename {src/tests => tests/src}/tests/serialize/TestSerialization.cpp (100%) rename {src/tests => tests/src}/tests/storagemanager/CMakeLists.txt (100%) rename {src/tests => tests/src}/tests/storagemanager/TestNewAccessor.cpp (100%) rename {src/tests => tests/src}/tests/storagemanager/TestPool.cpp (100%) rename {src/tests => tests/src}/tests/tmtcpacket/CMakeLists.txt (100%) rename {src/tests => tests/src}/tests/tmtcpacket/PusTmTest.cpp (100%) rename {src/tests => tests}/user/CMakeLists.txt (100%) rename {src/tests => tests/user}/README.md (100%) rename {src/tests => tests/user}/lcov.sh (100%) rename {src/tests => tests}/user/testcfg/CMakeLists.txt (100%) rename {src/tests => tests}/user/testcfg/FSFWConfig.h (100%) rename {src/tests => tests}/user/testcfg/Makefile-FSFW-Tests (100%) rename {src/tests => tests}/user/testcfg/TestsConfig.h (100%) rename {src/tests => tests}/user/testcfg/cdatapool/dataPoolInit.cpp (100%) rename {src/tests => tests}/user/testcfg/cdatapool/dataPoolInit.h (100%) rename {src/tests => tests}/user/testcfg/devices/logicalAddresses.cpp (100%) rename {src/tests => tests}/user/testcfg/devices/logicalAddresses.h (100%) rename {src/tests => tests}/user/testcfg/devices/powerSwitcherList.cpp (100%) rename {src/tests => tests}/user/testcfg/devices/powerSwitcherList.h (100%) rename {src/tests => tests}/user/testcfg/events/subsystemIdRanges.h (100%) rename {src/tests => tests}/user/testcfg/ipc/MissionMessageTypes.cpp (100%) rename {src/tests => tests}/user/testcfg/ipc/MissionMessageTypes.h (100%) rename {src/tests => tests}/user/testcfg/objects/systemObjectList.h (100%) rename {src/tests => tests}/user/testcfg/pollingsequence/PollingSequenceFactory.cpp (100%) rename {src/tests => tests}/user/testcfg/pollingsequence/PollingSequenceFactory.h (100%) rename {src/tests => tests}/user/testcfg/returnvalues/classIds.h (100%) rename {src/tests => tests}/user/testcfg/testcfg.mk (100%) rename {src/tests => tests}/user/testcfg/tmtc/apid.h (100%) rename {src/tests => tests}/user/testcfg/tmtc/pusIds.h (100%) rename {src/tests => tests}/user/testtemplate/TestTemplate.cpp (100%) rename {src/tests => tests}/user/unittest/CMakeLists.txt (100%) rename {src/tests => tests}/user/unittest/core/CMakeLists.txt (100%) rename {src/tests => tests}/user/unittest/core/CatchDefinitions.cpp (100%) rename {src/tests => tests}/user/unittest/core/CatchDefinitions.h (100%) rename {src/tests => tests}/user/unittest/core/CatchFactory.cpp (100%) rename {src/tests => tests}/user/unittest/core/CatchFactory.h (100%) rename {src/tests => tests}/user/unittest/core/CatchRunner.cpp (100%) rename {src/tests => tests}/user/unittest/core/CatchSetup.cpp (100%) rename {src/tests => tests}/user/unittest/core/core.mk (100%) rename {src/tests => tests}/user/unittest/core/printChar.cpp (100%) rename {src/tests => tests}/user/unittest/core/printChar.h (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 021c3d0a..ecb59506 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ endif() option(FSFW_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON) # Options to exclude parts of the FSFW from compilation. +option(FSFW_ADD_INTERNAL_TESTS "Add internal unit tests" ON) option(FSFW_USE_RMAP "Compile with RMAP" ON) option(FSFW_USE_DATALINKLAYER "Compile with Data Link Layer" ON) @@ -48,22 +49,22 @@ if(NOT FSFW_OSAL) endif() -set(FSFW_OSAL_DEFINITION FSFW_HOST) +set(FSFW_OSAL_DEFINITION FSFW_OSAL_HOST) if(FSFW_OSAL MATCHES host) set(OS_FSFW_NAME "Host") elseif(FSFW_OSAL MATCHES linux) set(OS_FSFW_NAME "Linux") - set(FSFW_OSAL_DEFINITION FSFW_LINUX) + set(FSFW_OSAL_DEFINITION FSFW_OSAL_LINUX) elseif(FSFW_OSAL MATCHES freertos) set(OS_FSFW_NAME "FreeRTOS") - set(FSFW_OSAL_DEFINITION FSFW_FREERTOS) + set(FSFW_OSAL_DEFINITION FSFW_OSAL_FREERTOS) target_link_libraries(${LIB_FSFW_NAME} PRIVATE ${LIB_OS_NAME} ) elseif(FSFW_OSAL STREQUAL rtems) set(OS_FSFW_NAME "RTEMS") - set(FSFW_OSAL_DEFINITION FSFW_RTEMS) + set(FSFW_OSAL_DEFINITION FSFW_OSAL_RTEMS) else() message(WARNING "Invalid operating system for FSFW specified! Setting to host.." @@ -83,6 +84,7 @@ target_compile_definitions(${LIB_FSFW_NAME} INTERFACE message(STATUS "Compiling FSFW for the ${OS_FSFW_NAME} operating system.") add_subdirectory(src) +add_subdirectory(tests) # The project CMakeLists file has to set the FSFW_CONFIG_PATH and add it. # If this is not given, we include the default configuration and emit a warning. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4d5bfc5a..70e6d76e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,3 @@ add_subdirectory(core) add_subdirectory(opt) add_subdirectory(osal) -# add_subdirectory(tests) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt deleted file mode 100644 index 24f8ef6f..00000000 --- a/src/tests/CMakeLists.txt +++ /dev/null @@ -1,5 +0,0 @@ -add_subdirectory(internal) - -if(LINK_CATCH2) - add_subdirectory(tests) -endif() \ No newline at end of file diff --git a/src/tests/internal/internal.mk b/src/tests/internal/internal.mk deleted file mode 100644 index 1d4c9c99..00000000 --- a/src/tests/internal/internal.mk +++ /dev/null @@ -1,4 +0,0 @@ -CXXSRC += $(wildcard $(CURRENTPATH)/osal/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/serialize/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/globalfunctions/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/*.cpp) \ No newline at end of file diff --git a/src/tests/internal/serialize/CMakeLists.txt b/src/tests/internal/serialize/CMakeLists.txt deleted file mode 100644 index e8dc5717..00000000 --- a/src/tests/internal/serialize/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -target_sources(${TARGET_NAME} PRIVATE - IntTestSerialization.cpp -) diff --git a/src/tests/tests/globalfunctions/CMakeLists.txt b/src/tests/tests/globalfunctions/CMakeLists.txt deleted file mode 100644 index 4ea49bf7..00000000 --- a/src/tests/tests/globalfunctions/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -target_sources(${TARGET_NAME} PRIVATE - TestArrayPrinter.cpp -) diff --git a/src/tests/tests/tests.mk b/src/tests/tests/tests.mk deleted file mode 100644 index 47e634a2..00000000 --- a/src/tests/tests/tests.mk +++ /dev/null @@ -1,8 +0,0 @@ -CXXSRC += $(wildcard $(CURRENTPATH)/container/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/action/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/serialize/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/storagemanager/*.cpp) - -# OSAL not included for now. - -INCLUDES += $(CURRENTPATH) \ No newline at end of file diff --git a/src/tests/user/unlockRealtime.sh b/src/tests/user/unlockRealtime.sh deleted file mode 100644 index b28d5490..00000000 --- a/src/tests/user/unlockRealtime.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -# Run this script to unlock all permissions to run the linux binaries -# and create threads - -binaries=$(find $directory -type f -name "*.elf") - -echo Unlocking real time permissions for binaries and bash console... - -# Set up the soft realtime limit to maximum (99) -# Please note that the hard limit needs to be set to 99 too -# for this to work (check with ulimit -Hr). -# If that has not been done yet, add -# hard rtprio 99 -# to /etc/security/limits.conf -# It is also necessary and recommended to add -# soft rtprio 99 -# as well. This can also be done in the command line -# but would need to be done for each session. -ulimit -Sr 99 - -for binary in ${binaries}; do - sudo setcap 'cap_sys_nice=eip' ${binary} - result=$? - if [ ${result} = 0 ];then - echo ${binary} was unlocked - fi -done - -# sudo setcap 'cap_sys_nice=eip' /bin/bash -# result=$? -# if [ ${result} = 0 ];then -# echo /bin/bash was unlocked -# fi - diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 00000000..26ce12e8 --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,2 @@ +add_subdirectory(src) +add_subdirectory(inc) \ No newline at end of file diff --git a/tests/inc/CMakeLists.txt b/tests/inc/CMakeLists.txt new file mode 100644 index 00000000..7ca25bd0 --- /dev/null +++ b/tests/inc/CMakeLists.txt @@ -0,0 +1,3 @@ +target_include_directories(${LIB_FSFW_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} +) diff --git a/src/tests/internal/InternalUnitTester.h b/tests/inc/fsfw/tests/internal/InternalUnitTester.h similarity index 80% rename from src/tests/internal/InternalUnitTester.h rename to tests/inc/fsfw/tests/internal/InternalUnitTester.h index ae954c6a..50c89d77 100644 --- a/src/tests/internal/InternalUnitTester.h +++ b/tests/inc/fsfw/tests/internal/InternalUnitTester.h @@ -2,7 +2,7 @@ #define FRAMEWORK_TEST_UNITTESTCLASS_H_ #include "UnittDefinitions.h" -#include "../../returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" /** @@ -17,7 +17,7 @@ class InternalUnitTester: public HasReturnvaluesIF { public: struct TestConfig { - bool testArrayPrinter; + bool testArrayPrinter = false; }; InternalUnitTester(); @@ -27,7 +27,7 @@ public: * Some function which calls all other tests * @return */ - virtual ReturnValue_t performTests(struct InternalUnitTester::TestConfig& testConfig); + virtual ReturnValue_t performTests(const struct InternalUnitTester::TestConfig& testConfig); }; diff --git a/src/tests/internal/UnittDefinitions.h b/tests/inc/fsfw/tests/internal/UnittDefinitions.h similarity index 88% rename from src/tests/internal/UnittDefinitions.h rename to tests/inc/fsfw/tests/internal/UnittDefinitions.h index 3e14fec5..7e7e06a6 100644 --- a/src/tests/internal/UnittDefinitions.h +++ b/tests/inc/fsfw/tests/internal/UnittDefinitions.h @@ -1,8 +1,9 @@ #ifndef UNITTEST_INTERNAL_UNITTDEFINITIONS_H_ #define UNITTEST_INTERNAL_UNITTDEFINITIONS_H_ -#include "../../returnvalues/HasReturnvaluesIF.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" + #include #include #include diff --git a/src/tests/internal/globalfunctions/TestArrayPrinter.h b/tests/inc/fsfw/tests/internal/globalfunctions/TestArrayPrinter.h similarity index 100% rename from src/tests/internal/globalfunctions/TestArrayPrinter.h rename to tests/inc/fsfw/tests/internal/globalfunctions/TestArrayPrinter.h diff --git a/src/tests/internal/osal/IntTestMq.h b/tests/inc/fsfw/tests/internal/osal/IntTestMq.h similarity index 100% rename from src/tests/internal/osal/IntTestMq.h rename to tests/inc/fsfw/tests/internal/osal/IntTestMq.h diff --git a/src/tests/internal/osal/IntTestMutex.h b/tests/inc/fsfw/tests/internal/osal/IntTestMutex.h similarity index 100% rename from src/tests/internal/osal/IntTestMutex.h rename to tests/inc/fsfw/tests/internal/osal/IntTestMutex.h diff --git a/src/tests/internal/osal/IntTestSemaphore.h b/tests/inc/fsfw/tests/internal/osal/IntTestSemaphore.h similarity index 100% rename from src/tests/internal/osal/IntTestSemaphore.h rename to tests/inc/fsfw/tests/internal/osal/IntTestSemaphore.h diff --git a/src/tests/internal/serialize/IntTestSerialization.h b/tests/inc/fsfw/tests/internal/serialize/IntTestSerialization.h similarity index 88% rename from src/tests/internal/serialize/IntTestSerialization.h rename to tests/inc/fsfw/tests/internal/serialize/IntTestSerialization.h index 8706e057..0767fb44 100644 --- a/src/tests/internal/serialize/IntTestSerialization.h +++ b/tests/inc/fsfw/tests/internal/serialize/IntTestSerialization.h @@ -1,7 +1,7 @@ #ifndef FSFW_UNITTEST_INTERNAL_INTTESTSERIALIZATION_H_ #define FSFW_UNITTEST_INTERNAL_INTTESTSERIALIZATION_H_ -#include "../../../returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" #include namespace testserialize { diff --git a/tests/src/CMakeLists.txt b/tests/src/CMakeLists.txt new file mode 100644 index 00000000..3f5d21b5 --- /dev/null +++ b/tests/src/CMakeLists.txt @@ -0,0 +1,7 @@ +if(FSFW_ADD_INTERNAL_TESTS) + add_subdirectory(internal) +endif() + +if(FSFW_ADD_UNITTESTS) + add_subdirectory(tests) +endif() diff --git a/src/tests/internal/CMakeLists.txt b/tests/src/internal/CMakeLists.txt similarity index 57% rename from src/tests/internal/CMakeLists.txt rename to tests/src/internal/CMakeLists.txt index 11fd2b2f..2a144a9b 100644 --- a/src/tests/internal/CMakeLists.txt +++ b/tests/src/internal/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${LIB_FSFW_NAME} PRIVATE InternalUnitTester.cpp UnittDefinitions.cpp ) diff --git a/src/tests/internal/InternalUnitTester.cpp b/tests/src/internal/InternalUnitTester.cpp similarity index 57% rename from src/tests/internal/InternalUnitTester.cpp rename to tests/src/internal/InternalUnitTester.cpp index a9394ad3..8631ce0d 100644 --- a/src/tests/internal/InternalUnitTester.cpp +++ b/tests/src/internal/InternalUnitTester.cpp @@ -1,11 +1,11 @@ -#include "InternalUnitTester.h" -#include "UnittDefinitions.h" +#include "fsfw/tests/internal/InternalUnitTester.h" +#include "fsfw/tests/internal/UnittDefinitions.h" -#include "osal/IntTestMq.h" -#include "osal/IntTestSemaphore.h" -#include "osal/IntTestMutex.h" -#include "serialize/IntTestSerialization.h" -#include "globalfunctions/TestArrayPrinter.h" +#include "fsfw/tests/internal/osal/IntTestMq.h" +#include "fsfw/tests/internal/osal/IntTestSemaphore.h" +#include "fsfw/tests/internal/osal/IntTestMutex.h" +#include "fsfw/tests/internal/serialize/IntTestSerialization.h" +#include "fsfw/tests/internal/globalfunctions/TestArrayPrinter.h" #include @@ -13,7 +13,8 @@ InternalUnitTester::InternalUnitTester() {} InternalUnitTester::~InternalUnitTester() {} -ReturnValue_t InternalUnitTester::performTests(struct InternalUnitTester::TestConfig& testConfig) { +ReturnValue_t InternalUnitTester::performTests( + const struct InternalUnitTester::TestConfig& testConfig) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::info << "Running internal unit tests.." << std::endl; #else diff --git a/src/tests/internal/UnittDefinitions.cpp b/tests/src/internal/UnittDefinitions.cpp similarity index 87% rename from src/tests/internal/UnittDefinitions.cpp rename to tests/src/internal/UnittDefinitions.cpp index ed4b59c1..74fd53be 100644 --- a/src/tests/internal/UnittDefinitions.cpp +++ b/tests/src/internal/UnittDefinitions.cpp @@ -1,4 +1,4 @@ -#include "UnittDefinitions.h" +#include "fsfw/tests/internal/UnittDefinitions.h" ReturnValue_t unitt::put_error(std::string errorId) { #if FSFW_CPP_OSTREAM_ENABLED == 1 diff --git a/tests/src/internal/globalfunctions/CMakeLists.txt b/tests/src/internal/globalfunctions/CMakeLists.txt new file mode 100644 index 00000000..cde97734 --- /dev/null +++ b/tests/src/internal/globalfunctions/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${LIB_FSFW_NAME} PRIVATE + TestArrayPrinter.cpp +) diff --git a/src/tests/internal/globalfunctions/TestArrayPrinter.cpp b/tests/src/internal/globalfunctions/TestArrayPrinter.cpp similarity index 94% rename from src/tests/internal/globalfunctions/TestArrayPrinter.cpp rename to tests/src/internal/globalfunctions/TestArrayPrinter.cpp index de016d19..90578095 100644 --- a/src/tests/internal/globalfunctions/TestArrayPrinter.cpp +++ b/tests/src/internal/globalfunctions/TestArrayPrinter.cpp @@ -1,4 +1,4 @@ -#include "TestArrayPrinter.h" +#include "fsfw/tests/internal/globalfunctions/TestArrayPrinter.h" void arrayprinter::testArrayPrinter() { { diff --git a/src/tests/internal/osal/CMakeLists.txt b/tests/src/internal/osal/CMakeLists.txt similarity index 58% rename from src/tests/internal/osal/CMakeLists.txt rename to tests/src/internal/osal/CMakeLists.txt index c6f1eb95..84316089 100644 --- a/src/tests/internal/osal/CMakeLists.txt +++ b/tests/src/internal/osal/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${LIB_FSFW_NAME} PRIVATE IntTestMq.cpp IntTestMutex.cpp IntTestSemaphore.cpp diff --git a/src/tests/internal/osal/IntTestMq.cpp b/tests/src/internal/osal/IntTestMq.cpp similarity index 93% rename from src/tests/internal/osal/IntTestMq.cpp rename to tests/src/internal/osal/IntTestMq.cpp index fc8e963e..91bc2c6d 100644 --- a/src/tests/internal/osal/IntTestMq.cpp +++ b/tests/src/internal/osal/IntTestMq.cpp @@ -1,5 +1,5 @@ -#include "IntTestMq.h" -#include +#include "fsfw/tests/internal/osal/IntTestMq.h" +#include "fsfw/tests/internal/UnittDefinitions.h" #include #include @@ -49,5 +49,4 @@ void testmq::testMq() { if(senderId != testSenderMqId) { unitt::put_error(id); } - } diff --git a/src/tests/internal/osal/IntTestMutex.cpp b/tests/src/internal/osal/IntTestMutex.cpp similarity index 92% rename from src/tests/internal/osal/IntTestMutex.cpp rename to tests/src/internal/osal/IntTestMutex.cpp index 13d87a8b..9e7c1481 100644 --- a/src/tests/internal/osal/IntTestMutex.cpp +++ b/tests/src/internal/osal/IntTestMutex.cpp @@ -1,7 +1,7 @@ -#include "IntTestMutex.h" +#include "fsfw/tests/internal/osal/IntTestMutex.h" +#include "fsfw/tests/internal/UnittDefinitions.h" #include -#include #if defined(WIN32) || defined(UNIX) #include diff --git a/src/tests/internal/osal/IntTestSemaphore.cpp b/tests/src/internal/osal/IntTestSemaphore.cpp similarity index 96% rename from src/tests/internal/osal/IntTestSemaphore.cpp rename to tests/src/internal/osal/IntTestSemaphore.cpp index 43990c2c..e278e3c1 100644 --- a/src/tests/internal/osal/IntTestSemaphore.cpp +++ b/tests/src/internal/osal/IntTestSemaphore.cpp @@ -1,8 +1,8 @@ -#include "IntTestSemaphore.h" -#include +#include "fsfw/tests/internal/osal/IntTestSemaphore.h" +#include "fsfw/tests/internal/UnittDefinitions.h" #include -#include +#include #include #include diff --git a/tests/src/internal/serialize/CMakeLists.txt b/tests/src/internal/serialize/CMakeLists.txt new file mode 100644 index 00000000..47e8b538 --- /dev/null +++ b/tests/src/internal/serialize/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${LIB_FSFW_NAME} PRIVATE + IntTestSerialization.cpp +) diff --git a/src/tests/internal/serialize/IntTestSerialization.cpp b/tests/src/internal/serialize/IntTestSerialization.cpp similarity index 98% rename from src/tests/internal/serialize/IntTestSerialization.cpp rename to tests/src/internal/serialize/IntTestSerialization.cpp index 69d82942..3489c759 100644 --- a/src/tests/internal/serialize/IntTestSerialization.cpp +++ b/tests/src/internal/serialize/IntTestSerialization.cpp @@ -1,5 +1,5 @@ -#include "IntTestSerialization.h" -#include +#include "fsfw/tests/internal/serialize/IntTestSerialization.h" +#include "fsfw/tests/internal/UnittDefinitions.h" #include #include diff --git a/src/tests/tests/CMakeLists.txt b/tests/src/tests/CMakeLists.txt similarity index 99% rename from src/tests/tests/CMakeLists.txt rename to tests/src/tests/CMakeLists.txt index 180e1a51..2f3d9f70 100644 --- a/src/tests/tests/CMakeLists.txt +++ b/tests/src/tests/CMakeLists.txt @@ -4,4 +4,3 @@ add_subdirectory(osal) add_subdirectory(serialize) add_subdirectory(datapoollocal) add_subdirectory(storagemanager) - diff --git a/src/tests/tests/action/CMakeLists.txt b/tests/src/tests/action/CMakeLists.txt similarity index 100% rename from src/tests/tests/action/CMakeLists.txt rename to tests/src/tests/action/CMakeLists.txt diff --git a/src/tests/tests/action/TestActionHelper.cpp b/tests/src/tests/action/TestActionHelper.cpp similarity index 100% rename from src/tests/tests/action/TestActionHelper.cpp rename to tests/src/tests/action/TestActionHelper.cpp diff --git a/src/tests/tests/action/TestActionHelper.h b/tests/src/tests/action/TestActionHelper.h similarity index 100% rename from src/tests/tests/action/TestActionHelper.h rename to tests/src/tests/action/TestActionHelper.h diff --git a/src/tests/tests/container/CMakeLists.txt b/tests/src/tests/container/CMakeLists.txt similarity index 100% rename from src/tests/tests/container/CMakeLists.txt rename to tests/src/tests/container/CMakeLists.txt diff --git a/src/tests/tests/container/RingBufferTest.cpp b/tests/src/tests/container/RingBufferTest.cpp similarity index 100% rename from src/tests/tests/container/RingBufferTest.cpp rename to tests/src/tests/container/RingBufferTest.cpp diff --git a/src/tests/tests/container/TestArrayList.cpp b/tests/src/tests/container/TestArrayList.cpp similarity index 100% rename from src/tests/tests/container/TestArrayList.cpp rename to tests/src/tests/container/TestArrayList.cpp diff --git a/src/tests/tests/container/TestDynamicFifo.cpp b/tests/src/tests/container/TestDynamicFifo.cpp similarity index 100% rename from src/tests/tests/container/TestDynamicFifo.cpp rename to tests/src/tests/container/TestDynamicFifo.cpp diff --git a/src/tests/tests/container/TestFifo.cpp b/tests/src/tests/container/TestFifo.cpp similarity index 100% rename from src/tests/tests/container/TestFifo.cpp rename to tests/src/tests/container/TestFifo.cpp diff --git a/src/tests/tests/container/TestFixedArrayList.cpp b/tests/src/tests/container/TestFixedArrayList.cpp similarity index 100% rename from src/tests/tests/container/TestFixedArrayList.cpp rename to tests/src/tests/container/TestFixedArrayList.cpp diff --git a/src/tests/tests/container/TestFixedMap.cpp b/tests/src/tests/container/TestFixedMap.cpp similarity index 100% rename from src/tests/tests/container/TestFixedMap.cpp rename to tests/src/tests/container/TestFixedMap.cpp diff --git a/src/tests/tests/container/TestFixedOrderedMultimap.cpp b/tests/src/tests/container/TestFixedOrderedMultimap.cpp similarity index 100% rename from src/tests/tests/container/TestFixedOrderedMultimap.cpp rename to tests/src/tests/container/TestFixedOrderedMultimap.cpp diff --git a/src/tests/tests/container/TestPlacementFactory.cpp b/tests/src/tests/container/TestPlacementFactory.cpp similarity index 100% rename from src/tests/tests/container/TestPlacementFactory.cpp rename to tests/src/tests/container/TestPlacementFactory.cpp diff --git a/src/tests/tests/datapoollocal/CMakeLists.txt b/tests/src/tests/datapoollocal/CMakeLists.txt similarity index 100% rename from src/tests/tests/datapoollocal/CMakeLists.txt rename to tests/src/tests/datapoollocal/CMakeLists.txt diff --git a/src/tests/tests/datapoollocal/DataSetTest.cpp b/tests/src/tests/datapoollocal/DataSetTest.cpp similarity index 100% rename from src/tests/tests/datapoollocal/DataSetTest.cpp rename to tests/src/tests/datapoollocal/DataSetTest.cpp diff --git a/src/tests/tests/datapoollocal/LocalPoolManagerTest.cpp b/tests/src/tests/datapoollocal/LocalPoolManagerTest.cpp similarity index 100% rename from src/tests/tests/datapoollocal/LocalPoolManagerTest.cpp rename to tests/src/tests/datapoollocal/LocalPoolManagerTest.cpp diff --git a/src/tests/tests/datapoollocal/LocalPoolOwnerBase.cpp b/tests/src/tests/datapoollocal/LocalPoolOwnerBase.cpp similarity index 100% rename from src/tests/tests/datapoollocal/LocalPoolOwnerBase.cpp rename to tests/src/tests/datapoollocal/LocalPoolOwnerBase.cpp diff --git a/src/tests/tests/datapoollocal/LocalPoolOwnerBase.h b/tests/src/tests/datapoollocal/LocalPoolOwnerBase.h similarity index 100% rename from src/tests/tests/datapoollocal/LocalPoolOwnerBase.h rename to tests/src/tests/datapoollocal/LocalPoolOwnerBase.h diff --git a/src/tests/tests/datapoollocal/LocalPoolVariableTest.cpp b/tests/src/tests/datapoollocal/LocalPoolVariableTest.cpp similarity index 100% rename from src/tests/tests/datapoollocal/LocalPoolVariableTest.cpp rename to tests/src/tests/datapoollocal/LocalPoolVariableTest.cpp diff --git a/src/tests/tests/datapoollocal/LocalPoolVectorTest.cpp b/tests/src/tests/datapoollocal/LocalPoolVectorTest.cpp similarity index 100% rename from src/tests/tests/datapoollocal/LocalPoolVectorTest.cpp rename to tests/src/tests/datapoollocal/LocalPoolVectorTest.cpp diff --git a/src/tests/internal/globalfunctions/CMakeLists.txt b/tests/src/tests/globalfunctions/CMakeLists.txt similarity index 100% rename from src/tests/internal/globalfunctions/CMakeLists.txt rename to tests/src/tests/globalfunctions/CMakeLists.txt diff --git a/src/tests/tests/mocks/HkReceiverMock.h b/tests/src/tests/mocks/HkReceiverMock.h similarity index 100% rename from src/tests/tests/mocks/HkReceiverMock.h rename to tests/src/tests/mocks/HkReceiverMock.h diff --git a/src/tests/tests/mocks/MessageQueueMockBase.h b/tests/src/tests/mocks/MessageQueueMockBase.h similarity index 100% rename from src/tests/tests/mocks/MessageQueueMockBase.h rename to tests/src/tests/mocks/MessageQueueMockBase.h diff --git a/src/tests/tests/osal/CMakeLists.txt b/tests/src/tests/osal/CMakeLists.txt similarity index 100% rename from src/tests/tests/osal/CMakeLists.txt rename to tests/src/tests/osal/CMakeLists.txt diff --git a/src/tests/tests/osal/TestMessageQueue.cpp b/tests/src/tests/osal/TestMessageQueue.cpp similarity index 100% rename from src/tests/tests/osal/TestMessageQueue.cpp rename to tests/src/tests/osal/TestMessageQueue.cpp diff --git a/src/tests/tests/osal/TestSemaphore.cpp b/tests/src/tests/osal/TestSemaphore.cpp similarity index 100% rename from src/tests/tests/osal/TestSemaphore.cpp rename to tests/src/tests/osal/TestSemaphore.cpp diff --git a/src/tests/tests/serialize/CMakeLists.txt b/tests/src/tests/serialize/CMakeLists.txt similarity index 100% rename from src/tests/tests/serialize/CMakeLists.txt rename to tests/src/tests/serialize/CMakeLists.txt diff --git a/src/tests/tests/serialize/TestSerialBufferAdapter.cpp b/tests/src/tests/serialize/TestSerialBufferAdapter.cpp similarity index 100% rename from src/tests/tests/serialize/TestSerialBufferAdapter.cpp rename to tests/src/tests/serialize/TestSerialBufferAdapter.cpp diff --git a/src/tests/tests/serialize/TestSerialLinkedPacket.cpp b/tests/src/tests/serialize/TestSerialLinkedPacket.cpp similarity index 100% rename from src/tests/tests/serialize/TestSerialLinkedPacket.cpp rename to tests/src/tests/serialize/TestSerialLinkedPacket.cpp diff --git a/src/tests/tests/serialize/TestSerialLinkedPacket.h b/tests/src/tests/serialize/TestSerialLinkedPacket.h similarity index 100% rename from src/tests/tests/serialize/TestSerialLinkedPacket.h rename to tests/src/tests/serialize/TestSerialLinkedPacket.h diff --git a/src/tests/tests/serialize/TestSerialization.cpp b/tests/src/tests/serialize/TestSerialization.cpp similarity index 100% rename from src/tests/tests/serialize/TestSerialization.cpp rename to tests/src/tests/serialize/TestSerialization.cpp diff --git a/src/tests/tests/storagemanager/CMakeLists.txt b/tests/src/tests/storagemanager/CMakeLists.txt similarity index 100% rename from src/tests/tests/storagemanager/CMakeLists.txt rename to tests/src/tests/storagemanager/CMakeLists.txt diff --git a/src/tests/tests/storagemanager/TestNewAccessor.cpp b/tests/src/tests/storagemanager/TestNewAccessor.cpp similarity index 100% rename from src/tests/tests/storagemanager/TestNewAccessor.cpp rename to tests/src/tests/storagemanager/TestNewAccessor.cpp diff --git a/src/tests/tests/storagemanager/TestPool.cpp b/tests/src/tests/storagemanager/TestPool.cpp similarity index 100% rename from src/tests/tests/storagemanager/TestPool.cpp rename to tests/src/tests/storagemanager/TestPool.cpp diff --git a/src/tests/tests/tmtcpacket/CMakeLists.txt b/tests/src/tests/tmtcpacket/CMakeLists.txt similarity index 100% rename from src/tests/tests/tmtcpacket/CMakeLists.txt rename to tests/src/tests/tmtcpacket/CMakeLists.txt diff --git a/src/tests/tests/tmtcpacket/PusTmTest.cpp b/tests/src/tests/tmtcpacket/PusTmTest.cpp similarity index 100% rename from src/tests/tests/tmtcpacket/PusTmTest.cpp rename to tests/src/tests/tmtcpacket/PusTmTest.cpp diff --git a/src/tests/user/CMakeLists.txt b/tests/user/CMakeLists.txt similarity index 100% rename from src/tests/user/CMakeLists.txt rename to tests/user/CMakeLists.txt diff --git a/src/tests/README.md b/tests/user/README.md similarity index 100% rename from src/tests/README.md rename to tests/user/README.md diff --git a/src/tests/lcov.sh b/tests/user/lcov.sh similarity index 100% rename from src/tests/lcov.sh rename to tests/user/lcov.sh diff --git a/src/tests/user/testcfg/CMakeLists.txt b/tests/user/testcfg/CMakeLists.txt similarity index 100% rename from src/tests/user/testcfg/CMakeLists.txt rename to tests/user/testcfg/CMakeLists.txt diff --git a/src/tests/user/testcfg/FSFWConfig.h b/tests/user/testcfg/FSFWConfig.h similarity index 100% rename from src/tests/user/testcfg/FSFWConfig.h rename to tests/user/testcfg/FSFWConfig.h diff --git a/src/tests/user/testcfg/Makefile-FSFW-Tests b/tests/user/testcfg/Makefile-FSFW-Tests similarity index 100% rename from src/tests/user/testcfg/Makefile-FSFW-Tests rename to tests/user/testcfg/Makefile-FSFW-Tests diff --git a/src/tests/user/testcfg/TestsConfig.h b/tests/user/testcfg/TestsConfig.h similarity index 100% rename from src/tests/user/testcfg/TestsConfig.h rename to tests/user/testcfg/TestsConfig.h diff --git a/src/tests/user/testcfg/cdatapool/dataPoolInit.cpp b/tests/user/testcfg/cdatapool/dataPoolInit.cpp similarity index 100% rename from src/tests/user/testcfg/cdatapool/dataPoolInit.cpp rename to tests/user/testcfg/cdatapool/dataPoolInit.cpp diff --git a/src/tests/user/testcfg/cdatapool/dataPoolInit.h b/tests/user/testcfg/cdatapool/dataPoolInit.h similarity index 100% rename from src/tests/user/testcfg/cdatapool/dataPoolInit.h rename to tests/user/testcfg/cdatapool/dataPoolInit.h diff --git a/src/tests/user/testcfg/devices/logicalAddresses.cpp b/tests/user/testcfg/devices/logicalAddresses.cpp similarity index 100% rename from src/tests/user/testcfg/devices/logicalAddresses.cpp rename to tests/user/testcfg/devices/logicalAddresses.cpp diff --git a/src/tests/user/testcfg/devices/logicalAddresses.h b/tests/user/testcfg/devices/logicalAddresses.h similarity index 100% rename from src/tests/user/testcfg/devices/logicalAddresses.h rename to tests/user/testcfg/devices/logicalAddresses.h diff --git a/src/tests/user/testcfg/devices/powerSwitcherList.cpp b/tests/user/testcfg/devices/powerSwitcherList.cpp similarity index 100% rename from src/tests/user/testcfg/devices/powerSwitcherList.cpp rename to tests/user/testcfg/devices/powerSwitcherList.cpp diff --git a/src/tests/user/testcfg/devices/powerSwitcherList.h b/tests/user/testcfg/devices/powerSwitcherList.h similarity index 100% rename from src/tests/user/testcfg/devices/powerSwitcherList.h rename to tests/user/testcfg/devices/powerSwitcherList.h diff --git a/src/tests/user/testcfg/events/subsystemIdRanges.h b/tests/user/testcfg/events/subsystemIdRanges.h similarity index 100% rename from src/tests/user/testcfg/events/subsystemIdRanges.h rename to tests/user/testcfg/events/subsystemIdRanges.h diff --git a/src/tests/user/testcfg/ipc/MissionMessageTypes.cpp b/tests/user/testcfg/ipc/MissionMessageTypes.cpp similarity index 100% rename from src/tests/user/testcfg/ipc/MissionMessageTypes.cpp rename to tests/user/testcfg/ipc/MissionMessageTypes.cpp diff --git a/src/tests/user/testcfg/ipc/MissionMessageTypes.h b/tests/user/testcfg/ipc/MissionMessageTypes.h similarity index 100% rename from src/tests/user/testcfg/ipc/MissionMessageTypes.h rename to tests/user/testcfg/ipc/MissionMessageTypes.h diff --git a/src/tests/user/testcfg/objects/systemObjectList.h b/tests/user/testcfg/objects/systemObjectList.h similarity index 100% rename from src/tests/user/testcfg/objects/systemObjectList.h rename to tests/user/testcfg/objects/systemObjectList.h diff --git a/src/tests/user/testcfg/pollingsequence/PollingSequenceFactory.cpp b/tests/user/testcfg/pollingsequence/PollingSequenceFactory.cpp similarity index 100% rename from src/tests/user/testcfg/pollingsequence/PollingSequenceFactory.cpp rename to tests/user/testcfg/pollingsequence/PollingSequenceFactory.cpp diff --git a/src/tests/user/testcfg/pollingsequence/PollingSequenceFactory.h b/tests/user/testcfg/pollingsequence/PollingSequenceFactory.h similarity index 100% rename from src/tests/user/testcfg/pollingsequence/PollingSequenceFactory.h rename to tests/user/testcfg/pollingsequence/PollingSequenceFactory.h diff --git a/src/tests/user/testcfg/returnvalues/classIds.h b/tests/user/testcfg/returnvalues/classIds.h similarity index 100% rename from src/tests/user/testcfg/returnvalues/classIds.h rename to tests/user/testcfg/returnvalues/classIds.h diff --git a/src/tests/user/testcfg/testcfg.mk b/tests/user/testcfg/testcfg.mk similarity index 100% rename from src/tests/user/testcfg/testcfg.mk rename to tests/user/testcfg/testcfg.mk diff --git a/src/tests/user/testcfg/tmtc/apid.h b/tests/user/testcfg/tmtc/apid.h similarity index 100% rename from src/tests/user/testcfg/tmtc/apid.h rename to tests/user/testcfg/tmtc/apid.h diff --git a/src/tests/user/testcfg/tmtc/pusIds.h b/tests/user/testcfg/tmtc/pusIds.h similarity index 100% rename from src/tests/user/testcfg/tmtc/pusIds.h rename to tests/user/testcfg/tmtc/pusIds.h diff --git a/src/tests/user/testtemplate/TestTemplate.cpp b/tests/user/testtemplate/TestTemplate.cpp similarity index 100% rename from src/tests/user/testtemplate/TestTemplate.cpp rename to tests/user/testtemplate/TestTemplate.cpp diff --git a/src/tests/user/unittest/CMakeLists.txt b/tests/user/unittest/CMakeLists.txt similarity index 100% rename from src/tests/user/unittest/CMakeLists.txt rename to tests/user/unittest/CMakeLists.txt diff --git a/src/tests/user/unittest/core/CMakeLists.txt b/tests/user/unittest/core/CMakeLists.txt similarity index 100% rename from src/tests/user/unittest/core/CMakeLists.txt rename to tests/user/unittest/core/CMakeLists.txt diff --git a/src/tests/user/unittest/core/CatchDefinitions.cpp b/tests/user/unittest/core/CatchDefinitions.cpp similarity index 100% rename from src/tests/user/unittest/core/CatchDefinitions.cpp rename to tests/user/unittest/core/CatchDefinitions.cpp diff --git a/src/tests/user/unittest/core/CatchDefinitions.h b/tests/user/unittest/core/CatchDefinitions.h similarity index 100% rename from src/tests/user/unittest/core/CatchDefinitions.h rename to tests/user/unittest/core/CatchDefinitions.h diff --git a/src/tests/user/unittest/core/CatchFactory.cpp b/tests/user/unittest/core/CatchFactory.cpp similarity index 100% rename from src/tests/user/unittest/core/CatchFactory.cpp rename to tests/user/unittest/core/CatchFactory.cpp diff --git a/src/tests/user/unittest/core/CatchFactory.h b/tests/user/unittest/core/CatchFactory.h similarity index 100% rename from src/tests/user/unittest/core/CatchFactory.h rename to tests/user/unittest/core/CatchFactory.h diff --git a/src/tests/user/unittest/core/CatchRunner.cpp b/tests/user/unittest/core/CatchRunner.cpp similarity index 100% rename from src/tests/user/unittest/core/CatchRunner.cpp rename to tests/user/unittest/core/CatchRunner.cpp diff --git a/src/tests/user/unittest/core/CatchSetup.cpp b/tests/user/unittest/core/CatchSetup.cpp similarity index 100% rename from src/tests/user/unittest/core/CatchSetup.cpp rename to tests/user/unittest/core/CatchSetup.cpp diff --git a/src/tests/user/unittest/core/core.mk b/tests/user/unittest/core/core.mk similarity index 100% rename from src/tests/user/unittest/core/core.mk rename to tests/user/unittest/core/core.mk diff --git a/src/tests/user/unittest/core/printChar.cpp b/tests/user/unittest/core/printChar.cpp similarity index 100% rename from src/tests/user/unittest/core/printChar.cpp rename to tests/user/unittest/core/printChar.cpp diff --git a/src/tests/user/unittest/core/printChar.h b/tests/user/unittest/core/printChar.h similarity index 100% rename from src/tests/user/unittest/core/printChar.h rename to tests/user/unittest/core/printChar.h From 376617f9f91fabc8e021c1990afb5fce8e27de62 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 14 Jul 2021 10:24:38 +0200 Subject: [PATCH 181/389] missing interface includes --- tests/inc/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/inc/CMakeLists.txt b/tests/inc/CMakeLists.txt index 7ca25bd0..abf6a3d2 100644 --- a/tests/inc/CMakeLists.txt +++ b/tests/inc/CMakeLists.txt @@ -1,3 +1,7 @@ target_include_directories(${LIB_FSFW_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ) + +target_include_directories(${LIB_FSFW_NAME} INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR} +) From 8f1a54aa19aa4ce7a7774004316020acce428b74 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 14 Jul 2021 10:27:33 +0200 Subject: [PATCH 182/389] clarification --- osal/FreeRTOS/QueueMapManager.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osal/FreeRTOS/QueueMapManager.h b/osal/FreeRTOS/QueueMapManager.h index 07ca8b9e..e86fe17b 100644 --- a/osal/FreeRTOS/QueueMapManager.h +++ b/osal/FreeRTOS/QueueMapManager.h @@ -39,7 +39,8 @@ private: QueueMapManager(); ~QueueMapManager(); - uint32_t queueCounter = 0; + // Start at 1 because 0 might be the NO_QUEUE value + uint32_t queueCounter = 1; MutexIF* mapLock; QueueMap queueMap; static QueueMapManager* mqManagerInstance; From f6d1b8981cb6a09b3c8ef6d59641060d03eee23e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 14 Jul 2021 10:33:55 +0200 Subject: [PATCH 183/389] additional safety by check against NO_QUEUE --- osal/FreeRTOS/QueueMapManager.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osal/FreeRTOS/QueueMapManager.cpp b/osal/FreeRTOS/QueueMapManager.cpp index 51cfe11d..7d0873b9 100644 --- a/osal/FreeRTOS/QueueMapManager.cpp +++ b/osal/FreeRTOS/QueueMapManager.cpp @@ -18,6 +18,10 @@ QueueMapManager* QueueMapManager::instance() { ReturnValue_t QueueMapManager::addMessageQueue(QueueHandle_t queue, MessageQueueId_t* id) { MutexGuard lock(mapLock); uint32_t currentId = queueCounter++; + if(currentId == MessageQueueIF::NO_QUEUE) { + // Skip the NO_QUEUE value + queueCounter++; + } auto returnPair = queueMap.emplace(currentId, queue); if(not returnPair.second) { #if FSFW_CPP_OSTREAM_ENABLED == 1 From 5f0a3f3baaa1a05f48e641db564d87c5d224a4b3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 14 Jul 2021 10:34:38 +0200 Subject: [PATCH 184/389] using current ID --- osal/FreeRTOS/QueueMapManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osal/FreeRTOS/QueueMapManager.cpp b/osal/FreeRTOS/QueueMapManager.cpp index 7d0873b9..e60b5689 100644 --- a/osal/FreeRTOS/QueueMapManager.cpp +++ b/osal/FreeRTOS/QueueMapManager.cpp @@ -20,7 +20,7 @@ ReturnValue_t QueueMapManager::addMessageQueue(QueueHandle_t queue, MessageQueue uint32_t currentId = queueCounter++; if(currentId == MessageQueueIF::NO_QUEUE) { // Skip the NO_QUEUE value - queueCounter++; + currentId++; } auto returnPair = queueMap.emplace(currentId, queue); if(not returnPair.second) { From df1d5e50054d53d65effd5413f54f8cfb78d3ebe Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 14 Jul 2021 10:35:37 +0200 Subject: [PATCH 185/389] this is the correct implementation --- osal/FreeRTOS/QueueMapManager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osal/FreeRTOS/QueueMapManager.cpp b/osal/FreeRTOS/QueueMapManager.cpp index e60b5689..8e8b0c3e 100644 --- a/osal/FreeRTOS/QueueMapManager.cpp +++ b/osal/FreeRTOS/QueueMapManager.cpp @@ -20,7 +20,7 @@ ReturnValue_t QueueMapManager::addMessageQueue(QueueHandle_t queue, MessageQueue uint32_t currentId = queueCounter++; if(currentId == MessageQueueIF::NO_QUEUE) { // Skip the NO_QUEUE value - currentId++; + currentId = queueCounter++; } auto returnPair = queueMap.emplace(currentId, queue); if(not returnPair.second) { From 3c4289335e21a87a42525c094bf68f54dbb36222 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 14 Jul 2021 10:39:02 +0200 Subject: [PATCH 186/389] integrated queue map manager bugfixes --- inc/fsfw/osal/freertos/QueueMapManager.h | 3 ++- src/osal/freertos/QueueMapManager.cpp | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/inc/fsfw/osal/freertos/QueueMapManager.h b/inc/fsfw/osal/freertos/QueueMapManager.h index 3aa82594..7e999b0d 100644 --- a/inc/fsfw/osal/freertos/QueueMapManager.h +++ b/inc/fsfw/osal/freertos/QueueMapManager.h @@ -39,7 +39,8 @@ private: QueueMapManager(); ~QueueMapManager(); - uint32_t queueCounter = 0; + // Start at 1 because 0 might be the NO_QUEUE value + uint32_t queueCounter = 1; MutexIF* mapLock; QueueMap queueMap; static QueueMapManager* mqManagerInstance; diff --git a/src/osal/freertos/QueueMapManager.cpp b/src/osal/freertos/QueueMapManager.cpp index dcb88a1e..e32cbe1d 100644 --- a/src/osal/freertos/QueueMapManager.cpp +++ b/src/osal/freertos/QueueMapManager.cpp @@ -17,7 +17,11 @@ QueueMapManager* QueueMapManager::instance() { ReturnValue_t QueueMapManager::addMessageQueue(QueueHandle_t queue, MessageQueueId_t* id) { MutexGuard lock(mapLock); - uint32_t currentId = ++queueCounter; + uint32_t currentId = queueCounter++; + if(currentId == MessageQueueIF::NO_QUEUE) { + // Skip the NO_QUEUE value + currentId = queueCounter++; + } auto returnPair = queueMap.emplace(currentId, queue); if(not returnPair.second) { #if FSFW_CPP_OSTREAM_ENABLED == 1 From 704193eeaf31f4bfd07f1ef29fd87e4dd313e961 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 14 Jul 2021 10:50:44 +0200 Subject: [PATCH 187/389] include replacements host/windows/rtems --- inc/fsfw/osal/common/tcpipHelpers.h | 2 +- inc/fsfw/osal/host/Mutex.h | 2 +- inc/fsfw/osal/rtems/CpuUsage.h | 4 +- inc/fsfw/osal/rtems/RtemsBasic.h | 2 +- src/osal/host/Clock.cpp | 6 +-- src/osal/host/FixedTimeslotTask.cpp | 20 ++++---- src/osal/host/MessageQueue.cpp | 12 ++--- src/osal/host/MutexFactory.cpp | 4 +- src/osal/host/PeriodicTask.cpp | 18 +++---- src/osal/host/QueueFactory.cpp | 11 ++-- src/osal/host/QueueMapManager.cpp | 8 +-- src/osal/host/SemaphoreFactory.cpp | 4 +- src/osal/host/TaskFactory.cpp | 15 +++--- src/osal/host/taskHelpers.cpp | 2 +- src/osal/rtems/Clock.cpp | 6 +-- src/osal/rtems/CpuUsage.cpp | 6 +-- src/osal/rtems/FixedTimeslotTask.cpp | 14 +++--- src/osal/rtems/InitTask.cpp | 4 +- src/osal/rtems/InternalErrorCodes.cpp | 2 +- src/osal/rtems/MessageQueue.cpp | 8 +-- src/osal/rtems/Mutex.cpp | 4 +- src/osal/rtems/MutexFactory.cpp | 4 +- src/osal/rtems/PeriodicTask.cpp | 8 +-- src/osal/rtems/QueueFactory.cpp | 9 ++-- src/osal/rtems/RTEMSTaskBase.cpp | 4 +- src/osal/rtems/RtemsBasic.cpp | 72 +-------------------------- src/osal/rtems/TaskFactory.cpp | 12 ++--- src/osal/windows/tcpipHelpers.cpp | 8 +-- src/osal/windows/winTaskHelpers.cpp | 3 +- 29 files changed, 103 insertions(+), 171 deletions(-) diff --git a/inc/fsfw/osal/common/tcpipHelpers.h b/inc/fsfw/osal/common/tcpipHelpers.h index 9764a93f..bf9a7b5a 100644 --- a/inc/fsfw/osal/common/tcpipHelpers.h +++ b/inc/fsfw/osal/common/tcpipHelpers.h @@ -1,7 +1,7 @@ #ifndef FSFW_OSAL_WINDOWS_TCPIPHELPERS_H_ #define FSFW_OSAL_WINDOWS_TCPIPHELPERS_H_ -#include "../../timemanager/clockDefinitions.h" +#include "fsfw/timemanager/clockDefinitions.h" #include "tcpipCommon.h" namespace tcpip { diff --git a/inc/fsfw/osal/host/Mutex.h b/inc/fsfw/osal/host/Mutex.h index 0bd93c8a..e90ce932 100644 --- a/inc/fsfw/osal/host/Mutex.h +++ b/inc/fsfw/osal/host/Mutex.h @@ -1,7 +1,7 @@ #ifndef FSFW_OSAL_HOSTED_MUTEX_H_ #define FSFW_OSAL_HOSTED_MUTEX_H_ -#include "../../ipc/MutexIF.h" +#include "fsfw/ipc/MutexIF.h" #include diff --git a/inc/fsfw/osal/rtems/CpuUsage.h b/inc/fsfw/osal/rtems/CpuUsage.h index f487e191..6b6b9910 100644 --- a/inc/fsfw/osal/rtems/CpuUsage.h +++ b/inc/fsfw/osal/rtems/CpuUsage.h @@ -1,8 +1,8 @@ #ifndef CPUUSAGE_H_ #define CPUUSAGE_H_ -#include "../../container/FixedArrayList.h" -#include "../../serialize/SerializeIF.h" +#include "fsfw/container/FixedArrayList.h" +#include "fsfw/serialize/SerializeIF.h" #include class CpuUsage : public SerializeIF { diff --git a/inc/fsfw/osal/rtems/RtemsBasic.h b/inc/fsfw/osal/rtems/RtemsBasic.h index 73f23186..382697a3 100644 --- a/inc/fsfw/osal/rtems/RtemsBasic.h +++ b/inc/fsfw/osal/rtems/RtemsBasic.h @@ -1,7 +1,7 @@ #ifndef FSFW_OSAL_RTEMS_RTEMSBASIC_H_ #define FSFW_OSAL_RTEMS_RTEMSBASIC_H_ -#include "../../returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" #include #include diff --git a/src/osal/host/Clock.cpp b/src/osal/host/Clock.cpp index 1018de57..0bdcd8f5 100644 --- a/src/osal/host/Clock.cpp +++ b/src/osal/host/Clock.cpp @@ -1,6 +1,6 @@ -#include "../../serviceinterface/ServiceInterface.h" -#include "../../timemanager/Clock.h" -#include "../../platform.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/timemanager/Clock.h" +#include "fsfw/platform.h" #include diff --git a/src/osal/host/FixedTimeslotTask.cpp b/src/osal/host/FixedTimeslotTask.cpp index 3ad191e5..f9a0588c 100644 --- a/src/osal/host/FixedTimeslotTask.cpp +++ b/src/osal/host/FixedTimeslotTask.cpp @@ -1,20 +1,20 @@ -#include "taskHelpers.h" +#include "fsfw/osal/host/taskHelpers.h" +#include "fsfw/osal/host/FixedTimeslotTask.h" +#include "fsfw/osal/host/FixedTimeslotTask.h" -#include "../../platform.h" -#include "../../osal/host/FixedTimeslotTask.h" -#include "../../ipc/MutexFactory.h" -#include "../../osal/host/Mutex.h" -#include "../../osal/host/FixedTimeslotTask.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../tasks/ExecutableObjectIF.h" +#include "fsfw/platform.h" +#include "fsfw/ipc/MutexFactory.h" +#include "fsfw/osal/host/Mutex.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tasks/ExecutableObjectIF.h" #include #include #if defined(PLATFORM_WIN) #include -#include "../windows/winTaskHelpers.h" +#include "fsfw/osal/windows/winTaskHelpers.h" #elif defined(PLATFORM_UNIX) #include #endif diff --git a/src/osal/host/MessageQueue.cpp b/src/osal/host/MessageQueue.cpp index a2137e27..c7bcb042 100644 --- a/src/osal/host/MessageQueue.cpp +++ b/src/osal/host/MessageQueue.cpp @@ -1,10 +1,10 @@ -#include "MessageQueue.h" -#include "QueueMapManager.h" +#include "fsfw/osal/host/MessageQueue.h" +#include "fsfw/osal/host/QueueMapManager.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../ipc/MutexFactory.h" -#include "../../ipc/MutexGuard.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/ipc/MutexFactory.h" +#include "fsfw/ipc/MutexGuard.h" #include diff --git a/src/osal/host/MutexFactory.cpp b/src/osal/host/MutexFactory.cpp index f3b98fd1..87287906 100644 --- a/src/osal/host/MutexFactory.cpp +++ b/src/osal/host/MutexFactory.cpp @@ -1,5 +1,5 @@ -#include "../../ipc/MutexFactory.h" -#include "../../osal/host/Mutex.h" +#include "fsfw/osal/host/Mutex.h" +#include "fsfw/ipc/MutexFactory.h" //TODO: Different variant than the lazy loading in QueueFactory. //What's better and why? -> one is on heap the other on bss/data diff --git a/src/osal/host/PeriodicTask.cpp b/src/osal/host/PeriodicTask.cpp index 180272d0..def3a6cb 100644 --- a/src/osal/host/PeriodicTask.cpp +++ b/src/osal/host/PeriodicTask.cpp @@ -1,19 +1,19 @@ -#include "Mutex.h" -#include "PeriodicTask.h" -#include "taskHelpers.h" +#include "fsfw/osal/host/Mutex.h" +#include "fsfw/osal/host/PeriodicTask.h" +#include "fsfw/osal/host/taskHelpers.h" -#include "../../platform.h" -#include "../../ipc/MutexFactory.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../tasks/ExecutableObjectIF.h" +#include "fsfw/platform.h" +#include "fsfw/ipc/MutexFactory.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/tasks/ExecutableObjectIF.h" #include #include #if defined(PLATFORM_WIN) #include -#include +#include "fsfw/osal/windows/winTaskHelpers.h" #elif defined(PLATFORM_UNIX) #include #endif diff --git a/src/osal/host/QueueFactory.cpp b/src/osal/host/QueueFactory.cpp index 1a679c96..466bb33b 100644 --- a/src/osal/host/QueueFactory.cpp +++ b/src/osal/host/QueueFactory.cpp @@ -1,10 +1,9 @@ +#include "fsfw/osal/host/MessageQueue.h" -#include "MessageQueue.h" - -#include "../../ipc/MessageQueueSenderIF.h" -#include "../../ipc/MessageQueueMessageIF.h" -#include "../../ipc/QueueFactory.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "fsfw/ipc/MessageQueueSenderIF.h" +#include "fsfw/ipc/MessageQueueMessageIF.h" +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include diff --git a/src/osal/host/QueueMapManager.cpp b/src/osal/host/QueueMapManager.cpp index 879bc36d..ad39972f 100644 --- a/src/osal/host/QueueMapManager.cpp +++ b/src/osal/host/QueueMapManager.cpp @@ -1,8 +1,8 @@ -#include "QueueMapManager.h" +#include "fsfw/osal/host/QueueMapManager.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../ipc/MutexFactory.h" -#include "../../ipc/MutexGuard.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/ipc/MutexFactory.h" +#include "fsfw/ipc/MutexGuard.h" QueueMapManager* QueueMapManager::mqManagerInstance = nullptr; diff --git a/src/osal/host/SemaphoreFactory.cpp b/src/osal/host/SemaphoreFactory.cpp index 530b3e45..3ea12877 100644 --- a/src/osal/host/SemaphoreFactory.cpp +++ b/src/osal/host/SemaphoreFactory.cpp @@ -1,5 +1,5 @@ -#include "../../tasks/SemaphoreFactory.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/tasks/SemaphoreFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" SemaphoreFactory* SemaphoreFactory::factoryInstance = nullptr; diff --git a/src/osal/host/TaskFactory.cpp b/src/osal/host/TaskFactory.cpp index 71d0bf8b..ad59bd1a 100644 --- a/src/osal/host/TaskFactory.cpp +++ b/src/osal/host/TaskFactory.cpp @@ -1,10 +1,11 @@ -#include "taskHelpers.h" -#include "../../tasks/TaskFactory.h" -#include "../../osal/host/FixedTimeslotTask.h" -#include "../../osal/host/PeriodicTask.h" -#include "../../returnvalues/HasReturnvaluesIF.h" -#include "../../tasks/PeriodicTaskIF.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/osal/host/FixedTimeslotTask.h" +#include "fsfw/osal/host/PeriodicTask.h" +#include "fsfw/osal/host/taskHelpers.h" + +#include "fsfw/tasks/TaskFactory.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/tasks/PeriodicTaskIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include diff --git a/src/osal/host/taskHelpers.cpp b/src/osal/host/taskHelpers.cpp index be4c29ad..a7de76d9 100644 --- a/src/osal/host/taskHelpers.cpp +++ b/src/osal/host/taskHelpers.cpp @@ -1,4 +1,4 @@ -#include "taskHelpers.h" +#include "fsfw/osal/host/taskHelpers.h" #include #include diff --git a/src/osal/rtems/Clock.cpp b/src/osal/rtems/Clock.cpp index ae720c36..42f30dcc 100644 --- a/src/osal/rtems/Clock.cpp +++ b/src/osal/rtems/Clock.cpp @@ -1,7 +1,7 @@ -#include "RtemsBasic.h" +#include "fsfw/osal/rtems/RtemsBasic.h" -#include "../../timemanager/Clock.h" -#include "../../ipc/MutexGuard.h" +#include "fsfw/timemanager/Clock.h" +#include "fsfw/ipc/MutexGuard.h" #include #include diff --git a/src/osal/rtems/CpuUsage.cpp b/src/osal/rtems/CpuUsage.cpp index 89c01336..771b52dc 100644 --- a/src/osal/rtems/CpuUsage.cpp +++ b/src/osal/rtems/CpuUsage.cpp @@ -1,6 +1,6 @@ -#include "CpuUsage.h" -#include "../../serialize/SerialArrayListAdapter.h" -#include "../../serialize/SerializeAdapter.h" +#include "fsfw/osal/rtems/CpuUsage.h" +#include "fsfw/serialize/SerialArrayListAdapter.h" +#include "fsfw/serialize/SerializeAdapter.h" #include extern "C" { diff --git a/src/osal/rtems/FixedTimeslotTask.cpp b/src/osal/rtems/FixedTimeslotTask.cpp index 19960a4c..8b313df6 100644 --- a/src/osal/rtems/FixedTimeslotTask.cpp +++ b/src/osal/rtems/FixedTimeslotTask.cpp @@ -1,11 +1,11 @@ -#include "FixedTimeslotTask.h" -#include "RtemsBasic.h" +#include "fsfw/osal/rtems/FixedTimeslotTask.h" +#include "fsfw/osal/rtems/RtemsBasic.h" -#include "../../tasks/FixedSequenceSlot.h" -#include "../../objectmanager/SystemObjectIF.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../returnvalues/HasReturnvaluesIF.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/tasks/FixedSequenceSlot.h" +#include "fsfw/objectmanager/SystemObjectIF.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include #include diff --git a/src/osal/rtems/InitTask.cpp b/src/osal/rtems/InitTask.cpp index 80afed3d..8a9bb9f6 100644 --- a/src/osal/rtems/InitTask.cpp +++ b/src/osal/rtems/InitTask.cpp @@ -1,5 +1,5 @@ -#include "InitTask.h" -#include "RtemsBasic.h" +#include "fsfw/osal/rtems/InitTask.h" +#include "fsfw/osal/rtems/RtemsBasic.h" diff --git a/src/osal/rtems/InternalErrorCodes.cpp b/src/osal/rtems/InternalErrorCodes.cpp index f4079814..049286d7 100644 --- a/src/osal/rtems/InternalErrorCodes.cpp +++ b/src/osal/rtems/InternalErrorCodes.cpp @@ -1,4 +1,4 @@ -#include "../../osal/InternalErrorCodes.h" +#include "fsfw/osal/InternalErrorCodes.h" #include ReturnValue_t InternalErrorCodes::translate(uint8_t code) { diff --git a/src/osal/rtems/MessageQueue.cpp b/src/osal/rtems/MessageQueue.cpp index e8128e90..65fe0946 100644 --- a/src/osal/rtems/MessageQueue.cpp +++ b/src/osal/rtems/MessageQueue.cpp @@ -1,8 +1,8 @@ -#include "MessageQueue.h" -#include "RtemsBasic.h" +#include "fsfw/osal/rtems/MessageQueue.h" +#include "fsfw/osal/rtems/RtemsBasic.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../objectmanager/ObjectManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" #include diff --git a/src/osal/rtems/Mutex.cpp b/src/osal/rtems/Mutex.cpp index f65c1f55..2dfa39fa 100644 --- a/src/osal/rtems/Mutex.cpp +++ b/src/osal/rtems/Mutex.cpp @@ -1,5 +1,5 @@ -#include "Mutex.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/osal/rtems/Mutex.h" +#include "fsfw/serviceinterface/ServiceInterface.h" uint8_t Mutex::count = 0; diff --git a/src/osal/rtems/MutexFactory.cpp b/src/osal/rtems/MutexFactory.cpp index adc599e9..bf7ce666 100644 --- a/src/osal/rtems/MutexFactory.cpp +++ b/src/osal/rtems/MutexFactory.cpp @@ -1,6 +1,6 @@ -#include "Mutex.h" +#include "fsfw/osal/rtems/Mutex.h" -#include "../../ipc/MutexFactory.h" +#include "fsfw/ipc/MutexFactory.h" MutexFactory* MutexFactory::factoryInstance = new MutexFactory(); diff --git a/src/osal/rtems/PeriodicTask.cpp b/src/osal/rtems/PeriodicTask.cpp index 58717344..db98153c 100644 --- a/src/osal/rtems/PeriodicTask.cpp +++ b/src/osal/rtems/PeriodicTask.cpp @@ -1,8 +1,8 @@ -#include "PeriodicTask.h" +#include "fsfw/osal/rtems/PeriodicTask.h" -#include "../../serviceinterface/ServiceInterface.h" -#include "../../objectmanager/ObjectManager.h" -#include "../../tasks/ExecutableObjectIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/tasks/ExecutableObjectIF.h" PeriodicTask::PeriodicTask(const char *name, rtems_task_priority setPriority, size_t setStack, rtems_interval setPeriod, void (*setDeadlineMissedFunc)()) : diff --git a/src/osal/rtems/QueueFactory.cpp b/src/osal/rtems/QueueFactory.cpp index ff561304..ddcc3959 100644 --- a/src/osal/rtems/QueueFactory.cpp +++ b/src/osal/rtems/QueueFactory.cpp @@ -1,7 +1,8 @@ -#include "../../ipc/QueueFactory.h" -#include "../../ipc/MessageQueueSenderIF.h" -#include "MessageQueue.h" -#include "RtemsBasic.h" +#include "fsfw/osal/rtems/MessageQueue.h" +#include "fsfw/osal/rtems/RtemsBasic.h" + +#include "fsfw/ipc/QueueFactory.h" +#include "fsfw/ipc/MessageQueueSenderIF.h" QueueFactory* QueueFactory::factoryInstance = nullptr; diff --git a/src/osal/rtems/RTEMSTaskBase.cpp b/src/osal/rtems/RTEMSTaskBase.cpp index d0cdc876..fc8bbed5 100644 --- a/src/osal/rtems/RTEMSTaskBase.cpp +++ b/src/osal/rtems/RTEMSTaskBase.cpp @@ -1,5 +1,5 @@ -#include "RTEMSTaskBase.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/osal/rtems/RTEMSTaskBase.h" +#include "fsfw/serviceinterface/ServiceInterface.h" const size_t PeriodicTaskIF::MINIMUM_STACK_SIZE = RTEMS_MINIMUM_STACK_SIZE; diff --git a/src/osal/rtems/RtemsBasic.cpp b/src/osal/rtems/RtemsBasic.cpp index 8ab0ddcd..463824ad 100644 --- a/src/osal/rtems/RtemsBasic.cpp +++ b/src/osal/rtems/RtemsBasic.cpp @@ -1,71 +1 @@ -#include "RtemsBasic.h" - -// TODO: Can this be removed? - -//ReturnValue_t RtemsBasic::convertReturnCode(rtems_status_code inValue) { -// if (inValue == RTEMS_SUCCESSFUL) { -// return HasReturnvaluesIF::RETURN_OK; -// } else { -// switch(inValue){ -// case RTEMS_SUCCESSFUL: -// return OperatingSystemIF::SUCCESSFUL; -// case RTEMS_TASK_EXITTED: -// return OperatingSystemIF::TASK_EXITTED; -// case RTEMS_MP_NOT_CONFIGURED: -// return OperatingSystemIF::MP_NOT_CONFIGURED; -// case RTEMS_INVALID_NAME: -// return OperatingSystemIF::INVALID_NAME; -// case RTEMS_INVALID_ID: -// return OperatingSystemIF::INVALID_ID; -// case RTEMS_TOO_MANY: -// return OperatingSystemIF::TOO_MANY; -// case RTEMS_TIMEOUT: -// return OperatingSystemIF::TIMEOUT; -// case RTEMS_OBJECT_WAS_DELETED: -// return OperatingSystemIF::OBJECT_WAS_DELETED; -// case RTEMS_INVALID_SIZE: -// return OperatingSystemIF::INVALID_SIZE; -// case RTEMS_INVALID_ADDRESS: -// return OperatingSystemIF::INVALID_ADDRESS; -// case RTEMS_INVALID_NUMBER: -// return OperatingSystemIF::INVALID_NUMBER; -// case RTEMS_NOT_DEFINED: -// return OperatingSystemIF::NOT_DEFINED; -// case RTEMS_RESOURCE_IN_USE: -// return OperatingSystemIF::RESOURCE_IN_USE; -// //TODO RTEMS_UNSATISFIED is double mapped for FLP so it will only return Queue_empty and not unsatisfied -// case RTEMS_UNSATISFIED: -// return OperatingSystemIF::QUEUE_EMPTY; -// case RTEMS_INCORRECT_STATE: -// return OperatingSystemIF::INCORRECT_STATE; -// case RTEMS_ALREADY_SUSPENDED: -// return OperatingSystemIF::ALREADY_SUSPENDED; -// case RTEMS_ILLEGAL_ON_SELF: -// return OperatingSystemIF::ILLEGAL_ON_SELF; -// case RTEMS_ILLEGAL_ON_REMOTE_OBJECT: -// return OperatingSystemIF::ILLEGAL_ON_REMOTE_OBJECT; -// case RTEMS_CALLED_FROM_ISR: -// return OperatingSystemIF::CALLED_FROM_ISR; -// case RTEMS_INVALID_PRIORITY: -// return OperatingSystemIF::INVALID_PRIORITY; -// case RTEMS_INVALID_CLOCK: -// return OperatingSystemIF::INVALID_CLOCK; -// case RTEMS_INVALID_NODE: -// return OperatingSystemIF::INVALID_NODE; -// case RTEMS_NOT_CONFIGURED: -// return OperatingSystemIF::NOT_CONFIGURED; -// case RTEMS_NOT_OWNER_OF_RESOURCE: -// return OperatingSystemIF::NOT_OWNER_OF_RESOURCE; -// case RTEMS_NOT_IMPLEMENTED: -// return OperatingSystemIF::NOT_IMPLEMENTED; -// case RTEMS_INTERNAL_ERROR: -// return OperatingSystemIF::INTERNAL_ERROR; -// case RTEMS_NO_MEMORY: -// return OperatingSystemIF::NO_MEMORY; -// case RTEMS_IO_ERROR: -// return OperatingSystemIF::IO_ERROR; -// default: -// return HasReturnvaluesIF::RETURN_FAILED; -// } -// } -//} +#include "fsfw/osal/rtems/RtemsBasic.h" diff --git a/src/osal/rtems/TaskFactory.cpp b/src/osal/rtems/TaskFactory.cpp index 095e9a26..dd3e92fc 100644 --- a/src/osal/rtems/TaskFactory.cpp +++ b/src/osal/rtems/TaskFactory.cpp @@ -1,10 +1,10 @@ -#include "FixedTimeslotTask.h" -#include "PeriodicTask.h" -#include "InitTask.h" -#include "RtemsBasic.h" +#include "fsfw/osal/rtems/FixedTimeslotTask.h" +#include "fsfw/osal/rtems/PeriodicTask.h" +#include "fsfw/osal/rtems/InitTask.h" +#include "fsfw/osal/rtems/RtemsBasic.h" -#include "../../tasks/TaskFactory.h" -#include "../../returnvalues/HasReturnvaluesIF.h" +#include "fsfw/tasks/TaskFactory.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" //TODO: Different variant than the lazy loading in QueueFactory. What's better and why? TaskFactory* TaskFactory::factoryInstance = new TaskFactory(); diff --git a/src/osal/windows/tcpipHelpers.cpp b/src/osal/windows/tcpipHelpers.cpp index 3dab9406..37d6fb2f 100644 --- a/src/osal/windows/tcpipHelpers.cpp +++ b/src/osal/windows/tcpipHelpers.cpp @@ -1,8 +1,8 @@ -#include "../common/tcpipHelpers.h" -#include +#include "fsfw/FSFW.h" +#include "fsfw/osal/common/tcpipHelpers.h" -#include "../../tasks/TaskFactory.h" -#include "../../serviceinterface/ServiceInterface.h" +#include "fsfw/tasks/TaskFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" #include diff --git a/src/osal/windows/winTaskHelpers.cpp b/src/osal/windows/winTaskHelpers.cpp index 6765b952..20d4d98d 100644 --- a/src/osal/windows/winTaskHelpers.cpp +++ b/src/osal/windows/winTaskHelpers.cpp @@ -1,4 +1,5 @@ -#include +#include "fsfw/osal/windows/winTaskHelpers.h" + #include TaskPriority tasks::makeWinPriority(PriorityClass prioClass, PriorityNumber prioNumber) { From e5807c396ceda3afaba779fb2f2f03c30e524c68 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 14 Jul 2021 11:03:42 +0200 Subject: [PATCH 188/389] adding spg4 code option --- CMakeLists.txt | 2 ++ contrib/CMakeLists.txt | 11 +++++++++++ 2 files changed, 13 insertions(+) create mode 100644 contrib/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index ecb59506..4f48047c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,7 @@ option(FSFW_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON) option(FSFW_ADD_INTERNAL_TESTS "Add internal unit tests" ON) option(FSFW_USE_RMAP "Compile with RMAP" ON) option(FSFW_USE_DATALINKLAYER "Compile with Data Link Layer" ON) +option(FSFW_ADD_SPG4_PROPAGATOR "Add SPG4 propagator code" ON) set(LIB_FSFW_NAME fsfw) add_library(${LIB_FSFW_NAME}) @@ -85,6 +86,7 @@ message(STATUS "Compiling FSFW for the ${OS_FSFW_NAME} operating system.") add_subdirectory(src) add_subdirectory(tests) +add_subdirectory(contrib) # The project CMakeLists file has to set the FSFW_CONFIG_PATH and add it. # If this is not given, we include the default configuration and emit a warning. diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt new file mode 100644 index 00000000..48cb21d2 --- /dev/null +++ b/contrib/CMakeLists.txt @@ -0,0 +1,11 @@ +if(FSFW_ADD_SPG4_PROPAGATOR) + target_sources(${LIB_FSFW_NAME} PRIVATE + spg4unit.cpp + ) + target_include_directories(${LIB_FSFW_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/spg4 + ) + target_include_directories(${LIB_FSFW_NAME} INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR}/spg4 + ) +endif() From 22693eee50aa85fccc9a1bd45aca4bca6b5dd62b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 14 Jul 2021 11:05:14 +0200 Subject: [PATCH 189/389] minor fixes for contrib --- contrib/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index 48cb21d2..3a987228 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -1,11 +1,11 @@ if(FSFW_ADD_SPG4_PROPAGATOR) target_sources(${LIB_FSFW_NAME} PRIVATE - spg4unit.cpp + sgp4/sgp4unit.cpp ) target_include_directories(${LIB_FSFW_NAME} PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/spg4 + ${CMAKE_CURRENT_SOURCE_DIR}/sgp4 ) target_include_directories(${LIB_FSFW_NAME} INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR}/spg4 + ${CMAKE_CURRENT_SOURCE_DIR}/sgp4 ) endif() From fbdff5d0b464da15524e52e9b2a0074ec0ec31a1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 14 Jul 2021 11:14:25 +0200 Subject: [PATCH 190/389] updated change log --- CHANGELOG | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 09b8db6a..75e7ced5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,17 +1,80 @@ -## Changes from ASTP 1.0.0 to 1.1.0 +# Changed from ASTP 1.1.0 to 1.2.0 + +## API Changes + +### FSFW Architecture + +- Internal API changed completely to have separation of sources and headers +- External API mostly stayed the same +- Folder names are now all smaller case: internalError was renamed to internalerror and + FreeRTOS was renamed to freertos + +### HAL + +- HAL added back into FSFW. It is tightly bound to the FSFW, and compiling it as a static library + made using it more complicated than necessary + +## Bugfixes + +### FreeRTOS QueueMapManager + +- Fixed a bug which causes the first generated Queue ID to be invalid + +## Enhancements + +### FSFW Architecture + +- See API changes chapter. This change will keep the internal API consistent in the future + +# Changes from ASTP 1.0.0 to 1.1.0 + +## API Changes ### PUS - Added PUS C support +- SUBSYSTEM_IDs added for PUS Services +- Added new Parameter which must be defined in config: fsfwconfig::FSFW_MAX_TM_PACKET_SIZE + +### ObjectManager + + - ObjectManager is now a singelton + ### Configuration - Additional configuration option fsfwconfig::FSFW_MAX_TM_PACKET_SIZE which need to be specified in FSFWConfig.h +### CMake + +- Changed Cmake FSFW_ADDITIONAL_INC_PATH to FSFW_ADDITIONAL_INC_PATHS + +## Bugfixes + +- timemanager/TimeStamperIF.h: Timestamp config was not used correctly, leading to different timestamp sizes than configured in fsfwconfig::FSFW_MISSION_TIMESTAMP_SIZE +- TCP server fixes + +## Enhancements + +### FreeRTOS Queue Handles + +- Fixed an internal issue how FreeRTOS MessageQueues were handled + +### Linux OSAL + +- Better printf error messages + +### CMake + +- Check for C++11 as mininimum required Version + +### Debug Output + +- Changed Warning color to magenta, which is well readable on both dark and light mode IDEs -## Changes from ASTP 0.0.1 to 1.0.0 +# Changes from ASTP 0.0.1 to 1.0.0 ### Host OSAL From a3e6b1018b88f6e1e848f49e8f566026e88b98e8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 14 Jul 2021 18:05:53 +0200 Subject: [PATCH 191/389] deleted .mk file --- misc/defaultcfg/fsfwconfig/fsfwconfig.mk | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 misc/defaultcfg/fsfwconfig/fsfwconfig.mk diff --git a/misc/defaultcfg/fsfwconfig/fsfwconfig.mk b/misc/defaultcfg/fsfwconfig/fsfwconfig.mk deleted file mode 100644 index 51543eba..00000000 --- a/misc/defaultcfg/fsfwconfig/fsfwconfig.mk +++ /dev/null @@ -1,15 +0,0 @@ -CXXSRC += $(wildcard $(CURRENTPATH)/ipc/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/objects/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/pollingsequence/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/events/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/tmtc/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/devices/*.cpp) - -INCLUDES += $(CURRENTPATH) -INCLUDES += $(CURRENTPATH)/objects -INCLUDES += $(CURRENTPATH)/returnvalues -INCLUDES += $(CURRENTPATH)/tmtc -INCLUDES += $(CURRENTPATH)/events -INCLUDES += $(CURRENTPATH)/devices -INCLUDES += $(CURRENTPATH)/pollingsequence -INCLUDES += $(CURRENTPATH)/ipc From 243cf42dc4c2650f37cdbbb34acf6f6affc793d2 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 15 Jul 2021 18:43:16 +0200 Subject: [PATCH 192/389] added hal subfolder --- CMakeLists.txt | 1 + hal/CMakeLists.txt | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f48047c..5ea8c9b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,6 +86,7 @@ message(STATUS "Compiling FSFW for the ${OS_FSFW_NAME} operating system.") add_subdirectory(src) add_subdirectory(tests) +add_subdirectory(hal) add_subdirectory(contrib) # The project CMakeLists file has to set the FSFW_CONFIG_PATH and add it. diff --git a/hal/CMakeLists.txt b/hal/CMakeLists.txt index 24d7dac3..070b9fbc 100644 --- a/hal/CMakeLists.txt +++ b/hal/CMakeLists.txt @@ -5,9 +5,7 @@ find_library(LIB_FSFW_NAME fsfw REQUIRED) option(FSFW_HAL_ADD_LINUX "Add the Linux HAL to the sources. Required gpiod library" OFF) option(FSFW_HAL_ADD_RASPBERRY_PI "Add Raspberry Pi specific code to the sources" OFF) - option(FSFW_HAL_ADD_STM32H7 "Add the STM32H7 HAL to the sources" OFF) - option(FSFW_HAL_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON) set(LIB_FSFW_HAL_NAME fsfw_hal) From e2da68795b0163d05c20891bbf0a18803e385b56 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 15 Jul 2021 18:53:59 +0200 Subject: [PATCH 193/389] hal integration done --- hal/CMakeLists.txt | 49 ++----------------- hal/inc/CMakeLists.txt | 7 +++ .../fsfw/{ => hal}/common/gpio/GpioCookie.h | 0 hal/inc/fsfw/{ => hal}/common/gpio/GpioIF.h | 0 .../{ => hal}/common/gpio/gpioDefinitions.h | 0 hal/inc/fsfw/{ => hal}/common/spi/spiCommon.h | 0 .../devicehandlers/GyroL3GD20Handler.h | 0 .../devicedefinitions/GyroL3GD20Definitions.h | 0 hal/inc/fsfw/{ => hal}/linux/UnixFileGuard.h | 0 .../{ => hal}/linux/gpio/LinuxLibgpioIF.h | 0 hal/inc/fsfw/{ => hal}/linux/i2c/I2cComIF.h | 0 hal/inc/fsfw/{ => hal}/linux/i2c/I2cCookie.h | 0 hal/inc/fsfw/{ => hal}/linux/rpi/GpioRPi.h | 0 hal/inc/fsfw/{ => hal}/linux/spi/SpiComIF.h | 0 hal/inc/fsfw/{ => hal}/linux/spi/SpiCookie.h | 0 .../fsfw/{ => hal}/linux/spi/spiDefinitions.h | 0 hal/inc/fsfw/{ => hal}/linux/uart/UartComIF.h | 0 .../fsfw/{ => hal}/linux/uart/UartCookie.h | 0 hal/inc/fsfw/{ => hal}/linux/utility.h | 0 .../stm32h7/devicetest/GyroL3GD20H.h | 0 hal/inc/fsfw/{ => hal}/stm32h7/dma.h | 0 hal/inc/fsfw/{ => hal}/stm32h7/gpio/gpio.h | 0 hal/inc/fsfw/{ => hal}/stm32h7/interrupts.h | 0 hal/inc/fsfw/{ => hal}/stm32h7/spi/SpiComIF.h | 0 .../fsfw/{ => hal}/stm32h7/spi/SpiCookie.h | 0 hal/inc/fsfw/{ => hal}/stm32h7/spi/mspInit.h | 0 hal/inc/fsfw/{ => hal}/stm32h7/spi/spiCore.h | 0 .../{ => hal}/stm32h7/spi/spiDefinitions.h | 0 .../{ => hal}/stm32h7/spi/spiInterrupts.h | 0 .../{ => hal}/stm32h7/spi/stm32h743ziSpi.h | 0 hal/src/CMakeLists.txt | 10 ++++ hal/src/common/CMakeLists.txt | 1 + hal/src/common/gpio/CMakeLists.txt | 2 +- hal/src/common/gpio/GpioCookie.cpp | 2 +- hal/src/devicehandlers/CMakeLists.txt | 2 +- hal/src/devicehandlers/GyroL3GD20Handler.cpp | 4 +- hal/src/linux/CMakeLists.txt | 2 +- hal/src/linux/UnixFileGuard.cpp | 2 +- hal/src/linux/gpio/CMakeLists.txt | 4 +- hal/src/linux/gpio/LinuxLibgpioIF.cpp | 6 +-- hal/src/linux/i2c/CMakeLists.txt | 2 +- hal/src/linux/i2c/I2cComIF.cpp | 8 +-- hal/src/linux/i2c/I2cCookie.cpp | 2 +- hal/src/linux/rpi/CMakeLists.txt | 2 +- hal/src/linux/rpi/GpioRPi.cpp | 7 +-- hal/src/linux/spi/CMakeLists.txt | 2 +- hal/src/linux/spi/SpiComIF.cpp | 10 ++-- hal/src/linux/spi/SpiCookie.cpp | 2 +- hal/src/linux/uart/UartComIF.cpp | 2 +- hal/src/linux/uart/UartCookie.cpp | 2 +- hal/src/stm32h7/CMakeLists.txt | 2 +- hal/src/stm32h7/devicetest/CMakeLists.txt | 2 +- hal/src/stm32h7/gpio/CMakeLists.txt | 2 +- hal/src/stm32h7/i2c/CMakeLists.txt | 2 +- hal/src/stm32h7/spi/CMakeLists.txt | 2 +- hal/src/stm32h7/uart/CMakeLists.txt | 2 +- 56 files changed, 61 insertions(+), 81 deletions(-) create mode 100644 hal/inc/CMakeLists.txt rename hal/inc/fsfw/{ => hal}/common/gpio/GpioCookie.h (100%) rename hal/inc/fsfw/{ => hal}/common/gpio/GpioIF.h (100%) rename hal/inc/fsfw/{ => hal}/common/gpio/gpioDefinitions.h (100%) rename hal/inc/fsfw/{ => hal}/common/spi/spiCommon.h (100%) rename hal/inc/fsfw/{ => hal}/devicehandlers/GyroL3GD20Handler.h (100%) rename hal/inc/fsfw/{ => hal}/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h (100%) rename hal/inc/fsfw/{ => hal}/linux/UnixFileGuard.h (100%) rename hal/inc/fsfw/{ => hal}/linux/gpio/LinuxLibgpioIF.h (100%) rename hal/inc/fsfw/{ => hal}/linux/i2c/I2cComIF.h (100%) rename hal/inc/fsfw/{ => hal}/linux/i2c/I2cCookie.h (100%) rename hal/inc/fsfw/{ => hal}/linux/rpi/GpioRPi.h (100%) rename hal/inc/fsfw/{ => hal}/linux/spi/SpiComIF.h (100%) rename hal/inc/fsfw/{ => hal}/linux/spi/SpiCookie.h (100%) rename hal/inc/fsfw/{ => hal}/linux/spi/spiDefinitions.h (100%) rename hal/inc/fsfw/{ => hal}/linux/uart/UartComIF.h (100%) rename hal/inc/fsfw/{ => hal}/linux/uart/UartCookie.h (100%) rename hal/inc/fsfw/{ => hal}/linux/utility.h (100%) rename hal/inc/fsfw/{ => hal}/stm32h7/devicetest/GyroL3GD20H.h (100%) rename hal/inc/fsfw/{ => hal}/stm32h7/dma.h (100%) rename hal/inc/fsfw/{ => hal}/stm32h7/gpio/gpio.h (100%) rename hal/inc/fsfw/{ => hal}/stm32h7/interrupts.h (100%) rename hal/inc/fsfw/{ => hal}/stm32h7/spi/SpiComIF.h (100%) rename hal/inc/fsfw/{ => hal}/stm32h7/spi/SpiCookie.h (100%) rename hal/inc/fsfw/{ => hal}/stm32h7/spi/mspInit.h (100%) rename hal/inc/fsfw/{ => hal}/stm32h7/spi/spiCore.h (100%) rename hal/inc/fsfw/{ => hal}/stm32h7/spi/spiDefinitions.h (100%) rename hal/inc/fsfw/{ => hal}/stm32h7/spi/spiInterrupts.h (100%) rename hal/inc/fsfw/{ => hal}/stm32h7/spi/stm32h743ziSpi.h (100%) create mode 100644 hal/src/CMakeLists.txt create mode 100644 hal/src/common/CMakeLists.txt diff --git a/hal/CMakeLists.txt b/hal/CMakeLists.txt index 070b9fbc..018018d0 100644 --- a/hal/CMakeLists.txt +++ b/hal/CMakeLists.txt @@ -12,26 +12,12 @@ set(LIB_FSFW_HAL_NAME fsfw_hal) set(LINUX_HAL_PATH_NAME linux) set(STM32H7_PATH_NAME stm32h7) -add_library(${LIB_FSFW_HAL_NAME}) - if(NOT LIB_FSFW_NAME) message(ERROR "LIB_FSFW_NAME needs to be set as a linkable target") endif() -add_subdirectory(devicehandlers) -add_subdirectory(common) - -if(FSFW_HAL_ADD_LINUX) - add_subdirectory(${LINUX_HAL_PATH_NAME}) -endif() - -if(FSFW_HAL_ADD_STM32H7) - add_subdirectory(${STM32H7_PATH_NAME}) -endif() - -target_link_libraries(${LIB_FSFW_HAL_NAME} PRIVATE - ${LIB_FSFW_NAME} -) +add_subdirectory(src) +add_subdirectory(inc) foreach(INCLUDE_PATH ${FSFW_HAL_ADDITIONAL_INC_PATHS}) if(IS_ABSOLUTE ${INCLUDE_PATH}) @@ -48,40 +34,15 @@ foreach(INCLUDE_PATH ${FSFW_HAL_ADDITIONAL_INC_PATHS}) list(APPEND FSFW_HAL_ADD_INC_PATHS_ABS ${CURR_ABS_INC_PATH}) endforeach() -target_include_directories(${LIB_FSFW_HAL_NAME} PRIVATE +target_include_directories(${LIB_FSFW_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${FSFW_HAL_ADD_INC_PATHS_ABS} ) -target_compile_definitions(${LIB_FSFW_HAL_NAME} PRIVATE +target_compile_definitions(${LIB_FSFW_NAME} PRIVATE ${FSFW_HAL_DEFINES} ) -target_link_libraries(${LIB_FSFW_HAL_NAME} PRIVATE +target_link_libraries(${LIB_FSFW_NAME} PRIVATE ${FSFW_HAL_LINK_LIBS} ) - -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - if(NOT DEFINED FSFW_WARNING_FLAGS) - set(FSFW_WARNING_FLAGS - -Wall - -Wextra - -Wimplicit-fallthrough=1 - -Wno-unused-parameter - ) - endif() - - target_compile_options(${LIB_FSFW_NAME} PRIVATE - "-ffunction-sections" - "-fdata-sections" - ) - - target_link_options(${LIB_FSFW_NAME} PRIVATE - "Wl,--gc-sections" - ) - - if(FSFW_HAL_WARNING_SHADOW_LOCAL_GCC) - list(APPEND WARNING_FLAGS "-Wshadow=local") - endif() - -endif() diff --git a/hal/inc/CMakeLists.txt b/hal/inc/CMakeLists.txt new file mode 100644 index 00000000..abf6a3d2 --- /dev/null +++ b/hal/inc/CMakeLists.txt @@ -0,0 +1,7 @@ +target_include_directories(${LIB_FSFW_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} +) + +target_include_directories(${LIB_FSFW_NAME} INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR} +) diff --git a/hal/inc/fsfw/common/gpio/GpioCookie.h b/hal/inc/fsfw/hal/common/gpio/GpioCookie.h similarity index 100% rename from hal/inc/fsfw/common/gpio/GpioCookie.h rename to hal/inc/fsfw/hal/common/gpio/GpioCookie.h diff --git a/hal/inc/fsfw/common/gpio/GpioIF.h b/hal/inc/fsfw/hal/common/gpio/GpioIF.h similarity index 100% rename from hal/inc/fsfw/common/gpio/GpioIF.h rename to hal/inc/fsfw/hal/common/gpio/GpioIF.h diff --git a/hal/inc/fsfw/common/gpio/gpioDefinitions.h b/hal/inc/fsfw/hal/common/gpio/gpioDefinitions.h similarity index 100% rename from hal/inc/fsfw/common/gpio/gpioDefinitions.h rename to hal/inc/fsfw/hal/common/gpio/gpioDefinitions.h diff --git a/hal/inc/fsfw/common/spi/spiCommon.h b/hal/inc/fsfw/hal/common/spi/spiCommon.h similarity index 100% rename from hal/inc/fsfw/common/spi/spiCommon.h rename to hal/inc/fsfw/hal/common/spi/spiCommon.h diff --git a/hal/inc/fsfw/devicehandlers/GyroL3GD20Handler.h b/hal/inc/fsfw/hal/devicehandlers/GyroL3GD20Handler.h similarity index 100% rename from hal/inc/fsfw/devicehandlers/GyroL3GD20Handler.h rename to hal/inc/fsfw/hal/devicehandlers/GyroL3GD20Handler.h diff --git a/hal/inc/fsfw/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h b/hal/inc/fsfw/hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h similarity index 100% rename from hal/inc/fsfw/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h rename to hal/inc/fsfw/hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h diff --git a/hal/inc/fsfw/linux/UnixFileGuard.h b/hal/inc/fsfw/hal/linux/UnixFileGuard.h similarity index 100% rename from hal/inc/fsfw/linux/UnixFileGuard.h rename to hal/inc/fsfw/hal/linux/UnixFileGuard.h diff --git a/hal/inc/fsfw/linux/gpio/LinuxLibgpioIF.h b/hal/inc/fsfw/hal/linux/gpio/LinuxLibgpioIF.h similarity index 100% rename from hal/inc/fsfw/linux/gpio/LinuxLibgpioIF.h rename to hal/inc/fsfw/hal/linux/gpio/LinuxLibgpioIF.h diff --git a/hal/inc/fsfw/linux/i2c/I2cComIF.h b/hal/inc/fsfw/hal/linux/i2c/I2cComIF.h similarity index 100% rename from hal/inc/fsfw/linux/i2c/I2cComIF.h rename to hal/inc/fsfw/hal/linux/i2c/I2cComIF.h diff --git a/hal/inc/fsfw/linux/i2c/I2cCookie.h b/hal/inc/fsfw/hal/linux/i2c/I2cCookie.h similarity index 100% rename from hal/inc/fsfw/linux/i2c/I2cCookie.h rename to hal/inc/fsfw/hal/linux/i2c/I2cCookie.h diff --git a/hal/inc/fsfw/linux/rpi/GpioRPi.h b/hal/inc/fsfw/hal/linux/rpi/GpioRPi.h similarity index 100% rename from hal/inc/fsfw/linux/rpi/GpioRPi.h rename to hal/inc/fsfw/hal/linux/rpi/GpioRPi.h diff --git a/hal/inc/fsfw/linux/spi/SpiComIF.h b/hal/inc/fsfw/hal/linux/spi/SpiComIF.h similarity index 100% rename from hal/inc/fsfw/linux/spi/SpiComIF.h rename to hal/inc/fsfw/hal/linux/spi/SpiComIF.h diff --git a/hal/inc/fsfw/linux/spi/SpiCookie.h b/hal/inc/fsfw/hal/linux/spi/SpiCookie.h similarity index 100% rename from hal/inc/fsfw/linux/spi/SpiCookie.h rename to hal/inc/fsfw/hal/linux/spi/SpiCookie.h diff --git a/hal/inc/fsfw/linux/spi/spiDefinitions.h b/hal/inc/fsfw/hal/linux/spi/spiDefinitions.h similarity index 100% rename from hal/inc/fsfw/linux/spi/spiDefinitions.h rename to hal/inc/fsfw/hal/linux/spi/spiDefinitions.h diff --git a/hal/inc/fsfw/linux/uart/UartComIF.h b/hal/inc/fsfw/hal/linux/uart/UartComIF.h similarity index 100% rename from hal/inc/fsfw/linux/uart/UartComIF.h rename to hal/inc/fsfw/hal/linux/uart/UartComIF.h diff --git a/hal/inc/fsfw/linux/uart/UartCookie.h b/hal/inc/fsfw/hal/linux/uart/UartCookie.h similarity index 100% rename from hal/inc/fsfw/linux/uart/UartCookie.h rename to hal/inc/fsfw/hal/linux/uart/UartCookie.h diff --git a/hal/inc/fsfw/linux/utility.h b/hal/inc/fsfw/hal/linux/utility.h similarity index 100% rename from hal/inc/fsfw/linux/utility.h rename to hal/inc/fsfw/hal/linux/utility.h diff --git a/hal/inc/fsfw/stm32h7/devicetest/GyroL3GD20H.h b/hal/inc/fsfw/hal/stm32h7/devicetest/GyroL3GD20H.h similarity index 100% rename from hal/inc/fsfw/stm32h7/devicetest/GyroL3GD20H.h rename to hal/inc/fsfw/hal/stm32h7/devicetest/GyroL3GD20H.h diff --git a/hal/inc/fsfw/stm32h7/dma.h b/hal/inc/fsfw/hal/stm32h7/dma.h similarity index 100% rename from hal/inc/fsfw/stm32h7/dma.h rename to hal/inc/fsfw/hal/stm32h7/dma.h diff --git a/hal/inc/fsfw/stm32h7/gpio/gpio.h b/hal/inc/fsfw/hal/stm32h7/gpio/gpio.h similarity index 100% rename from hal/inc/fsfw/stm32h7/gpio/gpio.h rename to hal/inc/fsfw/hal/stm32h7/gpio/gpio.h diff --git a/hal/inc/fsfw/stm32h7/interrupts.h b/hal/inc/fsfw/hal/stm32h7/interrupts.h similarity index 100% rename from hal/inc/fsfw/stm32h7/interrupts.h rename to hal/inc/fsfw/hal/stm32h7/interrupts.h diff --git a/hal/inc/fsfw/stm32h7/spi/SpiComIF.h b/hal/inc/fsfw/hal/stm32h7/spi/SpiComIF.h similarity index 100% rename from hal/inc/fsfw/stm32h7/spi/SpiComIF.h rename to hal/inc/fsfw/hal/stm32h7/spi/SpiComIF.h diff --git a/hal/inc/fsfw/stm32h7/spi/SpiCookie.h b/hal/inc/fsfw/hal/stm32h7/spi/SpiCookie.h similarity index 100% rename from hal/inc/fsfw/stm32h7/spi/SpiCookie.h rename to hal/inc/fsfw/hal/stm32h7/spi/SpiCookie.h diff --git a/hal/inc/fsfw/stm32h7/spi/mspInit.h b/hal/inc/fsfw/hal/stm32h7/spi/mspInit.h similarity index 100% rename from hal/inc/fsfw/stm32h7/spi/mspInit.h rename to hal/inc/fsfw/hal/stm32h7/spi/mspInit.h diff --git a/hal/inc/fsfw/stm32h7/spi/spiCore.h b/hal/inc/fsfw/hal/stm32h7/spi/spiCore.h similarity index 100% rename from hal/inc/fsfw/stm32h7/spi/spiCore.h rename to hal/inc/fsfw/hal/stm32h7/spi/spiCore.h diff --git a/hal/inc/fsfw/stm32h7/spi/spiDefinitions.h b/hal/inc/fsfw/hal/stm32h7/spi/spiDefinitions.h similarity index 100% rename from hal/inc/fsfw/stm32h7/spi/spiDefinitions.h rename to hal/inc/fsfw/hal/stm32h7/spi/spiDefinitions.h diff --git a/hal/inc/fsfw/stm32h7/spi/spiInterrupts.h b/hal/inc/fsfw/hal/stm32h7/spi/spiInterrupts.h similarity index 100% rename from hal/inc/fsfw/stm32h7/spi/spiInterrupts.h rename to hal/inc/fsfw/hal/stm32h7/spi/spiInterrupts.h diff --git a/hal/inc/fsfw/stm32h7/spi/stm32h743ziSpi.h b/hal/inc/fsfw/hal/stm32h7/spi/stm32h743ziSpi.h similarity index 100% rename from hal/inc/fsfw/stm32h7/spi/stm32h743ziSpi.h rename to hal/inc/fsfw/hal/stm32h7/spi/stm32h743ziSpi.h diff --git a/hal/src/CMakeLists.txt b/hal/src/CMakeLists.txt new file mode 100644 index 00000000..fcd81389 --- /dev/null +++ b/hal/src/CMakeLists.txt @@ -0,0 +1,10 @@ +add_subdirectory(devicehandlers) +add_subdirectory(common) + +if(FSFW_HAL_ADD_LINUX) + add_subdirectory(${LINUX_HAL_PATH_NAME}) +endif() + +if(FSFW_HAL_ADD_STM32H7) + add_subdirectory(${STM32H7_PATH_NAME}) +endif() diff --git a/hal/src/common/CMakeLists.txt b/hal/src/common/CMakeLists.txt new file mode 100644 index 00000000..f1cfec52 --- /dev/null +++ b/hal/src/common/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(gpio) diff --git a/hal/src/common/gpio/CMakeLists.txt b/hal/src/common/gpio/CMakeLists.txt index 9dbcdf9d..098c05fa 100644 --- a/hal/src/common/gpio/CMakeLists.txt +++ b/hal/src/common/gpio/CMakeLists.txt @@ -1,3 +1,3 @@ -target_sources(${LIB_FSFW_HAL_NAME} PRIVATE +target_sources(${LIB_FSFW_NAME} PRIVATE GpioCookie.cpp ) \ No newline at end of file diff --git a/hal/src/common/gpio/GpioCookie.cpp b/hal/src/common/gpio/GpioCookie.cpp index da765cea..31832070 100644 --- a/hal/src/common/gpio/GpioCookie.cpp +++ b/hal/src/common/gpio/GpioCookie.cpp @@ -1,4 +1,4 @@ -#include "GpioCookie.h" +#include "fsfw/hal/common/gpio/GpioCookie.h" #include "fsfw/serviceinterface/ServiceInterface.h" GpioCookie::GpioCookie() { diff --git a/hal/src/devicehandlers/CMakeLists.txt b/hal/src/devicehandlers/CMakeLists.txt index 1cde7e49..cf542d8d 100644 --- a/hal/src/devicehandlers/CMakeLists.txt +++ b/hal/src/devicehandlers/CMakeLists.txt @@ -1,3 +1,3 @@ -target_sources(${LIB_FSFW_HAL_NAME} PRIVATE +target_sources(${LIB_FSFW_NAME} PRIVATE GyroL3GD20Handler.cpp ) diff --git a/hal/src/devicehandlers/GyroL3GD20Handler.cpp b/hal/src/devicehandlers/GyroL3GD20Handler.cpp index 79cbe435..11f7e92d 100644 --- a/hal/src/devicehandlers/GyroL3GD20Handler.cpp +++ b/hal/src/devicehandlers/GyroL3GD20Handler.cpp @@ -1,6 +1,6 @@ -#include "GyroL3GD20Handler.h" +#include "fsfw/hal/devicehandlers/GyroL3GD20Handler.h" -#include +#include "fsfw/datapool/PoolReadGuard.h" GyroHandlerL3GD20H::GyroHandlerL3GD20H(object_id_t objectId, object_id_t deviceCommunication, CookieIF *comCookie): diff --git a/hal/src/linux/CMakeLists.txt b/hal/src/linux/CMakeLists.txt index 6c2ec77e..5944b0e5 100644 --- a/hal/src/linux/CMakeLists.txt +++ b/hal/src/linux/CMakeLists.txt @@ -2,7 +2,7 @@ if(FSFW_HAL_ADD_RASPBERRY_PI) add_subdirectory(rpi) endif() -target_sources(${LIB_FSFW_HAL_NAME} PRIVATE +target_sources(${LIB_FSFW_NAME} PRIVATE UnixFileGuard.cpp utility.cpp ) diff --git a/hal/src/linux/UnixFileGuard.cpp b/hal/src/linux/UnixFileGuard.cpp index 3aec58d8..c47e35b1 100644 --- a/hal/src/linux/UnixFileGuard.cpp +++ b/hal/src/linux/UnixFileGuard.cpp @@ -1,4 +1,4 @@ -#include "UnixFileGuard.h" +#include "fsfw/hal/linux/UnixFileGuard.h" UnixFileGuard::UnixFileGuard(std::string device, int* fileDescriptor, int flags, std::string diagnosticPrefix): diff --git a/hal/src/linux/gpio/CMakeLists.txt b/hal/src/linux/gpio/CMakeLists.txt index b2041b40..7083f70d 100644 --- a/hal/src/linux/gpio/CMakeLists.txt +++ b/hal/src/linux/gpio/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${LIB_FSFW_HAL_NAME} PRIVATE +target_sources(${LIB_FSFW_NAME} PRIVATE LinuxLibgpioIF.cpp ) @@ -7,6 +7,6 @@ target_sources(${LIB_FSFW_HAL_NAME} PRIVATE # to install the package before syncing the sysroot to your host computer. find_library(LIB_GPIO gpiod REQUIRED) -target_link_libraries(${LIB_FSFW_HAL_NAME} PRIVATE +target_link_libraries(${LIB_FSFW_NAME} PRIVATE ${LIB_GPIO} ) \ No newline at end of file diff --git a/hal/src/linux/gpio/LinuxLibgpioIF.cpp b/hal/src/linux/gpio/LinuxLibgpioIF.cpp index cfdac2bf..98e02796 100644 --- a/hal/src/linux/gpio/LinuxLibgpioIF.cpp +++ b/hal/src/linux/gpio/LinuxLibgpioIF.cpp @@ -1,6 +1,6 @@ -#include "LinuxLibgpioIF.h" -#include -#include +#include "fsfw/hal/linux/gpio/LinuxLibgpioIF.h" +#include "fsfw/hal/common/gpio/gpioDefinitions.h" +#include "fsfw/hal/common/gpio/GpioCookie.h" #include diff --git a/hal/src/linux/i2c/CMakeLists.txt b/hal/src/linux/i2c/CMakeLists.txt index 0e50313c..3eb0882c 100644 --- a/hal/src/linux/i2c/CMakeLists.txt +++ b/hal/src/linux/i2c/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${LIB_FSFW_HAL_NAME} PUBLIC +target_sources(${LIB_FSFW_NAME} PUBLIC I2cComIF.cpp I2cCookie.cpp ) diff --git a/hal/src/linux/i2c/I2cComIF.cpp b/hal/src/linux/i2c/I2cComIF.cpp index aa336c7b..d756e75e 100644 --- a/hal/src/linux/i2c/I2cComIF.cpp +++ b/hal/src/linux/i2c/I2cComIF.cpp @@ -1,8 +1,8 @@ -#include "I2cComIF.h" -#include "../utility.h" -#include "../UnixFileGuard.h" +#include "fsfw/hal/linux/i2c/I2cComIF.h" +#include "fsfw/hal/linux/utility.h" +#include "fsfw/hal/linux/UnixFileGuard.h" -#include +#include "fsfw/serviceinterface/ServiceInterface.h" #include #include diff --git a/hal/src/linux/i2c/I2cCookie.cpp b/hal/src/linux/i2c/I2cCookie.cpp index fe0f3f92..fd0f654d 100644 --- a/hal/src/linux/i2c/I2cCookie.cpp +++ b/hal/src/linux/i2c/I2cCookie.cpp @@ -1,4 +1,4 @@ -#include "I2cCookie.h" +#include "fsfw/hal/linux/i2c/I2cCookie.h" I2cCookie::I2cCookie(address_t i2cAddress_, size_t maxReplyLen_, std::string deviceFile_) : diff --git a/hal/src/linux/rpi/CMakeLists.txt b/hal/src/linux/rpi/CMakeLists.txt index 053583aa..47be218c 100644 --- a/hal/src/linux/rpi/CMakeLists.txt +++ b/hal/src/linux/rpi/CMakeLists.txt @@ -1,3 +1,3 @@ -target_sources(${LIB_FSFW_HAL_NAME} PRIVATE +target_sources(${LIB_FSFW_NAME} PRIVATE GpioRPi.cpp ) \ No newline at end of file diff --git a/hal/src/linux/rpi/GpioRPi.cpp b/hal/src/linux/rpi/GpioRPi.cpp index 64b6fcaa..277a9fb2 100644 --- a/hal/src/linux/rpi/GpioRPi.cpp +++ b/hal/src/linux/rpi/GpioRPi.cpp @@ -1,6 +1,7 @@ -#include "GpioRPi.h" -#include "../../common/gpio/GpioCookie.h" -#include +#include "fsfw/FSFW.h" + +#include "fsfw/hal/linux/rpi/GpioRPi.h" +#include "fsfw/hal/common/gpio/GpioCookie.h" #include diff --git a/hal/src/linux/spi/CMakeLists.txt b/hal/src/linux/spi/CMakeLists.txt index 5794547c..404e1f47 100644 --- a/hal/src/linux/spi/CMakeLists.txt +++ b/hal/src/linux/spi/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${LIB_FSFW_HAL_NAME} PUBLIC +target_sources(${LIB_FSFW_NAME} PUBLIC SpiComIF.cpp SpiCookie.cpp ) diff --git a/hal/src/linux/spi/SpiComIF.cpp b/hal/src/linux/spi/SpiComIF.cpp index 9dc44295..f3d8ab09 100644 --- a/hal/src/linux/spi/SpiComIF.cpp +++ b/hal/src/linux/spi/SpiComIF.cpp @@ -1,8 +1,8 @@ -#include "SpiComIF.h" -#include "SpiCookie.h" -#include "../utility.h" -#include "../UnixFileGuard.h" -#include "FSFWConfig.h" +#include "fsfw/FSFW.h" +#include "fsfw/hal/linux/spi/SpiComIF.h" +#include "fsfw/hal/linux/spi/SpiCookie.h" +#include "fsfw/hal/linux/utility.h" +#include "fsfw/hal/linux/UnixFileGuard.h" #include #include diff --git a/hal/src/linux/spi/SpiCookie.cpp b/hal/src/linux/spi/SpiCookie.cpp index e34ea36a..a74bc419 100644 --- a/hal/src/linux/spi/SpiCookie.cpp +++ b/hal/src/linux/spi/SpiCookie.cpp @@ -1,4 +1,4 @@ -#include "SpiCookie.h" +#include "fsfw/hal/linux/spi/SpiCookie.h" SpiCookie::SpiCookie(address_t spiAddress, gpioId_t chipSelect, std::string spiDev, const size_t maxSize, spi::SpiModes spiMode, uint32_t spiSpeed): diff --git a/hal/src/linux/uart/UartComIF.cpp b/hal/src/linux/uart/UartComIF.cpp index c84affa9..e5fc90c3 100644 --- a/hal/src/linux/uart/UartComIF.cpp +++ b/hal/src/linux/uart/UartComIF.cpp @@ -1,4 +1,4 @@ -#include "UartComIF.h" +#include "fsfw/hal/linux/uart/UartComIF.h" #include "OBSWConfig.h" #include "fsfw/serviceinterface/ServiceInterface.h" diff --git a/hal/src/linux/uart/UartCookie.cpp b/hal/src/linux/uart/UartCookie.cpp index 2e9cede9..bfd091a8 100644 --- a/hal/src/linux/uart/UartCookie.cpp +++ b/hal/src/linux/uart/UartCookie.cpp @@ -1,4 +1,4 @@ -#include "UartCookie.h" +#include "fsfw/hal/linux/uart/UartCookie.h" #include diff --git a/hal/src/stm32h7/CMakeLists.txt b/hal/src/stm32h7/CMakeLists.txt index 63c13734..bae3b1ac 100644 --- a/hal/src/stm32h7/CMakeLists.txt +++ b/hal/src/stm32h7/CMakeLists.txt @@ -2,6 +2,6 @@ add_subdirectory(spi) add_subdirectory(gpio) add_subdirectory(devicetest) -target_sources(${LIB_FSFW_HAL_NAME} PRIVATE +target_sources(${LIB_FSFW_NAME} PRIVATE dma.cpp ) diff --git a/hal/src/stm32h7/devicetest/CMakeLists.txt b/hal/src/stm32h7/devicetest/CMakeLists.txt index 1ee43134..7bd4c3a9 100644 --- a/hal/src/stm32h7/devicetest/CMakeLists.txt +++ b/hal/src/stm32h7/devicetest/CMakeLists.txt @@ -1,3 +1,3 @@ -target_sources(${LIB_FSFW_HAL_NAME} PRIVATE +target_sources(${LIB_FSFW_NAME} PRIVATE GyroL3GD20H.cpp ) \ No newline at end of file diff --git a/hal/src/stm32h7/gpio/CMakeLists.txt b/hal/src/stm32h7/gpio/CMakeLists.txt index 66027dd9..35245b25 100644 --- a/hal/src/stm32h7/gpio/CMakeLists.txt +++ b/hal/src/stm32h7/gpio/CMakeLists.txt @@ -1,3 +1,3 @@ -target_sources(${LIB_FSFW_HAL_NAME} PRIVATE +target_sources(${LIB_FSFW_NAME} PRIVATE gpio.cpp ) diff --git a/hal/src/stm32h7/i2c/CMakeLists.txt b/hal/src/stm32h7/i2c/CMakeLists.txt index aa3194a9..5ecb0990 100644 --- a/hal/src/stm32h7/i2c/CMakeLists.txt +++ b/hal/src/stm32h7/i2c/CMakeLists.txt @@ -1,2 +1,2 @@ -target_sources(${LIB_FSFW_HAL_NAME} PRIVATE +target_sources(${LIB_FSFW_NAME} PRIVATE ) diff --git a/hal/src/stm32h7/spi/CMakeLists.txt b/hal/src/stm32h7/spi/CMakeLists.txt index fb4f6474..e28c35aa 100644 --- a/hal/src/stm32h7/spi/CMakeLists.txt +++ b/hal/src/stm32h7/spi/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${LIB_FSFW_HAL_NAME} PRIVATE +target_sources(${LIB_FSFW_NAME} PRIVATE spiCore.cpp spiDefinitions.cpp spiInterrupts.cpp diff --git a/hal/src/stm32h7/uart/CMakeLists.txt b/hal/src/stm32h7/uart/CMakeLists.txt index aa3194a9..5ecb0990 100644 --- a/hal/src/stm32h7/uart/CMakeLists.txt +++ b/hal/src/stm32h7/uart/CMakeLists.txt @@ -1,2 +1,2 @@ -target_sources(${LIB_FSFW_HAL_NAME} PRIVATE +target_sources(${LIB_FSFW_NAME} PRIVATE ) From 3c364604ac4fecd3c1ea5c38e6dca564c232c7a6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 15 Jul 2021 18:59:47 +0200 Subject: [PATCH 194/389] target name replaced --- hal/src/linux/uart/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hal/src/linux/uart/CMakeLists.txt b/hal/src/linux/uart/CMakeLists.txt index d8cea5a8..21ed0278 100644 --- a/hal/src/linux/uart/CMakeLists.txt +++ b/hal/src/linux/uart/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PUBLIC +target_sources(${LIB_FSFW_NAME} PUBLIC UartComIF.cpp UartCookie.cpp ) From d11e54dc0a296bda86b5597a34e5e8ba59b9653e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 15 Jul 2021 19:06:40 +0200 Subject: [PATCH 195/389] some more fixes --- hal/CMakeLists.txt | 6 ------ hal/src/linux/utility.cpp | 7 ++++++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/hal/CMakeLists.txt b/hal/CMakeLists.txt index 018018d0..4cb18315 100644 --- a/hal/CMakeLists.txt +++ b/hal/CMakeLists.txt @@ -8,14 +8,9 @@ option(FSFW_HAL_ADD_RASPBERRY_PI "Add Raspberry Pi specific code to the sources" option(FSFW_HAL_ADD_STM32H7 "Add the STM32H7 HAL to the sources" OFF) option(FSFW_HAL_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON) -set(LIB_FSFW_HAL_NAME fsfw_hal) set(LINUX_HAL_PATH_NAME linux) set(STM32H7_PATH_NAME stm32h7) -if(NOT LIB_FSFW_NAME) - message(ERROR "LIB_FSFW_NAME needs to be set as a linkable target") -endif() - add_subdirectory(src) add_subdirectory(inc) @@ -35,7 +30,6 @@ foreach(INCLUDE_PATH ${FSFW_HAL_ADDITIONAL_INC_PATHS}) endforeach() target_include_directories(${LIB_FSFW_NAME} PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} ${FSFW_HAL_ADD_INC_PATHS_ABS} ) diff --git a/hal/src/linux/utility.cpp b/hal/src/linux/utility.cpp index c63b8014..04fded6c 100644 --- a/hal/src/linux/utility.cpp +++ b/hal/src/linux/utility.cpp @@ -1,4 +1,9 @@ -#include +#include "fsfw/FSFW.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/hal/linux/utility.h" + +#include +#include void utility::handleIoctlError(const char* const customPrintout) { #if FSFW_VERBOSE_LEVEL >= 1 From 1db5c950b883a0e95644e06a49ef74577a289a4e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 15 Jul 2021 19:23:12 +0200 Subject: [PATCH 196/389] stm32h7 include corrections --- hal/inc/fsfw/hal/stm32h7/gpio/gpio.h | 2 -- hal/inc/fsfw/hal/stm32h7/spi/SpiComIF.h | 4 ++-- hal/inc/fsfw/hal/stm32h7/spi/spiCore.h | 5 +++-- hal/src/stm32h7/devicetest/GyroL3GD20H.cpp | 12 ++++++------ hal/src/stm32h7/gpio/gpio.cpp | 2 +- hal/src/stm32h7/spi/SpiComIF.cpp | 14 +++++++------- hal/src/stm32h7/spi/SpiCookie.cpp | 2 +- hal/src/stm32h7/spi/mspInit.cpp | 11 ++++++----- hal/src/stm32h7/spi/spiCore.cpp | 5 +++-- hal/src/stm32h7/spi/spiDefinitions.cpp | 2 +- hal/src/stm32h7/spi/spiInterrupts.cpp | 4 ++-- hal/src/stm32h7/spi/stm32h743ziSpi.cpp | 7 ++++--- 12 files changed, 36 insertions(+), 34 deletions(-) diff --git a/hal/inc/fsfw/hal/stm32h7/gpio/gpio.h b/hal/inc/fsfw/hal/stm32h7/gpio/gpio.h index adb60de6..38fcd708 100644 --- a/hal/inc/fsfw/hal/stm32h7/gpio/gpio.h +++ b/hal/inc/fsfw/hal/stm32h7/gpio/gpio.h @@ -9,6 +9,4 @@ void initializeGpioClock(GPIO_TypeDef* gpioPort); } - - #endif /* FSFW_HAL_STM32H7_GPIO_GPIO_H_ */ diff --git a/hal/inc/fsfw/hal/stm32h7/spi/SpiComIF.h b/hal/inc/fsfw/hal/stm32h7/spi/SpiComIF.h index 4b1ef801..c2554544 100644 --- a/hal/inc/fsfw/hal/stm32h7/spi/SpiComIF.h +++ b/hal/inc/fsfw/hal/stm32h7/spi/SpiComIF.h @@ -5,8 +5,8 @@ #include "fsfw/devicehandlers/DeviceCommunicationIF.h" #include "fsfw/objectmanager/SystemObject.h" -#include "fsfw/osal/FreeRTOS/BinarySemaphore.h" -#include "fsfw_hal/stm32h7/spi/spiDefinitions.h" +#include "fsfw/osal/freertos/BinarySemaphore.h" +#include "fsfw/hal/stm32h7/spi/spiDefinitions.h" #include "stm32h7xx_hal_spi.h" #include "stm32h743xx.h" diff --git a/hal/inc/fsfw/hal/stm32h7/spi/spiCore.h b/hal/inc/fsfw/hal/stm32h7/spi/spiCore.h index 7a9a0e18..bff90a5b 100644 --- a/hal/inc/fsfw/hal/stm32h7/spi/spiCore.h +++ b/hal/inc/fsfw/hal/stm32h7/spi/spiCore.h @@ -1,11 +1,12 @@ #ifndef FSFW_HAL_STM32H7_SPI_SPICORE_H_ #define FSFW_HAL_STM32H7_SPI_SPICORE_H_ -#include +#include "fsfw/hal/stm32h7/dma.h" +#include "fsfw/hal/stm32h7/spi/spiDefinitions.h" + #include "stm32h7xx_hal.h" #include "stm32h7xx_hal_dma.h" - #ifdef __cplusplus extern "C" { #endif diff --git a/hal/src/stm32h7/devicetest/GyroL3GD20H.cpp b/hal/src/stm32h7/devicetest/GyroL3GD20H.cpp index 8176c3c2..6765f540 100644 --- a/hal/src/stm32h7/devicetest/GyroL3GD20H.cpp +++ b/hal/src/stm32h7/devicetest/GyroL3GD20H.cpp @@ -1,10 +1,10 @@ -#include "GyroL3GD20H.h" +#include "fsfw/hal/stm32h7/devicetest/GyroL3GD20H.h" -#include "../spi/mspInit.h" -#include "../spi/spiDefinitions.h" -#include "../spi/spiCore.h" -#include "../spi/spiInterrupts.h" -#include "../spi/stm32h743ziSpi.h" +#include "fsfw/hal/stm32h7/spi/mspInit.h" +#include "fsfw/hal/stm32h7/spi/spiDefinitions.h" +#include "fsfw/hal/stm32h7/spi/spiCore.h" +#include "fsfw/hal/stm32h7/spi/spiInterrupts.h" +#include "fsfw/hal/stm32h7/spi/stm32h743ziSpi.h" #include "fsfw/tasks/TaskFactory.h" #include "fsfw/serviceinterface/ServiceInterface.h" diff --git a/hal/src/stm32h7/gpio/gpio.cpp b/hal/src/stm32h7/gpio/gpio.cpp index 50873f75..927588a3 100644 --- a/hal/src/stm32h7/gpio/gpio.cpp +++ b/hal/src/stm32h7/gpio/gpio.cpp @@ -1,4 +1,4 @@ -#include "gpio.h" +#include "fsfw/hal/stm32h7/gpio/gpio.h" #include "stm32h7xx_hal_rcc.h" diff --git a/hal/src/stm32h7/spi/SpiComIF.cpp b/hal/src/stm32h7/spi/SpiComIF.cpp index 732fb5ea..d1484de0 100644 --- a/hal/src/stm32h7/spi/SpiComIF.cpp +++ b/hal/src/stm32h7/spi/SpiComIF.cpp @@ -1,12 +1,12 @@ -#include "SpiComIF.h" -#include "SpiCookie.h" +#include "fsfw/hal/stm32h7/spi/SpiComIF.h" +#include "fsfw/hal/stm32h7/spi/SpiCookie.h" #include "fsfw/tasks/SemaphoreFactory.h" -#include "fsfw/osal/FreeRTOS/TaskManagement.h" -#include "fsfw_hal/stm32h7/spi/spiCore.h" -#include "fsfw_hal/stm32h7/spi/spiInterrupts.h" -#include "fsfw_hal/stm32h7/spi/mspInit.h" -#include "fsfw_hal/stm32h7/gpio/gpio.h" +#include "fsfw/osal/freertos/TaskManagement.h" +#include "fsfw/hal/stm32h7/spi/spiCore.h" +#include "fsfw/hal/stm32h7/spi/spiInterrupts.h" +#include "fsfw/hal/stm32h7/spi/mspInit.h" +#include "fsfw/hal/stm32h7/gpio/gpio.h" #include "stm32h7xx_hal_gpio.h" diff --git a/hal/src/stm32h7/spi/SpiCookie.cpp b/hal/src/stm32h7/spi/SpiCookie.cpp index 06c0ac5f..82d705c2 100644 --- a/hal/src/stm32h7/spi/SpiCookie.cpp +++ b/hal/src/stm32h7/spi/SpiCookie.cpp @@ -1,4 +1,4 @@ -#include "SpiCookie.h" +#include "fsfw/hal/stm32h7/spi/SpiCookie.h" SpiCookie::SpiCookie(address_t deviceAddress, spi::SpiBus spiIdx, spi::TransferModes transferMode, diff --git a/hal/src/stm32h7/spi/mspInit.cpp b/hal/src/stm32h7/spi/mspInit.cpp index 80d2ffe0..424a8bfb 100644 --- a/hal/src/stm32h7/spi/mspInit.cpp +++ b/hal/src/stm32h7/spi/mspInit.cpp @@ -1,13 +1,14 @@ -#include -#include "mspInit.h" -#include "spiCore.h" -#include "spiInterrupts.h" +#include "fsfw/hal/stm32h7/dma.h" +#include "fsfw/hal/stm32h7/spi/mspInit.h" +#include "fsfw/hal/stm32h7/spi/spiCore.h" +#include "fsfw/hal/stm32h7/spi/spiInterrupts.h" + #include "stm32h743xx.h" #include "stm32h7xx_hal_spi.h" #include "stm32h7xx_hal_dma.h" #include "stm32h7xx_hal_def.h" -#include +#include spi::msp_func_t mspInitFunc = nullptr; spi::MspCfgBase* mspInitArgs = nullptr; diff --git a/hal/src/stm32h7/spi/spiCore.cpp b/hal/src/stm32h7/spi/spiCore.cpp index feec65f0..a72bf12b 100644 --- a/hal/src/stm32h7/spi/spiCore.cpp +++ b/hal/src/stm32h7/spi/spiCore.cpp @@ -1,5 +1,6 @@ -#include "spiDefinitions.h" -#include "spiCore.h" +#include "fsfw/hal/stm32h7/spi/spiCore.h" +#include "fsfw/hal/stm32h7/spi/spiDefinitions.h" + #include SPI_HandleTypeDef* spiHandle = nullptr; diff --git a/hal/src/stm32h7/spi/spiDefinitions.cpp b/hal/src/stm32h7/spi/spiDefinitions.cpp index fbceb934..6a83ae42 100644 --- a/hal/src/stm32h7/spi/spiDefinitions.cpp +++ b/hal/src/stm32h7/spi/spiDefinitions.cpp @@ -1,4 +1,4 @@ -#include "spiDefinitions.h" +#include "fsfw/hal/stm32h7/spi/spiDefinitions.h" void spi::assignSpiMode(SpiModes spiMode, SPI_HandleTypeDef& spiHandle) { switch(spiMode) { diff --git a/hal/src/stm32h7/spi/spiInterrupts.cpp b/hal/src/stm32h7/spi/spiInterrupts.cpp index 83ba7322..90cfe706 100644 --- a/hal/src/stm32h7/spi/spiInterrupts.cpp +++ b/hal/src/stm32h7/spi/spiInterrupts.cpp @@ -1,5 +1,5 @@ -#include "spiInterrupts.h" -#include "spiCore.h" +#include "fsfw/hal/stm32h7/spi/spiInterrupts.h" +#include "fsfw/hal/stm32h7/spi/spiCore.h" #include "stm32h7xx_hal.h" #include "stm32h7xx_hal_dma.h" diff --git a/hal/src/stm32h7/spi/stm32h743ziSpi.cpp b/hal/src/stm32h7/spi/stm32h743ziSpi.cpp index 826ecb23..f1f2815e 100644 --- a/hal/src/stm32h7/spi/stm32h743ziSpi.cpp +++ b/hal/src/stm32h7/spi/stm32h743ziSpi.cpp @@ -1,6 +1,7 @@ -#include "stm32h743ziSpi.h" -#include "spiCore.h" -#include "spiInterrupts.h" +#include "fsfw/hal/stm32h7/spi/stm32h743ziSpi.h" +#include "fsfw/hal/stm32h7/spi/spiCore.h" +#include "fsfw/hal/stm32h7/spi/spiInterrupts.h" + #include "stm32h7xx_hal.h" #include "stm32h7xx_hal_rcc.h" From aafccd191e3a592e19c09b01b95dea89c8936e54 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 15 Jul 2021 19:27:13 +0200 Subject: [PATCH 197/389] correction in dma.cpp --- hal/src/stm32h7/dma.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hal/src/stm32h7/dma.cpp b/hal/src/stm32h7/dma.cpp index 91fb3382..288e4294 100644 --- a/hal/src/stm32h7/dma.cpp +++ b/hal/src/stm32h7/dma.cpp @@ -1,6 +1,7 @@ -#include -#include -#include +#include + +#include +#include user_handler_t DMA_1_USER_HANDLERS[8]; user_args_t DMA_1_USER_ARGS[8]; From a65a1840838435f8ce3cfed8bc7a2adf74eac2ac Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 16 Jul 2021 12:22:14 +0200 Subject: [PATCH 198/389] not an ideal solution but works for now --- hal/inc/fsfw/hal/linux/spi/SpiComIF.h | 6 +++--- hal/inc/fsfw/hal/stm32h7/spi/SpiComIF.h | 2 +- hal/src/stm32h7/devicetest/GyroL3GD20H.cpp | 1 - hal/src/stm32h7/spi/SpiComIF.cpp | 17 ++++++++++++++- inc/fsfw/osal/freertos/BinarySemaphore.h | 2 +- inc/fsfw/osal/rtems/BinarySemaphore.h | 21 +++++++++++++++++++ inc/fsfw/osal/rtems/MessageQueue.h | 6 +++--- src/osal/rtems/BinarySemaphore.cpp | 24 ++++++++++++++++++++++ src/osal/rtems/CMakeLists.txt | 1 + 9 files changed, 70 insertions(+), 10 deletions(-) create mode 100644 inc/fsfw/osal/rtems/BinarySemaphore.h create mode 100644 src/osal/rtems/BinarySemaphore.cpp diff --git a/hal/inc/fsfw/hal/linux/spi/SpiComIF.h b/hal/inc/fsfw/hal/linux/spi/SpiComIF.h index 676c7cba..7f66b8e5 100644 --- a/hal/inc/fsfw/hal/linux/spi/SpiComIF.h +++ b/hal/inc/fsfw/hal/linux/spi/SpiComIF.h @@ -3,10 +3,10 @@ #include "spiDefinitions.h" #include "returnvalues/classIds.h" -#include "../../common/gpio/GpioIF.h" +#include "fsfw/hal/common/gpio/GpioIF.h" -#include -#include +#include "fsfw/devicehandlers/DeviceCommunicationIF.h" +#include "fsfw/objectmanager/SystemObject.h" #include #include diff --git a/hal/inc/fsfw/hal/stm32h7/spi/SpiComIF.h b/hal/inc/fsfw/hal/stm32h7/spi/SpiComIF.h index c2554544..00625b34 100644 --- a/hal/inc/fsfw/hal/stm32h7/spi/SpiComIF.h +++ b/hal/inc/fsfw/hal/stm32h7/spi/SpiComIF.h @@ -5,7 +5,6 @@ #include "fsfw/devicehandlers/DeviceCommunicationIF.h" #include "fsfw/objectmanager/SystemObject.h" -#include "fsfw/osal/freertos/BinarySemaphore.h" #include "fsfw/hal/stm32h7/spi/spiDefinitions.h" #include "stm32h7xx_hal_spi.h" #include "stm32h743xx.h" @@ -14,6 +13,7 @@ #include class SpiCookie; +class BinarySemaphore; /** * @brief This communication interface allows using generic device handlers with using diff --git a/hal/src/stm32h7/devicetest/GyroL3GD20H.cpp b/hal/src/stm32h7/devicetest/GyroL3GD20H.cpp index 6765f540..04b1de3b 100644 --- a/hal/src/stm32h7/devicetest/GyroL3GD20H.cpp +++ b/hal/src/stm32h7/devicetest/GyroL3GD20H.cpp @@ -9,7 +9,6 @@ #include "fsfw/tasks/TaskFactory.h" #include "fsfw/serviceinterface/ServiceInterface.h" -#include "stm32h7xx_nucleo.h" #include "stm32h7xx_hal_spi.h" #include "stm32h7xx_hal_rcc.h" diff --git a/hal/src/stm32h7/spi/SpiComIF.cpp b/hal/src/stm32h7/spi/SpiComIF.cpp index d1484de0..da34c4c0 100644 --- a/hal/src/stm32h7/spi/SpiComIF.cpp +++ b/hal/src/stm32h7/spi/SpiComIF.cpp @@ -2,12 +2,21 @@ #include "fsfw/hal/stm32h7/spi/SpiCookie.h" #include "fsfw/tasks/SemaphoreFactory.h" -#include "fsfw/osal/freertos/TaskManagement.h" #include "fsfw/hal/stm32h7/spi/spiCore.h" #include "fsfw/hal/stm32h7/spi/spiInterrupts.h" #include "fsfw/hal/stm32h7/spi/mspInit.h" #include "fsfw/hal/stm32h7/gpio/gpio.h" +// FreeRTOS required special Semaphore handling from an ISR. Therefore, we use the concrete +// instance here, because RTEMS and FreeRTOS are the only relevant OSALs currently +// and it is not trivial to add a releaseFromISR to the SemaphoreIF +#if defined FSFW_OSAL_RTEMS +#include "fsfw/osal/rtems/BinarySemaphore.h" +#elif defined FSFW_OSAL_FREERTOS +#include "fsfw/osal/freertos/TaskManagement.h" +#include "fsfw/osal/freertos/BinarySemaphore.h" +#endif + #include "stm32h7xx_hal_gpio.h" SpiComIF::SpiComIF(object_id_t objectId): SystemObject(objectId) { @@ -421,10 +430,14 @@ void SpiComIF::genericIrqHandler(void *irqArgsVoid, spi::TransferStates targetSt HAL_GPIO_WritePin(spiCookie->getChipSelectGpioPort(), spiCookie->getChipSelectGpioPin(), GPIO_PIN_SET); +#if defined FSFW_OSAL_FREERTOS // Release the task semaphore BaseType_t taskWoken = pdFALSE; ReturnValue_t result = BinarySemaphore::releaseFromISR(comIF->spiSemaphore->getSemaphore(), &taskWoken); +#elif defined FSFW_OSAL_RTEMS + ReturnValue_t result = comIF->spiSemaphore->release(); +#endif if(result != HasReturnvaluesIF::RETURN_OK) { // Configuration error printf("SpiComIF::genericIrqHandler: Failure releasing Semaphore!\n"); @@ -436,11 +449,13 @@ void SpiComIF::genericIrqHandler(void *irqArgsVoid, spi::TransferStates targetSt SCB_InvalidateDCache_by_Addr ((uint32_t *) comIF->currentRecvPtr, comIF->currentRecvBuffSize); } +#if defined FSFW_OSAL_FREERTOS /* Request a context switch if the SPI ComIF task was woken up and has a higher priority than the currently running task */ if(taskWoken == pdTRUE) { TaskManagement::requestContextSwitch(CallContext::ISR); } +#endif } void SpiComIF::printCfgError(const char *const type) { diff --git a/inc/fsfw/osal/freertos/BinarySemaphore.h b/inc/fsfw/osal/freertos/BinarySemaphore.h index 1ae56ff6..6e70bf70 100644 --- a/inc/fsfw/osal/freertos/BinarySemaphore.h +++ b/inc/fsfw/osal/freertos/BinarySemaphore.h @@ -98,7 +98,7 @@ public: * already available. */ static ReturnValue_t releaseFromISR(SemaphoreHandle_t semaphore, - BaseType_t * higherPriorityTaskWoken); + BaseType_t * higherPriorityTaskWoken) override; protected: SemaphoreHandle_t handle; diff --git a/inc/fsfw/osal/rtems/BinarySemaphore.h b/inc/fsfw/osal/rtems/BinarySemaphore.h new file mode 100644 index 00000000..3b3a5aba --- /dev/null +++ b/inc/fsfw/osal/rtems/BinarySemaphore.h @@ -0,0 +1,21 @@ +#ifndef FSFW_INC_FSFW_OSAL_RTEMS_BINARYSEMAPHORE_H_ +#define FSFW_INC_FSFW_OSAL_RTEMS_BINARYSEMAPHORE_H_ + +#include "fsfw/tasks/SemaphoreIF.h" + +class BinarySemaphore: public SemaphoreIF { +public: + BinarySemaphore(); + virtual ~BinarySemaphore(); + + // Interface implementation + ReturnValue_t acquire(TimeoutType timeoutType = + TimeoutType::BLOCKING, uint32_t timeoutMs = 0) override; + ReturnValue_t release() override; + uint8_t getSemaphoreCounter() const override; +private: +}; + + + +#endif /* FSFW_INC_FSFW_OSAL_RTEMS_BINARYSEMAPHORE_H_ */ diff --git a/inc/fsfw/osal/rtems/MessageQueue.h b/inc/fsfw/osal/rtems/MessageQueue.h index 342f1e30..fa143ebe 100644 --- a/inc/fsfw/osal/rtems/MessageQueue.h +++ b/inc/fsfw/osal/rtems/MessageQueue.h @@ -1,9 +1,9 @@ #ifndef FSFW_OSAL_RTEMS_MESSAGEQUEUE_H_ #define FSFW_OSAL_RTEMS_MESSAGEQUEUE_H_ -#include "../../internalError/InternalErrorReporterIF.h" -#include "../../ipc/MessageQueueIF.h" -#include "../../ipc/MessageQueueMessage.h" +#include "fsfw/internalerror/InternalErrorReporterIF.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/ipc/MessageQueueMessage.h" #include "RtemsBasic.h" /** diff --git a/src/osal/rtems/BinarySemaphore.cpp b/src/osal/rtems/BinarySemaphore.cpp new file mode 100644 index 00000000..f9db1009 --- /dev/null +++ b/src/osal/rtems/BinarySemaphore.cpp @@ -0,0 +1,24 @@ +#include "fsfw/osal/rtems/BinarySemaphore.h" + +#include + +BinarySemaphore::BinarySemaphore() { +} + +BinarySemaphore::~BinarySemaphore() { + +} + +// Interface implementation +ReturnValue_t BinarySemaphore::acquire(TimeoutType timeoutType, uint32_t timeoutMs) { + return HasReturnvaluesIF::RETURN_OK; +} + + +ReturnValue_t BinarySemaphore::release() { + return HasReturnvaluesIF::RETURN_OK; +} + +uint8_t BinarySemaphore::getSemaphoreCounter() const { + return 0; +} diff --git a/src/osal/rtems/CMakeLists.txt b/src/osal/rtems/CMakeLists.txt index cd266125..ac728b2f 100644 --- a/src/osal/rtems/CMakeLists.txt +++ b/src/osal/rtems/CMakeLists.txt @@ -13,6 +13,7 @@ target_sources(${LIB_FSFW_NAME} RtemsBasic.cpp RTEMSTaskBase.cpp TaskFactory.cpp + BinarySemaphore.cpp ) From 291a8d4ea30b1e18aaa1236fe7a65be14c869994 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 16 Jul 2021 12:33:19 +0200 Subject: [PATCH 199/389] added semaphore factory --- src/osal/rtems/CMakeLists.txt | 1 + src/osal/rtems/SemaphoreFactory.cpp | 34 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 src/osal/rtems/SemaphoreFactory.cpp diff --git a/src/osal/rtems/CMakeLists.txt b/src/osal/rtems/CMakeLists.txt index ac728b2f..734566a3 100644 --- a/src/osal/rtems/CMakeLists.txt +++ b/src/osal/rtems/CMakeLists.txt @@ -14,6 +14,7 @@ target_sources(${LIB_FSFW_NAME} RTEMSTaskBase.cpp TaskFactory.cpp BinarySemaphore.cpp + SemaphoreFactory.cpp ) diff --git a/src/osal/rtems/SemaphoreFactory.cpp b/src/osal/rtems/SemaphoreFactory.cpp new file mode 100644 index 00000000..cec4b833 --- /dev/null +++ b/src/osal/rtems/SemaphoreFactory.cpp @@ -0,0 +1,34 @@ +#include "fsfw/osal/rtems/BinarySemaphore.h" +//#include "fsfw/osal/rtems/CountingSemaphore.h" + +#include "fsfw/tasks/SemaphoreFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" + +SemaphoreFactory* SemaphoreFactory::factoryInstance = nullptr; + +SemaphoreFactory::SemaphoreFactory() { +} + +SemaphoreFactory::~SemaphoreFactory() { + delete factoryInstance; +} + +SemaphoreFactory* SemaphoreFactory::instance() { + if (factoryInstance == nullptr){ + factoryInstance = new SemaphoreFactory(); + } + return SemaphoreFactory::factoryInstance; +} + +SemaphoreIF* SemaphoreFactory::createBinarySemaphore(uint32_t argument) { + return new BinarySemaphore(); +} + +SemaphoreIF* SemaphoreFactory::createCountingSemaphore(uint8_t maxCount, + uint8_t initCount, uint32_t argument) { + return nullptr; +} + +void SemaphoreFactory::deleteSemaphore(SemaphoreIF* semaphore) { + delete semaphore; +} From 0b45e5c89a25e0f0222ae7c5a20d5839b80efff7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 19 Jul 2021 14:40:32 +0200 Subject: [PATCH 200/389] fix --- osal/host/QueueMapManager.cpp | 4 ++++ osal/host/QueueMapManager.h | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/osal/host/QueueMapManager.cpp b/osal/host/QueueMapManager.cpp index 879bc36d..cea79f7b 100644 --- a/osal/host/QueueMapManager.cpp +++ b/osal/host/QueueMapManager.cpp @@ -25,6 +25,10 @@ ReturnValue_t QueueMapManager::addMessageQueue( MessageQueueIF* queueToInsert, MessageQueueId_t* id) { MutexGuard lock(mapLock); uint32_t currentId = queueCounter++; + if(currentId == MessageQueueIF::NO_QUEUE) { + // Skip the NO_QUEUE value + currentId = queueCounter++; + } auto returnPair = queueMap.emplace(currentId, queueToInsert); if(not returnPair.second) { /* This should never happen for the atomic variable. */ diff --git a/osal/host/QueueMapManager.h b/osal/host/QueueMapManager.h index e274bed2..c4e0fcdf 100644 --- a/osal/host/QueueMapManager.h +++ b/osal/host/QueueMapManager.h @@ -41,7 +41,8 @@ private: QueueMapManager(); ~QueueMapManager(); - uint32_t queueCounter = 0; + // Start at 1 because 0 might be the NO_QUEUE value + uint32_t queueCounter = 1; MutexIF* mapLock; QueueMap queueMap; static QueueMapManager* mqManagerInstance; From e93230d0efae8cc2045299346406ff6026f27fcd Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 19 Jul 2021 14:47:33 +0200 Subject: [PATCH 201/389] update init value --- osal/FreeRTOS/QueueMapManager.h | 3 +-- osal/host/QueueMapManager.h | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/osal/FreeRTOS/QueueMapManager.h b/osal/FreeRTOS/QueueMapManager.h index e86fe17b..032fb2ba 100644 --- a/osal/FreeRTOS/QueueMapManager.h +++ b/osal/FreeRTOS/QueueMapManager.h @@ -39,8 +39,7 @@ private: QueueMapManager(); ~QueueMapManager(); - // Start at 1 because 0 might be the NO_QUEUE value - uint32_t queueCounter = 1; + uint32_t queueCounter = MessageQueueIF::NO_QUEUE + 1; MutexIF* mapLock; QueueMap queueMap; static QueueMapManager* mqManagerInstance; diff --git a/osal/host/QueueMapManager.h b/osal/host/QueueMapManager.h index c4e0fcdf..2dd2a01d 100644 --- a/osal/host/QueueMapManager.h +++ b/osal/host/QueueMapManager.h @@ -41,8 +41,7 @@ private: QueueMapManager(); ~QueueMapManager(); - // Start at 1 because 0 might be the NO_QUEUE value - uint32_t queueCounter = 1; + uint32_t queueCounter = MessageQueueIF::NO_QUEUE + 1; MutexIF* mapLock; QueueMap queueMap; static QueueMapManager* mqManagerInstance; From baf3d4da477a07ee42a0a537721e4fd35bbd11b8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 19 Jul 2021 14:57:10 +0200 Subject: [PATCH 202/389] better form --- osal/FreeRTOS/QueueMapManager.cpp | 6 ++++-- osal/host/QueueMapManager.cpp | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/osal/FreeRTOS/QueueMapManager.cpp b/osal/FreeRTOS/QueueMapManager.cpp index 8e8b0c3e..b58fd4fe 100644 --- a/osal/FreeRTOS/QueueMapManager.cpp +++ b/osal/FreeRTOS/QueueMapManager.cpp @@ -17,10 +17,12 @@ QueueMapManager* QueueMapManager::instance() { ReturnValue_t QueueMapManager::addMessageQueue(QueueHandle_t queue, MessageQueueId_t* id) { MutexGuard lock(mapLock); - uint32_t currentId = queueCounter++; + uint32_t currentId = queueCounter; + queueCounter++; if(currentId == MessageQueueIF::NO_QUEUE) { // Skip the NO_QUEUE value - currentId = queueCounter++; + currentId = queueCounter; + queueCounter++; } auto returnPair = queueMap.emplace(currentId, queue); if(not returnPair.second) { diff --git a/osal/host/QueueMapManager.cpp b/osal/host/QueueMapManager.cpp index cea79f7b..5117d551 100644 --- a/osal/host/QueueMapManager.cpp +++ b/osal/host/QueueMapManager.cpp @@ -24,10 +24,12 @@ QueueMapManager* QueueMapManager::instance() { ReturnValue_t QueueMapManager::addMessageQueue( MessageQueueIF* queueToInsert, MessageQueueId_t* id) { MutexGuard lock(mapLock); - uint32_t currentId = queueCounter++; + uint32_t currentId = queueCounter; + queueCounter++; if(currentId == MessageQueueIF::NO_QUEUE) { // Skip the NO_QUEUE value - currentId = queueCounter++; + currentId = queueCounter; + queueCounter++; } auto returnPair = queueMap.emplace(currentId, queueToInsert); if(not returnPair.second) { From 16ed5e32706f431bf8e3d16c9a570006d376c017 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 19 Jul 2021 15:01:43 +0200 Subject: [PATCH 203/389] update to bugfix --- src/osal/freertos/QueueMapManager.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/osal/freertos/QueueMapManager.cpp b/src/osal/freertos/QueueMapManager.cpp index e32cbe1d..7d6b2f12 100644 --- a/src/osal/freertos/QueueMapManager.cpp +++ b/src/osal/freertos/QueueMapManager.cpp @@ -17,10 +17,12 @@ QueueMapManager* QueueMapManager::instance() { ReturnValue_t QueueMapManager::addMessageQueue(QueueHandle_t queue, MessageQueueId_t* id) { MutexGuard lock(mapLock); - uint32_t currentId = queueCounter++; + uint32_t currentId = queueCounter; + queueCounter++; if(currentId == MessageQueueIF::NO_QUEUE) { // Skip the NO_QUEUE value - currentId = queueCounter++; + currentId = queueCounter; + queueCounter++; } auto returnPair = queueMap.emplace(currentId, queue); if(not returnPair.second) { From 4c41cb1f715c7f1dd25cb9cd3f85add45889ae92 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 19 Jul 2021 15:03:02 +0200 Subject: [PATCH 204/389] update to upstream --- src/osal/host/QueueMapManager.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/osal/host/QueueMapManager.cpp b/src/osal/host/QueueMapManager.cpp index ad39972f..58575cf6 100644 --- a/src/osal/host/QueueMapManager.cpp +++ b/src/osal/host/QueueMapManager.cpp @@ -24,7 +24,13 @@ QueueMapManager* QueueMapManager::instance() { ReturnValue_t QueueMapManager::addMessageQueue( MessageQueueIF* queueToInsert, MessageQueueId_t* id) { MutexGuard lock(mapLock); - uint32_t currentId = queueCounter++; + uint32_t currentId = queueCounter; + queueCounter++; + if(currentId == MessageQueueIF::NO_QUEUE) { + // Skip the NO_QUEUE value + currentId = queueCounter; + queueCounter++; + } auto returnPair = queueMap.emplace(currentId, queueToInsert); if(not returnPair.second) { /* This should never happen for the atomic variable. */ From cbdf92a775300885916add805fafd4f7f9de786a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 19 Jul 2021 15:04:08 +0200 Subject: [PATCH 205/389] update to origin --- inc/fsfw/osal/freertos/QueueMapManager.h | 3 +-- inc/fsfw/osal/host/QueueMapManager.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/inc/fsfw/osal/freertos/QueueMapManager.h b/inc/fsfw/osal/freertos/QueueMapManager.h index 7e999b0d..dbe0526b 100644 --- a/inc/fsfw/osal/freertos/QueueMapManager.h +++ b/inc/fsfw/osal/freertos/QueueMapManager.h @@ -39,8 +39,7 @@ private: QueueMapManager(); ~QueueMapManager(); - // Start at 1 because 0 might be the NO_QUEUE value - uint32_t queueCounter = 1; + uint32_t queueCounter = MessageQueueIF::NO_QUEUE + 1; MutexIF* mapLock; QueueMap queueMap; static QueueMapManager* mqManagerInstance; diff --git a/inc/fsfw/osal/host/QueueMapManager.h b/inc/fsfw/osal/host/QueueMapManager.h index e274bed2..2dd2a01d 100644 --- a/inc/fsfw/osal/host/QueueMapManager.h +++ b/inc/fsfw/osal/host/QueueMapManager.h @@ -41,7 +41,7 @@ private: QueueMapManager(); ~QueueMapManager(); - uint32_t queueCounter = 0; + uint32_t queueCounter = MessageQueueIF::NO_QUEUE + 1; MutexIF* mapLock; QueueMap queueMap; static QueueMapManager* mqManagerInstance; From 7849b8e39130d4ccb7f0aada141dc0deaad852d9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 19 Jul 2021 15:07:56 +0200 Subject: [PATCH 206/389] mutex update --- src/osal/host/Mutex.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/osal/host/Mutex.cpp diff --git a/src/osal/host/Mutex.cpp b/src/osal/host/Mutex.cpp new file mode 100644 index 00000000..1c8b1dd8 --- /dev/null +++ b/src/osal/host/Mutex.cpp @@ -0,0 +1,32 @@ +#include "Mutex.h" +#include "fsfw/serviceinterface/ServiceInterface.h" + +Mutex::Mutex() {} + +ReturnValue_t Mutex::lockMutex(TimeoutType timeoutType, uint32_t timeoutMs) { + if(timeoutType == TimeoutType::BLOCKING) { + mutex.lock(); + return HasReturnvaluesIF::RETURN_OK; + } + else if(timeoutType == TimeoutType::POLLING) { + if(mutex.try_lock()) { + return HasReturnvaluesIF::RETURN_OK; + } + } + else if(timeoutType == TimeoutType::WAITING){ + auto chronoMs = std::chrono::milliseconds(timeoutMs); + if(mutex.try_lock_for(chronoMs)) { + return HasReturnvaluesIF::RETURN_OK; + } + } + return MutexIF::MUTEX_TIMEOUT; +} + +ReturnValue_t Mutex::unlockMutex() { + mutex.unlock(); + return HasReturnvaluesIF::RETURN_OK; +} + +std::timed_mutex* Mutex::getMutexHandle() { + return &mutex; +} From d47906e83321a6cea2176ad12d947ba6a45291a8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 19 Jul 2021 16:25:51 +0200 Subject: [PATCH 207/389] trying to fuse header / inc --- hal/CMakeLists.txt | 1 - hal/inc/CMakeLists.txt | 7 ---- hal/src/CMakeLists.txt | 15 ++++----- hal/src/fsfw/CMakeLists.txt | 1 + hal/src/fsfw/hal/CMakeLists.txt | 10 ++++++ hal/src/{ => fsfw/hal}/common/CMakeLists.txt | 0 .../{ => fsfw/hal}/common/gpio/CMakeLists.txt | 0 .../{ => fsfw/hal}/common/gpio/GpioCookie.cpp | 0 .../fsfw/hal/common/gpio/GpioCookie.h | 0 .../fsfw/hal/common/gpio/GpioIF.h | 0 .../fsfw/hal/common/gpio/gpioDefinitions.h | 0 .../fsfw/hal/common/spi/spiCommon.h | 0 .../hal}/devicehandlers/CMakeLists.txt | 0 .../hal}/devicehandlers/GyroL3GD20Handler.cpp | 0 .../hal/devicehandlers/GyroL3GD20Handler.h | 0 .../devicedefinitions/GyroL3GD20Definitions.h | 0 hal/src/{ => fsfw/hal}/host/CMakeLists.txt | 0 hal/src/{ => fsfw/hal}/linux/CMakeLists.txt | 0 .../{ => fsfw/hal}/linux/UnixFileGuard.cpp | 0 .../fsfw/hal/linux/UnixFileGuard.h | 0 .../{ => fsfw/hal}/linux/gpio/CMakeLists.txt | 0 .../hal}/linux/gpio/LinuxLibgpioIF.cpp | 0 .../fsfw/hal/linux/gpio/LinuxLibgpioIF.h | 0 .../{ => fsfw/hal}/linux/i2c/CMakeLists.txt | 0 hal/src/{ => fsfw/hal}/linux/i2c/I2cComIF.cpp | 0 .../fsfw/hal/linux/i2c/I2cComIF.h | 0 .../{ => fsfw/hal}/linux/i2c/I2cCookie.cpp | 0 .../fsfw/hal/linux/i2c/I2cCookie.h | 0 .../{ => fsfw/hal}/linux/rpi/CMakeLists.txt | 0 hal/src/{ => fsfw/hal}/linux/rpi/GpioRPi.cpp | 0 hal/{inc => src}/fsfw/hal/linux/rpi/GpioRPi.h | 0 .../{ => fsfw/hal}/linux/spi/CMakeLists.txt | 0 hal/src/{ => fsfw/hal}/linux/spi/SpiComIF.cpp | 0 .../fsfw/hal/linux/spi/SpiComIF.h | 0 .../{ => fsfw/hal}/linux/spi/SpiCookie.cpp | 0 .../fsfw/hal/linux/spi/SpiCookie.h | 0 .../fsfw/hal/linux/spi/spiDefinitions.h | 0 .../{ => fsfw/hal}/linux/uart/CMakeLists.txt | 0 .../{ => fsfw/hal}/linux/uart/UartComIF.cpp | 0 .../fsfw/hal/linux/uart/UartComIF.h | 0 .../{ => fsfw/hal}/linux/uart/UartCookie.cpp | 0 .../fsfw/hal/linux/uart/UartCookie.h | 0 hal/src/{ => fsfw/hal}/linux/utility.cpp | 0 hal/{inc => src}/fsfw/hal/linux/utility.h | 0 hal/src/{ => fsfw/hal}/stm32h7/CMakeLists.txt | 0 .../hal}/stm32h7/devicetest/CMakeLists.txt | 0 .../hal}/stm32h7/devicetest/GyroL3GD20H.cpp | 0 .../fsfw/hal/stm32h7/devicetest/GyroL3GD20H.h | 0 hal/src/{ => fsfw/hal}/stm32h7/dma.cpp | 0 hal/{inc => src}/fsfw/hal/stm32h7/dma.h | 0 .../hal}/stm32h7/gpio/CMakeLists.txt | 0 hal/src/{ => fsfw/hal}/stm32h7/gpio/gpio.cpp | 0 hal/{inc => src}/fsfw/hal/stm32h7/gpio/gpio.h | 0 .../{ => fsfw/hal}/stm32h7/i2c/CMakeLists.txt | 0 .../fsfw/hal/stm32h7/interrupts.h | 0 .../{ => fsfw/hal}/stm32h7/spi/CMakeLists.txt | 0 .../{ => fsfw/hal}/stm32h7/spi/SpiComIF.cpp | 0 .../fsfw/hal/stm32h7/spi/SpiComIF.h | 0 .../{ => fsfw/hal}/stm32h7/spi/SpiCookie.cpp | 0 .../fsfw/hal/stm32h7/spi/SpiCookie.h | 0 .../{ => fsfw/hal}/stm32h7/spi/mspInit.cpp | 0 .../fsfw/hal/stm32h7/spi/mspInit.h | 0 .../{ => fsfw/hal}/stm32h7/spi/spiCore.cpp | 0 .../fsfw/hal/stm32h7/spi/spiCore.h | 0 .../hal}/stm32h7/spi/spiDefinitions.cpp | 0 .../fsfw/hal/stm32h7/spi/spiDefinitions.h | 0 .../hal}/stm32h7/spi/spiInterrupts.cpp | 0 .../fsfw/hal/stm32h7/spi/spiInterrupts.h | 0 .../hal}/stm32h7/spi/stm32h743ziSpi.cpp | 0 .../fsfw/hal/stm32h7/spi/stm32h743ziSpi.h | 0 .../hal}/stm32h7/uart/CMakeLists.txt | 0 inc/fsfw/action.h | 11 ------- inc/fsfw/datapoollocal.h | 12 ------- inc/fsfw/osal/host/Mutex.cpp | 32 ------------------- inc/fsfw/osal/rtems/BinarySemaphore.h | 21 ------------ src/CMakeLists.txt | 12 +++++-- src/core/devicehandlers/CMakeLists.txt | 10 ------ src/core/housekeeping/CMakeLists.txt | 4 --- src/{core => fsfw}/CMakeLists.txt | 15 +++++++++ {inc => src}/fsfw/FSFW.h | 0 {inc => src}/fsfw/FSFWVersion.h | 0 src/fsfw/action.h | 11 +++++++ src/{core => fsfw}/action/ActionHelper.cpp | 0 {inc => src}/fsfw/action/ActionHelper.h | 0 src/{core => fsfw}/action/ActionMessage.cpp | 0 {inc => src}/fsfw/action/ActionMessage.h | 0 src/{core => fsfw}/action/CMakeLists.txt | 0 .../action/CommandActionHelper.cpp | 0 .../fsfw/action/CommandActionHelper.h | 0 {inc => src}/fsfw/action/CommandsActionsIF.h | 0 {inc => src}/fsfw/action/HasActionsIF.h | 0 .../action/SimpleActionHelper.cpp | 0 {inc => src}/fsfw/action/SimpleActionHelper.h | 0 {inc => src}/fsfw/container/ArrayList.h | 0 {inc => src}/fsfw/container/BinaryTree.h | 0 src/{core => fsfw}/container/CMakeLists.txt | 0 {inc => src}/fsfw/container/DynamicFIFO.h | 0 {inc => src}/fsfw/container/FIFO.h | 0 {inc => src}/fsfw/container/FIFOBase.h | 0 {inc => src}/fsfw/container/FIFOBase.tpp | 0 {inc => src}/fsfw/container/FixedArrayList.h | 0 {inc => src}/fsfw/container/FixedMap.h | 0 .../fsfw/container/FixedOrderedMultimap.h | 0 .../fsfw/container/FixedOrderedMultimap.tpp | 0 {inc => src}/fsfw/container/HybridIterator.h | 0 .../fsfw/container/IndexedRingMemoryArray.h | 0 .../fsfw/container/PlacementFactory.h | 0 {inc => src}/fsfw/container/RingBufferBase.h | 0 .../container/SharedRingBuffer.cpp | 0 .../fsfw/container/SharedRingBuffer.h | 0 .../container/SimpleRingBuffer.cpp | 0 .../fsfw/container/SimpleRingBuffer.h | 0 .../fsfw/container/SinglyLinkedList.h | 0 {inc => src}/fsfw/container/group.h | 0 src/{core => fsfw}/controller/CMakeLists.txt | 0 .../controller/ControllerBase.cpp | 0 {inc => src}/fsfw/controller/ControllerBase.h | 0 .../controller/ExtendedControllerBase.cpp | 0 .../fsfw/controller/ExtendedControllerBase.h | 0 src/{opt => fsfw}/coordinates/CMakeLists.txt | 0 .../coordinates/CoordinateTransformations.cpp | 0 .../coordinates/CoordinateTransformations.h | 0 {inc => src}/fsfw/coordinates/Jgm3Model.h | 0 .../coordinates/Sgp4Propagator.cpp | 0 .../fsfw/coordinates/Sgp4Propagator.h | 0 {inc => src}/fsfw/datalinklayer/BCFrame.h | 0 .../fsfw/datalinklayer/CCSDSReturnValuesIF.h | 0 .../datalinklayer/CMakeLists.txt | 0 src/{opt => fsfw}/datalinklayer/Clcw.cpp | 0 {inc => src}/fsfw/datalinklayer/Clcw.h | 0 {inc => src}/fsfw/datalinklayer/ClcwIF.h | 0 .../datalinklayer/DataLinkLayer.cpp | 0 .../fsfw/datalinklayer/DataLinkLayer.h | 0 .../fsfw/datalinklayer/Farm1StateIF.h | 0 .../datalinklayer/Farm1StateLockout.cpp | 0 .../fsfw/datalinklayer/Farm1StateLockout.h | 0 .../datalinklayer/Farm1StateOpen.cpp | 0 .../fsfw/datalinklayer/Farm1StateOpen.h | 0 .../datalinklayer/Farm1StateWait.cpp | 0 .../fsfw/datalinklayer/Farm1StateWait.h | 0 .../datalinklayer/MapPacketExtraction.cpp | 0 .../fsfw/datalinklayer/MapPacketExtraction.h | 0 .../datalinklayer/MapPacketExtractionIF.h | 0 .../datalinklayer/TcTransferFrame.cpp | 0 .../fsfw/datalinklayer/TcTransferFrame.h | 0 .../datalinklayer/TcTransferFrameLocal.cpp | 0 .../fsfw/datalinklayer/TcTransferFrameLocal.h | 0 .../datalinklayer/VirtualChannelReception.cpp | 0 .../datalinklayer/VirtualChannelReception.h | 0 .../datalinklayer/VirtualChannelReceptionIF.h | 0 src/{core => fsfw}/datapool/CMakeLists.txt | 0 {inc => src}/fsfw/datapool/DataSetIF.h | 0 .../datapool/HkSwitchHelper.cpp | 0 {inc => src}/fsfw/datapool/HkSwitchHelper.h | 0 .../datapool/PoolDataSetBase.cpp | 0 {inc => src}/fsfw/datapool/PoolDataSetBase.h | 0 {inc => src}/fsfw/datapool/PoolDataSetIF.h | 0 src/{core => fsfw}/datapool/PoolEntry.cpp | 0 {inc => src}/fsfw/datapool/PoolEntry.h | 0 {inc => src}/fsfw/datapool/PoolEntryIF.h | 0 {inc => src}/fsfw/datapool/PoolReadGuard.h | 0 {inc => src}/fsfw/datapool/PoolVarList.h | 0 {inc => src}/fsfw/datapool/PoolVariableIF.h | 0 {inc => src}/fsfw/datapool/ReadCommitIF.h | 0 .../fsfw/datapool/ReadCommitIFAttorney.h | 0 {inc => src}/fsfw/datapool/SharedDataSetIF.h | 0 src/fsfw/datapoollocal.h | 11 +++++++ .../fsfw/datapoollocal/AccessLocalPoolF.h | 0 .../datapoollocal/CMakeLists.txt | 0 .../fsfw/datapoollocal/HasLocalDataPoolIF.h | 0 .../datapoollocal/LocalDataPoolManager.cpp | 0 .../fsfw/datapoollocal/LocalDataPoolManager.h | 0 .../datapoollocal/LocalDataSet.cpp | 0 .../fsfw/datapoollocal/LocalDataSet.h | 0 .../datapoollocal/LocalPoolDataSetBase.cpp | 0 .../fsfw/datapoollocal/LocalPoolDataSetBase.h | 0 .../datapoollocal/LocalPoolObjectBase.cpp | 0 .../fsfw/datapoollocal/LocalPoolObjectBase.h | 0 .../fsfw/datapoollocal/LocalPoolVariable.h | 0 .../fsfw/datapoollocal/LocalPoolVariable.tpp | 0 .../fsfw/datapoollocal/LocalPoolVector.h | 0 .../fsfw/datapoollocal/LocalPoolVector.tpp | 0 .../fsfw/datapoollocal/MarkChangedIF.h | 0 .../ProvidesDataPoolSubscriptionIF.h | 0 .../datapoollocal/SharedLocalDataSet.cpp | 0 .../fsfw/datapoollocal/SharedLocalDataSet.h | 0 .../fsfw/datapoollocal/StaticLocalDataSet.h | 0 .../datapoollocal/internal/CMakeLists.txt | 0 .../internal/HasLocalDpIFManagerAttorney.cpp | 0 .../internal/HasLocalDpIFManagerAttorney.h | 0 .../internal/HasLocalDpIFUserAttorney.cpp | 0 .../internal/HasLocalDpIFUserAttorney.h | 0 .../internal/LocalDpManagerAttorney.h | 0 .../internal/LocalPoolDataSetAttorney.h | 0 .../fsfw/datapoollocal/localPoolDefinitions.h | 0 .../devicehandlers/AcceptsDeviceResponsesIF.h | 0 .../devicehandlers/AssemblyBase.cpp | 0 .../fsfw/devicehandlers/AssemblyBase.h | 0 .../fsfw/devicehandlers/CMakeLists.txt | 0 .../devicehandlers/ChildHandlerBase.cpp | 0 .../fsfw/devicehandlers/ChildHandlerBase.h | 0 .../devicehandlers/ChildHandlerFDIR.cpp | 0 .../fsfw/devicehandlers/ChildHandlerFDIR.h | 0 {inc => src}/fsfw/devicehandlers/CookieIF.h | 0 .../devicehandlers/DeviceCommunicationIF.h | 0 .../devicehandlers/DeviceHandlerBase.cpp | 0 .../fsfw/devicehandlers/DeviceHandlerBase.h | 0 .../DeviceHandlerFailureIsolation.cpp | 0 .../DeviceHandlerFailureIsolation.h | 0 .../fsfw/devicehandlers/DeviceHandlerIF.h | 0 .../devicehandlers/DeviceHandlerMessage.cpp | 0 .../devicehandlers/DeviceHandlerMessage.h | 0 .../devicehandlers/DeviceHandlerThermalSet.h | 0 .../DeviceTmReportingWrapper.cpp | 0 .../devicehandlers/DeviceTmReportingWrapper.h | 0 .../devicehandlers/HealthDevice.cpp | 0 .../fsfw/devicehandlers/HealthDevice.h | 0 src/{core => fsfw}/events/CMakeLists.txt | 0 {inc => src}/fsfw/events/Event.h | 0 src/{core => fsfw}/events/EventManager.cpp | 0 {inc => src}/fsfw/events/EventManager.h | 0 {inc => src}/fsfw/events/EventManagerIF.h | 0 src/{core => fsfw}/events/EventMessage.cpp | 0 {inc => src}/fsfw/events/EventMessage.h | 0 .../fsfw/events/EventReportingProxyIF.h | 0 .../events/eventmatching/CMakeLists.txt | 0 .../eventmatching/EventIdRangeMatcher.cpp | 0 .../eventmatching/EventIdRangeMatcher.h | 0 .../events/eventmatching/EventMatchTree.cpp | 0 .../events/eventmatching/EventMatchTree.h | 0 .../eventmatching/EventRangeMatcherBase.h | 0 .../eventmatching/ReporterRangeMatcher.cpp | 0 .../eventmatching/ReporterRangeMatcher.h | 0 .../eventmatching/SeverityRangeMatcher.cpp | 0 .../eventmatching/SeverityRangeMatcher.h | 0 .../fsfw/events/eventmatching/eventmatching.h | 0 .../fsfw/events/fwSubsystemIdRanges.h | 0 src/{core => fsfw}/fdir/CMakeLists.txt | 0 {inc => src}/fsfw/fdir/ConfirmsFailuresIF.h | 0 src/{core => fsfw}/fdir/EventCorrelation.cpp | 0 {inc => src}/fsfw/fdir/EventCorrelation.h | 0 .../fdir/FailureIsolationBase.cpp | 0 {inc => src}/fsfw/fdir/FailureIsolationBase.h | 0 src/{core => fsfw}/fdir/FaultCounter.cpp | 0 {inc => src}/fsfw/fdir/FaultCounter.h | 0 .../globalfunctions/AsciiConverter.cpp | 0 .../fsfw/globalfunctions/AsciiConverter.h | 0 .../globalfunctions/CMakeLists.txt | 0 src/{core => fsfw}/globalfunctions/CRC.cpp | 0 {inc => src}/fsfw/globalfunctions/CRC.h | 0 .../globalfunctions/DleEncoder.cpp | 0 .../fsfw/globalfunctions/DleEncoder.h | 0 .../PeriodicOperationDivider.cpp | 0 .../PeriodicOperationDivider.h | 0 src/{core => fsfw}/globalfunctions/Type.cpp | 0 {inc => src}/fsfw/globalfunctions/Type.h | 0 .../globalfunctions/arrayprinter.cpp | 0 .../fsfw/globalfunctions/arrayprinter.h | 0 .../globalfunctions/bitutility.cpp | 0 .../fsfw/globalfunctions/bitutility.h | 0 {inc => src}/fsfw/globalfunctions/constants.h | 0 .../globalfunctions/matching/BinaryMatcher.h | 0 .../globalfunctions/matching/DecimalMatcher.h | 0 .../fsfw/globalfunctions/matching/MatchTree.h | 0 .../fsfw/globalfunctions/matching/MatcherIF.h | 0 .../globalfunctions/matching/RangeMatcher.h | 0 .../matching/SerializeableMatcherIF.h | 0 .../globalfunctions/math/CMakeLists.txt | 0 .../globalfunctions/math/MatrixOperations.h | 0 .../math/QuaternionOperations.cpp | 0 .../math/QuaternionOperations.h | 0 .../globalfunctions/math/VectorOperations.h | 0 {inc => src}/fsfw/globalfunctions/sign.h | 0 .../globalfunctions/timevalOperations.cpp | 0 .../fsfw/globalfunctions/timevalOperations.h | 0 src/fsfw/health.h | 9 ++++++ src/{core => fsfw}/health/CMakeLists.txt | 0 {inc => src}/fsfw/health/HasHealthIF.h | 0 src/{core => fsfw}/health/HealthHelper.cpp | 0 {inc => src}/fsfw/health/HealthHelper.h | 0 src/{core => fsfw}/health/HealthMessage.cpp | 0 {inc => src}/fsfw/health/HealthMessage.h | 0 src/{core => fsfw}/health/HealthTable.cpp | 0 {inc => src}/fsfw/health/HealthTable.h | 0 {inc => src}/fsfw/health/HealthTableIF.h | 0 {inc => src}/fsfw/health/ManagesHealthIF.h | 0 src/fsfw/housekeeping.h | 9 ++++++ .../fsfw/housekeeping/AcceptsHkPacketsIF.h | 0 {inc => src}/fsfw/housekeeping/CMakeLists.txt | 0 .../housekeeping/HousekeepingMessage.cpp | 0 .../fsfw/housekeeping/HousekeepingMessage.h | 0 .../housekeeping/HousekeepingPacketDownlink.h | 0 .../fsfw/housekeeping/HousekeepingSetPacket.h | 0 .../fsfw/housekeeping/HousekeepingSnapshot.h | 0 .../PeriodicHousekeepingHelper.cpp | 0 .../housekeeping/PeriodicHousekeepingHelper.h | 0 .../internalerror/CMakeLists.txt | 0 .../fsfw/internalerror/InternalErrorDataset.h | 0 .../internalerror/InternalErrorReporter.cpp | 0 .../internalerror/InternalErrorReporter.h | 0 .../internalerror/InternalErrorReporterIF.h | 0 src/{core => fsfw}/ipc/CMakeLists.txt | 0 src/{core => fsfw}/ipc/CommandMessage.cpp | 0 {inc => src}/fsfw/ipc/CommandMessage.h | 0 .../ipc/CommandMessageCleaner.cpp | 0 {inc => src}/fsfw/ipc/CommandMessageCleaner.h | 0 {inc => src}/fsfw/ipc/CommandMessageIF.h | 0 {inc => src}/fsfw/ipc/FwMessageTypes.h | 0 {inc => src}/fsfw/ipc/MessageQueueIF.h | 0 .../ipc/MessageQueueMessage.cpp | 0 {inc => src}/fsfw/ipc/MessageQueueMessage.h | 0 {inc => src}/fsfw/ipc/MessageQueueMessageIF.h | 0 {inc => src}/fsfw/ipc/MessageQueueSenderIF.h | 0 {inc => src}/fsfw/ipc/MutexFactory.h | 0 {inc => src}/fsfw/ipc/MutexGuard.h | 0 {inc => src}/fsfw/ipc/MutexIF.h | 0 {inc => src}/fsfw/ipc/QueueFactory.h | 0 .../fsfw/ipc/messageQueueDefinitions.h | 0 .../fsfw/memory/AcceptsMemoryMessagesIF.h | 0 src/{core => fsfw}/memory/CMakeLists.txt | 0 .../memory/GenericFileSystemMessage.cpp | 0 .../fsfw/memory/GenericFileSystemMessage.h | 0 {inc => src}/fsfw/memory/HasFileSystemIF.h | 0 {inc => src}/fsfw/memory/HasMemoryIF.h | 0 src/{core => fsfw}/memory/MemoryHelper.cpp | 0 {inc => src}/fsfw/memory/MemoryHelper.h | 0 src/{core => fsfw}/memory/MemoryMessage.cpp | 0 {inc => src}/fsfw/memory/MemoryMessage.h | 0 src/{core => fsfw}/modes/CMakeLists.txt | 0 {inc => src}/fsfw/modes/HasModesIF.h | 0 src/{core => fsfw}/modes/ModeHelper.cpp | 0 {inc => src}/fsfw/modes/ModeHelper.h | 0 src/{core => fsfw}/modes/ModeMessage.cpp | 0 {inc => src}/fsfw/modes/ModeMessage.h | 0 .../fsfw/monitoring/AbsLimitMonitor.h | 0 src/{opt => fsfw}/monitoring/CMakeLists.txt | 0 {inc => src}/fsfw/monitoring/HasMonitorsIF.h | 0 {inc => src}/fsfw/monitoring/LimitMonitor.h | 0 .../monitoring/LimitViolationReporter.cpp | 0 .../fsfw/monitoring/LimitViolationReporter.h | 0 {inc => src}/fsfw/monitoring/MonitorBase.h | 0 .../fsfw/monitoring/MonitorReporter.h | 0 {inc => src}/fsfw/monitoring/MonitoringIF.h | 0 .../monitoring/MonitoringMessage.cpp | 0 .../fsfw/monitoring/MonitoringMessage.h | 0 .../monitoring/MonitoringMessageContent.h | 0 .../monitoring/ReceivesMonitoringReportsIF.h | 0 {inc => src}/fsfw/monitoring/TriplexMonitor.h | 0 .../fsfw/monitoring/TwoValueLimitMonitor.h | 0 .../objectmanager/CMakeLists.txt | 0 .../objectmanager/ObjectManager.cpp | 0 .../fsfw/objectmanager/ObjectManager.h | 0 .../fsfw/objectmanager/ObjectManagerIF.h | 0 .../objectmanager/SystemObject.cpp | 0 .../fsfw/objectmanager/SystemObject.h | 0 .../fsfw/objectmanager/SystemObjectIF.h | 0 .../fsfw/objectmanager/frameworkObjects.h | 0 src/{ => fsfw}/osal/CMakeLists.txt | 0 {inc => src}/fsfw/osal/Endiness.h | 0 {inc => src}/fsfw/osal/InternalErrorCodes.h | 0 src/{ => fsfw}/osal/common/CMakeLists.txt | 0 src/{ => fsfw}/osal/common/TcpIpBase.cpp | 0 {inc => src}/fsfw/osal/common/TcpIpBase.h | 0 src/{ => fsfw}/osal/common/TcpTmTcBridge.cpp | 0 {inc => src}/fsfw/osal/common/TcpTmTcBridge.h | 0 src/{ => fsfw}/osal/common/TcpTmTcServer.cpp | 0 {inc => src}/fsfw/osal/common/TcpTmTcServer.h | 0 .../osal/common/UdpTcPollingTask.cpp | 0 .../fsfw/osal/common/UdpTcPollingTask.h | 0 src/{ => fsfw}/osal/common/UdpTmTcBridge.cpp | 0 {inc => src}/fsfw/osal/common/UdpTmTcBridge.h | 0 src/{ => fsfw}/osal/common/tcpipCommon.cpp | 0 {inc => src}/fsfw/osal/common/tcpipCommon.h | 0 {inc => src}/fsfw/osal/common/tcpipHelpers.h | 0 .../osal/freertos/BinSemaphUsingTask.cpp | 0 .../fsfw/osal/freertos/BinSemaphUsingTask.h | 0 .../osal/freertos/BinarySemaphore.cpp | 0 .../fsfw/osal/freertos/BinarySemaphore.h | 0 src/{ => fsfw}/osal/freertos/CMakeLists.txt | 0 src/{ => fsfw}/osal/freertos/Clock.cpp | 0 .../osal/freertos/CountingSemaphUsingTask.cpp | 0 .../osal/freertos/CountingSemaphUsingTask.h | 0 .../osal/freertos/CountingSemaphore.cpp | 0 .../fsfw/osal/freertos/CountingSemaphore.h | 0 .../osal/freertos/FixedTimeslotTask.cpp | 0 .../fsfw/osal/freertos/FixedTimeslotTask.h | 0 .../fsfw/osal/freertos/FreeRTOSTaskIF.h | 0 src/{ => fsfw}/osal/freertos/MessageQueue.cpp | 0 .../fsfw/osal/freertos/MessageQueue.h | 0 src/{ => fsfw}/osal/freertos/Mutex.cpp | 0 {inc => src}/fsfw/osal/freertos/Mutex.h | 0 src/{ => fsfw}/osal/freertos/MutexFactory.cpp | 0 src/{ => fsfw}/osal/freertos/PeriodicTask.cpp | 0 .../fsfw/osal/freertos/PeriodicTask.h | 0 src/{ => fsfw}/osal/freertos/QueueFactory.cpp | 0 .../osal/freertos/QueueMapManager.cpp | 0 .../fsfw/osal/freertos/QueueMapManager.h | 0 {inc => src}/fsfw/osal/freertos/README.md | 0 .../osal/freertos/SemaphoreFactory.cpp | 0 src/{ => fsfw}/osal/freertos/TaskFactory.cpp | 0 .../osal/freertos/TaskManagement.cpp | 0 .../fsfw/osal/freertos/TaskManagement.h | 0 src/{ => fsfw}/osal/freertos/Timekeeper.cpp | 0 {inc => src}/fsfw/osal/freertos/Timekeeper.h | 0 src/{ => fsfw}/osal/host/CMakeLists.txt | 0 src/{ => fsfw}/osal/host/Clock.cpp | 0 .../osal/host/FixedTimeslotTask.cpp | 0 .../fsfw/osal/host/FixedTimeslotTask.h | 0 src/{ => fsfw}/osal/host/MessageQueue.cpp | 0 {inc => src}/fsfw/osal/host/MessageQueue.h | 10 +++--- src/{ => fsfw}/osal/host/Mutex.cpp | 2 +- {inc => src}/fsfw/osal/host/Mutex.h | 0 src/{ => fsfw}/osal/host/MutexFactory.cpp | 0 src/{ => fsfw}/osal/host/PeriodicTask.cpp | 0 {inc => src}/fsfw/osal/host/PeriodicTask.h | 0 src/{ => fsfw}/osal/host/QueueFactory.cpp | 0 src/{ => fsfw}/osal/host/QueueMapManager.cpp | 0 {inc => src}/fsfw/osal/host/QueueMapManager.h | 0 src/{ => fsfw}/osal/host/SemaphoreFactory.cpp | 0 src/{ => fsfw}/osal/host/TaskFactory.cpp | 0 src/{ => fsfw}/osal/host/taskHelpers.cpp | 0 {inc => src}/fsfw/osal/host/taskHelpers.h | 0 src/{ => fsfw}/osal/linux/BinarySemaphore.cpp | 0 .../fsfw/osal/linux/BinarySemaphore.h | 0 src/{ => fsfw}/osal/linux/CMakeLists.txt | 0 src/{ => fsfw}/osal/linux/Clock.cpp | 0 .../osal/linux/CountingSemaphore.cpp | 0 .../fsfw/osal/linux/CountingSemaphore.h | 0 .../osal/linux/FixedTimeslotTask.cpp | 0 .../fsfw/osal/linux/FixedTimeslotTask.h | 0 .../osal/linux/InternalErrorCodes.cpp | 0 src/{ => fsfw}/osal/linux/MessageQueue.cpp | 0 {inc => src}/fsfw/osal/linux/MessageQueue.h | 0 src/{ => fsfw}/osal/linux/Mutex.cpp | 0 {inc => src}/fsfw/osal/linux/Mutex.h | 0 src/{ => fsfw}/osal/linux/MutexFactory.cpp | 0 .../osal/linux/PeriodicPosixTask.cpp | 0 .../fsfw/osal/linux/PeriodicPosixTask.h | 0 src/{ => fsfw}/osal/linux/PosixThread.cpp | 0 {inc => src}/fsfw/osal/linux/PosixThread.h | 0 src/{ => fsfw}/osal/linux/QueueFactory.cpp | 0 .../osal/linux/SemaphoreFactory.cpp | 0 src/{ => fsfw}/osal/linux/TaskFactory.cpp | 0 src/{ => fsfw}/osal/linux/Timer.cpp | 0 {inc => src}/fsfw/osal/linux/Timer.h | 0 src/{ => fsfw}/osal/linux/tcpipHelpers.cpp | 0 src/{ => fsfw}/osal/linux/unixUtility.cpp | 0 {inc => src}/fsfw/osal/linux/unixUtility.h | 0 src/{ => fsfw}/osal/rtems/BinarySemaphore.cpp | 0 src/{ => fsfw}/osal/rtems/CMakeLists.txt | 0 src/{ => fsfw}/osal/rtems/Clock.cpp | 0 src/{ => fsfw}/osal/rtems/CpuUsage.cpp | 0 {inc => src}/fsfw/osal/rtems/CpuUsage.h | 0 .../osal/rtems/FixedTimeslotTask.cpp | 0 .../fsfw/osal/rtems/FixedTimeslotTask.h | 0 src/{ => fsfw}/osal/rtems/InitTask.cpp | 0 {inc => src}/fsfw/osal/rtems/InitTask.h | 0 .../osal/rtems/InternalErrorCodes.cpp | 0 src/{ => fsfw}/osal/rtems/MessageQueue.cpp | 0 {inc => src}/fsfw/osal/rtems/MessageQueue.h | 0 src/{ => fsfw}/osal/rtems/Mutex.cpp | 0 {inc => src}/fsfw/osal/rtems/Mutex.h | 0 src/{ => fsfw}/osal/rtems/MutexFactory.cpp | 0 src/{ => fsfw}/osal/rtems/PeriodicTask.cpp | 0 {inc => src}/fsfw/osal/rtems/PeriodicTask.h | 0 src/{ => fsfw}/osal/rtems/QueueFactory.cpp | 0 src/{ => fsfw}/osal/rtems/RTEMSTaskBase.cpp | 0 {inc => src}/fsfw/osal/rtems/RTEMSTaskBase.h | 0 src/{ => fsfw}/osal/rtems/RtemsBasic.cpp | 0 {inc => src}/fsfw/osal/rtems/RtemsBasic.h | 0 .../osal/rtems/SemaphoreFactory.cpp | 0 src/{ => fsfw}/osal/rtems/TaskFactory.cpp | 0 src/{ => fsfw}/osal/windows/CMakeLists.txt | 0 src/{ => fsfw}/osal/windows/tcpipHelpers.cpp | 0 .../osal/windows/winTaskHelpers.cpp | 0 .../fsfw/osal/windows/winTaskHelpers.h | 0 src/{core => fsfw}/parameters/CMakeLists.txt | 0 .../fsfw/parameters/HasParametersIF.h | 0 .../parameters/ParameterHelper.cpp | 0 .../fsfw/parameters/ParameterHelper.h | 0 .../parameters/ParameterMessage.cpp | 0 .../fsfw/parameters/ParameterMessage.h | 0 .../parameters/ParameterWrapper.cpp | 0 .../fsfw/parameters/ParameterWrapper.h | 0 .../parameters/ReceivesParameterMessagesIF.h | 0 {inc => src}/fsfw/platform.h | 0 src/{core => fsfw}/power/CMakeLists.txt | 0 src/{core => fsfw}/power/Fuse.cpp | 0 {inc => src}/fsfw/power/Fuse.h | 0 src/{core => fsfw}/power/PowerComponent.cpp | 0 {inc => src}/fsfw/power/PowerComponent.h | 0 {inc => src}/fsfw/power/PowerComponentIF.h | 0 src/{core => fsfw}/power/PowerSensor.cpp | 0 {inc => src}/fsfw/power/PowerSensor.h | 0 {inc => src}/fsfw/power/PowerSwitchIF.h | 0 src/{core => fsfw}/power/PowerSwitcher.cpp | 0 {inc => src}/fsfw/power/PowerSwitcher.h | 0 src/{opt => fsfw}/pus/CMakeLists.txt | 0 .../pus/CService200ModeCommanding.cpp | 0 .../fsfw/pus/CService200ModeCommanding.h | 0 .../pus/CService201HealthCommanding.cpp | 0 .../fsfw/pus/CService201HealthCommanding.h | 0 src/{opt => fsfw}/pus/Service17Test.cpp | 0 {inc => src}/fsfw/pus/Service17Test.h | 0 .../pus/Service1TelecommandVerification.cpp | 0 .../pus/Service1TelecommandVerification.h | 0 .../pus/Service20ParameterManagement.cpp | 0 .../fsfw/pus/Service20ParameterManagement.h | 0 .../pus/Service2DeviceAccess.cpp | 0 {inc => src}/fsfw/pus/Service2DeviceAccess.h | 0 .../pus/Service3Housekeeping.cpp | 0 {inc => src}/fsfw/pus/Service3Housekeeping.h | 0 .../pus/Service5EventReporting.cpp | 0 .../fsfw/pus/Service5EventReporting.h | 0 .../pus/Service8FunctionManagement.cpp | 0 .../fsfw/pus/Service8FunctionManagement.h | 0 .../pus/Service9TimeManagement.cpp | 0 .../fsfw/pus/Service9TimeManagement.h | 0 .../fsfw/pus/servicepackets/Service1Packets.h | 0 .../pus/servicepackets/Service200Packets.h | 0 .../pus/servicepackets/Service201Packets.h | 0 .../pus/servicepackets/Service20Packets.h | 0 .../fsfw/pus/servicepackets/Service2Packets.h | 0 .../fsfw/pus/servicepackets/Service3Packets.h | 0 .../fsfw/pus/servicepackets/Service5Packets.h | 0 .../fsfw/pus/servicepackets/Service8Packets.h | 0 .../fsfw/pus/servicepackets/Service9Packets.h | 0 {inc => src}/fsfw/returnvalues/FwClassIds.h | 0 .../fsfw/returnvalues/HasReturnvaluesIF.h | 0 src/{opt => fsfw}/rmap/CMakeLists.txt | 0 src/{opt => fsfw}/rmap/RMAP.cpp | 0 {inc => src}/fsfw/rmap/RMAP.h | 0 {inc => src}/fsfw/rmap/RMAPChannelIF.h | 0 src/{opt => fsfw}/rmap/RMAPCookie.cpp | 0 {inc => src}/fsfw/rmap/RMAPCookie.h | 0 .../rmap/RmapDeviceCommunicationIF.cpp | 0 .../fsfw/rmap/RmapDeviceCommunicationIF.h | 0 {inc => src}/fsfw/rmap/rmapStructs.h | 0 src/fsfw/serialize.h | 10 ++++++ src/{core => fsfw}/serialize/CMakeLists.txt | 0 {inc => src}/fsfw/serialize/EndianConverter.h | 0 .../fsfw/serialize/SerialArrayListAdapter.h | 0 .../serialize/SerialBufferAdapter.cpp | 0 .../fsfw/serialize/SerialBufferAdapter.h | 0 .../serialize/SerialFixedArrayListAdapter.h | 0 .../fsfw/serialize/SerialLinkedListAdapter.h | 0 .../fsfw/serialize/SerializeAdapter.h | 0 .../fsfw/serialize/SerializeElement.h | 0 {inc => src}/fsfw/serialize/SerializeIF.h | 0 .../serviceinterface/CMakeLists.txt | 0 .../fsfw/serviceinterface/ServiceInterface.h | 0 .../ServiceInterfaceBuffer.cpp | 0 .../serviceinterface/ServiceInterfaceBuffer.h | 0 .../ServiceInterfacePrinter.cpp | 0 .../ServiceInterfacePrinter.h | 0 .../ServiceInterfaceStream.cpp | 0 .../serviceinterface/ServiceInterfaceStream.h | 0 .../serviceInterfaceDefintions.h | 0 .../storagemanager/CMakeLists.txt | 0 .../storagemanager/ConstStorageAccessor.cpp | 0 .../storagemanager/ConstStorageAccessor.h | 0 .../storagemanager/LocalPool.cpp | 0 {inc => src}/fsfw/storagemanager/LocalPool.h | 0 .../storagemanager/PoolManager.cpp | 0 .../fsfw/storagemanager/PoolManager.h | 0 .../storagemanager/StorageAccessor.cpp | 0 .../fsfw/storagemanager/StorageAccessor.h | 0 .../fsfw/storagemanager/StorageManagerIF.h | 0 .../fsfw/storagemanager/storeAddress.h | 0 src/{core => fsfw}/subsystem/CMakeLists.txt | 0 src/{core => fsfw}/subsystem/Subsystem.cpp | 0 {inc => src}/fsfw/subsystem/Subsystem.h | 0 .../subsystem/SubsystemBase.cpp | 0 {inc => src}/fsfw/subsystem/SubsystemBase.h | 0 .../subsystem/modes/CMakeLists.txt | 0 .../fsfw/subsystem/modes/HasModeSequenceIF.h | 0 .../fsfw/subsystem/modes/ModeDefinitions.h | 0 .../subsystem/modes/ModeSequenceMessage.cpp | 0 .../subsystem/modes/ModeSequenceMessage.h | 0 .../subsystem/modes/ModeStore.cpp | 0 {inc => src}/fsfw/subsystem/modes/ModeStore.h | 0 .../fsfw/subsystem/modes/ModeStoreIF.h | 0 src/{core => fsfw}/tasks/CMakeLists.txt | 0 {inc => src}/fsfw/tasks/ExecutableObjectIF.h | 0 .../tasks/FixedSequenceSlot.cpp | 0 {inc => src}/fsfw/tasks/FixedSequenceSlot.h | 0 .../tasks/FixedSlotSequence.cpp | 0 {inc => src}/fsfw/tasks/FixedSlotSequence.h | 0 {inc => src}/fsfw/tasks/FixedTimeslotTaskIF.h | 0 {inc => src}/fsfw/tasks/PeriodicTaskIF.h | 0 {inc => src}/fsfw/tasks/SemaphoreFactory.h | 0 {inc => src}/fsfw/tasks/SemaphoreIF.h | 0 {inc => src}/fsfw/tasks/TaskFactory.h | 0 {inc => src}/fsfw/tasks/Typedef.h | 0 .../tcdistribution/CCSDSDistributor.cpp | 0 .../fsfw/tcdistribution/CCSDSDistributor.h | 0 .../fsfw/tcdistribution/CCSDSDistributorIF.h | 0 .../tcdistribution/CMakeLists.txt | 0 .../tcdistribution/PUSDistributor.cpp | 0 .../fsfw/tcdistribution/PUSDistributor.h | 0 .../fsfw/tcdistribution/PUSDistributorIF.h | 0 .../tcdistribution/TcDistributor.cpp | 0 .../fsfw/tcdistribution/TcDistributor.h | 0 .../tcdistribution/TcPacketCheck.cpp | 0 .../fsfw/tcdistribution/TcPacketCheck.h | 0 .../thermal/AbstractTemperatureSensor.cpp | 0 .../fsfw/thermal/AbstractTemperatureSensor.h | 0 .../fsfw/thermal/AcceptsThermalMessagesIF.h | 0 src/{core => fsfw}/thermal/CMakeLists.txt | 0 src/{core => fsfw}/thermal/Heater.cpp | 0 {inc => src}/fsfw/thermal/Heater.h | 0 .../thermal/RedundantHeater.cpp | 0 {inc => src}/fsfw/thermal/RedundantHeater.h | 0 {inc => src}/fsfw/thermal/TemperatureSensor.h | 0 .../thermal/ThermalComponent.cpp | 0 {inc => src}/fsfw/thermal/ThermalComponent.h | 0 .../thermal/ThermalComponentCore.cpp | 0 .../fsfw/thermal/ThermalComponentCore.h | 0 .../fsfw/thermal/ThermalComponentIF.h | 0 src/{core => fsfw}/thermal/ThermalModule.cpp | 0 {inc => src}/fsfw/thermal/ThermalModule.h | 0 {inc => src}/fsfw/thermal/ThermalModuleIF.h | 0 .../thermal/ThermalMonitorReporter.cpp | 0 .../fsfw/thermal/ThermalMonitorReporter.h | 0 {inc => src}/fsfw/thermal/tcsDefinitions.h | 0 src/{core => fsfw}/timemanager/CCSDSTime.cpp | 0 {inc => src}/fsfw/timemanager/CCSDSTime.h | 0 src/{core => fsfw}/timemanager/CMakeLists.txt | 0 {inc => src}/fsfw/timemanager/Clock.h | 0 .../timemanager/ClockCommon.cpp | 0 src/{core => fsfw}/timemanager/Countdown.cpp | 0 {inc => src}/fsfw/timemanager/Countdown.h | 0 .../fsfw/timemanager/ReceivesTimeInfoIF.h | 0 src/{core => fsfw}/timemanager/Stopwatch.cpp | 0 {inc => src}/fsfw/timemanager/Stopwatch.h | 0 .../timemanager/TimeMessage.cpp | 0 {inc => src}/fsfw/timemanager/TimeMessage.h | 0 .../timemanager/TimeStamper.cpp | 0 {inc => src}/fsfw/timemanager/TimeStamper.h | 0 {inc => src}/fsfw/timemanager/TimeStamperIF.h | 0 .../fsfw/timemanager/clockDefinitions.h | 0 src/{opt => fsfw}/tmstorage/CMakeLists.txt | 0 .../fsfw/tmstorage/TmStoreBackendIF.h | 0 .../fsfw/tmstorage/TmStoreFrontendIF.h | 0 .../tmstorage/TmStoreMessage.cpp | 0 {inc => src}/fsfw/tmstorage/TmStoreMessage.h | 0 {inc => src}/fsfw/tmstorage/TmStorePackets.h | 0 src/{core => fsfw}/tmtcpacket/CMakeLists.txt | 0 src/{core => fsfw}/tmtcpacket/SpacePacket.cpp | 0 {inc => src}/fsfw/tmtcpacket/SpacePacket.h | 0 .../tmtcpacket/SpacePacketBase.cpp | 0 .../fsfw/tmtcpacket/SpacePacketBase.h | 0 {inc => src}/fsfw/tmtcpacket/ccsds_header.h | 0 .../tmtcpacket/packetmatcher/ApidMatcher.h | 0 .../tmtcpacket/packetmatcher/CMakeLists.txt | 0 .../packetmatcher/PacketMatchTree.cpp | 0 .../packetmatcher/PacketMatchTree.h | 0 .../tmtcpacket/packetmatcher/ServiceMatcher.h | 0 .../packetmatcher/SubserviceMatcher.h | 0 .../tmtcpacket/pus/CMakeLists.txt | 0 .../pus/PacketTimestampInterpreterIF.h | 0 {inc => src}/fsfw/tmtcpacket/pus/tc.h | 0 .../tmtcpacket/pus/tc/CMakeLists.txt | 0 .../tmtcpacket/pus/tc/TcPacketBase.cpp | 0 .../fsfw/tmtcpacket/pus/tc/TcPacketBase.h | 0 .../tmtcpacket/pus/tc/TcPacketPus.cpp | 0 .../fsfw/tmtcpacket/pus/tc/TcPacketPus.h | 0 .../tmtcpacket/pus/tc/TcPacketStoredBase.cpp | 0 .../tmtcpacket/pus/tc/TcPacketStoredBase.h | 0 .../fsfw/tmtcpacket/pus/tc/TcPacketStoredIF.h | 0 .../tmtcpacket/pus/tc/TcPacketStoredPus.cpp | 0 .../tmtcpacket/pus/tc/TcPacketStoredPus.h | 0 {inc => src}/fsfw/tmtcpacket/pus/tm.h | 0 .../tmtcpacket/pus/tm/CMakeLists.txt | 0 .../tmtcpacket/pus/tm/TmPacketBase.cpp | 0 .../fsfw/tmtcpacket/pus/tm/TmPacketBase.h | 0 .../tmtcpacket/pus/tm/TmPacketMinimal.cpp | 0 .../fsfw/tmtcpacket/pus/tm/TmPacketMinimal.h | 0 .../tmtcpacket/pus/tm/TmPacketPusA.cpp | 0 .../fsfw/tmtcpacket/pus/tm/TmPacketPusA.h | 0 .../tmtcpacket/pus/tm/TmPacketPusC.cpp | 0 .../fsfw/tmtcpacket/pus/tm/TmPacketPusC.h | 0 .../fsfw/tmtcpacket/pus/tm/TmPacketStored.h | 0 .../tmtcpacket/pus/tm/TmPacketStoredBase.cpp | 0 .../tmtcpacket/pus/tm/TmPacketStoredBase.h | 0 .../tmtcpacket/pus/tm/TmPacketStoredPusA.cpp | 0 .../tmtcpacket/pus/tm/TmPacketStoredPusA.h | 0 .../tmtcpacket/pus/tm/TmPacketStoredPusC.cpp | 0 .../tmtcpacket/pus/tm/TmPacketStoredPusC.h | 0 .../fsfw/tmtcservices/AcceptsTelecommandsIF.h | 0 .../fsfw/tmtcservices/AcceptsTelemetryIF.h | 0 .../tmtcservices/AcceptsVerifyMessageIF.h | 0 .../tmtcservices/CMakeLists.txt | 0 .../tmtcservices/CommandingServiceBase.cpp | 0 .../fsfw/tmtcservices/CommandingServiceBase.h | 0 .../tmtcservices/PusServiceBase.cpp | 0 .../fsfw/tmtcservices/PusServiceBase.h | 0 .../tmtcservices/PusVerificationReport.cpp | 0 .../fsfw/tmtcservices/PusVerificationReport.h | 0 .../fsfw/tmtcservices/SourceSequenceCounter.h | 0 .../tmtcservices/TmTcBridge.cpp | 0 {inc => src}/fsfw/tmtcservices/TmTcBridge.h | 0 .../tmtcservices/TmTcMessage.cpp | 0 {inc => src}/fsfw/tmtcservices/TmTcMessage.h | 0 .../fsfw/tmtcservices/VerificationCodes.h | 0 .../tmtcservices/VerificationReporter.cpp | 0 .../fsfw/tmtcservices/VerificationReporter.h | 0 src/opt/CMakeLists.txt | 6 ---- tests/CMakeLists.txt | 1 - tests/inc/CMakeLists.txt | 7 ---- tests/src/CMakeLists.txt | 14 ++++---- tests/src/fsfw/CMakeLists.txt | 1 + tests/src/fsfw/tests/CMakeLists.txt | 8 +++++ .../{ => fsfw/tests}/internal/CMakeLists.txt | 0 .../tests}/internal/InternalUnitTester.cpp | 0 .../fsfw/tests/internal/InternalUnitTester.h | 0 .../tests}/internal/UnittDefinitions.cpp | 0 .../fsfw/tests/internal/UnittDefinitions.h | 0 .../internal/globalfunctions/CMakeLists.txt | 0 .../globalfunctions/TestArrayPrinter.cpp | 0 .../globalfunctions/TestArrayPrinter.h | 0 .../tests}/internal/osal/CMakeLists.txt | 0 .../tests}/internal/osal/IntTestMq.cpp | 0 .../fsfw/tests/internal/osal/IntTestMq.h | 0 .../tests}/internal/osal/IntTestMutex.cpp | 0 .../fsfw/tests/internal/osal/IntTestMutex.h | 0 .../tests}/internal/osal/IntTestSemaphore.cpp | 0 .../tests/internal/osal/IntTestSemaphore.h | 0 .../tests}/internal/serialize/CMakeLists.txt | 0 .../serialize/IntTestSerialization.cpp | 0 .../internal/serialize/IntTestSerialization.h | 0 .../{tests => fsfw/tests/unit}/CMakeLists.txt | 2 ++ .../tests/unit}/action/CMakeLists.txt | 0 .../tests/unit}/action/TestActionHelper.cpp | 0 .../tests/unit}/action/TestActionHelper.h | 0 .../tests/unit}/container/CMakeLists.txt | 0 .../tests/unit}/container/RingBufferTest.cpp | 0 .../tests/unit}/container/TestArrayList.cpp | 0 .../tests/unit}/container/TestDynamicFifo.cpp | 0 .../tests/unit}/container/TestFifo.cpp | 0 .../unit}/container/TestFixedArrayList.cpp | 0 .../tests/unit}/container/TestFixedMap.cpp | 0 .../container/TestFixedOrderedMultimap.cpp | 0 .../unit}/container/TestPlacementFactory.cpp | 0 .../tests/unit}/datapoollocal/CMakeLists.txt | 0 .../tests/unit}/datapoollocal/DataSetTest.cpp | 0 .../datapoollocal/LocalPoolManagerTest.cpp | 0 .../datapoollocal/LocalPoolOwnerBase.cpp | 0 .../unit}/datapoollocal/LocalPoolOwnerBase.h | 0 .../datapoollocal/LocalPoolVariableTest.cpp | 0 .../datapoollocal/LocalPoolVectorTest.cpp | 0 .../unit}/globalfunctions/CMakeLists.txt | 0 .../tests/unit}/mocks/HkReceiverMock.h | 0 .../tests/unit}/mocks/MessageQueueMockBase.h | 0 .../tests/unit}/osal/CMakeLists.txt | 0 .../tests/unit}/osal/TestMessageQueue.cpp | 0 .../tests/unit}/osal/TestSemaphore.cpp | 0 .../tests/unit}/serialize/CMakeLists.txt | 0 .../serialize/TestSerialBufferAdapter.cpp | 0 .../serialize/TestSerialLinkedPacket.cpp | 0 .../unit}/serialize/TestSerialLinkedPacket.h | 0 .../unit}/serialize/TestSerialization.cpp | 0 .../tests/unit}/storagemanager/CMakeLists.txt | 0 .../unit}/storagemanager/TestNewAccessor.cpp | 0 .../tests/unit}/storagemanager/TestPool.cpp | 0 .../tests/unit}/tmtcpacket/CMakeLists.txt | 0 .../tests/unit}/tmtcpacket/PusTmTest.cpp | 0 767 files changed, 117 insertions(+), 135 deletions(-) delete mode 100644 hal/inc/CMakeLists.txt create mode 100644 hal/src/fsfw/CMakeLists.txt create mode 100644 hal/src/fsfw/hal/CMakeLists.txt rename hal/src/{ => fsfw/hal}/common/CMakeLists.txt (100%) rename hal/src/{ => fsfw/hal}/common/gpio/CMakeLists.txt (100%) rename hal/src/{ => fsfw/hal}/common/gpio/GpioCookie.cpp (100%) rename hal/{inc => src}/fsfw/hal/common/gpio/GpioCookie.h (100%) rename hal/{inc => src}/fsfw/hal/common/gpio/GpioIF.h (100%) rename hal/{inc => src}/fsfw/hal/common/gpio/gpioDefinitions.h (100%) rename hal/{inc => src}/fsfw/hal/common/spi/spiCommon.h (100%) rename hal/src/{ => fsfw/hal}/devicehandlers/CMakeLists.txt (100%) rename hal/src/{ => fsfw/hal}/devicehandlers/GyroL3GD20Handler.cpp (100%) rename hal/{inc => src}/fsfw/hal/devicehandlers/GyroL3GD20Handler.h (100%) rename hal/{inc => src}/fsfw/hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h (100%) rename hal/src/{ => fsfw/hal}/host/CMakeLists.txt (100%) rename hal/src/{ => fsfw/hal}/linux/CMakeLists.txt (100%) rename hal/src/{ => fsfw/hal}/linux/UnixFileGuard.cpp (100%) rename hal/{inc => src}/fsfw/hal/linux/UnixFileGuard.h (100%) rename hal/src/{ => fsfw/hal}/linux/gpio/CMakeLists.txt (100%) rename hal/src/{ => fsfw/hal}/linux/gpio/LinuxLibgpioIF.cpp (100%) rename hal/{inc => src}/fsfw/hal/linux/gpio/LinuxLibgpioIF.h (100%) rename hal/src/{ => fsfw/hal}/linux/i2c/CMakeLists.txt (100%) rename hal/src/{ => fsfw/hal}/linux/i2c/I2cComIF.cpp (100%) rename hal/{inc => src}/fsfw/hal/linux/i2c/I2cComIF.h (100%) rename hal/src/{ => fsfw/hal}/linux/i2c/I2cCookie.cpp (100%) rename hal/{inc => src}/fsfw/hal/linux/i2c/I2cCookie.h (100%) rename hal/src/{ => fsfw/hal}/linux/rpi/CMakeLists.txt (100%) rename hal/src/{ => fsfw/hal}/linux/rpi/GpioRPi.cpp (100%) rename hal/{inc => src}/fsfw/hal/linux/rpi/GpioRPi.h (100%) rename hal/src/{ => fsfw/hal}/linux/spi/CMakeLists.txt (100%) rename hal/src/{ => fsfw/hal}/linux/spi/SpiComIF.cpp (100%) rename hal/{inc => src}/fsfw/hal/linux/spi/SpiComIF.h (100%) rename hal/src/{ => fsfw/hal}/linux/spi/SpiCookie.cpp (100%) rename hal/{inc => src}/fsfw/hal/linux/spi/SpiCookie.h (100%) rename hal/{inc => src}/fsfw/hal/linux/spi/spiDefinitions.h (100%) rename hal/src/{ => fsfw/hal}/linux/uart/CMakeLists.txt (100%) rename hal/src/{ => fsfw/hal}/linux/uart/UartComIF.cpp (100%) rename hal/{inc => src}/fsfw/hal/linux/uart/UartComIF.h (100%) rename hal/src/{ => fsfw/hal}/linux/uart/UartCookie.cpp (100%) rename hal/{inc => src}/fsfw/hal/linux/uart/UartCookie.h (100%) rename hal/src/{ => fsfw/hal}/linux/utility.cpp (100%) rename hal/{inc => src}/fsfw/hal/linux/utility.h (100%) rename hal/src/{ => fsfw/hal}/stm32h7/CMakeLists.txt (100%) rename hal/src/{ => fsfw/hal}/stm32h7/devicetest/CMakeLists.txt (100%) rename hal/src/{ => fsfw/hal}/stm32h7/devicetest/GyroL3GD20H.cpp (100%) rename hal/{inc => src}/fsfw/hal/stm32h7/devicetest/GyroL3GD20H.h (100%) rename hal/src/{ => fsfw/hal}/stm32h7/dma.cpp (100%) rename hal/{inc => src}/fsfw/hal/stm32h7/dma.h (100%) rename hal/src/{ => fsfw/hal}/stm32h7/gpio/CMakeLists.txt (100%) rename hal/src/{ => fsfw/hal}/stm32h7/gpio/gpio.cpp (100%) rename hal/{inc => src}/fsfw/hal/stm32h7/gpio/gpio.h (100%) rename hal/src/{ => fsfw/hal}/stm32h7/i2c/CMakeLists.txt (100%) rename hal/{inc => src}/fsfw/hal/stm32h7/interrupts.h (100%) rename hal/src/{ => fsfw/hal}/stm32h7/spi/CMakeLists.txt (100%) rename hal/src/{ => fsfw/hal}/stm32h7/spi/SpiComIF.cpp (100%) rename hal/{inc => src}/fsfw/hal/stm32h7/spi/SpiComIF.h (100%) rename hal/src/{ => fsfw/hal}/stm32h7/spi/SpiCookie.cpp (100%) rename hal/{inc => src}/fsfw/hal/stm32h7/spi/SpiCookie.h (100%) rename hal/src/{ => fsfw/hal}/stm32h7/spi/mspInit.cpp (100%) rename hal/{inc => src}/fsfw/hal/stm32h7/spi/mspInit.h (100%) rename hal/src/{ => fsfw/hal}/stm32h7/spi/spiCore.cpp (100%) rename hal/{inc => src}/fsfw/hal/stm32h7/spi/spiCore.h (100%) rename hal/src/{ => fsfw/hal}/stm32h7/spi/spiDefinitions.cpp (100%) rename hal/{inc => src}/fsfw/hal/stm32h7/spi/spiDefinitions.h (100%) rename hal/src/{ => fsfw/hal}/stm32h7/spi/spiInterrupts.cpp (100%) rename hal/{inc => src}/fsfw/hal/stm32h7/spi/spiInterrupts.h (100%) rename hal/src/{ => fsfw/hal}/stm32h7/spi/stm32h743ziSpi.cpp (100%) rename hal/{inc => src}/fsfw/hal/stm32h7/spi/stm32h743ziSpi.h (100%) rename hal/src/{ => fsfw/hal}/stm32h7/uart/CMakeLists.txt (100%) delete mode 100644 inc/fsfw/action.h delete mode 100644 inc/fsfw/datapoollocal.h delete mode 100644 inc/fsfw/osal/host/Mutex.cpp delete mode 100644 inc/fsfw/osal/rtems/BinarySemaphore.h delete mode 100644 src/core/devicehandlers/CMakeLists.txt delete mode 100644 src/core/housekeeping/CMakeLists.txt rename src/{core => fsfw}/CMakeLists.txt (78%) rename {inc => src}/fsfw/FSFW.h (100%) rename {inc => src}/fsfw/FSFWVersion.h (100%) create mode 100644 src/fsfw/action.h rename src/{core => fsfw}/action/ActionHelper.cpp (100%) rename {inc => src}/fsfw/action/ActionHelper.h (100%) rename src/{core => fsfw}/action/ActionMessage.cpp (100%) rename {inc => src}/fsfw/action/ActionMessage.h (100%) rename src/{core => fsfw}/action/CMakeLists.txt (100%) rename src/{core => fsfw}/action/CommandActionHelper.cpp (100%) rename {inc => src}/fsfw/action/CommandActionHelper.h (100%) rename {inc => src}/fsfw/action/CommandsActionsIF.h (100%) rename {inc => src}/fsfw/action/HasActionsIF.h (100%) rename src/{core => fsfw}/action/SimpleActionHelper.cpp (100%) rename {inc => src}/fsfw/action/SimpleActionHelper.h (100%) rename {inc => src}/fsfw/container/ArrayList.h (100%) rename {inc => src}/fsfw/container/BinaryTree.h (100%) rename src/{core => fsfw}/container/CMakeLists.txt (100%) rename {inc => src}/fsfw/container/DynamicFIFO.h (100%) rename {inc => src}/fsfw/container/FIFO.h (100%) rename {inc => src}/fsfw/container/FIFOBase.h (100%) rename {inc => src}/fsfw/container/FIFOBase.tpp (100%) rename {inc => src}/fsfw/container/FixedArrayList.h (100%) rename {inc => src}/fsfw/container/FixedMap.h (100%) rename {inc => src}/fsfw/container/FixedOrderedMultimap.h (100%) rename {inc => src}/fsfw/container/FixedOrderedMultimap.tpp (100%) rename {inc => src}/fsfw/container/HybridIterator.h (100%) rename {inc => src}/fsfw/container/IndexedRingMemoryArray.h (100%) rename {inc => src}/fsfw/container/PlacementFactory.h (100%) rename {inc => src}/fsfw/container/RingBufferBase.h (100%) rename src/{core => fsfw}/container/SharedRingBuffer.cpp (100%) rename {inc => src}/fsfw/container/SharedRingBuffer.h (100%) rename src/{core => fsfw}/container/SimpleRingBuffer.cpp (100%) rename {inc => src}/fsfw/container/SimpleRingBuffer.h (100%) rename {inc => src}/fsfw/container/SinglyLinkedList.h (100%) rename {inc => src}/fsfw/container/group.h (100%) rename src/{core => fsfw}/controller/CMakeLists.txt (100%) rename src/{core => fsfw}/controller/ControllerBase.cpp (100%) rename {inc => src}/fsfw/controller/ControllerBase.h (100%) rename src/{core => fsfw}/controller/ExtendedControllerBase.cpp (100%) rename {inc => src}/fsfw/controller/ExtendedControllerBase.h (100%) rename src/{opt => fsfw}/coordinates/CMakeLists.txt (100%) rename src/{opt => fsfw}/coordinates/CoordinateTransformations.cpp (100%) rename {inc => src}/fsfw/coordinates/CoordinateTransformations.h (100%) rename {inc => src}/fsfw/coordinates/Jgm3Model.h (100%) rename src/{opt => fsfw}/coordinates/Sgp4Propagator.cpp (100%) rename {inc => src}/fsfw/coordinates/Sgp4Propagator.h (100%) rename {inc => src}/fsfw/datalinklayer/BCFrame.h (100%) rename {inc => src}/fsfw/datalinklayer/CCSDSReturnValuesIF.h (100%) rename src/{opt => fsfw}/datalinklayer/CMakeLists.txt (100%) rename src/{opt => fsfw}/datalinklayer/Clcw.cpp (100%) rename {inc => src}/fsfw/datalinklayer/Clcw.h (100%) rename {inc => src}/fsfw/datalinklayer/ClcwIF.h (100%) rename src/{opt => fsfw}/datalinklayer/DataLinkLayer.cpp (100%) rename {inc => src}/fsfw/datalinklayer/DataLinkLayer.h (100%) rename {inc => src}/fsfw/datalinklayer/Farm1StateIF.h (100%) rename src/{opt => fsfw}/datalinklayer/Farm1StateLockout.cpp (100%) rename {inc => src}/fsfw/datalinklayer/Farm1StateLockout.h (100%) rename src/{opt => fsfw}/datalinklayer/Farm1StateOpen.cpp (100%) rename {inc => src}/fsfw/datalinklayer/Farm1StateOpen.h (100%) rename src/{opt => fsfw}/datalinklayer/Farm1StateWait.cpp (100%) rename {inc => src}/fsfw/datalinklayer/Farm1StateWait.h (100%) rename src/{opt => fsfw}/datalinklayer/MapPacketExtraction.cpp (100%) rename {inc => src}/fsfw/datalinklayer/MapPacketExtraction.h (100%) rename {inc => src}/fsfw/datalinklayer/MapPacketExtractionIF.h (100%) rename src/{opt => fsfw}/datalinklayer/TcTransferFrame.cpp (100%) rename {inc => src}/fsfw/datalinklayer/TcTransferFrame.h (100%) rename src/{opt => fsfw}/datalinklayer/TcTransferFrameLocal.cpp (100%) rename {inc => src}/fsfw/datalinklayer/TcTransferFrameLocal.h (100%) rename src/{opt => fsfw}/datalinklayer/VirtualChannelReception.cpp (100%) rename {inc => src}/fsfw/datalinklayer/VirtualChannelReception.h (100%) rename {inc => src}/fsfw/datalinklayer/VirtualChannelReceptionIF.h (100%) rename src/{core => fsfw}/datapool/CMakeLists.txt (100%) rename {inc => src}/fsfw/datapool/DataSetIF.h (100%) rename src/{core => fsfw}/datapool/HkSwitchHelper.cpp (100%) rename {inc => src}/fsfw/datapool/HkSwitchHelper.h (100%) rename src/{core => fsfw}/datapool/PoolDataSetBase.cpp (100%) rename {inc => src}/fsfw/datapool/PoolDataSetBase.h (100%) rename {inc => src}/fsfw/datapool/PoolDataSetIF.h (100%) rename src/{core => fsfw}/datapool/PoolEntry.cpp (100%) rename {inc => src}/fsfw/datapool/PoolEntry.h (100%) rename {inc => src}/fsfw/datapool/PoolEntryIF.h (100%) rename {inc => src}/fsfw/datapool/PoolReadGuard.h (100%) rename {inc => src}/fsfw/datapool/PoolVarList.h (100%) rename {inc => src}/fsfw/datapool/PoolVariableIF.h (100%) rename {inc => src}/fsfw/datapool/ReadCommitIF.h (100%) rename {inc => src}/fsfw/datapool/ReadCommitIFAttorney.h (100%) rename {inc => src}/fsfw/datapool/SharedDataSetIF.h (100%) create mode 100644 src/fsfw/datapoollocal.h rename {inc => src}/fsfw/datapoollocal/AccessLocalPoolF.h (100%) rename src/{core => fsfw}/datapoollocal/CMakeLists.txt (100%) rename {inc => src}/fsfw/datapoollocal/HasLocalDataPoolIF.h (100%) rename src/{core => fsfw}/datapoollocal/LocalDataPoolManager.cpp (100%) rename {inc => src}/fsfw/datapoollocal/LocalDataPoolManager.h (100%) rename src/{core => fsfw}/datapoollocal/LocalDataSet.cpp (100%) rename {inc => src}/fsfw/datapoollocal/LocalDataSet.h (100%) rename src/{core => fsfw}/datapoollocal/LocalPoolDataSetBase.cpp (100%) rename {inc => src}/fsfw/datapoollocal/LocalPoolDataSetBase.h (100%) rename src/{core => fsfw}/datapoollocal/LocalPoolObjectBase.cpp (100%) rename {inc => src}/fsfw/datapoollocal/LocalPoolObjectBase.h (100%) rename {inc => src}/fsfw/datapoollocal/LocalPoolVariable.h (100%) rename {inc => src}/fsfw/datapoollocal/LocalPoolVariable.tpp (100%) rename {inc => src}/fsfw/datapoollocal/LocalPoolVector.h (100%) rename {inc => src}/fsfw/datapoollocal/LocalPoolVector.tpp (100%) rename {inc => src}/fsfw/datapoollocal/MarkChangedIF.h (100%) rename {inc => src}/fsfw/datapoollocal/ProvidesDataPoolSubscriptionIF.h (100%) rename src/{core => fsfw}/datapoollocal/SharedLocalDataSet.cpp (100%) rename {inc => src}/fsfw/datapoollocal/SharedLocalDataSet.h (100%) rename {inc => src}/fsfw/datapoollocal/StaticLocalDataSet.h (100%) rename src/{core => fsfw}/datapoollocal/internal/CMakeLists.txt (100%) rename src/{core => fsfw}/datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp (100%) rename src/{core => fsfw}/datapoollocal/internal/HasLocalDpIFManagerAttorney.h (100%) rename src/{core => fsfw}/datapoollocal/internal/HasLocalDpIFUserAttorney.cpp (100%) rename src/{core => fsfw}/datapoollocal/internal/HasLocalDpIFUserAttorney.h (100%) rename {inc => src}/fsfw/datapoollocal/internal/LocalDpManagerAttorney.h (100%) rename src/{core => fsfw}/datapoollocal/internal/LocalPoolDataSetAttorney.h (100%) rename {inc => src}/fsfw/datapoollocal/localPoolDefinitions.h (100%) rename {inc => src}/fsfw/devicehandlers/AcceptsDeviceResponsesIF.h (100%) rename src/{core => fsfw}/devicehandlers/AssemblyBase.cpp (100%) rename {inc => src}/fsfw/devicehandlers/AssemblyBase.h (100%) rename {inc => src}/fsfw/devicehandlers/CMakeLists.txt (100%) rename src/{core => fsfw}/devicehandlers/ChildHandlerBase.cpp (100%) rename {inc => src}/fsfw/devicehandlers/ChildHandlerBase.h (100%) rename src/{core => fsfw}/devicehandlers/ChildHandlerFDIR.cpp (100%) rename {inc => src}/fsfw/devicehandlers/ChildHandlerFDIR.h (100%) rename {inc => src}/fsfw/devicehandlers/CookieIF.h (100%) rename {inc => src}/fsfw/devicehandlers/DeviceCommunicationIF.h (100%) rename src/{core => fsfw}/devicehandlers/DeviceHandlerBase.cpp (100%) rename {inc => src}/fsfw/devicehandlers/DeviceHandlerBase.h (100%) rename src/{core => fsfw}/devicehandlers/DeviceHandlerFailureIsolation.cpp (100%) rename {inc => src}/fsfw/devicehandlers/DeviceHandlerFailureIsolation.h (100%) rename {inc => src}/fsfw/devicehandlers/DeviceHandlerIF.h (100%) rename src/{core => fsfw}/devicehandlers/DeviceHandlerMessage.cpp (100%) rename {inc => src}/fsfw/devicehandlers/DeviceHandlerMessage.h (100%) rename {inc => src}/fsfw/devicehandlers/DeviceHandlerThermalSet.h (100%) rename src/{core => fsfw}/devicehandlers/DeviceTmReportingWrapper.cpp (100%) rename {inc => src}/fsfw/devicehandlers/DeviceTmReportingWrapper.h (100%) rename src/{core => fsfw}/devicehandlers/HealthDevice.cpp (100%) rename {inc => src}/fsfw/devicehandlers/HealthDevice.h (100%) rename src/{core => fsfw}/events/CMakeLists.txt (100%) rename {inc => src}/fsfw/events/Event.h (100%) rename src/{core => fsfw}/events/EventManager.cpp (100%) rename {inc => src}/fsfw/events/EventManager.h (100%) rename {inc => src}/fsfw/events/EventManagerIF.h (100%) rename src/{core => fsfw}/events/EventMessage.cpp (100%) rename {inc => src}/fsfw/events/EventMessage.h (100%) rename {inc => src}/fsfw/events/EventReportingProxyIF.h (100%) rename src/{core => fsfw}/events/eventmatching/CMakeLists.txt (100%) rename src/{core => fsfw}/events/eventmatching/EventIdRangeMatcher.cpp (100%) rename {inc => src}/fsfw/events/eventmatching/EventIdRangeMatcher.h (100%) rename src/{core => fsfw}/events/eventmatching/EventMatchTree.cpp (100%) rename {inc => src}/fsfw/events/eventmatching/EventMatchTree.h (100%) rename {inc => src}/fsfw/events/eventmatching/EventRangeMatcherBase.h (100%) rename src/{core => fsfw}/events/eventmatching/ReporterRangeMatcher.cpp (100%) rename {inc => src}/fsfw/events/eventmatching/ReporterRangeMatcher.h (100%) rename src/{core => fsfw}/events/eventmatching/SeverityRangeMatcher.cpp (100%) rename {inc => src}/fsfw/events/eventmatching/SeverityRangeMatcher.h (100%) rename {inc => src}/fsfw/events/eventmatching/eventmatching.h (100%) rename {inc => src}/fsfw/events/fwSubsystemIdRanges.h (100%) rename src/{core => fsfw}/fdir/CMakeLists.txt (100%) rename {inc => src}/fsfw/fdir/ConfirmsFailuresIF.h (100%) rename src/{core => fsfw}/fdir/EventCorrelation.cpp (100%) rename {inc => src}/fsfw/fdir/EventCorrelation.h (100%) rename src/{core => fsfw}/fdir/FailureIsolationBase.cpp (100%) rename {inc => src}/fsfw/fdir/FailureIsolationBase.h (100%) rename src/{core => fsfw}/fdir/FaultCounter.cpp (100%) rename {inc => src}/fsfw/fdir/FaultCounter.h (100%) rename src/{core => fsfw}/globalfunctions/AsciiConverter.cpp (100%) rename {inc => src}/fsfw/globalfunctions/AsciiConverter.h (100%) rename src/{core => fsfw}/globalfunctions/CMakeLists.txt (100%) rename src/{core => fsfw}/globalfunctions/CRC.cpp (100%) rename {inc => src}/fsfw/globalfunctions/CRC.h (100%) rename src/{core => fsfw}/globalfunctions/DleEncoder.cpp (100%) rename {inc => src}/fsfw/globalfunctions/DleEncoder.h (100%) rename src/{core => fsfw}/globalfunctions/PeriodicOperationDivider.cpp (100%) rename {inc => src}/fsfw/globalfunctions/PeriodicOperationDivider.h (100%) rename src/{core => fsfw}/globalfunctions/Type.cpp (100%) rename {inc => src}/fsfw/globalfunctions/Type.h (100%) rename src/{core => fsfw}/globalfunctions/arrayprinter.cpp (100%) rename {inc => src}/fsfw/globalfunctions/arrayprinter.h (100%) rename src/{core => fsfw}/globalfunctions/bitutility.cpp (100%) rename {inc => src}/fsfw/globalfunctions/bitutility.h (100%) rename {inc => src}/fsfw/globalfunctions/constants.h (100%) rename {inc => src}/fsfw/globalfunctions/matching/BinaryMatcher.h (100%) rename {inc => src}/fsfw/globalfunctions/matching/DecimalMatcher.h (100%) rename {inc => src}/fsfw/globalfunctions/matching/MatchTree.h (100%) rename {inc => src}/fsfw/globalfunctions/matching/MatcherIF.h (100%) rename {inc => src}/fsfw/globalfunctions/matching/RangeMatcher.h (100%) rename {inc => src}/fsfw/globalfunctions/matching/SerializeableMatcherIF.h (100%) rename src/{core => fsfw}/globalfunctions/math/CMakeLists.txt (100%) rename {inc => src}/fsfw/globalfunctions/math/MatrixOperations.h (100%) rename src/{core => fsfw}/globalfunctions/math/QuaternionOperations.cpp (100%) rename {inc => src}/fsfw/globalfunctions/math/QuaternionOperations.h (100%) rename {inc => src}/fsfw/globalfunctions/math/VectorOperations.h (100%) rename {inc => src}/fsfw/globalfunctions/sign.h (100%) rename src/{core => fsfw}/globalfunctions/timevalOperations.cpp (100%) rename {inc => src}/fsfw/globalfunctions/timevalOperations.h (100%) create mode 100644 src/fsfw/health.h rename src/{core => fsfw}/health/CMakeLists.txt (100%) rename {inc => src}/fsfw/health/HasHealthIF.h (100%) rename src/{core => fsfw}/health/HealthHelper.cpp (100%) rename {inc => src}/fsfw/health/HealthHelper.h (100%) rename src/{core => fsfw}/health/HealthMessage.cpp (100%) rename {inc => src}/fsfw/health/HealthMessage.h (100%) rename src/{core => fsfw}/health/HealthTable.cpp (100%) rename {inc => src}/fsfw/health/HealthTable.h (100%) rename {inc => src}/fsfw/health/HealthTableIF.h (100%) rename {inc => src}/fsfw/health/ManagesHealthIF.h (100%) create mode 100644 src/fsfw/housekeeping.h rename {inc => src}/fsfw/housekeeping/AcceptsHkPacketsIF.h (100%) rename {inc => src}/fsfw/housekeeping/CMakeLists.txt (100%) rename src/{core => fsfw}/housekeeping/HousekeepingMessage.cpp (100%) rename {inc => src}/fsfw/housekeeping/HousekeepingMessage.h (100%) rename {inc => src}/fsfw/housekeeping/HousekeepingPacketDownlink.h (100%) rename {inc => src}/fsfw/housekeeping/HousekeepingSetPacket.h (100%) rename {inc => src}/fsfw/housekeeping/HousekeepingSnapshot.h (100%) rename src/{core => fsfw}/housekeeping/PeriodicHousekeepingHelper.cpp (100%) rename {inc => src}/fsfw/housekeeping/PeriodicHousekeepingHelper.h (100%) rename src/{core => fsfw}/internalerror/CMakeLists.txt (100%) rename {inc => src}/fsfw/internalerror/InternalErrorDataset.h (100%) rename src/{core => fsfw}/internalerror/InternalErrorReporter.cpp (100%) rename {inc => src}/fsfw/internalerror/InternalErrorReporter.h (100%) rename {inc => src}/fsfw/internalerror/InternalErrorReporterIF.h (100%) rename src/{core => fsfw}/ipc/CMakeLists.txt (100%) rename src/{core => fsfw}/ipc/CommandMessage.cpp (100%) rename {inc => src}/fsfw/ipc/CommandMessage.h (100%) rename src/{core => fsfw}/ipc/CommandMessageCleaner.cpp (100%) rename {inc => src}/fsfw/ipc/CommandMessageCleaner.h (100%) rename {inc => src}/fsfw/ipc/CommandMessageIF.h (100%) rename {inc => src}/fsfw/ipc/FwMessageTypes.h (100%) rename {inc => src}/fsfw/ipc/MessageQueueIF.h (100%) rename src/{core => fsfw}/ipc/MessageQueueMessage.cpp (100%) rename {inc => src}/fsfw/ipc/MessageQueueMessage.h (100%) rename {inc => src}/fsfw/ipc/MessageQueueMessageIF.h (100%) rename {inc => src}/fsfw/ipc/MessageQueueSenderIF.h (100%) rename {inc => src}/fsfw/ipc/MutexFactory.h (100%) rename {inc => src}/fsfw/ipc/MutexGuard.h (100%) rename {inc => src}/fsfw/ipc/MutexIF.h (100%) rename {inc => src}/fsfw/ipc/QueueFactory.h (100%) rename {inc => src}/fsfw/ipc/messageQueueDefinitions.h (100%) rename {inc => src}/fsfw/memory/AcceptsMemoryMessagesIF.h (100%) rename src/{core => fsfw}/memory/CMakeLists.txt (100%) rename src/{core => fsfw}/memory/GenericFileSystemMessage.cpp (100%) rename {inc => src}/fsfw/memory/GenericFileSystemMessage.h (100%) rename {inc => src}/fsfw/memory/HasFileSystemIF.h (100%) rename {inc => src}/fsfw/memory/HasMemoryIF.h (100%) rename src/{core => fsfw}/memory/MemoryHelper.cpp (100%) rename {inc => src}/fsfw/memory/MemoryHelper.h (100%) rename src/{core => fsfw}/memory/MemoryMessage.cpp (100%) rename {inc => src}/fsfw/memory/MemoryMessage.h (100%) rename src/{core => fsfw}/modes/CMakeLists.txt (100%) rename {inc => src}/fsfw/modes/HasModesIF.h (100%) rename src/{core => fsfw}/modes/ModeHelper.cpp (100%) rename {inc => src}/fsfw/modes/ModeHelper.h (100%) rename src/{core => fsfw}/modes/ModeMessage.cpp (100%) rename {inc => src}/fsfw/modes/ModeMessage.h (100%) rename {inc => src}/fsfw/monitoring/AbsLimitMonitor.h (100%) rename src/{opt => fsfw}/monitoring/CMakeLists.txt (100%) rename {inc => src}/fsfw/monitoring/HasMonitorsIF.h (100%) rename {inc => src}/fsfw/monitoring/LimitMonitor.h (100%) rename src/{opt => fsfw}/monitoring/LimitViolationReporter.cpp (100%) rename {inc => src}/fsfw/monitoring/LimitViolationReporter.h (100%) rename {inc => src}/fsfw/monitoring/MonitorBase.h (100%) rename {inc => src}/fsfw/monitoring/MonitorReporter.h (100%) rename {inc => src}/fsfw/monitoring/MonitoringIF.h (100%) rename src/{opt => fsfw}/monitoring/MonitoringMessage.cpp (100%) rename {inc => src}/fsfw/monitoring/MonitoringMessage.h (100%) rename {inc => src}/fsfw/monitoring/MonitoringMessageContent.h (100%) rename {inc => src}/fsfw/monitoring/ReceivesMonitoringReportsIF.h (100%) rename {inc => src}/fsfw/monitoring/TriplexMonitor.h (100%) rename {inc => src}/fsfw/monitoring/TwoValueLimitMonitor.h (100%) rename src/{core => fsfw}/objectmanager/CMakeLists.txt (100%) rename src/{core => fsfw}/objectmanager/ObjectManager.cpp (100%) rename {inc => src}/fsfw/objectmanager/ObjectManager.h (100%) rename {inc => src}/fsfw/objectmanager/ObjectManagerIF.h (100%) rename src/{core => fsfw}/objectmanager/SystemObject.cpp (100%) rename {inc => src}/fsfw/objectmanager/SystemObject.h (100%) rename {inc => src}/fsfw/objectmanager/SystemObjectIF.h (100%) rename {inc => src}/fsfw/objectmanager/frameworkObjects.h (100%) rename src/{ => fsfw}/osal/CMakeLists.txt (100%) rename {inc => src}/fsfw/osal/Endiness.h (100%) rename {inc => src}/fsfw/osal/InternalErrorCodes.h (100%) rename src/{ => fsfw}/osal/common/CMakeLists.txt (100%) rename src/{ => fsfw}/osal/common/TcpIpBase.cpp (100%) rename {inc => src}/fsfw/osal/common/TcpIpBase.h (100%) rename src/{ => fsfw}/osal/common/TcpTmTcBridge.cpp (100%) rename {inc => src}/fsfw/osal/common/TcpTmTcBridge.h (100%) rename src/{ => fsfw}/osal/common/TcpTmTcServer.cpp (100%) rename {inc => src}/fsfw/osal/common/TcpTmTcServer.h (100%) rename src/{ => fsfw}/osal/common/UdpTcPollingTask.cpp (100%) rename {inc => src}/fsfw/osal/common/UdpTcPollingTask.h (100%) rename src/{ => fsfw}/osal/common/UdpTmTcBridge.cpp (100%) rename {inc => src}/fsfw/osal/common/UdpTmTcBridge.h (100%) rename src/{ => fsfw}/osal/common/tcpipCommon.cpp (100%) rename {inc => src}/fsfw/osal/common/tcpipCommon.h (100%) rename {inc => src}/fsfw/osal/common/tcpipHelpers.h (100%) rename src/{ => fsfw}/osal/freertos/BinSemaphUsingTask.cpp (100%) rename {inc => src}/fsfw/osal/freertos/BinSemaphUsingTask.h (100%) rename src/{ => fsfw}/osal/freertos/BinarySemaphore.cpp (100%) rename {inc => src}/fsfw/osal/freertos/BinarySemaphore.h (100%) rename src/{ => fsfw}/osal/freertos/CMakeLists.txt (100%) rename src/{ => fsfw}/osal/freertos/Clock.cpp (100%) rename src/{ => fsfw}/osal/freertos/CountingSemaphUsingTask.cpp (100%) rename {inc => src}/fsfw/osal/freertos/CountingSemaphUsingTask.h (100%) rename src/{ => fsfw}/osal/freertos/CountingSemaphore.cpp (100%) rename {inc => src}/fsfw/osal/freertos/CountingSemaphore.h (100%) rename src/{ => fsfw}/osal/freertos/FixedTimeslotTask.cpp (100%) rename {inc => src}/fsfw/osal/freertos/FixedTimeslotTask.h (100%) rename {inc => src}/fsfw/osal/freertos/FreeRTOSTaskIF.h (100%) rename src/{ => fsfw}/osal/freertos/MessageQueue.cpp (100%) rename {inc => src}/fsfw/osal/freertos/MessageQueue.h (100%) rename src/{ => fsfw}/osal/freertos/Mutex.cpp (100%) rename {inc => src}/fsfw/osal/freertos/Mutex.h (100%) rename src/{ => fsfw}/osal/freertos/MutexFactory.cpp (100%) rename src/{ => fsfw}/osal/freertos/PeriodicTask.cpp (100%) rename {inc => src}/fsfw/osal/freertos/PeriodicTask.h (100%) rename src/{ => fsfw}/osal/freertos/QueueFactory.cpp (100%) rename src/{ => fsfw}/osal/freertos/QueueMapManager.cpp (100%) rename {inc => src}/fsfw/osal/freertos/QueueMapManager.h (100%) rename {inc => src}/fsfw/osal/freertos/README.md (100%) rename src/{ => fsfw}/osal/freertos/SemaphoreFactory.cpp (100%) rename src/{ => fsfw}/osal/freertos/TaskFactory.cpp (100%) rename src/{ => fsfw}/osal/freertos/TaskManagement.cpp (100%) rename {inc => src}/fsfw/osal/freertos/TaskManagement.h (100%) rename src/{ => fsfw}/osal/freertos/Timekeeper.cpp (100%) rename {inc => src}/fsfw/osal/freertos/Timekeeper.h (100%) rename src/{ => fsfw}/osal/host/CMakeLists.txt (100%) rename src/{ => fsfw}/osal/host/Clock.cpp (100%) rename src/{ => fsfw}/osal/host/FixedTimeslotTask.cpp (100%) rename {inc => src}/fsfw/osal/host/FixedTimeslotTask.h (100%) rename src/{ => fsfw}/osal/host/MessageQueue.cpp (100%) rename {inc => src}/fsfw/osal/host/MessageQueue.h (97%) rename src/{ => fsfw}/osal/host/Mutex.cpp (95%) rename {inc => src}/fsfw/osal/host/Mutex.h (100%) rename src/{ => fsfw}/osal/host/MutexFactory.cpp (100%) rename src/{ => fsfw}/osal/host/PeriodicTask.cpp (100%) rename {inc => src}/fsfw/osal/host/PeriodicTask.h (100%) rename src/{ => fsfw}/osal/host/QueueFactory.cpp (100%) rename src/{ => fsfw}/osal/host/QueueMapManager.cpp (100%) rename {inc => src}/fsfw/osal/host/QueueMapManager.h (100%) rename src/{ => fsfw}/osal/host/SemaphoreFactory.cpp (100%) rename src/{ => fsfw}/osal/host/TaskFactory.cpp (100%) rename src/{ => fsfw}/osal/host/taskHelpers.cpp (100%) rename {inc => src}/fsfw/osal/host/taskHelpers.h (100%) rename src/{ => fsfw}/osal/linux/BinarySemaphore.cpp (100%) rename {inc => src}/fsfw/osal/linux/BinarySemaphore.h (100%) rename src/{ => fsfw}/osal/linux/CMakeLists.txt (100%) rename src/{ => fsfw}/osal/linux/Clock.cpp (100%) rename src/{ => fsfw}/osal/linux/CountingSemaphore.cpp (100%) rename {inc => src}/fsfw/osal/linux/CountingSemaphore.h (100%) rename src/{ => fsfw}/osal/linux/FixedTimeslotTask.cpp (100%) rename {inc => src}/fsfw/osal/linux/FixedTimeslotTask.h (100%) rename src/{ => fsfw}/osal/linux/InternalErrorCodes.cpp (100%) rename src/{ => fsfw}/osal/linux/MessageQueue.cpp (100%) rename {inc => src}/fsfw/osal/linux/MessageQueue.h (100%) rename src/{ => fsfw}/osal/linux/Mutex.cpp (100%) rename {inc => src}/fsfw/osal/linux/Mutex.h (100%) rename src/{ => fsfw}/osal/linux/MutexFactory.cpp (100%) rename src/{ => fsfw}/osal/linux/PeriodicPosixTask.cpp (100%) rename {inc => src}/fsfw/osal/linux/PeriodicPosixTask.h (100%) rename src/{ => fsfw}/osal/linux/PosixThread.cpp (100%) rename {inc => src}/fsfw/osal/linux/PosixThread.h (100%) rename src/{ => fsfw}/osal/linux/QueueFactory.cpp (100%) rename src/{ => fsfw}/osal/linux/SemaphoreFactory.cpp (100%) rename src/{ => fsfw}/osal/linux/TaskFactory.cpp (100%) rename src/{ => fsfw}/osal/linux/Timer.cpp (100%) rename {inc => src}/fsfw/osal/linux/Timer.h (100%) rename src/{ => fsfw}/osal/linux/tcpipHelpers.cpp (100%) rename src/{ => fsfw}/osal/linux/unixUtility.cpp (100%) rename {inc => src}/fsfw/osal/linux/unixUtility.h (100%) rename src/{ => fsfw}/osal/rtems/BinarySemaphore.cpp (100%) rename src/{ => fsfw}/osal/rtems/CMakeLists.txt (100%) rename src/{ => fsfw}/osal/rtems/Clock.cpp (100%) rename src/{ => fsfw}/osal/rtems/CpuUsage.cpp (100%) rename {inc => src}/fsfw/osal/rtems/CpuUsage.h (100%) rename src/{ => fsfw}/osal/rtems/FixedTimeslotTask.cpp (100%) rename {inc => src}/fsfw/osal/rtems/FixedTimeslotTask.h (100%) rename src/{ => fsfw}/osal/rtems/InitTask.cpp (100%) rename {inc => src}/fsfw/osal/rtems/InitTask.h (100%) rename src/{ => fsfw}/osal/rtems/InternalErrorCodes.cpp (100%) rename src/{ => fsfw}/osal/rtems/MessageQueue.cpp (100%) rename {inc => src}/fsfw/osal/rtems/MessageQueue.h (100%) rename src/{ => fsfw}/osal/rtems/Mutex.cpp (100%) rename {inc => src}/fsfw/osal/rtems/Mutex.h (100%) rename src/{ => fsfw}/osal/rtems/MutexFactory.cpp (100%) rename src/{ => fsfw}/osal/rtems/PeriodicTask.cpp (100%) rename {inc => src}/fsfw/osal/rtems/PeriodicTask.h (100%) rename src/{ => fsfw}/osal/rtems/QueueFactory.cpp (100%) rename src/{ => fsfw}/osal/rtems/RTEMSTaskBase.cpp (100%) rename {inc => src}/fsfw/osal/rtems/RTEMSTaskBase.h (100%) rename src/{ => fsfw}/osal/rtems/RtemsBasic.cpp (100%) rename {inc => src}/fsfw/osal/rtems/RtemsBasic.h (100%) rename src/{ => fsfw}/osal/rtems/SemaphoreFactory.cpp (100%) rename src/{ => fsfw}/osal/rtems/TaskFactory.cpp (100%) rename src/{ => fsfw}/osal/windows/CMakeLists.txt (100%) rename src/{ => fsfw}/osal/windows/tcpipHelpers.cpp (100%) rename src/{ => fsfw}/osal/windows/winTaskHelpers.cpp (100%) rename {inc => src}/fsfw/osal/windows/winTaskHelpers.h (100%) rename src/{core => fsfw}/parameters/CMakeLists.txt (100%) rename {inc => src}/fsfw/parameters/HasParametersIF.h (100%) rename src/{core => fsfw}/parameters/ParameterHelper.cpp (100%) rename {inc => src}/fsfw/parameters/ParameterHelper.h (100%) rename src/{core => fsfw}/parameters/ParameterMessage.cpp (100%) rename {inc => src}/fsfw/parameters/ParameterMessage.h (100%) rename src/{core => fsfw}/parameters/ParameterWrapper.cpp (100%) rename {inc => src}/fsfw/parameters/ParameterWrapper.h (100%) rename {inc => src}/fsfw/parameters/ReceivesParameterMessagesIF.h (100%) rename {inc => src}/fsfw/platform.h (100%) rename src/{core => fsfw}/power/CMakeLists.txt (100%) rename src/{core => fsfw}/power/Fuse.cpp (100%) rename {inc => src}/fsfw/power/Fuse.h (100%) rename src/{core => fsfw}/power/PowerComponent.cpp (100%) rename {inc => src}/fsfw/power/PowerComponent.h (100%) rename {inc => src}/fsfw/power/PowerComponentIF.h (100%) rename src/{core => fsfw}/power/PowerSensor.cpp (100%) rename {inc => src}/fsfw/power/PowerSensor.h (100%) rename {inc => src}/fsfw/power/PowerSwitchIF.h (100%) rename src/{core => fsfw}/power/PowerSwitcher.cpp (100%) rename {inc => src}/fsfw/power/PowerSwitcher.h (100%) rename src/{opt => fsfw}/pus/CMakeLists.txt (100%) rename src/{opt => fsfw}/pus/CService200ModeCommanding.cpp (100%) rename {inc => src}/fsfw/pus/CService200ModeCommanding.h (100%) rename src/{opt => fsfw}/pus/CService201HealthCommanding.cpp (100%) rename {inc => src}/fsfw/pus/CService201HealthCommanding.h (100%) rename src/{opt => fsfw}/pus/Service17Test.cpp (100%) rename {inc => src}/fsfw/pus/Service17Test.h (100%) rename src/{opt => fsfw}/pus/Service1TelecommandVerification.cpp (100%) rename {inc => src}/fsfw/pus/Service1TelecommandVerification.h (100%) rename src/{opt => fsfw}/pus/Service20ParameterManagement.cpp (100%) rename {inc => src}/fsfw/pus/Service20ParameterManagement.h (100%) rename src/{opt => fsfw}/pus/Service2DeviceAccess.cpp (100%) rename {inc => src}/fsfw/pus/Service2DeviceAccess.h (100%) rename src/{opt => fsfw}/pus/Service3Housekeeping.cpp (100%) rename {inc => src}/fsfw/pus/Service3Housekeeping.h (100%) rename src/{opt => fsfw}/pus/Service5EventReporting.cpp (100%) rename {inc => src}/fsfw/pus/Service5EventReporting.h (100%) rename src/{opt => fsfw}/pus/Service8FunctionManagement.cpp (100%) rename {inc => src}/fsfw/pus/Service8FunctionManagement.h (100%) rename src/{opt => fsfw}/pus/Service9TimeManagement.cpp (100%) rename {inc => src}/fsfw/pus/Service9TimeManagement.h (100%) rename {inc => src}/fsfw/pus/servicepackets/Service1Packets.h (100%) rename {inc => src}/fsfw/pus/servicepackets/Service200Packets.h (100%) rename {inc => src}/fsfw/pus/servicepackets/Service201Packets.h (100%) rename {inc => src}/fsfw/pus/servicepackets/Service20Packets.h (100%) rename {inc => src}/fsfw/pus/servicepackets/Service2Packets.h (100%) rename {inc => src}/fsfw/pus/servicepackets/Service3Packets.h (100%) rename {inc => src}/fsfw/pus/servicepackets/Service5Packets.h (100%) rename {inc => src}/fsfw/pus/servicepackets/Service8Packets.h (100%) rename {inc => src}/fsfw/pus/servicepackets/Service9Packets.h (100%) rename {inc => src}/fsfw/returnvalues/FwClassIds.h (100%) rename {inc => src}/fsfw/returnvalues/HasReturnvaluesIF.h (100%) rename src/{opt => fsfw}/rmap/CMakeLists.txt (100%) rename src/{opt => fsfw}/rmap/RMAP.cpp (100%) rename {inc => src}/fsfw/rmap/RMAP.h (100%) rename {inc => src}/fsfw/rmap/RMAPChannelIF.h (100%) rename src/{opt => fsfw}/rmap/RMAPCookie.cpp (100%) rename {inc => src}/fsfw/rmap/RMAPCookie.h (100%) rename src/{opt => fsfw}/rmap/RmapDeviceCommunicationIF.cpp (100%) rename {inc => src}/fsfw/rmap/RmapDeviceCommunicationIF.h (100%) rename {inc => src}/fsfw/rmap/rmapStructs.h (100%) create mode 100644 src/fsfw/serialize.h rename src/{core => fsfw}/serialize/CMakeLists.txt (100%) rename {inc => src}/fsfw/serialize/EndianConverter.h (100%) rename {inc => src}/fsfw/serialize/SerialArrayListAdapter.h (100%) rename src/{core => fsfw}/serialize/SerialBufferAdapter.cpp (100%) rename {inc => src}/fsfw/serialize/SerialBufferAdapter.h (100%) rename {inc => src}/fsfw/serialize/SerialFixedArrayListAdapter.h (100%) rename {inc => src}/fsfw/serialize/SerialLinkedListAdapter.h (100%) rename {inc => src}/fsfw/serialize/SerializeAdapter.h (100%) rename {inc => src}/fsfw/serialize/SerializeElement.h (100%) rename {inc => src}/fsfw/serialize/SerializeIF.h (100%) rename src/{core => fsfw}/serviceinterface/CMakeLists.txt (100%) rename {inc => src}/fsfw/serviceinterface/ServiceInterface.h (100%) rename src/{core => fsfw}/serviceinterface/ServiceInterfaceBuffer.cpp (100%) rename {inc => src}/fsfw/serviceinterface/ServiceInterfaceBuffer.h (100%) rename src/{core => fsfw}/serviceinterface/ServiceInterfacePrinter.cpp (100%) rename {inc => src}/fsfw/serviceinterface/ServiceInterfacePrinter.h (100%) rename src/{core => fsfw}/serviceinterface/ServiceInterfaceStream.cpp (100%) rename {inc => src}/fsfw/serviceinterface/ServiceInterfaceStream.h (100%) rename {inc => src}/fsfw/serviceinterface/serviceInterfaceDefintions.h (100%) rename src/{core => fsfw}/storagemanager/CMakeLists.txt (100%) rename src/{core => fsfw}/storagemanager/ConstStorageAccessor.cpp (100%) rename {inc => src}/fsfw/storagemanager/ConstStorageAccessor.h (100%) rename src/{core => fsfw}/storagemanager/LocalPool.cpp (100%) rename {inc => src}/fsfw/storagemanager/LocalPool.h (100%) rename src/{core => fsfw}/storagemanager/PoolManager.cpp (100%) rename {inc => src}/fsfw/storagemanager/PoolManager.h (100%) rename src/{core => fsfw}/storagemanager/StorageAccessor.cpp (100%) rename {inc => src}/fsfw/storagemanager/StorageAccessor.h (100%) rename {inc => src}/fsfw/storagemanager/StorageManagerIF.h (100%) rename {inc => src}/fsfw/storagemanager/storeAddress.h (100%) rename src/{core => fsfw}/subsystem/CMakeLists.txt (100%) rename src/{core => fsfw}/subsystem/Subsystem.cpp (100%) rename {inc => src}/fsfw/subsystem/Subsystem.h (100%) rename src/{core => fsfw}/subsystem/SubsystemBase.cpp (100%) rename {inc => src}/fsfw/subsystem/SubsystemBase.h (100%) rename src/{core => fsfw}/subsystem/modes/CMakeLists.txt (100%) rename {inc => src}/fsfw/subsystem/modes/HasModeSequenceIF.h (100%) rename {inc => src}/fsfw/subsystem/modes/ModeDefinitions.h (100%) rename src/{core => fsfw}/subsystem/modes/ModeSequenceMessage.cpp (100%) rename {inc => src}/fsfw/subsystem/modes/ModeSequenceMessage.h (100%) rename src/{core => fsfw}/subsystem/modes/ModeStore.cpp (100%) rename {inc => src}/fsfw/subsystem/modes/ModeStore.h (100%) rename {inc => src}/fsfw/subsystem/modes/ModeStoreIF.h (100%) rename src/{core => fsfw}/tasks/CMakeLists.txt (100%) rename {inc => src}/fsfw/tasks/ExecutableObjectIF.h (100%) rename src/{core => fsfw}/tasks/FixedSequenceSlot.cpp (100%) rename {inc => src}/fsfw/tasks/FixedSequenceSlot.h (100%) rename src/{core => fsfw}/tasks/FixedSlotSequence.cpp (100%) rename {inc => src}/fsfw/tasks/FixedSlotSequence.h (100%) rename {inc => src}/fsfw/tasks/FixedTimeslotTaskIF.h (100%) rename {inc => src}/fsfw/tasks/PeriodicTaskIF.h (100%) rename {inc => src}/fsfw/tasks/SemaphoreFactory.h (100%) rename {inc => src}/fsfw/tasks/SemaphoreIF.h (100%) rename {inc => src}/fsfw/tasks/TaskFactory.h (100%) rename {inc => src}/fsfw/tasks/Typedef.h (100%) rename src/{core => fsfw}/tcdistribution/CCSDSDistributor.cpp (100%) rename {inc => src}/fsfw/tcdistribution/CCSDSDistributor.h (100%) rename {inc => src}/fsfw/tcdistribution/CCSDSDistributorIF.h (100%) rename src/{core => fsfw}/tcdistribution/CMakeLists.txt (100%) rename src/{core => fsfw}/tcdistribution/PUSDistributor.cpp (100%) rename {inc => src}/fsfw/tcdistribution/PUSDistributor.h (100%) rename {inc => src}/fsfw/tcdistribution/PUSDistributorIF.h (100%) rename src/{core => fsfw}/tcdistribution/TcDistributor.cpp (100%) rename {inc => src}/fsfw/tcdistribution/TcDistributor.h (100%) rename src/{core => fsfw}/tcdistribution/TcPacketCheck.cpp (100%) rename {inc => src}/fsfw/tcdistribution/TcPacketCheck.h (100%) rename src/{core => fsfw}/thermal/AbstractTemperatureSensor.cpp (100%) rename {inc => src}/fsfw/thermal/AbstractTemperatureSensor.h (100%) rename {inc => src}/fsfw/thermal/AcceptsThermalMessagesIF.h (100%) rename src/{core => fsfw}/thermal/CMakeLists.txt (100%) rename src/{core => fsfw}/thermal/Heater.cpp (100%) rename {inc => src}/fsfw/thermal/Heater.h (100%) rename src/{core => fsfw}/thermal/RedundantHeater.cpp (100%) rename {inc => src}/fsfw/thermal/RedundantHeater.h (100%) rename {inc => src}/fsfw/thermal/TemperatureSensor.h (100%) rename src/{core => fsfw}/thermal/ThermalComponent.cpp (100%) rename {inc => src}/fsfw/thermal/ThermalComponent.h (100%) rename src/{core => fsfw}/thermal/ThermalComponentCore.cpp (100%) rename {inc => src}/fsfw/thermal/ThermalComponentCore.h (100%) rename {inc => src}/fsfw/thermal/ThermalComponentIF.h (100%) rename src/{core => fsfw}/thermal/ThermalModule.cpp (100%) rename {inc => src}/fsfw/thermal/ThermalModule.h (100%) rename {inc => src}/fsfw/thermal/ThermalModuleIF.h (100%) rename src/{core => fsfw}/thermal/ThermalMonitorReporter.cpp (100%) rename {inc => src}/fsfw/thermal/ThermalMonitorReporter.h (100%) rename {inc => src}/fsfw/thermal/tcsDefinitions.h (100%) rename src/{core => fsfw}/timemanager/CCSDSTime.cpp (100%) rename {inc => src}/fsfw/timemanager/CCSDSTime.h (100%) rename src/{core => fsfw}/timemanager/CMakeLists.txt (100%) rename {inc => src}/fsfw/timemanager/Clock.h (100%) rename src/{core => fsfw}/timemanager/ClockCommon.cpp (100%) rename src/{core => fsfw}/timemanager/Countdown.cpp (100%) rename {inc => src}/fsfw/timemanager/Countdown.h (100%) rename {inc => src}/fsfw/timemanager/ReceivesTimeInfoIF.h (100%) rename src/{core => fsfw}/timemanager/Stopwatch.cpp (100%) rename {inc => src}/fsfw/timemanager/Stopwatch.h (100%) rename src/{core => fsfw}/timemanager/TimeMessage.cpp (100%) rename {inc => src}/fsfw/timemanager/TimeMessage.h (100%) rename src/{core => fsfw}/timemanager/TimeStamper.cpp (100%) rename {inc => src}/fsfw/timemanager/TimeStamper.h (100%) rename {inc => src}/fsfw/timemanager/TimeStamperIF.h (100%) rename {inc => src}/fsfw/timemanager/clockDefinitions.h (100%) rename src/{opt => fsfw}/tmstorage/CMakeLists.txt (100%) rename {inc => src}/fsfw/tmstorage/TmStoreBackendIF.h (100%) rename {inc => src}/fsfw/tmstorage/TmStoreFrontendIF.h (100%) rename src/{opt => fsfw}/tmstorage/TmStoreMessage.cpp (100%) rename {inc => src}/fsfw/tmstorage/TmStoreMessage.h (100%) rename {inc => src}/fsfw/tmstorage/TmStorePackets.h (100%) rename src/{core => fsfw}/tmtcpacket/CMakeLists.txt (100%) rename src/{core => fsfw}/tmtcpacket/SpacePacket.cpp (100%) rename {inc => src}/fsfw/tmtcpacket/SpacePacket.h (100%) rename src/{core => fsfw}/tmtcpacket/SpacePacketBase.cpp (100%) rename {inc => src}/fsfw/tmtcpacket/SpacePacketBase.h (100%) rename {inc => src}/fsfw/tmtcpacket/ccsds_header.h (100%) rename {inc => src}/fsfw/tmtcpacket/packetmatcher/ApidMatcher.h (100%) rename src/{core => fsfw}/tmtcpacket/packetmatcher/CMakeLists.txt (100%) rename src/{core => fsfw}/tmtcpacket/packetmatcher/PacketMatchTree.cpp (100%) rename {inc => src}/fsfw/tmtcpacket/packetmatcher/PacketMatchTree.h (100%) rename {inc => src}/fsfw/tmtcpacket/packetmatcher/ServiceMatcher.h (100%) rename {inc => src}/fsfw/tmtcpacket/packetmatcher/SubserviceMatcher.h (100%) rename src/{core => fsfw}/tmtcpacket/pus/CMakeLists.txt (100%) rename {inc => src}/fsfw/tmtcpacket/pus/PacketTimestampInterpreterIF.h (100%) rename {inc => src}/fsfw/tmtcpacket/pus/tc.h (100%) rename src/{core => fsfw}/tmtcpacket/pus/tc/CMakeLists.txt (100%) rename src/{core => fsfw}/tmtcpacket/pus/tc/TcPacketBase.cpp (100%) rename {inc => src}/fsfw/tmtcpacket/pus/tc/TcPacketBase.h (100%) rename src/{core => fsfw}/tmtcpacket/pus/tc/TcPacketPus.cpp (100%) rename {inc => src}/fsfw/tmtcpacket/pus/tc/TcPacketPus.h (100%) rename src/{core => fsfw}/tmtcpacket/pus/tc/TcPacketStoredBase.cpp (100%) rename {inc => src}/fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.h (100%) rename {inc => src}/fsfw/tmtcpacket/pus/tc/TcPacketStoredIF.h (100%) rename src/{core => fsfw}/tmtcpacket/pus/tc/TcPacketStoredPus.cpp (100%) rename {inc => src}/fsfw/tmtcpacket/pus/tc/TcPacketStoredPus.h (100%) rename {inc => src}/fsfw/tmtcpacket/pus/tm.h (100%) rename src/{core => fsfw}/tmtcpacket/pus/tm/CMakeLists.txt (100%) rename src/{core => fsfw}/tmtcpacket/pus/tm/TmPacketBase.cpp (100%) rename {inc => src}/fsfw/tmtcpacket/pus/tm/TmPacketBase.h (100%) rename src/{core => fsfw}/tmtcpacket/pus/tm/TmPacketMinimal.cpp (100%) rename {inc => src}/fsfw/tmtcpacket/pus/tm/TmPacketMinimal.h (100%) rename src/{core => fsfw}/tmtcpacket/pus/tm/TmPacketPusA.cpp (100%) rename {inc => src}/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h (100%) rename src/{core => fsfw}/tmtcpacket/pus/tm/TmPacketPusC.cpp (100%) rename {inc => src}/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h (100%) rename {inc => src}/fsfw/tmtcpacket/pus/tm/TmPacketStored.h (100%) rename src/{core => fsfw}/tmtcpacket/pus/tm/TmPacketStoredBase.cpp (100%) rename {inc => src}/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.h (100%) rename src/{core => fsfw}/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp (100%) rename {inc => src}/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.h (100%) rename src/{core => fsfw}/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp (100%) rename {inc => src}/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.h (100%) rename {inc => src}/fsfw/tmtcservices/AcceptsTelecommandsIF.h (100%) rename {inc => src}/fsfw/tmtcservices/AcceptsTelemetryIF.h (100%) rename {inc => src}/fsfw/tmtcservices/AcceptsVerifyMessageIF.h (100%) rename src/{core => fsfw}/tmtcservices/CMakeLists.txt (100%) rename src/{core => fsfw}/tmtcservices/CommandingServiceBase.cpp (100%) rename {inc => src}/fsfw/tmtcservices/CommandingServiceBase.h (100%) rename src/{core => fsfw}/tmtcservices/PusServiceBase.cpp (100%) rename {inc => src}/fsfw/tmtcservices/PusServiceBase.h (100%) rename src/{core => fsfw}/tmtcservices/PusVerificationReport.cpp (100%) rename {inc => src}/fsfw/tmtcservices/PusVerificationReport.h (100%) rename {inc => src}/fsfw/tmtcservices/SourceSequenceCounter.h (100%) rename src/{core => fsfw}/tmtcservices/TmTcBridge.cpp (100%) rename {inc => src}/fsfw/tmtcservices/TmTcBridge.h (100%) rename src/{core => fsfw}/tmtcservices/TmTcMessage.cpp (100%) rename {inc => src}/fsfw/tmtcservices/TmTcMessage.h (100%) rename {inc => src}/fsfw/tmtcservices/VerificationCodes.h (100%) rename src/{core => fsfw}/tmtcservices/VerificationReporter.cpp (100%) rename {inc => src}/fsfw/tmtcservices/VerificationReporter.h (100%) delete mode 100644 src/opt/CMakeLists.txt delete mode 100644 tests/inc/CMakeLists.txt create mode 100644 tests/src/fsfw/CMakeLists.txt create mode 100644 tests/src/fsfw/tests/CMakeLists.txt rename tests/src/{ => fsfw/tests}/internal/CMakeLists.txt (100%) rename tests/src/{ => fsfw/tests}/internal/InternalUnitTester.cpp (100%) rename tests/{inc => src}/fsfw/tests/internal/InternalUnitTester.h (100%) rename tests/src/{ => fsfw/tests}/internal/UnittDefinitions.cpp (100%) rename tests/{inc => src}/fsfw/tests/internal/UnittDefinitions.h (100%) rename tests/src/{ => fsfw/tests}/internal/globalfunctions/CMakeLists.txt (100%) rename tests/src/{ => fsfw/tests}/internal/globalfunctions/TestArrayPrinter.cpp (100%) rename tests/{inc => src}/fsfw/tests/internal/globalfunctions/TestArrayPrinter.h (100%) rename tests/src/{ => fsfw/tests}/internal/osal/CMakeLists.txt (100%) rename tests/src/{ => fsfw/tests}/internal/osal/IntTestMq.cpp (100%) rename tests/{inc => src}/fsfw/tests/internal/osal/IntTestMq.h (100%) rename tests/src/{ => fsfw/tests}/internal/osal/IntTestMutex.cpp (100%) rename tests/{inc => src}/fsfw/tests/internal/osal/IntTestMutex.h (100%) rename tests/src/{ => fsfw/tests}/internal/osal/IntTestSemaphore.cpp (100%) rename tests/{inc => src}/fsfw/tests/internal/osal/IntTestSemaphore.h (100%) rename tests/src/{ => fsfw/tests}/internal/serialize/CMakeLists.txt (100%) rename tests/src/{ => fsfw/tests}/internal/serialize/IntTestSerialization.cpp (100%) rename tests/{inc => src}/fsfw/tests/internal/serialize/IntTestSerialization.h (100%) rename tests/src/{tests => fsfw/tests/unit}/CMakeLists.txt (72%) rename tests/src/{tests => fsfw/tests/unit}/action/CMakeLists.txt (100%) rename tests/src/{tests => fsfw/tests/unit}/action/TestActionHelper.cpp (100%) rename tests/src/{tests => fsfw/tests/unit}/action/TestActionHelper.h (100%) rename tests/src/{tests => fsfw/tests/unit}/container/CMakeLists.txt (100%) rename tests/src/{tests => fsfw/tests/unit}/container/RingBufferTest.cpp (100%) rename tests/src/{tests => fsfw/tests/unit}/container/TestArrayList.cpp (100%) rename tests/src/{tests => fsfw/tests/unit}/container/TestDynamicFifo.cpp (100%) rename tests/src/{tests => fsfw/tests/unit}/container/TestFifo.cpp (100%) rename tests/src/{tests => fsfw/tests/unit}/container/TestFixedArrayList.cpp (100%) rename tests/src/{tests => fsfw/tests/unit}/container/TestFixedMap.cpp (100%) rename tests/src/{tests => fsfw/tests/unit}/container/TestFixedOrderedMultimap.cpp (100%) rename tests/src/{tests => fsfw/tests/unit}/container/TestPlacementFactory.cpp (100%) rename tests/src/{tests => fsfw/tests/unit}/datapoollocal/CMakeLists.txt (100%) rename tests/src/{tests => fsfw/tests/unit}/datapoollocal/DataSetTest.cpp (100%) rename tests/src/{tests => fsfw/tests/unit}/datapoollocal/LocalPoolManagerTest.cpp (100%) rename tests/src/{tests => fsfw/tests/unit}/datapoollocal/LocalPoolOwnerBase.cpp (100%) rename tests/src/{tests => fsfw/tests/unit}/datapoollocal/LocalPoolOwnerBase.h (100%) rename tests/src/{tests => fsfw/tests/unit}/datapoollocal/LocalPoolVariableTest.cpp (100%) rename tests/src/{tests => fsfw/tests/unit}/datapoollocal/LocalPoolVectorTest.cpp (100%) rename tests/src/{tests => fsfw/tests/unit}/globalfunctions/CMakeLists.txt (100%) rename tests/src/{tests => fsfw/tests/unit}/mocks/HkReceiverMock.h (100%) rename tests/src/{tests => fsfw/tests/unit}/mocks/MessageQueueMockBase.h (100%) rename tests/src/{tests => fsfw/tests/unit}/osal/CMakeLists.txt (100%) rename tests/src/{tests => fsfw/tests/unit}/osal/TestMessageQueue.cpp (100%) rename tests/src/{tests => fsfw/tests/unit}/osal/TestSemaphore.cpp (100%) rename tests/src/{tests => fsfw/tests/unit}/serialize/CMakeLists.txt (100%) rename tests/src/{tests => fsfw/tests/unit}/serialize/TestSerialBufferAdapter.cpp (100%) rename tests/src/{tests => fsfw/tests/unit}/serialize/TestSerialLinkedPacket.cpp (100%) rename tests/src/{tests => fsfw/tests/unit}/serialize/TestSerialLinkedPacket.h (100%) rename tests/src/{tests => fsfw/tests/unit}/serialize/TestSerialization.cpp (100%) rename tests/src/{tests => fsfw/tests/unit}/storagemanager/CMakeLists.txt (100%) rename tests/src/{tests => fsfw/tests/unit}/storagemanager/TestNewAccessor.cpp (100%) rename tests/src/{tests => fsfw/tests/unit}/storagemanager/TestPool.cpp (100%) rename tests/src/{tests => fsfw/tests/unit}/tmtcpacket/CMakeLists.txt (100%) rename tests/src/{tests => fsfw/tests/unit}/tmtcpacket/PusTmTest.cpp (100%) diff --git a/hal/CMakeLists.txt b/hal/CMakeLists.txt index 4cb18315..7a9a0ffa 100644 --- a/hal/CMakeLists.txt +++ b/hal/CMakeLists.txt @@ -12,7 +12,6 @@ set(LINUX_HAL_PATH_NAME linux) set(STM32H7_PATH_NAME stm32h7) add_subdirectory(src) -add_subdirectory(inc) foreach(INCLUDE_PATH ${FSFW_HAL_ADDITIONAL_INC_PATHS}) if(IS_ABSOLUTE ${INCLUDE_PATH}) diff --git a/hal/inc/CMakeLists.txt b/hal/inc/CMakeLists.txt deleted file mode 100644 index abf6a3d2..00000000 --- a/hal/inc/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -target_include_directories(${LIB_FSFW_NAME} PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} -) - -target_include_directories(${LIB_FSFW_NAME} INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR} -) diff --git a/hal/src/CMakeLists.txt b/hal/src/CMakeLists.txt index fcd81389..ed2f2522 100644 --- a/hal/src/CMakeLists.txt +++ b/hal/src/CMakeLists.txt @@ -1,10 +1,9 @@ -add_subdirectory(devicehandlers) -add_subdirectory(common) +target_include_directories(${LIB_FSFW_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} +) -if(FSFW_HAL_ADD_LINUX) - add_subdirectory(${LINUX_HAL_PATH_NAME}) -endif() +target_include_directories(${LIB_FSFW_NAME} INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR} +) -if(FSFW_HAL_ADD_STM32H7) - add_subdirectory(${STM32H7_PATH_NAME}) -endif() +add_subdirectory(fsfw) diff --git a/hal/src/fsfw/CMakeLists.txt b/hal/src/fsfw/CMakeLists.txt new file mode 100644 index 00000000..c034e0b7 --- /dev/null +++ b/hal/src/fsfw/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(hal) diff --git a/hal/src/fsfw/hal/CMakeLists.txt b/hal/src/fsfw/hal/CMakeLists.txt new file mode 100644 index 00000000..f5901e91 --- /dev/null +++ b/hal/src/fsfw/hal/CMakeLists.txt @@ -0,0 +1,10 @@ +add_subdirectory(devicehandlers) +add_subdirectory(common) + +if(FSFW_HAL_ADD_LINUX) + add_subdirectory(linux) +endif() + +if(FSFW_HAL_ADD_STM32H7) + add_subdirectory(stm32h7) +endif() diff --git a/hal/src/common/CMakeLists.txt b/hal/src/fsfw/hal/common/CMakeLists.txt similarity index 100% rename from hal/src/common/CMakeLists.txt rename to hal/src/fsfw/hal/common/CMakeLists.txt diff --git a/hal/src/common/gpio/CMakeLists.txt b/hal/src/fsfw/hal/common/gpio/CMakeLists.txt similarity index 100% rename from hal/src/common/gpio/CMakeLists.txt rename to hal/src/fsfw/hal/common/gpio/CMakeLists.txt diff --git a/hal/src/common/gpio/GpioCookie.cpp b/hal/src/fsfw/hal/common/gpio/GpioCookie.cpp similarity index 100% rename from hal/src/common/gpio/GpioCookie.cpp rename to hal/src/fsfw/hal/common/gpio/GpioCookie.cpp diff --git a/hal/inc/fsfw/hal/common/gpio/GpioCookie.h b/hal/src/fsfw/hal/common/gpio/GpioCookie.h similarity index 100% rename from hal/inc/fsfw/hal/common/gpio/GpioCookie.h rename to hal/src/fsfw/hal/common/gpio/GpioCookie.h diff --git a/hal/inc/fsfw/hal/common/gpio/GpioIF.h b/hal/src/fsfw/hal/common/gpio/GpioIF.h similarity index 100% rename from hal/inc/fsfw/hal/common/gpio/GpioIF.h rename to hal/src/fsfw/hal/common/gpio/GpioIF.h diff --git a/hal/inc/fsfw/hal/common/gpio/gpioDefinitions.h b/hal/src/fsfw/hal/common/gpio/gpioDefinitions.h similarity index 100% rename from hal/inc/fsfw/hal/common/gpio/gpioDefinitions.h rename to hal/src/fsfw/hal/common/gpio/gpioDefinitions.h diff --git a/hal/inc/fsfw/hal/common/spi/spiCommon.h b/hal/src/fsfw/hal/common/spi/spiCommon.h similarity index 100% rename from hal/inc/fsfw/hal/common/spi/spiCommon.h rename to hal/src/fsfw/hal/common/spi/spiCommon.h diff --git a/hal/src/devicehandlers/CMakeLists.txt b/hal/src/fsfw/hal/devicehandlers/CMakeLists.txt similarity index 100% rename from hal/src/devicehandlers/CMakeLists.txt rename to hal/src/fsfw/hal/devicehandlers/CMakeLists.txt diff --git a/hal/src/devicehandlers/GyroL3GD20Handler.cpp b/hal/src/fsfw/hal/devicehandlers/GyroL3GD20Handler.cpp similarity index 100% rename from hal/src/devicehandlers/GyroL3GD20Handler.cpp rename to hal/src/fsfw/hal/devicehandlers/GyroL3GD20Handler.cpp diff --git a/hal/inc/fsfw/hal/devicehandlers/GyroL3GD20Handler.h b/hal/src/fsfw/hal/devicehandlers/GyroL3GD20Handler.h similarity index 100% rename from hal/inc/fsfw/hal/devicehandlers/GyroL3GD20Handler.h rename to hal/src/fsfw/hal/devicehandlers/GyroL3GD20Handler.h diff --git a/hal/inc/fsfw/hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h b/hal/src/fsfw/hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h similarity index 100% rename from hal/inc/fsfw/hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h rename to hal/src/fsfw/hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h diff --git a/hal/src/host/CMakeLists.txt b/hal/src/fsfw/hal/host/CMakeLists.txt similarity index 100% rename from hal/src/host/CMakeLists.txt rename to hal/src/fsfw/hal/host/CMakeLists.txt diff --git a/hal/src/linux/CMakeLists.txt b/hal/src/fsfw/hal/linux/CMakeLists.txt similarity index 100% rename from hal/src/linux/CMakeLists.txt rename to hal/src/fsfw/hal/linux/CMakeLists.txt diff --git a/hal/src/linux/UnixFileGuard.cpp b/hal/src/fsfw/hal/linux/UnixFileGuard.cpp similarity index 100% rename from hal/src/linux/UnixFileGuard.cpp rename to hal/src/fsfw/hal/linux/UnixFileGuard.cpp diff --git a/hal/inc/fsfw/hal/linux/UnixFileGuard.h b/hal/src/fsfw/hal/linux/UnixFileGuard.h similarity index 100% rename from hal/inc/fsfw/hal/linux/UnixFileGuard.h rename to hal/src/fsfw/hal/linux/UnixFileGuard.h diff --git a/hal/src/linux/gpio/CMakeLists.txt b/hal/src/fsfw/hal/linux/gpio/CMakeLists.txt similarity index 100% rename from hal/src/linux/gpio/CMakeLists.txt rename to hal/src/fsfw/hal/linux/gpio/CMakeLists.txt diff --git a/hal/src/linux/gpio/LinuxLibgpioIF.cpp b/hal/src/fsfw/hal/linux/gpio/LinuxLibgpioIF.cpp similarity index 100% rename from hal/src/linux/gpio/LinuxLibgpioIF.cpp rename to hal/src/fsfw/hal/linux/gpio/LinuxLibgpioIF.cpp diff --git a/hal/inc/fsfw/hal/linux/gpio/LinuxLibgpioIF.h b/hal/src/fsfw/hal/linux/gpio/LinuxLibgpioIF.h similarity index 100% rename from hal/inc/fsfw/hal/linux/gpio/LinuxLibgpioIF.h rename to hal/src/fsfw/hal/linux/gpio/LinuxLibgpioIF.h diff --git a/hal/src/linux/i2c/CMakeLists.txt b/hal/src/fsfw/hal/linux/i2c/CMakeLists.txt similarity index 100% rename from hal/src/linux/i2c/CMakeLists.txt rename to hal/src/fsfw/hal/linux/i2c/CMakeLists.txt diff --git a/hal/src/linux/i2c/I2cComIF.cpp b/hal/src/fsfw/hal/linux/i2c/I2cComIF.cpp similarity index 100% rename from hal/src/linux/i2c/I2cComIF.cpp rename to hal/src/fsfw/hal/linux/i2c/I2cComIF.cpp diff --git a/hal/inc/fsfw/hal/linux/i2c/I2cComIF.h b/hal/src/fsfw/hal/linux/i2c/I2cComIF.h similarity index 100% rename from hal/inc/fsfw/hal/linux/i2c/I2cComIF.h rename to hal/src/fsfw/hal/linux/i2c/I2cComIF.h diff --git a/hal/src/linux/i2c/I2cCookie.cpp b/hal/src/fsfw/hal/linux/i2c/I2cCookie.cpp similarity index 100% rename from hal/src/linux/i2c/I2cCookie.cpp rename to hal/src/fsfw/hal/linux/i2c/I2cCookie.cpp diff --git a/hal/inc/fsfw/hal/linux/i2c/I2cCookie.h b/hal/src/fsfw/hal/linux/i2c/I2cCookie.h similarity index 100% rename from hal/inc/fsfw/hal/linux/i2c/I2cCookie.h rename to hal/src/fsfw/hal/linux/i2c/I2cCookie.h diff --git a/hal/src/linux/rpi/CMakeLists.txt b/hal/src/fsfw/hal/linux/rpi/CMakeLists.txt similarity index 100% rename from hal/src/linux/rpi/CMakeLists.txt rename to hal/src/fsfw/hal/linux/rpi/CMakeLists.txt diff --git a/hal/src/linux/rpi/GpioRPi.cpp b/hal/src/fsfw/hal/linux/rpi/GpioRPi.cpp similarity index 100% rename from hal/src/linux/rpi/GpioRPi.cpp rename to hal/src/fsfw/hal/linux/rpi/GpioRPi.cpp diff --git a/hal/inc/fsfw/hal/linux/rpi/GpioRPi.h b/hal/src/fsfw/hal/linux/rpi/GpioRPi.h similarity index 100% rename from hal/inc/fsfw/hal/linux/rpi/GpioRPi.h rename to hal/src/fsfw/hal/linux/rpi/GpioRPi.h diff --git a/hal/src/linux/spi/CMakeLists.txt b/hal/src/fsfw/hal/linux/spi/CMakeLists.txt similarity index 100% rename from hal/src/linux/spi/CMakeLists.txt rename to hal/src/fsfw/hal/linux/spi/CMakeLists.txt diff --git a/hal/src/linux/spi/SpiComIF.cpp b/hal/src/fsfw/hal/linux/spi/SpiComIF.cpp similarity index 100% rename from hal/src/linux/spi/SpiComIF.cpp rename to hal/src/fsfw/hal/linux/spi/SpiComIF.cpp diff --git a/hal/inc/fsfw/hal/linux/spi/SpiComIF.h b/hal/src/fsfw/hal/linux/spi/SpiComIF.h similarity index 100% rename from hal/inc/fsfw/hal/linux/spi/SpiComIF.h rename to hal/src/fsfw/hal/linux/spi/SpiComIF.h diff --git a/hal/src/linux/spi/SpiCookie.cpp b/hal/src/fsfw/hal/linux/spi/SpiCookie.cpp similarity index 100% rename from hal/src/linux/spi/SpiCookie.cpp rename to hal/src/fsfw/hal/linux/spi/SpiCookie.cpp diff --git a/hal/inc/fsfw/hal/linux/spi/SpiCookie.h b/hal/src/fsfw/hal/linux/spi/SpiCookie.h similarity index 100% rename from hal/inc/fsfw/hal/linux/spi/SpiCookie.h rename to hal/src/fsfw/hal/linux/spi/SpiCookie.h diff --git a/hal/inc/fsfw/hal/linux/spi/spiDefinitions.h b/hal/src/fsfw/hal/linux/spi/spiDefinitions.h similarity index 100% rename from hal/inc/fsfw/hal/linux/spi/spiDefinitions.h rename to hal/src/fsfw/hal/linux/spi/spiDefinitions.h diff --git a/hal/src/linux/uart/CMakeLists.txt b/hal/src/fsfw/hal/linux/uart/CMakeLists.txt similarity index 100% rename from hal/src/linux/uart/CMakeLists.txt rename to hal/src/fsfw/hal/linux/uart/CMakeLists.txt diff --git a/hal/src/linux/uart/UartComIF.cpp b/hal/src/fsfw/hal/linux/uart/UartComIF.cpp similarity index 100% rename from hal/src/linux/uart/UartComIF.cpp rename to hal/src/fsfw/hal/linux/uart/UartComIF.cpp diff --git a/hal/inc/fsfw/hal/linux/uart/UartComIF.h b/hal/src/fsfw/hal/linux/uart/UartComIF.h similarity index 100% rename from hal/inc/fsfw/hal/linux/uart/UartComIF.h rename to hal/src/fsfw/hal/linux/uart/UartComIF.h diff --git a/hal/src/linux/uart/UartCookie.cpp b/hal/src/fsfw/hal/linux/uart/UartCookie.cpp similarity index 100% rename from hal/src/linux/uart/UartCookie.cpp rename to hal/src/fsfw/hal/linux/uart/UartCookie.cpp diff --git a/hal/inc/fsfw/hal/linux/uart/UartCookie.h b/hal/src/fsfw/hal/linux/uart/UartCookie.h similarity index 100% rename from hal/inc/fsfw/hal/linux/uart/UartCookie.h rename to hal/src/fsfw/hal/linux/uart/UartCookie.h diff --git a/hal/src/linux/utility.cpp b/hal/src/fsfw/hal/linux/utility.cpp similarity index 100% rename from hal/src/linux/utility.cpp rename to hal/src/fsfw/hal/linux/utility.cpp diff --git a/hal/inc/fsfw/hal/linux/utility.h b/hal/src/fsfw/hal/linux/utility.h similarity index 100% rename from hal/inc/fsfw/hal/linux/utility.h rename to hal/src/fsfw/hal/linux/utility.h diff --git a/hal/src/stm32h7/CMakeLists.txt b/hal/src/fsfw/hal/stm32h7/CMakeLists.txt similarity index 100% rename from hal/src/stm32h7/CMakeLists.txt rename to hal/src/fsfw/hal/stm32h7/CMakeLists.txt diff --git a/hal/src/stm32h7/devicetest/CMakeLists.txt b/hal/src/fsfw/hal/stm32h7/devicetest/CMakeLists.txt similarity index 100% rename from hal/src/stm32h7/devicetest/CMakeLists.txt rename to hal/src/fsfw/hal/stm32h7/devicetest/CMakeLists.txt diff --git a/hal/src/stm32h7/devicetest/GyroL3GD20H.cpp b/hal/src/fsfw/hal/stm32h7/devicetest/GyroL3GD20H.cpp similarity index 100% rename from hal/src/stm32h7/devicetest/GyroL3GD20H.cpp rename to hal/src/fsfw/hal/stm32h7/devicetest/GyroL3GD20H.cpp diff --git a/hal/inc/fsfw/hal/stm32h7/devicetest/GyroL3GD20H.h b/hal/src/fsfw/hal/stm32h7/devicetest/GyroL3GD20H.h similarity index 100% rename from hal/inc/fsfw/hal/stm32h7/devicetest/GyroL3GD20H.h rename to hal/src/fsfw/hal/stm32h7/devicetest/GyroL3GD20H.h diff --git a/hal/src/stm32h7/dma.cpp b/hal/src/fsfw/hal/stm32h7/dma.cpp similarity index 100% rename from hal/src/stm32h7/dma.cpp rename to hal/src/fsfw/hal/stm32h7/dma.cpp diff --git a/hal/inc/fsfw/hal/stm32h7/dma.h b/hal/src/fsfw/hal/stm32h7/dma.h similarity index 100% rename from hal/inc/fsfw/hal/stm32h7/dma.h rename to hal/src/fsfw/hal/stm32h7/dma.h diff --git a/hal/src/stm32h7/gpio/CMakeLists.txt b/hal/src/fsfw/hal/stm32h7/gpio/CMakeLists.txt similarity index 100% rename from hal/src/stm32h7/gpio/CMakeLists.txt rename to hal/src/fsfw/hal/stm32h7/gpio/CMakeLists.txt diff --git a/hal/src/stm32h7/gpio/gpio.cpp b/hal/src/fsfw/hal/stm32h7/gpio/gpio.cpp similarity index 100% rename from hal/src/stm32h7/gpio/gpio.cpp rename to hal/src/fsfw/hal/stm32h7/gpio/gpio.cpp diff --git a/hal/inc/fsfw/hal/stm32h7/gpio/gpio.h b/hal/src/fsfw/hal/stm32h7/gpio/gpio.h similarity index 100% rename from hal/inc/fsfw/hal/stm32h7/gpio/gpio.h rename to hal/src/fsfw/hal/stm32h7/gpio/gpio.h diff --git a/hal/src/stm32h7/i2c/CMakeLists.txt b/hal/src/fsfw/hal/stm32h7/i2c/CMakeLists.txt similarity index 100% rename from hal/src/stm32h7/i2c/CMakeLists.txt rename to hal/src/fsfw/hal/stm32h7/i2c/CMakeLists.txt diff --git a/hal/inc/fsfw/hal/stm32h7/interrupts.h b/hal/src/fsfw/hal/stm32h7/interrupts.h similarity index 100% rename from hal/inc/fsfw/hal/stm32h7/interrupts.h rename to hal/src/fsfw/hal/stm32h7/interrupts.h diff --git a/hal/src/stm32h7/spi/CMakeLists.txt b/hal/src/fsfw/hal/stm32h7/spi/CMakeLists.txt similarity index 100% rename from hal/src/stm32h7/spi/CMakeLists.txt rename to hal/src/fsfw/hal/stm32h7/spi/CMakeLists.txt diff --git a/hal/src/stm32h7/spi/SpiComIF.cpp b/hal/src/fsfw/hal/stm32h7/spi/SpiComIF.cpp similarity index 100% rename from hal/src/stm32h7/spi/SpiComIF.cpp rename to hal/src/fsfw/hal/stm32h7/spi/SpiComIF.cpp diff --git a/hal/inc/fsfw/hal/stm32h7/spi/SpiComIF.h b/hal/src/fsfw/hal/stm32h7/spi/SpiComIF.h similarity index 100% rename from hal/inc/fsfw/hal/stm32h7/spi/SpiComIF.h rename to hal/src/fsfw/hal/stm32h7/spi/SpiComIF.h diff --git a/hal/src/stm32h7/spi/SpiCookie.cpp b/hal/src/fsfw/hal/stm32h7/spi/SpiCookie.cpp similarity index 100% rename from hal/src/stm32h7/spi/SpiCookie.cpp rename to hal/src/fsfw/hal/stm32h7/spi/SpiCookie.cpp diff --git a/hal/inc/fsfw/hal/stm32h7/spi/SpiCookie.h b/hal/src/fsfw/hal/stm32h7/spi/SpiCookie.h similarity index 100% rename from hal/inc/fsfw/hal/stm32h7/spi/SpiCookie.h rename to hal/src/fsfw/hal/stm32h7/spi/SpiCookie.h diff --git a/hal/src/stm32h7/spi/mspInit.cpp b/hal/src/fsfw/hal/stm32h7/spi/mspInit.cpp similarity index 100% rename from hal/src/stm32h7/spi/mspInit.cpp rename to hal/src/fsfw/hal/stm32h7/spi/mspInit.cpp diff --git a/hal/inc/fsfw/hal/stm32h7/spi/mspInit.h b/hal/src/fsfw/hal/stm32h7/spi/mspInit.h similarity index 100% rename from hal/inc/fsfw/hal/stm32h7/spi/mspInit.h rename to hal/src/fsfw/hal/stm32h7/spi/mspInit.h diff --git a/hal/src/stm32h7/spi/spiCore.cpp b/hal/src/fsfw/hal/stm32h7/spi/spiCore.cpp similarity index 100% rename from hal/src/stm32h7/spi/spiCore.cpp rename to hal/src/fsfw/hal/stm32h7/spi/spiCore.cpp diff --git a/hal/inc/fsfw/hal/stm32h7/spi/spiCore.h b/hal/src/fsfw/hal/stm32h7/spi/spiCore.h similarity index 100% rename from hal/inc/fsfw/hal/stm32h7/spi/spiCore.h rename to hal/src/fsfw/hal/stm32h7/spi/spiCore.h diff --git a/hal/src/stm32h7/spi/spiDefinitions.cpp b/hal/src/fsfw/hal/stm32h7/spi/spiDefinitions.cpp similarity index 100% rename from hal/src/stm32h7/spi/spiDefinitions.cpp rename to hal/src/fsfw/hal/stm32h7/spi/spiDefinitions.cpp diff --git a/hal/inc/fsfw/hal/stm32h7/spi/spiDefinitions.h b/hal/src/fsfw/hal/stm32h7/spi/spiDefinitions.h similarity index 100% rename from hal/inc/fsfw/hal/stm32h7/spi/spiDefinitions.h rename to hal/src/fsfw/hal/stm32h7/spi/spiDefinitions.h diff --git a/hal/src/stm32h7/spi/spiInterrupts.cpp b/hal/src/fsfw/hal/stm32h7/spi/spiInterrupts.cpp similarity index 100% rename from hal/src/stm32h7/spi/spiInterrupts.cpp rename to hal/src/fsfw/hal/stm32h7/spi/spiInterrupts.cpp diff --git a/hal/inc/fsfw/hal/stm32h7/spi/spiInterrupts.h b/hal/src/fsfw/hal/stm32h7/spi/spiInterrupts.h similarity index 100% rename from hal/inc/fsfw/hal/stm32h7/spi/spiInterrupts.h rename to hal/src/fsfw/hal/stm32h7/spi/spiInterrupts.h diff --git a/hal/src/stm32h7/spi/stm32h743ziSpi.cpp b/hal/src/fsfw/hal/stm32h7/spi/stm32h743ziSpi.cpp similarity index 100% rename from hal/src/stm32h7/spi/stm32h743ziSpi.cpp rename to hal/src/fsfw/hal/stm32h7/spi/stm32h743ziSpi.cpp diff --git a/hal/inc/fsfw/hal/stm32h7/spi/stm32h743ziSpi.h b/hal/src/fsfw/hal/stm32h7/spi/stm32h743ziSpi.h similarity index 100% rename from hal/inc/fsfw/hal/stm32h7/spi/stm32h743ziSpi.h rename to hal/src/fsfw/hal/stm32h7/spi/stm32h743ziSpi.h diff --git a/hal/src/stm32h7/uart/CMakeLists.txt b/hal/src/fsfw/hal/stm32h7/uart/CMakeLists.txt similarity index 100% rename from hal/src/stm32h7/uart/CMakeLists.txt rename to hal/src/fsfw/hal/stm32h7/uart/CMakeLists.txt diff --git a/inc/fsfw/action.h b/inc/fsfw/action.h deleted file mode 100644 index 543ccb0c..00000000 --- a/inc/fsfw/action.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef FSFW_INC_FSFW_ACTION_H_ -#define FSFW_INC_FSFW_ACTION_H_ - -#include "action/ActionHelper.h" -#include "action/ActionMessage.h" -#include "action/CommandActionHelper.h" -#include "action/HasActionsIF.h" -#include "action/CommandsActionsIF.h" -#include "action/SimpleActionHelper.h" - -#endif /* FSFW_INC_FSFW_ACTION_H_ */ diff --git a/inc/fsfw/datapoollocal.h b/inc/fsfw/datapoollocal.h deleted file mode 100644 index 73024a5c..00000000 --- a/inc/fsfw/datapoollocal.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef FSFW_DATAPOOLLOCAL_DATAPOOLLOCAL_H_ -#define FSFW_DATAPOOLLOCAL_DATAPOOLLOCAL_H_ - -/* Collected related headers */ -#include "datapoollocal/LocalPoolVariable.h" -#include "datapoollocal/LocalPoolVector.h" -#include "datapoollocal/StaticLocalDataSet.h" -#include "datapoollocal/LocalDataSet.h" -#include "datapoollocal/SharedLocalDataSet.h" - - -#endif /* FSFW_DATAPOOLLOCAL_DATAPOOLLOCAL_H_ */ diff --git a/inc/fsfw/osal/host/Mutex.cpp b/inc/fsfw/osal/host/Mutex.cpp deleted file mode 100644 index 892028b2..00000000 --- a/inc/fsfw/osal/host/Mutex.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "Mutex.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" - -Mutex::Mutex() {} - -ReturnValue_t Mutex::lockMutex(TimeoutType timeoutType, uint32_t timeoutMs) { - if(timeoutType == TimeoutType::BLOCKING) { - mutex.lock(); - return HasReturnvaluesIF::RETURN_OK; - } - else if(timeoutType == TimeoutType::POLLING) { - if(mutex.try_lock()) { - return HasReturnvaluesIF::RETURN_OK; - } - } - else if(timeoutType == TimeoutType::WAITING){ - auto chronoMs = std::chrono::milliseconds(timeoutMs); - if(mutex.try_lock_for(chronoMs)) { - return HasReturnvaluesIF::RETURN_OK; - } - } - return MutexIF::MUTEX_TIMEOUT; -} - -ReturnValue_t Mutex::unlockMutex() { - mutex.unlock(); - return HasReturnvaluesIF::RETURN_OK; -} - -std::timed_mutex* Mutex::getMutexHandle() { - return &mutex; -} diff --git a/inc/fsfw/osal/rtems/BinarySemaphore.h b/inc/fsfw/osal/rtems/BinarySemaphore.h deleted file mode 100644 index 3b3a5aba..00000000 --- a/inc/fsfw/osal/rtems/BinarySemaphore.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef FSFW_INC_FSFW_OSAL_RTEMS_BINARYSEMAPHORE_H_ -#define FSFW_INC_FSFW_OSAL_RTEMS_BINARYSEMAPHORE_H_ - -#include "fsfw/tasks/SemaphoreIF.h" - -class BinarySemaphore: public SemaphoreIF { -public: - BinarySemaphore(); - virtual ~BinarySemaphore(); - - // Interface implementation - ReturnValue_t acquire(TimeoutType timeoutType = - TimeoutType::BLOCKING, uint32_t timeoutMs = 0) override; - ReturnValue_t release() override; - uint8_t getSemaphoreCounter() const override; -private: -}; - - - -#endif /* FSFW_INC_FSFW_OSAL_RTEMS_BINARYSEMAPHORE_H_ */ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 70e6d76e..81ecb6e4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,3 +1,9 @@ -add_subdirectory(core) -add_subdirectory(opt) -add_subdirectory(osal) +target_include_directories(${LIB_FSFW_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} +) + +target_include_directories(${LIB_FSFW_NAME} INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_subdirectory(fsfw) \ No newline at end of file diff --git a/src/core/devicehandlers/CMakeLists.txt b/src/core/devicehandlers/CMakeLists.txt deleted file mode 100644 index a3fb6d65..00000000 --- a/src/core/devicehandlers/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - AssemblyBase.cpp - ChildHandlerBase.cpp - ChildHandlerFDIR.cpp - DeviceHandlerBase.cpp - DeviceHandlerFailureIsolation.cpp - DeviceHandlerMessage.cpp - DeviceTmReportingWrapper.cpp - HealthDevice.cpp -) diff --git a/src/core/housekeeping/CMakeLists.txt b/src/core/housekeeping/CMakeLists.txt deleted file mode 100644 index 0a3e7bd1..00000000 --- a/src/core/housekeeping/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -target_sources(${LIB_FSFW_NAME} PRIVATE - HousekeepingMessage.cpp - PeriodicHousekeepingHelper.cpp -) \ No newline at end of file diff --git a/src/core/CMakeLists.txt b/src/fsfw/CMakeLists.txt similarity index 78% rename from src/core/CMakeLists.txt rename to src/fsfw/CMakeLists.txt index 4a2f7a2c..2944f2b6 100644 --- a/src/core/CMakeLists.txt +++ b/src/fsfw/CMakeLists.txt @@ -1,3 +1,5 @@ +# Core + add_subdirectory(action) add_subdirectory(container) add_subdirectory(controller) @@ -26,3 +28,16 @@ add_subdirectory(thermal) add_subdirectory(timemanager) add_subdirectory(tmtcpacket) add_subdirectory(tmtcservices) + +# Optional + +add_subdirectory(coordinates) +add_subdirectory(datalinklayer) +add_subdirectory(monitoring) +add_subdirectory(pus) +add_subdirectory(rmap) +add_subdirectory(tmstorage) + +# OSAL + +add_subdirectory(osal) diff --git a/inc/fsfw/FSFW.h b/src/fsfw/FSFW.h similarity index 100% rename from inc/fsfw/FSFW.h rename to src/fsfw/FSFW.h diff --git a/inc/fsfw/FSFWVersion.h b/src/fsfw/FSFWVersion.h similarity index 100% rename from inc/fsfw/FSFWVersion.h rename to src/fsfw/FSFWVersion.h diff --git a/src/fsfw/action.h b/src/fsfw/action.h new file mode 100644 index 00000000..1300cf17 --- /dev/null +++ b/src/fsfw/action.h @@ -0,0 +1,11 @@ +#ifndef FSFW_INC_FSFW_ACTION_H_ +#define FSFW_INC_FSFW_ACTION_H_ + +#include "fsfw/action/ActionHelper.h" +#include "fsfw/action/ActionMessage.h" +#include "fsfw/action/CommandActionHelper.h" +#include "fsfw/action/HasActionsIF.h" +#include "fsfw/action/CommandsActionsIF.h" +#include "fsfw/action/SimpleActionHelper.h" + +#endif /* FSFW_INC_FSFW_ACTION_H_ */ diff --git a/src/core/action/ActionHelper.cpp b/src/fsfw/action/ActionHelper.cpp similarity index 100% rename from src/core/action/ActionHelper.cpp rename to src/fsfw/action/ActionHelper.cpp diff --git a/inc/fsfw/action/ActionHelper.h b/src/fsfw/action/ActionHelper.h similarity index 100% rename from inc/fsfw/action/ActionHelper.h rename to src/fsfw/action/ActionHelper.h diff --git a/src/core/action/ActionMessage.cpp b/src/fsfw/action/ActionMessage.cpp similarity index 100% rename from src/core/action/ActionMessage.cpp rename to src/fsfw/action/ActionMessage.cpp diff --git a/inc/fsfw/action/ActionMessage.h b/src/fsfw/action/ActionMessage.h similarity index 100% rename from inc/fsfw/action/ActionMessage.h rename to src/fsfw/action/ActionMessage.h diff --git a/src/core/action/CMakeLists.txt b/src/fsfw/action/CMakeLists.txt similarity index 100% rename from src/core/action/CMakeLists.txt rename to src/fsfw/action/CMakeLists.txt diff --git a/src/core/action/CommandActionHelper.cpp b/src/fsfw/action/CommandActionHelper.cpp similarity index 100% rename from src/core/action/CommandActionHelper.cpp rename to src/fsfw/action/CommandActionHelper.cpp diff --git a/inc/fsfw/action/CommandActionHelper.h b/src/fsfw/action/CommandActionHelper.h similarity index 100% rename from inc/fsfw/action/CommandActionHelper.h rename to src/fsfw/action/CommandActionHelper.h diff --git a/inc/fsfw/action/CommandsActionsIF.h b/src/fsfw/action/CommandsActionsIF.h similarity index 100% rename from inc/fsfw/action/CommandsActionsIF.h rename to src/fsfw/action/CommandsActionsIF.h diff --git a/inc/fsfw/action/HasActionsIF.h b/src/fsfw/action/HasActionsIF.h similarity index 100% rename from inc/fsfw/action/HasActionsIF.h rename to src/fsfw/action/HasActionsIF.h diff --git a/src/core/action/SimpleActionHelper.cpp b/src/fsfw/action/SimpleActionHelper.cpp similarity index 100% rename from src/core/action/SimpleActionHelper.cpp rename to src/fsfw/action/SimpleActionHelper.cpp diff --git a/inc/fsfw/action/SimpleActionHelper.h b/src/fsfw/action/SimpleActionHelper.h similarity index 100% rename from inc/fsfw/action/SimpleActionHelper.h rename to src/fsfw/action/SimpleActionHelper.h diff --git a/inc/fsfw/container/ArrayList.h b/src/fsfw/container/ArrayList.h similarity index 100% rename from inc/fsfw/container/ArrayList.h rename to src/fsfw/container/ArrayList.h diff --git a/inc/fsfw/container/BinaryTree.h b/src/fsfw/container/BinaryTree.h similarity index 100% rename from inc/fsfw/container/BinaryTree.h rename to src/fsfw/container/BinaryTree.h diff --git a/src/core/container/CMakeLists.txt b/src/fsfw/container/CMakeLists.txt similarity index 100% rename from src/core/container/CMakeLists.txt rename to src/fsfw/container/CMakeLists.txt diff --git a/inc/fsfw/container/DynamicFIFO.h b/src/fsfw/container/DynamicFIFO.h similarity index 100% rename from inc/fsfw/container/DynamicFIFO.h rename to src/fsfw/container/DynamicFIFO.h diff --git a/inc/fsfw/container/FIFO.h b/src/fsfw/container/FIFO.h similarity index 100% rename from inc/fsfw/container/FIFO.h rename to src/fsfw/container/FIFO.h diff --git a/inc/fsfw/container/FIFOBase.h b/src/fsfw/container/FIFOBase.h similarity index 100% rename from inc/fsfw/container/FIFOBase.h rename to src/fsfw/container/FIFOBase.h diff --git a/inc/fsfw/container/FIFOBase.tpp b/src/fsfw/container/FIFOBase.tpp similarity index 100% rename from inc/fsfw/container/FIFOBase.tpp rename to src/fsfw/container/FIFOBase.tpp diff --git a/inc/fsfw/container/FixedArrayList.h b/src/fsfw/container/FixedArrayList.h similarity index 100% rename from inc/fsfw/container/FixedArrayList.h rename to src/fsfw/container/FixedArrayList.h diff --git a/inc/fsfw/container/FixedMap.h b/src/fsfw/container/FixedMap.h similarity index 100% rename from inc/fsfw/container/FixedMap.h rename to src/fsfw/container/FixedMap.h diff --git a/inc/fsfw/container/FixedOrderedMultimap.h b/src/fsfw/container/FixedOrderedMultimap.h similarity index 100% rename from inc/fsfw/container/FixedOrderedMultimap.h rename to src/fsfw/container/FixedOrderedMultimap.h diff --git a/inc/fsfw/container/FixedOrderedMultimap.tpp b/src/fsfw/container/FixedOrderedMultimap.tpp similarity index 100% rename from inc/fsfw/container/FixedOrderedMultimap.tpp rename to src/fsfw/container/FixedOrderedMultimap.tpp diff --git a/inc/fsfw/container/HybridIterator.h b/src/fsfw/container/HybridIterator.h similarity index 100% rename from inc/fsfw/container/HybridIterator.h rename to src/fsfw/container/HybridIterator.h diff --git a/inc/fsfw/container/IndexedRingMemoryArray.h b/src/fsfw/container/IndexedRingMemoryArray.h similarity index 100% rename from inc/fsfw/container/IndexedRingMemoryArray.h rename to src/fsfw/container/IndexedRingMemoryArray.h diff --git a/inc/fsfw/container/PlacementFactory.h b/src/fsfw/container/PlacementFactory.h similarity index 100% rename from inc/fsfw/container/PlacementFactory.h rename to src/fsfw/container/PlacementFactory.h diff --git a/inc/fsfw/container/RingBufferBase.h b/src/fsfw/container/RingBufferBase.h similarity index 100% rename from inc/fsfw/container/RingBufferBase.h rename to src/fsfw/container/RingBufferBase.h diff --git a/src/core/container/SharedRingBuffer.cpp b/src/fsfw/container/SharedRingBuffer.cpp similarity index 100% rename from src/core/container/SharedRingBuffer.cpp rename to src/fsfw/container/SharedRingBuffer.cpp diff --git a/inc/fsfw/container/SharedRingBuffer.h b/src/fsfw/container/SharedRingBuffer.h similarity index 100% rename from inc/fsfw/container/SharedRingBuffer.h rename to src/fsfw/container/SharedRingBuffer.h diff --git a/src/core/container/SimpleRingBuffer.cpp b/src/fsfw/container/SimpleRingBuffer.cpp similarity index 100% rename from src/core/container/SimpleRingBuffer.cpp rename to src/fsfw/container/SimpleRingBuffer.cpp diff --git a/inc/fsfw/container/SimpleRingBuffer.h b/src/fsfw/container/SimpleRingBuffer.h similarity index 100% rename from inc/fsfw/container/SimpleRingBuffer.h rename to src/fsfw/container/SimpleRingBuffer.h diff --git a/inc/fsfw/container/SinglyLinkedList.h b/src/fsfw/container/SinglyLinkedList.h similarity index 100% rename from inc/fsfw/container/SinglyLinkedList.h rename to src/fsfw/container/SinglyLinkedList.h diff --git a/inc/fsfw/container/group.h b/src/fsfw/container/group.h similarity index 100% rename from inc/fsfw/container/group.h rename to src/fsfw/container/group.h diff --git a/src/core/controller/CMakeLists.txt b/src/fsfw/controller/CMakeLists.txt similarity index 100% rename from src/core/controller/CMakeLists.txt rename to src/fsfw/controller/CMakeLists.txt diff --git a/src/core/controller/ControllerBase.cpp b/src/fsfw/controller/ControllerBase.cpp similarity index 100% rename from src/core/controller/ControllerBase.cpp rename to src/fsfw/controller/ControllerBase.cpp diff --git a/inc/fsfw/controller/ControllerBase.h b/src/fsfw/controller/ControllerBase.h similarity index 100% rename from inc/fsfw/controller/ControllerBase.h rename to src/fsfw/controller/ControllerBase.h diff --git a/src/core/controller/ExtendedControllerBase.cpp b/src/fsfw/controller/ExtendedControllerBase.cpp similarity index 100% rename from src/core/controller/ExtendedControllerBase.cpp rename to src/fsfw/controller/ExtendedControllerBase.cpp diff --git a/inc/fsfw/controller/ExtendedControllerBase.h b/src/fsfw/controller/ExtendedControllerBase.h similarity index 100% rename from inc/fsfw/controller/ExtendedControllerBase.h rename to src/fsfw/controller/ExtendedControllerBase.h diff --git a/src/opt/coordinates/CMakeLists.txt b/src/fsfw/coordinates/CMakeLists.txt similarity index 100% rename from src/opt/coordinates/CMakeLists.txt rename to src/fsfw/coordinates/CMakeLists.txt diff --git a/src/opt/coordinates/CoordinateTransformations.cpp b/src/fsfw/coordinates/CoordinateTransformations.cpp similarity index 100% rename from src/opt/coordinates/CoordinateTransformations.cpp rename to src/fsfw/coordinates/CoordinateTransformations.cpp diff --git a/inc/fsfw/coordinates/CoordinateTransformations.h b/src/fsfw/coordinates/CoordinateTransformations.h similarity index 100% rename from inc/fsfw/coordinates/CoordinateTransformations.h rename to src/fsfw/coordinates/CoordinateTransformations.h diff --git a/inc/fsfw/coordinates/Jgm3Model.h b/src/fsfw/coordinates/Jgm3Model.h similarity index 100% rename from inc/fsfw/coordinates/Jgm3Model.h rename to src/fsfw/coordinates/Jgm3Model.h diff --git a/src/opt/coordinates/Sgp4Propagator.cpp b/src/fsfw/coordinates/Sgp4Propagator.cpp similarity index 100% rename from src/opt/coordinates/Sgp4Propagator.cpp rename to src/fsfw/coordinates/Sgp4Propagator.cpp diff --git a/inc/fsfw/coordinates/Sgp4Propagator.h b/src/fsfw/coordinates/Sgp4Propagator.h similarity index 100% rename from inc/fsfw/coordinates/Sgp4Propagator.h rename to src/fsfw/coordinates/Sgp4Propagator.h diff --git a/inc/fsfw/datalinklayer/BCFrame.h b/src/fsfw/datalinklayer/BCFrame.h similarity index 100% rename from inc/fsfw/datalinklayer/BCFrame.h rename to src/fsfw/datalinklayer/BCFrame.h diff --git a/inc/fsfw/datalinklayer/CCSDSReturnValuesIF.h b/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h similarity index 100% rename from inc/fsfw/datalinklayer/CCSDSReturnValuesIF.h rename to src/fsfw/datalinklayer/CCSDSReturnValuesIF.h diff --git a/src/opt/datalinklayer/CMakeLists.txt b/src/fsfw/datalinklayer/CMakeLists.txt similarity index 100% rename from src/opt/datalinklayer/CMakeLists.txt rename to src/fsfw/datalinklayer/CMakeLists.txt diff --git a/src/opt/datalinklayer/Clcw.cpp b/src/fsfw/datalinklayer/Clcw.cpp similarity index 100% rename from src/opt/datalinklayer/Clcw.cpp rename to src/fsfw/datalinklayer/Clcw.cpp diff --git a/inc/fsfw/datalinklayer/Clcw.h b/src/fsfw/datalinklayer/Clcw.h similarity index 100% rename from inc/fsfw/datalinklayer/Clcw.h rename to src/fsfw/datalinklayer/Clcw.h diff --git a/inc/fsfw/datalinklayer/ClcwIF.h b/src/fsfw/datalinklayer/ClcwIF.h similarity index 100% rename from inc/fsfw/datalinklayer/ClcwIF.h rename to src/fsfw/datalinklayer/ClcwIF.h diff --git a/src/opt/datalinklayer/DataLinkLayer.cpp b/src/fsfw/datalinklayer/DataLinkLayer.cpp similarity index 100% rename from src/opt/datalinklayer/DataLinkLayer.cpp rename to src/fsfw/datalinklayer/DataLinkLayer.cpp diff --git a/inc/fsfw/datalinklayer/DataLinkLayer.h b/src/fsfw/datalinklayer/DataLinkLayer.h similarity index 100% rename from inc/fsfw/datalinklayer/DataLinkLayer.h rename to src/fsfw/datalinklayer/DataLinkLayer.h diff --git a/inc/fsfw/datalinklayer/Farm1StateIF.h b/src/fsfw/datalinklayer/Farm1StateIF.h similarity index 100% rename from inc/fsfw/datalinklayer/Farm1StateIF.h rename to src/fsfw/datalinklayer/Farm1StateIF.h diff --git a/src/opt/datalinklayer/Farm1StateLockout.cpp b/src/fsfw/datalinklayer/Farm1StateLockout.cpp similarity index 100% rename from src/opt/datalinklayer/Farm1StateLockout.cpp rename to src/fsfw/datalinklayer/Farm1StateLockout.cpp diff --git a/inc/fsfw/datalinklayer/Farm1StateLockout.h b/src/fsfw/datalinklayer/Farm1StateLockout.h similarity index 100% rename from inc/fsfw/datalinklayer/Farm1StateLockout.h rename to src/fsfw/datalinklayer/Farm1StateLockout.h diff --git a/src/opt/datalinklayer/Farm1StateOpen.cpp b/src/fsfw/datalinklayer/Farm1StateOpen.cpp similarity index 100% rename from src/opt/datalinklayer/Farm1StateOpen.cpp rename to src/fsfw/datalinklayer/Farm1StateOpen.cpp diff --git a/inc/fsfw/datalinklayer/Farm1StateOpen.h b/src/fsfw/datalinklayer/Farm1StateOpen.h similarity index 100% rename from inc/fsfw/datalinklayer/Farm1StateOpen.h rename to src/fsfw/datalinklayer/Farm1StateOpen.h diff --git a/src/opt/datalinklayer/Farm1StateWait.cpp b/src/fsfw/datalinklayer/Farm1StateWait.cpp similarity index 100% rename from src/opt/datalinklayer/Farm1StateWait.cpp rename to src/fsfw/datalinklayer/Farm1StateWait.cpp diff --git a/inc/fsfw/datalinklayer/Farm1StateWait.h b/src/fsfw/datalinklayer/Farm1StateWait.h similarity index 100% rename from inc/fsfw/datalinklayer/Farm1StateWait.h rename to src/fsfw/datalinklayer/Farm1StateWait.h diff --git a/src/opt/datalinklayer/MapPacketExtraction.cpp b/src/fsfw/datalinklayer/MapPacketExtraction.cpp similarity index 100% rename from src/opt/datalinklayer/MapPacketExtraction.cpp rename to src/fsfw/datalinklayer/MapPacketExtraction.cpp diff --git a/inc/fsfw/datalinklayer/MapPacketExtraction.h b/src/fsfw/datalinklayer/MapPacketExtraction.h similarity index 100% rename from inc/fsfw/datalinklayer/MapPacketExtraction.h rename to src/fsfw/datalinklayer/MapPacketExtraction.h diff --git a/inc/fsfw/datalinklayer/MapPacketExtractionIF.h b/src/fsfw/datalinklayer/MapPacketExtractionIF.h similarity index 100% rename from inc/fsfw/datalinklayer/MapPacketExtractionIF.h rename to src/fsfw/datalinklayer/MapPacketExtractionIF.h diff --git a/src/opt/datalinklayer/TcTransferFrame.cpp b/src/fsfw/datalinklayer/TcTransferFrame.cpp similarity index 100% rename from src/opt/datalinklayer/TcTransferFrame.cpp rename to src/fsfw/datalinklayer/TcTransferFrame.cpp diff --git a/inc/fsfw/datalinklayer/TcTransferFrame.h b/src/fsfw/datalinklayer/TcTransferFrame.h similarity index 100% rename from inc/fsfw/datalinklayer/TcTransferFrame.h rename to src/fsfw/datalinklayer/TcTransferFrame.h diff --git a/src/opt/datalinklayer/TcTransferFrameLocal.cpp b/src/fsfw/datalinklayer/TcTransferFrameLocal.cpp similarity index 100% rename from src/opt/datalinklayer/TcTransferFrameLocal.cpp rename to src/fsfw/datalinklayer/TcTransferFrameLocal.cpp diff --git a/inc/fsfw/datalinklayer/TcTransferFrameLocal.h b/src/fsfw/datalinklayer/TcTransferFrameLocal.h similarity index 100% rename from inc/fsfw/datalinklayer/TcTransferFrameLocal.h rename to src/fsfw/datalinklayer/TcTransferFrameLocal.h diff --git a/src/opt/datalinklayer/VirtualChannelReception.cpp b/src/fsfw/datalinklayer/VirtualChannelReception.cpp similarity index 100% rename from src/opt/datalinklayer/VirtualChannelReception.cpp rename to src/fsfw/datalinklayer/VirtualChannelReception.cpp diff --git a/inc/fsfw/datalinklayer/VirtualChannelReception.h b/src/fsfw/datalinklayer/VirtualChannelReception.h similarity index 100% rename from inc/fsfw/datalinklayer/VirtualChannelReception.h rename to src/fsfw/datalinklayer/VirtualChannelReception.h diff --git a/inc/fsfw/datalinklayer/VirtualChannelReceptionIF.h b/src/fsfw/datalinklayer/VirtualChannelReceptionIF.h similarity index 100% rename from inc/fsfw/datalinklayer/VirtualChannelReceptionIF.h rename to src/fsfw/datalinklayer/VirtualChannelReceptionIF.h diff --git a/src/core/datapool/CMakeLists.txt b/src/fsfw/datapool/CMakeLists.txt similarity index 100% rename from src/core/datapool/CMakeLists.txt rename to src/fsfw/datapool/CMakeLists.txt diff --git a/inc/fsfw/datapool/DataSetIF.h b/src/fsfw/datapool/DataSetIF.h similarity index 100% rename from inc/fsfw/datapool/DataSetIF.h rename to src/fsfw/datapool/DataSetIF.h diff --git a/src/core/datapool/HkSwitchHelper.cpp b/src/fsfw/datapool/HkSwitchHelper.cpp similarity index 100% rename from src/core/datapool/HkSwitchHelper.cpp rename to src/fsfw/datapool/HkSwitchHelper.cpp diff --git a/inc/fsfw/datapool/HkSwitchHelper.h b/src/fsfw/datapool/HkSwitchHelper.h similarity index 100% rename from inc/fsfw/datapool/HkSwitchHelper.h rename to src/fsfw/datapool/HkSwitchHelper.h diff --git a/src/core/datapool/PoolDataSetBase.cpp b/src/fsfw/datapool/PoolDataSetBase.cpp similarity index 100% rename from src/core/datapool/PoolDataSetBase.cpp rename to src/fsfw/datapool/PoolDataSetBase.cpp diff --git a/inc/fsfw/datapool/PoolDataSetBase.h b/src/fsfw/datapool/PoolDataSetBase.h similarity index 100% rename from inc/fsfw/datapool/PoolDataSetBase.h rename to src/fsfw/datapool/PoolDataSetBase.h diff --git a/inc/fsfw/datapool/PoolDataSetIF.h b/src/fsfw/datapool/PoolDataSetIF.h similarity index 100% rename from inc/fsfw/datapool/PoolDataSetIF.h rename to src/fsfw/datapool/PoolDataSetIF.h diff --git a/src/core/datapool/PoolEntry.cpp b/src/fsfw/datapool/PoolEntry.cpp similarity index 100% rename from src/core/datapool/PoolEntry.cpp rename to src/fsfw/datapool/PoolEntry.cpp diff --git a/inc/fsfw/datapool/PoolEntry.h b/src/fsfw/datapool/PoolEntry.h similarity index 100% rename from inc/fsfw/datapool/PoolEntry.h rename to src/fsfw/datapool/PoolEntry.h diff --git a/inc/fsfw/datapool/PoolEntryIF.h b/src/fsfw/datapool/PoolEntryIF.h similarity index 100% rename from inc/fsfw/datapool/PoolEntryIF.h rename to src/fsfw/datapool/PoolEntryIF.h diff --git a/inc/fsfw/datapool/PoolReadGuard.h b/src/fsfw/datapool/PoolReadGuard.h similarity index 100% rename from inc/fsfw/datapool/PoolReadGuard.h rename to src/fsfw/datapool/PoolReadGuard.h diff --git a/inc/fsfw/datapool/PoolVarList.h b/src/fsfw/datapool/PoolVarList.h similarity index 100% rename from inc/fsfw/datapool/PoolVarList.h rename to src/fsfw/datapool/PoolVarList.h diff --git a/inc/fsfw/datapool/PoolVariableIF.h b/src/fsfw/datapool/PoolVariableIF.h similarity index 100% rename from inc/fsfw/datapool/PoolVariableIF.h rename to src/fsfw/datapool/PoolVariableIF.h diff --git a/inc/fsfw/datapool/ReadCommitIF.h b/src/fsfw/datapool/ReadCommitIF.h similarity index 100% rename from inc/fsfw/datapool/ReadCommitIF.h rename to src/fsfw/datapool/ReadCommitIF.h diff --git a/inc/fsfw/datapool/ReadCommitIFAttorney.h b/src/fsfw/datapool/ReadCommitIFAttorney.h similarity index 100% rename from inc/fsfw/datapool/ReadCommitIFAttorney.h rename to src/fsfw/datapool/ReadCommitIFAttorney.h diff --git a/inc/fsfw/datapool/SharedDataSetIF.h b/src/fsfw/datapool/SharedDataSetIF.h similarity index 100% rename from inc/fsfw/datapool/SharedDataSetIF.h rename to src/fsfw/datapool/SharedDataSetIF.h diff --git a/src/fsfw/datapoollocal.h b/src/fsfw/datapoollocal.h new file mode 100644 index 00000000..7a3c4c20 --- /dev/null +++ b/src/fsfw/datapoollocal.h @@ -0,0 +1,11 @@ +#ifndef FSFW_DATAPOOLLOCAL_DATAPOOLLOCAL_H_ +#define FSFW_DATAPOOLLOCAL_DATAPOOLLOCAL_H_ + +/* Collected related headers */ +#include "fsfw/datapoollocal/LocalPoolVariable.h" +#include "fsfw/datapoollocal/LocalPoolVector.h" +#include "fsfw/datapoollocal/StaticLocalDataSet.h" +#include "fsfw/datapoollocal/LocalDataSet.h" +#include "fsfw/datapoollocal/SharedLocalDataSet.h" + +#endif /* FSFW_DATAPOOLLOCAL_DATAPOOLLOCAL_H_ */ diff --git a/inc/fsfw/datapoollocal/AccessLocalPoolF.h b/src/fsfw/datapoollocal/AccessLocalPoolF.h similarity index 100% rename from inc/fsfw/datapoollocal/AccessLocalPoolF.h rename to src/fsfw/datapoollocal/AccessLocalPoolF.h diff --git a/src/core/datapoollocal/CMakeLists.txt b/src/fsfw/datapoollocal/CMakeLists.txt similarity index 100% rename from src/core/datapoollocal/CMakeLists.txt rename to src/fsfw/datapoollocal/CMakeLists.txt diff --git a/inc/fsfw/datapoollocal/HasLocalDataPoolIF.h b/src/fsfw/datapoollocal/HasLocalDataPoolIF.h similarity index 100% rename from inc/fsfw/datapoollocal/HasLocalDataPoolIF.h rename to src/fsfw/datapoollocal/HasLocalDataPoolIF.h diff --git a/src/core/datapoollocal/LocalDataPoolManager.cpp b/src/fsfw/datapoollocal/LocalDataPoolManager.cpp similarity index 100% rename from src/core/datapoollocal/LocalDataPoolManager.cpp rename to src/fsfw/datapoollocal/LocalDataPoolManager.cpp diff --git a/inc/fsfw/datapoollocal/LocalDataPoolManager.h b/src/fsfw/datapoollocal/LocalDataPoolManager.h similarity index 100% rename from inc/fsfw/datapoollocal/LocalDataPoolManager.h rename to src/fsfw/datapoollocal/LocalDataPoolManager.h diff --git a/src/core/datapoollocal/LocalDataSet.cpp b/src/fsfw/datapoollocal/LocalDataSet.cpp similarity index 100% rename from src/core/datapoollocal/LocalDataSet.cpp rename to src/fsfw/datapoollocal/LocalDataSet.cpp diff --git a/inc/fsfw/datapoollocal/LocalDataSet.h b/src/fsfw/datapoollocal/LocalDataSet.h similarity index 100% rename from inc/fsfw/datapoollocal/LocalDataSet.h rename to src/fsfw/datapoollocal/LocalDataSet.h diff --git a/src/core/datapoollocal/LocalPoolDataSetBase.cpp b/src/fsfw/datapoollocal/LocalPoolDataSetBase.cpp similarity index 100% rename from src/core/datapoollocal/LocalPoolDataSetBase.cpp rename to src/fsfw/datapoollocal/LocalPoolDataSetBase.cpp diff --git a/inc/fsfw/datapoollocal/LocalPoolDataSetBase.h b/src/fsfw/datapoollocal/LocalPoolDataSetBase.h similarity index 100% rename from inc/fsfw/datapoollocal/LocalPoolDataSetBase.h rename to src/fsfw/datapoollocal/LocalPoolDataSetBase.h diff --git a/src/core/datapoollocal/LocalPoolObjectBase.cpp b/src/fsfw/datapoollocal/LocalPoolObjectBase.cpp similarity index 100% rename from src/core/datapoollocal/LocalPoolObjectBase.cpp rename to src/fsfw/datapoollocal/LocalPoolObjectBase.cpp diff --git a/inc/fsfw/datapoollocal/LocalPoolObjectBase.h b/src/fsfw/datapoollocal/LocalPoolObjectBase.h similarity index 100% rename from inc/fsfw/datapoollocal/LocalPoolObjectBase.h rename to src/fsfw/datapoollocal/LocalPoolObjectBase.h diff --git a/inc/fsfw/datapoollocal/LocalPoolVariable.h b/src/fsfw/datapoollocal/LocalPoolVariable.h similarity index 100% rename from inc/fsfw/datapoollocal/LocalPoolVariable.h rename to src/fsfw/datapoollocal/LocalPoolVariable.h diff --git a/inc/fsfw/datapoollocal/LocalPoolVariable.tpp b/src/fsfw/datapoollocal/LocalPoolVariable.tpp similarity index 100% rename from inc/fsfw/datapoollocal/LocalPoolVariable.tpp rename to src/fsfw/datapoollocal/LocalPoolVariable.tpp diff --git a/inc/fsfw/datapoollocal/LocalPoolVector.h b/src/fsfw/datapoollocal/LocalPoolVector.h similarity index 100% rename from inc/fsfw/datapoollocal/LocalPoolVector.h rename to src/fsfw/datapoollocal/LocalPoolVector.h diff --git a/inc/fsfw/datapoollocal/LocalPoolVector.tpp b/src/fsfw/datapoollocal/LocalPoolVector.tpp similarity index 100% rename from inc/fsfw/datapoollocal/LocalPoolVector.tpp rename to src/fsfw/datapoollocal/LocalPoolVector.tpp diff --git a/inc/fsfw/datapoollocal/MarkChangedIF.h b/src/fsfw/datapoollocal/MarkChangedIF.h similarity index 100% rename from inc/fsfw/datapoollocal/MarkChangedIF.h rename to src/fsfw/datapoollocal/MarkChangedIF.h diff --git a/inc/fsfw/datapoollocal/ProvidesDataPoolSubscriptionIF.h b/src/fsfw/datapoollocal/ProvidesDataPoolSubscriptionIF.h similarity index 100% rename from inc/fsfw/datapoollocal/ProvidesDataPoolSubscriptionIF.h rename to src/fsfw/datapoollocal/ProvidesDataPoolSubscriptionIF.h diff --git a/src/core/datapoollocal/SharedLocalDataSet.cpp b/src/fsfw/datapoollocal/SharedLocalDataSet.cpp similarity index 100% rename from src/core/datapoollocal/SharedLocalDataSet.cpp rename to src/fsfw/datapoollocal/SharedLocalDataSet.cpp diff --git a/inc/fsfw/datapoollocal/SharedLocalDataSet.h b/src/fsfw/datapoollocal/SharedLocalDataSet.h similarity index 100% rename from inc/fsfw/datapoollocal/SharedLocalDataSet.h rename to src/fsfw/datapoollocal/SharedLocalDataSet.h diff --git a/inc/fsfw/datapoollocal/StaticLocalDataSet.h b/src/fsfw/datapoollocal/StaticLocalDataSet.h similarity index 100% rename from inc/fsfw/datapoollocal/StaticLocalDataSet.h rename to src/fsfw/datapoollocal/StaticLocalDataSet.h diff --git a/src/core/datapoollocal/internal/CMakeLists.txt b/src/fsfw/datapoollocal/internal/CMakeLists.txt similarity index 100% rename from src/core/datapoollocal/internal/CMakeLists.txt rename to src/fsfw/datapoollocal/internal/CMakeLists.txt diff --git a/src/core/datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp b/src/fsfw/datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp similarity index 100% rename from src/core/datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp rename to src/fsfw/datapoollocal/internal/HasLocalDpIFManagerAttorney.cpp diff --git a/src/core/datapoollocal/internal/HasLocalDpIFManagerAttorney.h b/src/fsfw/datapoollocal/internal/HasLocalDpIFManagerAttorney.h similarity index 100% rename from src/core/datapoollocal/internal/HasLocalDpIFManagerAttorney.h rename to src/fsfw/datapoollocal/internal/HasLocalDpIFManagerAttorney.h diff --git a/src/core/datapoollocal/internal/HasLocalDpIFUserAttorney.cpp b/src/fsfw/datapoollocal/internal/HasLocalDpIFUserAttorney.cpp similarity index 100% rename from src/core/datapoollocal/internal/HasLocalDpIFUserAttorney.cpp rename to src/fsfw/datapoollocal/internal/HasLocalDpIFUserAttorney.cpp diff --git a/src/core/datapoollocal/internal/HasLocalDpIFUserAttorney.h b/src/fsfw/datapoollocal/internal/HasLocalDpIFUserAttorney.h similarity index 100% rename from src/core/datapoollocal/internal/HasLocalDpIFUserAttorney.h rename to src/fsfw/datapoollocal/internal/HasLocalDpIFUserAttorney.h diff --git a/inc/fsfw/datapoollocal/internal/LocalDpManagerAttorney.h b/src/fsfw/datapoollocal/internal/LocalDpManagerAttorney.h similarity index 100% rename from inc/fsfw/datapoollocal/internal/LocalDpManagerAttorney.h rename to src/fsfw/datapoollocal/internal/LocalDpManagerAttorney.h diff --git a/src/core/datapoollocal/internal/LocalPoolDataSetAttorney.h b/src/fsfw/datapoollocal/internal/LocalPoolDataSetAttorney.h similarity index 100% rename from src/core/datapoollocal/internal/LocalPoolDataSetAttorney.h rename to src/fsfw/datapoollocal/internal/LocalPoolDataSetAttorney.h diff --git a/inc/fsfw/datapoollocal/localPoolDefinitions.h b/src/fsfw/datapoollocal/localPoolDefinitions.h similarity index 100% rename from inc/fsfw/datapoollocal/localPoolDefinitions.h rename to src/fsfw/datapoollocal/localPoolDefinitions.h diff --git a/inc/fsfw/devicehandlers/AcceptsDeviceResponsesIF.h b/src/fsfw/devicehandlers/AcceptsDeviceResponsesIF.h similarity index 100% rename from inc/fsfw/devicehandlers/AcceptsDeviceResponsesIF.h rename to src/fsfw/devicehandlers/AcceptsDeviceResponsesIF.h diff --git a/src/core/devicehandlers/AssemblyBase.cpp b/src/fsfw/devicehandlers/AssemblyBase.cpp similarity index 100% rename from src/core/devicehandlers/AssemblyBase.cpp rename to src/fsfw/devicehandlers/AssemblyBase.cpp diff --git a/inc/fsfw/devicehandlers/AssemblyBase.h b/src/fsfw/devicehandlers/AssemblyBase.h similarity index 100% rename from inc/fsfw/devicehandlers/AssemblyBase.h rename to src/fsfw/devicehandlers/AssemblyBase.h diff --git a/inc/fsfw/devicehandlers/CMakeLists.txt b/src/fsfw/devicehandlers/CMakeLists.txt similarity index 100% rename from inc/fsfw/devicehandlers/CMakeLists.txt rename to src/fsfw/devicehandlers/CMakeLists.txt diff --git a/src/core/devicehandlers/ChildHandlerBase.cpp b/src/fsfw/devicehandlers/ChildHandlerBase.cpp similarity index 100% rename from src/core/devicehandlers/ChildHandlerBase.cpp rename to src/fsfw/devicehandlers/ChildHandlerBase.cpp diff --git a/inc/fsfw/devicehandlers/ChildHandlerBase.h b/src/fsfw/devicehandlers/ChildHandlerBase.h similarity index 100% rename from inc/fsfw/devicehandlers/ChildHandlerBase.h rename to src/fsfw/devicehandlers/ChildHandlerBase.h diff --git a/src/core/devicehandlers/ChildHandlerFDIR.cpp b/src/fsfw/devicehandlers/ChildHandlerFDIR.cpp similarity index 100% rename from src/core/devicehandlers/ChildHandlerFDIR.cpp rename to src/fsfw/devicehandlers/ChildHandlerFDIR.cpp diff --git a/inc/fsfw/devicehandlers/ChildHandlerFDIR.h b/src/fsfw/devicehandlers/ChildHandlerFDIR.h similarity index 100% rename from inc/fsfw/devicehandlers/ChildHandlerFDIR.h rename to src/fsfw/devicehandlers/ChildHandlerFDIR.h diff --git a/inc/fsfw/devicehandlers/CookieIF.h b/src/fsfw/devicehandlers/CookieIF.h similarity index 100% rename from inc/fsfw/devicehandlers/CookieIF.h rename to src/fsfw/devicehandlers/CookieIF.h diff --git a/inc/fsfw/devicehandlers/DeviceCommunicationIF.h b/src/fsfw/devicehandlers/DeviceCommunicationIF.h similarity index 100% rename from inc/fsfw/devicehandlers/DeviceCommunicationIF.h rename to src/fsfw/devicehandlers/DeviceCommunicationIF.h diff --git a/src/core/devicehandlers/DeviceHandlerBase.cpp b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp similarity index 100% rename from src/core/devicehandlers/DeviceHandlerBase.cpp rename to src/fsfw/devicehandlers/DeviceHandlerBase.cpp diff --git a/inc/fsfw/devicehandlers/DeviceHandlerBase.h b/src/fsfw/devicehandlers/DeviceHandlerBase.h similarity index 100% rename from inc/fsfw/devicehandlers/DeviceHandlerBase.h rename to src/fsfw/devicehandlers/DeviceHandlerBase.h diff --git a/src/core/devicehandlers/DeviceHandlerFailureIsolation.cpp b/src/fsfw/devicehandlers/DeviceHandlerFailureIsolation.cpp similarity index 100% rename from src/core/devicehandlers/DeviceHandlerFailureIsolation.cpp rename to src/fsfw/devicehandlers/DeviceHandlerFailureIsolation.cpp diff --git a/inc/fsfw/devicehandlers/DeviceHandlerFailureIsolation.h b/src/fsfw/devicehandlers/DeviceHandlerFailureIsolation.h similarity index 100% rename from inc/fsfw/devicehandlers/DeviceHandlerFailureIsolation.h rename to src/fsfw/devicehandlers/DeviceHandlerFailureIsolation.h diff --git a/inc/fsfw/devicehandlers/DeviceHandlerIF.h b/src/fsfw/devicehandlers/DeviceHandlerIF.h similarity index 100% rename from inc/fsfw/devicehandlers/DeviceHandlerIF.h rename to src/fsfw/devicehandlers/DeviceHandlerIF.h diff --git a/src/core/devicehandlers/DeviceHandlerMessage.cpp b/src/fsfw/devicehandlers/DeviceHandlerMessage.cpp similarity index 100% rename from src/core/devicehandlers/DeviceHandlerMessage.cpp rename to src/fsfw/devicehandlers/DeviceHandlerMessage.cpp diff --git a/inc/fsfw/devicehandlers/DeviceHandlerMessage.h b/src/fsfw/devicehandlers/DeviceHandlerMessage.h similarity index 100% rename from inc/fsfw/devicehandlers/DeviceHandlerMessage.h rename to src/fsfw/devicehandlers/DeviceHandlerMessage.h diff --git a/inc/fsfw/devicehandlers/DeviceHandlerThermalSet.h b/src/fsfw/devicehandlers/DeviceHandlerThermalSet.h similarity index 100% rename from inc/fsfw/devicehandlers/DeviceHandlerThermalSet.h rename to src/fsfw/devicehandlers/DeviceHandlerThermalSet.h diff --git a/src/core/devicehandlers/DeviceTmReportingWrapper.cpp b/src/fsfw/devicehandlers/DeviceTmReportingWrapper.cpp similarity index 100% rename from src/core/devicehandlers/DeviceTmReportingWrapper.cpp rename to src/fsfw/devicehandlers/DeviceTmReportingWrapper.cpp diff --git a/inc/fsfw/devicehandlers/DeviceTmReportingWrapper.h b/src/fsfw/devicehandlers/DeviceTmReportingWrapper.h similarity index 100% rename from inc/fsfw/devicehandlers/DeviceTmReportingWrapper.h rename to src/fsfw/devicehandlers/DeviceTmReportingWrapper.h diff --git a/src/core/devicehandlers/HealthDevice.cpp b/src/fsfw/devicehandlers/HealthDevice.cpp similarity index 100% rename from src/core/devicehandlers/HealthDevice.cpp rename to src/fsfw/devicehandlers/HealthDevice.cpp diff --git a/inc/fsfw/devicehandlers/HealthDevice.h b/src/fsfw/devicehandlers/HealthDevice.h similarity index 100% rename from inc/fsfw/devicehandlers/HealthDevice.h rename to src/fsfw/devicehandlers/HealthDevice.h diff --git a/src/core/events/CMakeLists.txt b/src/fsfw/events/CMakeLists.txt similarity index 100% rename from src/core/events/CMakeLists.txt rename to src/fsfw/events/CMakeLists.txt diff --git a/inc/fsfw/events/Event.h b/src/fsfw/events/Event.h similarity index 100% rename from inc/fsfw/events/Event.h rename to src/fsfw/events/Event.h diff --git a/src/core/events/EventManager.cpp b/src/fsfw/events/EventManager.cpp similarity index 100% rename from src/core/events/EventManager.cpp rename to src/fsfw/events/EventManager.cpp diff --git a/inc/fsfw/events/EventManager.h b/src/fsfw/events/EventManager.h similarity index 100% rename from inc/fsfw/events/EventManager.h rename to src/fsfw/events/EventManager.h diff --git a/inc/fsfw/events/EventManagerIF.h b/src/fsfw/events/EventManagerIF.h similarity index 100% rename from inc/fsfw/events/EventManagerIF.h rename to src/fsfw/events/EventManagerIF.h diff --git a/src/core/events/EventMessage.cpp b/src/fsfw/events/EventMessage.cpp similarity index 100% rename from src/core/events/EventMessage.cpp rename to src/fsfw/events/EventMessage.cpp diff --git a/inc/fsfw/events/EventMessage.h b/src/fsfw/events/EventMessage.h similarity index 100% rename from inc/fsfw/events/EventMessage.h rename to src/fsfw/events/EventMessage.h diff --git a/inc/fsfw/events/EventReportingProxyIF.h b/src/fsfw/events/EventReportingProxyIF.h similarity index 100% rename from inc/fsfw/events/EventReportingProxyIF.h rename to src/fsfw/events/EventReportingProxyIF.h diff --git a/src/core/events/eventmatching/CMakeLists.txt b/src/fsfw/events/eventmatching/CMakeLists.txt similarity index 100% rename from src/core/events/eventmatching/CMakeLists.txt rename to src/fsfw/events/eventmatching/CMakeLists.txt diff --git a/src/core/events/eventmatching/EventIdRangeMatcher.cpp b/src/fsfw/events/eventmatching/EventIdRangeMatcher.cpp similarity index 100% rename from src/core/events/eventmatching/EventIdRangeMatcher.cpp rename to src/fsfw/events/eventmatching/EventIdRangeMatcher.cpp diff --git a/inc/fsfw/events/eventmatching/EventIdRangeMatcher.h b/src/fsfw/events/eventmatching/EventIdRangeMatcher.h similarity index 100% rename from inc/fsfw/events/eventmatching/EventIdRangeMatcher.h rename to src/fsfw/events/eventmatching/EventIdRangeMatcher.h diff --git a/src/core/events/eventmatching/EventMatchTree.cpp b/src/fsfw/events/eventmatching/EventMatchTree.cpp similarity index 100% rename from src/core/events/eventmatching/EventMatchTree.cpp rename to src/fsfw/events/eventmatching/EventMatchTree.cpp diff --git a/inc/fsfw/events/eventmatching/EventMatchTree.h b/src/fsfw/events/eventmatching/EventMatchTree.h similarity index 100% rename from inc/fsfw/events/eventmatching/EventMatchTree.h rename to src/fsfw/events/eventmatching/EventMatchTree.h diff --git a/inc/fsfw/events/eventmatching/EventRangeMatcherBase.h b/src/fsfw/events/eventmatching/EventRangeMatcherBase.h similarity index 100% rename from inc/fsfw/events/eventmatching/EventRangeMatcherBase.h rename to src/fsfw/events/eventmatching/EventRangeMatcherBase.h diff --git a/src/core/events/eventmatching/ReporterRangeMatcher.cpp b/src/fsfw/events/eventmatching/ReporterRangeMatcher.cpp similarity index 100% rename from src/core/events/eventmatching/ReporterRangeMatcher.cpp rename to src/fsfw/events/eventmatching/ReporterRangeMatcher.cpp diff --git a/inc/fsfw/events/eventmatching/ReporterRangeMatcher.h b/src/fsfw/events/eventmatching/ReporterRangeMatcher.h similarity index 100% rename from inc/fsfw/events/eventmatching/ReporterRangeMatcher.h rename to src/fsfw/events/eventmatching/ReporterRangeMatcher.h diff --git a/src/core/events/eventmatching/SeverityRangeMatcher.cpp b/src/fsfw/events/eventmatching/SeverityRangeMatcher.cpp similarity index 100% rename from src/core/events/eventmatching/SeverityRangeMatcher.cpp rename to src/fsfw/events/eventmatching/SeverityRangeMatcher.cpp diff --git a/inc/fsfw/events/eventmatching/SeverityRangeMatcher.h b/src/fsfw/events/eventmatching/SeverityRangeMatcher.h similarity index 100% rename from inc/fsfw/events/eventmatching/SeverityRangeMatcher.h rename to src/fsfw/events/eventmatching/SeverityRangeMatcher.h diff --git a/inc/fsfw/events/eventmatching/eventmatching.h b/src/fsfw/events/eventmatching/eventmatching.h similarity index 100% rename from inc/fsfw/events/eventmatching/eventmatching.h rename to src/fsfw/events/eventmatching/eventmatching.h diff --git a/inc/fsfw/events/fwSubsystemIdRanges.h b/src/fsfw/events/fwSubsystemIdRanges.h similarity index 100% rename from inc/fsfw/events/fwSubsystemIdRanges.h rename to src/fsfw/events/fwSubsystemIdRanges.h diff --git a/src/core/fdir/CMakeLists.txt b/src/fsfw/fdir/CMakeLists.txt similarity index 100% rename from src/core/fdir/CMakeLists.txt rename to src/fsfw/fdir/CMakeLists.txt diff --git a/inc/fsfw/fdir/ConfirmsFailuresIF.h b/src/fsfw/fdir/ConfirmsFailuresIF.h similarity index 100% rename from inc/fsfw/fdir/ConfirmsFailuresIF.h rename to src/fsfw/fdir/ConfirmsFailuresIF.h diff --git a/src/core/fdir/EventCorrelation.cpp b/src/fsfw/fdir/EventCorrelation.cpp similarity index 100% rename from src/core/fdir/EventCorrelation.cpp rename to src/fsfw/fdir/EventCorrelation.cpp diff --git a/inc/fsfw/fdir/EventCorrelation.h b/src/fsfw/fdir/EventCorrelation.h similarity index 100% rename from inc/fsfw/fdir/EventCorrelation.h rename to src/fsfw/fdir/EventCorrelation.h diff --git a/src/core/fdir/FailureIsolationBase.cpp b/src/fsfw/fdir/FailureIsolationBase.cpp similarity index 100% rename from src/core/fdir/FailureIsolationBase.cpp rename to src/fsfw/fdir/FailureIsolationBase.cpp diff --git a/inc/fsfw/fdir/FailureIsolationBase.h b/src/fsfw/fdir/FailureIsolationBase.h similarity index 100% rename from inc/fsfw/fdir/FailureIsolationBase.h rename to src/fsfw/fdir/FailureIsolationBase.h diff --git a/src/core/fdir/FaultCounter.cpp b/src/fsfw/fdir/FaultCounter.cpp similarity index 100% rename from src/core/fdir/FaultCounter.cpp rename to src/fsfw/fdir/FaultCounter.cpp diff --git a/inc/fsfw/fdir/FaultCounter.h b/src/fsfw/fdir/FaultCounter.h similarity index 100% rename from inc/fsfw/fdir/FaultCounter.h rename to src/fsfw/fdir/FaultCounter.h diff --git a/src/core/globalfunctions/AsciiConverter.cpp b/src/fsfw/globalfunctions/AsciiConverter.cpp similarity index 100% rename from src/core/globalfunctions/AsciiConverter.cpp rename to src/fsfw/globalfunctions/AsciiConverter.cpp diff --git a/inc/fsfw/globalfunctions/AsciiConverter.h b/src/fsfw/globalfunctions/AsciiConverter.h similarity index 100% rename from inc/fsfw/globalfunctions/AsciiConverter.h rename to src/fsfw/globalfunctions/AsciiConverter.h diff --git a/src/core/globalfunctions/CMakeLists.txt b/src/fsfw/globalfunctions/CMakeLists.txt similarity index 100% rename from src/core/globalfunctions/CMakeLists.txt rename to src/fsfw/globalfunctions/CMakeLists.txt diff --git a/src/core/globalfunctions/CRC.cpp b/src/fsfw/globalfunctions/CRC.cpp similarity index 100% rename from src/core/globalfunctions/CRC.cpp rename to src/fsfw/globalfunctions/CRC.cpp diff --git a/inc/fsfw/globalfunctions/CRC.h b/src/fsfw/globalfunctions/CRC.h similarity index 100% rename from inc/fsfw/globalfunctions/CRC.h rename to src/fsfw/globalfunctions/CRC.h diff --git a/src/core/globalfunctions/DleEncoder.cpp b/src/fsfw/globalfunctions/DleEncoder.cpp similarity index 100% rename from src/core/globalfunctions/DleEncoder.cpp rename to src/fsfw/globalfunctions/DleEncoder.cpp diff --git a/inc/fsfw/globalfunctions/DleEncoder.h b/src/fsfw/globalfunctions/DleEncoder.h similarity index 100% rename from inc/fsfw/globalfunctions/DleEncoder.h rename to src/fsfw/globalfunctions/DleEncoder.h diff --git a/src/core/globalfunctions/PeriodicOperationDivider.cpp b/src/fsfw/globalfunctions/PeriodicOperationDivider.cpp similarity index 100% rename from src/core/globalfunctions/PeriodicOperationDivider.cpp rename to src/fsfw/globalfunctions/PeriodicOperationDivider.cpp diff --git a/inc/fsfw/globalfunctions/PeriodicOperationDivider.h b/src/fsfw/globalfunctions/PeriodicOperationDivider.h similarity index 100% rename from inc/fsfw/globalfunctions/PeriodicOperationDivider.h rename to src/fsfw/globalfunctions/PeriodicOperationDivider.h diff --git a/src/core/globalfunctions/Type.cpp b/src/fsfw/globalfunctions/Type.cpp similarity index 100% rename from src/core/globalfunctions/Type.cpp rename to src/fsfw/globalfunctions/Type.cpp diff --git a/inc/fsfw/globalfunctions/Type.h b/src/fsfw/globalfunctions/Type.h similarity index 100% rename from inc/fsfw/globalfunctions/Type.h rename to src/fsfw/globalfunctions/Type.h diff --git a/src/core/globalfunctions/arrayprinter.cpp b/src/fsfw/globalfunctions/arrayprinter.cpp similarity index 100% rename from src/core/globalfunctions/arrayprinter.cpp rename to src/fsfw/globalfunctions/arrayprinter.cpp diff --git a/inc/fsfw/globalfunctions/arrayprinter.h b/src/fsfw/globalfunctions/arrayprinter.h similarity index 100% rename from inc/fsfw/globalfunctions/arrayprinter.h rename to src/fsfw/globalfunctions/arrayprinter.h diff --git a/src/core/globalfunctions/bitutility.cpp b/src/fsfw/globalfunctions/bitutility.cpp similarity index 100% rename from src/core/globalfunctions/bitutility.cpp rename to src/fsfw/globalfunctions/bitutility.cpp diff --git a/inc/fsfw/globalfunctions/bitutility.h b/src/fsfw/globalfunctions/bitutility.h similarity index 100% rename from inc/fsfw/globalfunctions/bitutility.h rename to src/fsfw/globalfunctions/bitutility.h diff --git a/inc/fsfw/globalfunctions/constants.h b/src/fsfw/globalfunctions/constants.h similarity index 100% rename from inc/fsfw/globalfunctions/constants.h rename to src/fsfw/globalfunctions/constants.h diff --git a/inc/fsfw/globalfunctions/matching/BinaryMatcher.h b/src/fsfw/globalfunctions/matching/BinaryMatcher.h similarity index 100% rename from inc/fsfw/globalfunctions/matching/BinaryMatcher.h rename to src/fsfw/globalfunctions/matching/BinaryMatcher.h diff --git a/inc/fsfw/globalfunctions/matching/DecimalMatcher.h b/src/fsfw/globalfunctions/matching/DecimalMatcher.h similarity index 100% rename from inc/fsfw/globalfunctions/matching/DecimalMatcher.h rename to src/fsfw/globalfunctions/matching/DecimalMatcher.h diff --git a/inc/fsfw/globalfunctions/matching/MatchTree.h b/src/fsfw/globalfunctions/matching/MatchTree.h similarity index 100% rename from inc/fsfw/globalfunctions/matching/MatchTree.h rename to src/fsfw/globalfunctions/matching/MatchTree.h diff --git a/inc/fsfw/globalfunctions/matching/MatcherIF.h b/src/fsfw/globalfunctions/matching/MatcherIF.h similarity index 100% rename from inc/fsfw/globalfunctions/matching/MatcherIF.h rename to src/fsfw/globalfunctions/matching/MatcherIF.h diff --git a/inc/fsfw/globalfunctions/matching/RangeMatcher.h b/src/fsfw/globalfunctions/matching/RangeMatcher.h similarity index 100% rename from inc/fsfw/globalfunctions/matching/RangeMatcher.h rename to src/fsfw/globalfunctions/matching/RangeMatcher.h diff --git a/inc/fsfw/globalfunctions/matching/SerializeableMatcherIF.h b/src/fsfw/globalfunctions/matching/SerializeableMatcherIF.h similarity index 100% rename from inc/fsfw/globalfunctions/matching/SerializeableMatcherIF.h rename to src/fsfw/globalfunctions/matching/SerializeableMatcherIF.h diff --git a/src/core/globalfunctions/math/CMakeLists.txt b/src/fsfw/globalfunctions/math/CMakeLists.txt similarity index 100% rename from src/core/globalfunctions/math/CMakeLists.txt rename to src/fsfw/globalfunctions/math/CMakeLists.txt diff --git a/inc/fsfw/globalfunctions/math/MatrixOperations.h b/src/fsfw/globalfunctions/math/MatrixOperations.h similarity index 100% rename from inc/fsfw/globalfunctions/math/MatrixOperations.h rename to src/fsfw/globalfunctions/math/MatrixOperations.h diff --git a/src/core/globalfunctions/math/QuaternionOperations.cpp b/src/fsfw/globalfunctions/math/QuaternionOperations.cpp similarity index 100% rename from src/core/globalfunctions/math/QuaternionOperations.cpp rename to src/fsfw/globalfunctions/math/QuaternionOperations.cpp diff --git a/inc/fsfw/globalfunctions/math/QuaternionOperations.h b/src/fsfw/globalfunctions/math/QuaternionOperations.h similarity index 100% rename from inc/fsfw/globalfunctions/math/QuaternionOperations.h rename to src/fsfw/globalfunctions/math/QuaternionOperations.h diff --git a/inc/fsfw/globalfunctions/math/VectorOperations.h b/src/fsfw/globalfunctions/math/VectorOperations.h similarity index 100% rename from inc/fsfw/globalfunctions/math/VectorOperations.h rename to src/fsfw/globalfunctions/math/VectorOperations.h diff --git a/inc/fsfw/globalfunctions/sign.h b/src/fsfw/globalfunctions/sign.h similarity index 100% rename from inc/fsfw/globalfunctions/sign.h rename to src/fsfw/globalfunctions/sign.h diff --git a/src/core/globalfunctions/timevalOperations.cpp b/src/fsfw/globalfunctions/timevalOperations.cpp similarity index 100% rename from src/core/globalfunctions/timevalOperations.cpp rename to src/fsfw/globalfunctions/timevalOperations.cpp diff --git a/inc/fsfw/globalfunctions/timevalOperations.h b/src/fsfw/globalfunctions/timevalOperations.h similarity index 100% rename from inc/fsfw/globalfunctions/timevalOperations.h rename to src/fsfw/globalfunctions/timevalOperations.h diff --git a/src/fsfw/health.h b/src/fsfw/health.h new file mode 100644 index 00000000..0b7c8793 --- /dev/null +++ b/src/fsfw/health.h @@ -0,0 +1,9 @@ +#ifndef FSFW_INC_FSFW_HEALTH_H_ +#define FSFW_INC_FSFW_HEALTH_H_ + +#include "src/core/health/HasHealthIF.h" +#include "src/core/health/HealthHelper.h" +#include "src/core/health/HealthMessage.h" +#include "src/core/health/HealthTable.h" + +#endif /* FSFW_INC_FSFW_HEALTH_H_ */ diff --git a/src/core/health/CMakeLists.txt b/src/fsfw/health/CMakeLists.txt similarity index 100% rename from src/core/health/CMakeLists.txt rename to src/fsfw/health/CMakeLists.txt diff --git a/inc/fsfw/health/HasHealthIF.h b/src/fsfw/health/HasHealthIF.h similarity index 100% rename from inc/fsfw/health/HasHealthIF.h rename to src/fsfw/health/HasHealthIF.h diff --git a/src/core/health/HealthHelper.cpp b/src/fsfw/health/HealthHelper.cpp similarity index 100% rename from src/core/health/HealthHelper.cpp rename to src/fsfw/health/HealthHelper.cpp diff --git a/inc/fsfw/health/HealthHelper.h b/src/fsfw/health/HealthHelper.h similarity index 100% rename from inc/fsfw/health/HealthHelper.h rename to src/fsfw/health/HealthHelper.h diff --git a/src/core/health/HealthMessage.cpp b/src/fsfw/health/HealthMessage.cpp similarity index 100% rename from src/core/health/HealthMessage.cpp rename to src/fsfw/health/HealthMessage.cpp diff --git a/inc/fsfw/health/HealthMessage.h b/src/fsfw/health/HealthMessage.h similarity index 100% rename from inc/fsfw/health/HealthMessage.h rename to src/fsfw/health/HealthMessage.h diff --git a/src/core/health/HealthTable.cpp b/src/fsfw/health/HealthTable.cpp similarity index 100% rename from src/core/health/HealthTable.cpp rename to src/fsfw/health/HealthTable.cpp diff --git a/inc/fsfw/health/HealthTable.h b/src/fsfw/health/HealthTable.h similarity index 100% rename from inc/fsfw/health/HealthTable.h rename to src/fsfw/health/HealthTable.h diff --git a/inc/fsfw/health/HealthTableIF.h b/src/fsfw/health/HealthTableIF.h similarity index 100% rename from inc/fsfw/health/HealthTableIF.h rename to src/fsfw/health/HealthTableIF.h diff --git a/inc/fsfw/health/ManagesHealthIF.h b/src/fsfw/health/ManagesHealthIF.h similarity index 100% rename from inc/fsfw/health/ManagesHealthIF.h rename to src/fsfw/health/ManagesHealthIF.h diff --git a/src/fsfw/housekeeping.h b/src/fsfw/housekeeping.h new file mode 100644 index 00000000..0627d523 --- /dev/null +++ b/src/fsfw/housekeeping.h @@ -0,0 +1,9 @@ +#ifndef FSFW_INC_FSFW_HOUSEKEEPING_H_ +#define FSFW_INC_FSFW_HOUSEKEEPING_H_ + +#include "src/core/housekeeping/HousekeepingMessage.h" +#include "src/core/housekeeping/HousekeepingPacketDownlink.h" +#include "src/core/housekeeping/HousekeepingSetPacket.h" +#include "src/core/housekeeping/HousekeepingSnapshot.h" + +#endif /* FSFW_INC_FSFW_HOUSEKEEPING_H_ */ diff --git a/inc/fsfw/housekeeping/AcceptsHkPacketsIF.h b/src/fsfw/housekeeping/AcceptsHkPacketsIF.h similarity index 100% rename from inc/fsfw/housekeeping/AcceptsHkPacketsIF.h rename to src/fsfw/housekeeping/AcceptsHkPacketsIF.h diff --git a/inc/fsfw/housekeeping/CMakeLists.txt b/src/fsfw/housekeeping/CMakeLists.txt similarity index 100% rename from inc/fsfw/housekeeping/CMakeLists.txt rename to src/fsfw/housekeeping/CMakeLists.txt diff --git a/src/core/housekeeping/HousekeepingMessage.cpp b/src/fsfw/housekeeping/HousekeepingMessage.cpp similarity index 100% rename from src/core/housekeeping/HousekeepingMessage.cpp rename to src/fsfw/housekeeping/HousekeepingMessage.cpp diff --git a/inc/fsfw/housekeeping/HousekeepingMessage.h b/src/fsfw/housekeeping/HousekeepingMessage.h similarity index 100% rename from inc/fsfw/housekeeping/HousekeepingMessage.h rename to src/fsfw/housekeeping/HousekeepingMessage.h diff --git a/inc/fsfw/housekeeping/HousekeepingPacketDownlink.h b/src/fsfw/housekeeping/HousekeepingPacketDownlink.h similarity index 100% rename from inc/fsfw/housekeeping/HousekeepingPacketDownlink.h rename to src/fsfw/housekeeping/HousekeepingPacketDownlink.h diff --git a/inc/fsfw/housekeeping/HousekeepingSetPacket.h b/src/fsfw/housekeeping/HousekeepingSetPacket.h similarity index 100% rename from inc/fsfw/housekeeping/HousekeepingSetPacket.h rename to src/fsfw/housekeeping/HousekeepingSetPacket.h diff --git a/inc/fsfw/housekeeping/HousekeepingSnapshot.h b/src/fsfw/housekeeping/HousekeepingSnapshot.h similarity index 100% rename from inc/fsfw/housekeeping/HousekeepingSnapshot.h rename to src/fsfw/housekeeping/HousekeepingSnapshot.h diff --git a/src/core/housekeeping/PeriodicHousekeepingHelper.cpp b/src/fsfw/housekeeping/PeriodicHousekeepingHelper.cpp similarity index 100% rename from src/core/housekeeping/PeriodicHousekeepingHelper.cpp rename to src/fsfw/housekeeping/PeriodicHousekeepingHelper.cpp diff --git a/inc/fsfw/housekeeping/PeriodicHousekeepingHelper.h b/src/fsfw/housekeeping/PeriodicHousekeepingHelper.h similarity index 100% rename from inc/fsfw/housekeeping/PeriodicHousekeepingHelper.h rename to src/fsfw/housekeeping/PeriodicHousekeepingHelper.h diff --git a/src/core/internalerror/CMakeLists.txt b/src/fsfw/internalerror/CMakeLists.txt similarity index 100% rename from src/core/internalerror/CMakeLists.txt rename to src/fsfw/internalerror/CMakeLists.txt diff --git a/inc/fsfw/internalerror/InternalErrorDataset.h b/src/fsfw/internalerror/InternalErrorDataset.h similarity index 100% rename from inc/fsfw/internalerror/InternalErrorDataset.h rename to src/fsfw/internalerror/InternalErrorDataset.h diff --git a/src/core/internalerror/InternalErrorReporter.cpp b/src/fsfw/internalerror/InternalErrorReporter.cpp similarity index 100% rename from src/core/internalerror/InternalErrorReporter.cpp rename to src/fsfw/internalerror/InternalErrorReporter.cpp diff --git a/inc/fsfw/internalerror/InternalErrorReporter.h b/src/fsfw/internalerror/InternalErrorReporter.h similarity index 100% rename from inc/fsfw/internalerror/InternalErrorReporter.h rename to src/fsfw/internalerror/InternalErrorReporter.h diff --git a/inc/fsfw/internalerror/InternalErrorReporterIF.h b/src/fsfw/internalerror/InternalErrorReporterIF.h similarity index 100% rename from inc/fsfw/internalerror/InternalErrorReporterIF.h rename to src/fsfw/internalerror/InternalErrorReporterIF.h diff --git a/src/core/ipc/CMakeLists.txt b/src/fsfw/ipc/CMakeLists.txt similarity index 100% rename from src/core/ipc/CMakeLists.txt rename to src/fsfw/ipc/CMakeLists.txt diff --git a/src/core/ipc/CommandMessage.cpp b/src/fsfw/ipc/CommandMessage.cpp similarity index 100% rename from src/core/ipc/CommandMessage.cpp rename to src/fsfw/ipc/CommandMessage.cpp diff --git a/inc/fsfw/ipc/CommandMessage.h b/src/fsfw/ipc/CommandMessage.h similarity index 100% rename from inc/fsfw/ipc/CommandMessage.h rename to src/fsfw/ipc/CommandMessage.h diff --git a/src/core/ipc/CommandMessageCleaner.cpp b/src/fsfw/ipc/CommandMessageCleaner.cpp similarity index 100% rename from src/core/ipc/CommandMessageCleaner.cpp rename to src/fsfw/ipc/CommandMessageCleaner.cpp diff --git a/inc/fsfw/ipc/CommandMessageCleaner.h b/src/fsfw/ipc/CommandMessageCleaner.h similarity index 100% rename from inc/fsfw/ipc/CommandMessageCleaner.h rename to src/fsfw/ipc/CommandMessageCleaner.h diff --git a/inc/fsfw/ipc/CommandMessageIF.h b/src/fsfw/ipc/CommandMessageIF.h similarity index 100% rename from inc/fsfw/ipc/CommandMessageIF.h rename to src/fsfw/ipc/CommandMessageIF.h diff --git a/inc/fsfw/ipc/FwMessageTypes.h b/src/fsfw/ipc/FwMessageTypes.h similarity index 100% rename from inc/fsfw/ipc/FwMessageTypes.h rename to src/fsfw/ipc/FwMessageTypes.h diff --git a/inc/fsfw/ipc/MessageQueueIF.h b/src/fsfw/ipc/MessageQueueIF.h similarity index 100% rename from inc/fsfw/ipc/MessageQueueIF.h rename to src/fsfw/ipc/MessageQueueIF.h diff --git a/src/core/ipc/MessageQueueMessage.cpp b/src/fsfw/ipc/MessageQueueMessage.cpp similarity index 100% rename from src/core/ipc/MessageQueueMessage.cpp rename to src/fsfw/ipc/MessageQueueMessage.cpp diff --git a/inc/fsfw/ipc/MessageQueueMessage.h b/src/fsfw/ipc/MessageQueueMessage.h similarity index 100% rename from inc/fsfw/ipc/MessageQueueMessage.h rename to src/fsfw/ipc/MessageQueueMessage.h diff --git a/inc/fsfw/ipc/MessageQueueMessageIF.h b/src/fsfw/ipc/MessageQueueMessageIF.h similarity index 100% rename from inc/fsfw/ipc/MessageQueueMessageIF.h rename to src/fsfw/ipc/MessageQueueMessageIF.h diff --git a/inc/fsfw/ipc/MessageQueueSenderIF.h b/src/fsfw/ipc/MessageQueueSenderIF.h similarity index 100% rename from inc/fsfw/ipc/MessageQueueSenderIF.h rename to src/fsfw/ipc/MessageQueueSenderIF.h diff --git a/inc/fsfw/ipc/MutexFactory.h b/src/fsfw/ipc/MutexFactory.h similarity index 100% rename from inc/fsfw/ipc/MutexFactory.h rename to src/fsfw/ipc/MutexFactory.h diff --git a/inc/fsfw/ipc/MutexGuard.h b/src/fsfw/ipc/MutexGuard.h similarity index 100% rename from inc/fsfw/ipc/MutexGuard.h rename to src/fsfw/ipc/MutexGuard.h diff --git a/inc/fsfw/ipc/MutexIF.h b/src/fsfw/ipc/MutexIF.h similarity index 100% rename from inc/fsfw/ipc/MutexIF.h rename to src/fsfw/ipc/MutexIF.h diff --git a/inc/fsfw/ipc/QueueFactory.h b/src/fsfw/ipc/QueueFactory.h similarity index 100% rename from inc/fsfw/ipc/QueueFactory.h rename to src/fsfw/ipc/QueueFactory.h diff --git a/inc/fsfw/ipc/messageQueueDefinitions.h b/src/fsfw/ipc/messageQueueDefinitions.h similarity index 100% rename from inc/fsfw/ipc/messageQueueDefinitions.h rename to src/fsfw/ipc/messageQueueDefinitions.h diff --git a/inc/fsfw/memory/AcceptsMemoryMessagesIF.h b/src/fsfw/memory/AcceptsMemoryMessagesIF.h similarity index 100% rename from inc/fsfw/memory/AcceptsMemoryMessagesIF.h rename to src/fsfw/memory/AcceptsMemoryMessagesIF.h diff --git a/src/core/memory/CMakeLists.txt b/src/fsfw/memory/CMakeLists.txt similarity index 100% rename from src/core/memory/CMakeLists.txt rename to src/fsfw/memory/CMakeLists.txt diff --git a/src/core/memory/GenericFileSystemMessage.cpp b/src/fsfw/memory/GenericFileSystemMessage.cpp similarity index 100% rename from src/core/memory/GenericFileSystemMessage.cpp rename to src/fsfw/memory/GenericFileSystemMessage.cpp diff --git a/inc/fsfw/memory/GenericFileSystemMessage.h b/src/fsfw/memory/GenericFileSystemMessage.h similarity index 100% rename from inc/fsfw/memory/GenericFileSystemMessage.h rename to src/fsfw/memory/GenericFileSystemMessage.h diff --git a/inc/fsfw/memory/HasFileSystemIF.h b/src/fsfw/memory/HasFileSystemIF.h similarity index 100% rename from inc/fsfw/memory/HasFileSystemIF.h rename to src/fsfw/memory/HasFileSystemIF.h diff --git a/inc/fsfw/memory/HasMemoryIF.h b/src/fsfw/memory/HasMemoryIF.h similarity index 100% rename from inc/fsfw/memory/HasMemoryIF.h rename to src/fsfw/memory/HasMemoryIF.h diff --git a/src/core/memory/MemoryHelper.cpp b/src/fsfw/memory/MemoryHelper.cpp similarity index 100% rename from src/core/memory/MemoryHelper.cpp rename to src/fsfw/memory/MemoryHelper.cpp diff --git a/inc/fsfw/memory/MemoryHelper.h b/src/fsfw/memory/MemoryHelper.h similarity index 100% rename from inc/fsfw/memory/MemoryHelper.h rename to src/fsfw/memory/MemoryHelper.h diff --git a/src/core/memory/MemoryMessage.cpp b/src/fsfw/memory/MemoryMessage.cpp similarity index 100% rename from src/core/memory/MemoryMessage.cpp rename to src/fsfw/memory/MemoryMessage.cpp diff --git a/inc/fsfw/memory/MemoryMessage.h b/src/fsfw/memory/MemoryMessage.h similarity index 100% rename from inc/fsfw/memory/MemoryMessage.h rename to src/fsfw/memory/MemoryMessage.h diff --git a/src/core/modes/CMakeLists.txt b/src/fsfw/modes/CMakeLists.txt similarity index 100% rename from src/core/modes/CMakeLists.txt rename to src/fsfw/modes/CMakeLists.txt diff --git a/inc/fsfw/modes/HasModesIF.h b/src/fsfw/modes/HasModesIF.h similarity index 100% rename from inc/fsfw/modes/HasModesIF.h rename to src/fsfw/modes/HasModesIF.h diff --git a/src/core/modes/ModeHelper.cpp b/src/fsfw/modes/ModeHelper.cpp similarity index 100% rename from src/core/modes/ModeHelper.cpp rename to src/fsfw/modes/ModeHelper.cpp diff --git a/inc/fsfw/modes/ModeHelper.h b/src/fsfw/modes/ModeHelper.h similarity index 100% rename from inc/fsfw/modes/ModeHelper.h rename to src/fsfw/modes/ModeHelper.h diff --git a/src/core/modes/ModeMessage.cpp b/src/fsfw/modes/ModeMessage.cpp similarity index 100% rename from src/core/modes/ModeMessage.cpp rename to src/fsfw/modes/ModeMessage.cpp diff --git a/inc/fsfw/modes/ModeMessage.h b/src/fsfw/modes/ModeMessage.h similarity index 100% rename from inc/fsfw/modes/ModeMessage.h rename to src/fsfw/modes/ModeMessage.h diff --git a/inc/fsfw/monitoring/AbsLimitMonitor.h b/src/fsfw/monitoring/AbsLimitMonitor.h similarity index 100% rename from inc/fsfw/monitoring/AbsLimitMonitor.h rename to src/fsfw/monitoring/AbsLimitMonitor.h diff --git a/src/opt/monitoring/CMakeLists.txt b/src/fsfw/monitoring/CMakeLists.txt similarity index 100% rename from src/opt/monitoring/CMakeLists.txt rename to src/fsfw/monitoring/CMakeLists.txt diff --git a/inc/fsfw/monitoring/HasMonitorsIF.h b/src/fsfw/monitoring/HasMonitorsIF.h similarity index 100% rename from inc/fsfw/monitoring/HasMonitorsIF.h rename to src/fsfw/monitoring/HasMonitorsIF.h diff --git a/inc/fsfw/monitoring/LimitMonitor.h b/src/fsfw/monitoring/LimitMonitor.h similarity index 100% rename from inc/fsfw/monitoring/LimitMonitor.h rename to src/fsfw/monitoring/LimitMonitor.h diff --git a/src/opt/monitoring/LimitViolationReporter.cpp b/src/fsfw/monitoring/LimitViolationReporter.cpp similarity index 100% rename from src/opt/monitoring/LimitViolationReporter.cpp rename to src/fsfw/monitoring/LimitViolationReporter.cpp diff --git a/inc/fsfw/monitoring/LimitViolationReporter.h b/src/fsfw/monitoring/LimitViolationReporter.h similarity index 100% rename from inc/fsfw/monitoring/LimitViolationReporter.h rename to src/fsfw/monitoring/LimitViolationReporter.h diff --git a/inc/fsfw/monitoring/MonitorBase.h b/src/fsfw/monitoring/MonitorBase.h similarity index 100% rename from inc/fsfw/monitoring/MonitorBase.h rename to src/fsfw/monitoring/MonitorBase.h diff --git a/inc/fsfw/monitoring/MonitorReporter.h b/src/fsfw/monitoring/MonitorReporter.h similarity index 100% rename from inc/fsfw/monitoring/MonitorReporter.h rename to src/fsfw/monitoring/MonitorReporter.h diff --git a/inc/fsfw/monitoring/MonitoringIF.h b/src/fsfw/monitoring/MonitoringIF.h similarity index 100% rename from inc/fsfw/monitoring/MonitoringIF.h rename to src/fsfw/monitoring/MonitoringIF.h diff --git a/src/opt/monitoring/MonitoringMessage.cpp b/src/fsfw/monitoring/MonitoringMessage.cpp similarity index 100% rename from src/opt/monitoring/MonitoringMessage.cpp rename to src/fsfw/monitoring/MonitoringMessage.cpp diff --git a/inc/fsfw/monitoring/MonitoringMessage.h b/src/fsfw/monitoring/MonitoringMessage.h similarity index 100% rename from inc/fsfw/monitoring/MonitoringMessage.h rename to src/fsfw/monitoring/MonitoringMessage.h diff --git a/inc/fsfw/monitoring/MonitoringMessageContent.h b/src/fsfw/monitoring/MonitoringMessageContent.h similarity index 100% rename from inc/fsfw/monitoring/MonitoringMessageContent.h rename to src/fsfw/monitoring/MonitoringMessageContent.h diff --git a/inc/fsfw/monitoring/ReceivesMonitoringReportsIF.h b/src/fsfw/monitoring/ReceivesMonitoringReportsIF.h similarity index 100% rename from inc/fsfw/monitoring/ReceivesMonitoringReportsIF.h rename to src/fsfw/monitoring/ReceivesMonitoringReportsIF.h diff --git a/inc/fsfw/monitoring/TriplexMonitor.h b/src/fsfw/monitoring/TriplexMonitor.h similarity index 100% rename from inc/fsfw/monitoring/TriplexMonitor.h rename to src/fsfw/monitoring/TriplexMonitor.h diff --git a/inc/fsfw/monitoring/TwoValueLimitMonitor.h b/src/fsfw/monitoring/TwoValueLimitMonitor.h similarity index 100% rename from inc/fsfw/monitoring/TwoValueLimitMonitor.h rename to src/fsfw/monitoring/TwoValueLimitMonitor.h diff --git a/src/core/objectmanager/CMakeLists.txt b/src/fsfw/objectmanager/CMakeLists.txt similarity index 100% rename from src/core/objectmanager/CMakeLists.txt rename to src/fsfw/objectmanager/CMakeLists.txt diff --git a/src/core/objectmanager/ObjectManager.cpp b/src/fsfw/objectmanager/ObjectManager.cpp similarity index 100% rename from src/core/objectmanager/ObjectManager.cpp rename to src/fsfw/objectmanager/ObjectManager.cpp diff --git a/inc/fsfw/objectmanager/ObjectManager.h b/src/fsfw/objectmanager/ObjectManager.h similarity index 100% rename from inc/fsfw/objectmanager/ObjectManager.h rename to src/fsfw/objectmanager/ObjectManager.h diff --git a/inc/fsfw/objectmanager/ObjectManagerIF.h b/src/fsfw/objectmanager/ObjectManagerIF.h similarity index 100% rename from inc/fsfw/objectmanager/ObjectManagerIF.h rename to src/fsfw/objectmanager/ObjectManagerIF.h diff --git a/src/core/objectmanager/SystemObject.cpp b/src/fsfw/objectmanager/SystemObject.cpp similarity index 100% rename from src/core/objectmanager/SystemObject.cpp rename to src/fsfw/objectmanager/SystemObject.cpp diff --git a/inc/fsfw/objectmanager/SystemObject.h b/src/fsfw/objectmanager/SystemObject.h similarity index 100% rename from inc/fsfw/objectmanager/SystemObject.h rename to src/fsfw/objectmanager/SystemObject.h diff --git a/inc/fsfw/objectmanager/SystemObjectIF.h b/src/fsfw/objectmanager/SystemObjectIF.h similarity index 100% rename from inc/fsfw/objectmanager/SystemObjectIF.h rename to src/fsfw/objectmanager/SystemObjectIF.h diff --git a/inc/fsfw/objectmanager/frameworkObjects.h b/src/fsfw/objectmanager/frameworkObjects.h similarity index 100% rename from inc/fsfw/objectmanager/frameworkObjects.h rename to src/fsfw/objectmanager/frameworkObjects.h diff --git a/src/osal/CMakeLists.txt b/src/fsfw/osal/CMakeLists.txt similarity index 100% rename from src/osal/CMakeLists.txt rename to src/fsfw/osal/CMakeLists.txt diff --git a/inc/fsfw/osal/Endiness.h b/src/fsfw/osal/Endiness.h similarity index 100% rename from inc/fsfw/osal/Endiness.h rename to src/fsfw/osal/Endiness.h diff --git a/inc/fsfw/osal/InternalErrorCodes.h b/src/fsfw/osal/InternalErrorCodes.h similarity index 100% rename from inc/fsfw/osal/InternalErrorCodes.h rename to src/fsfw/osal/InternalErrorCodes.h diff --git a/src/osal/common/CMakeLists.txt b/src/fsfw/osal/common/CMakeLists.txt similarity index 100% rename from src/osal/common/CMakeLists.txt rename to src/fsfw/osal/common/CMakeLists.txt diff --git a/src/osal/common/TcpIpBase.cpp b/src/fsfw/osal/common/TcpIpBase.cpp similarity index 100% rename from src/osal/common/TcpIpBase.cpp rename to src/fsfw/osal/common/TcpIpBase.cpp diff --git a/inc/fsfw/osal/common/TcpIpBase.h b/src/fsfw/osal/common/TcpIpBase.h similarity index 100% rename from inc/fsfw/osal/common/TcpIpBase.h rename to src/fsfw/osal/common/TcpIpBase.h diff --git a/src/osal/common/TcpTmTcBridge.cpp b/src/fsfw/osal/common/TcpTmTcBridge.cpp similarity index 100% rename from src/osal/common/TcpTmTcBridge.cpp rename to src/fsfw/osal/common/TcpTmTcBridge.cpp diff --git a/inc/fsfw/osal/common/TcpTmTcBridge.h b/src/fsfw/osal/common/TcpTmTcBridge.h similarity index 100% rename from inc/fsfw/osal/common/TcpTmTcBridge.h rename to src/fsfw/osal/common/TcpTmTcBridge.h diff --git a/src/osal/common/TcpTmTcServer.cpp b/src/fsfw/osal/common/TcpTmTcServer.cpp similarity index 100% rename from src/osal/common/TcpTmTcServer.cpp rename to src/fsfw/osal/common/TcpTmTcServer.cpp diff --git a/inc/fsfw/osal/common/TcpTmTcServer.h b/src/fsfw/osal/common/TcpTmTcServer.h similarity index 100% rename from inc/fsfw/osal/common/TcpTmTcServer.h rename to src/fsfw/osal/common/TcpTmTcServer.h diff --git a/src/osal/common/UdpTcPollingTask.cpp b/src/fsfw/osal/common/UdpTcPollingTask.cpp similarity index 100% rename from src/osal/common/UdpTcPollingTask.cpp rename to src/fsfw/osal/common/UdpTcPollingTask.cpp diff --git a/inc/fsfw/osal/common/UdpTcPollingTask.h b/src/fsfw/osal/common/UdpTcPollingTask.h similarity index 100% rename from inc/fsfw/osal/common/UdpTcPollingTask.h rename to src/fsfw/osal/common/UdpTcPollingTask.h diff --git a/src/osal/common/UdpTmTcBridge.cpp b/src/fsfw/osal/common/UdpTmTcBridge.cpp similarity index 100% rename from src/osal/common/UdpTmTcBridge.cpp rename to src/fsfw/osal/common/UdpTmTcBridge.cpp diff --git a/inc/fsfw/osal/common/UdpTmTcBridge.h b/src/fsfw/osal/common/UdpTmTcBridge.h similarity index 100% rename from inc/fsfw/osal/common/UdpTmTcBridge.h rename to src/fsfw/osal/common/UdpTmTcBridge.h diff --git a/src/osal/common/tcpipCommon.cpp b/src/fsfw/osal/common/tcpipCommon.cpp similarity index 100% rename from src/osal/common/tcpipCommon.cpp rename to src/fsfw/osal/common/tcpipCommon.cpp diff --git a/inc/fsfw/osal/common/tcpipCommon.h b/src/fsfw/osal/common/tcpipCommon.h similarity index 100% rename from inc/fsfw/osal/common/tcpipCommon.h rename to src/fsfw/osal/common/tcpipCommon.h diff --git a/inc/fsfw/osal/common/tcpipHelpers.h b/src/fsfw/osal/common/tcpipHelpers.h similarity index 100% rename from inc/fsfw/osal/common/tcpipHelpers.h rename to src/fsfw/osal/common/tcpipHelpers.h diff --git a/src/osal/freertos/BinSemaphUsingTask.cpp b/src/fsfw/osal/freertos/BinSemaphUsingTask.cpp similarity index 100% rename from src/osal/freertos/BinSemaphUsingTask.cpp rename to src/fsfw/osal/freertos/BinSemaphUsingTask.cpp diff --git a/inc/fsfw/osal/freertos/BinSemaphUsingTask.h b/src/fsfw/osal/freertos/BinSemaphUsingTask.h similarity index 100% rename from inc/fsfw/osal/freertos/BinSemaphUsingTask.h rename to src/fsfw/osal/freertos/BinSemaphUsingTask.h diff --git a/src/osal/freertos/BinarySemaphore.cpp b/src/fsfw/osal/freertos/BinarySemaphore.cpp similarity index 100% rename from src/osal/freertos/BinarySemaphore.cpp rename to src/fsfw/osal/freertos/BinarySemaphore.cpp diff --git a/inc/fsfw/osal/freertos/BinarySemaphore.h b/src/fsfw/osal/freertos/BinarySemaphore.h similarity index 100% rename from inc/fsfw/osal/freertos/BinarySemaphore.h rename to src/fsfw/osal/freertos/BinarySemaphore.h diff --git a/src/osal/freertos/CMakeLists.txt b/src/fsfw/osal/freertos/CMakeLists.txt similarity index 100% rename from src/osal/freertos/CMakeLists.txt rename to src/fsfw/osal/freertos/CMakeLists.txt diff --git a/src/osal/freertos/Clock.cpp b/src/fsfw/osal/freertos/Clock.cpp similarity index 100% rename from src/osal/freertos/Clock.cpp rename to src/fsfw/osal/freertos/Clock.cpp diff --git a/src/osal/freertos/CountingSemaphUsingTask.cpp b/src/fsfw/osal/freertos/CountingSemaphUsingTask.cpp similarity index 100% rename from src/osal/freertos/CountingSemaphUsingTask.cpp rename to src/fsfw/osal/freertos/CountingSemaphUsingTask.cpp diff --git a/inc/fsfw/osal/freertos/CountingSemaphUsingTask.h b/src/fsfw/osal/freertos/CountingSemaphUsingTask.h similarity index 100% rename from inc/fsfw/osal/freertos/CountingSemaphUsingTask.h rename to src/fsfw/osal/freertos/CountingSemaphUsingTask.h diff --git a/src/osal/freertos/CountingSemaphore.cpp b/src/fsfw/osal/freertos/CountingSemaphore.cpp similarity index 100% rename from src/osal/freertos/CountingSemaphore.cpp rename to src/fsfw/osal/freertos/CountingSemaphore.cpp diff --git a/inc/fsfw/osal/freertos/CountingSemaphore.h b/src/fsfw/osal/freertos/CountingSemaphore.h similarity index 100% rename from inc/fsfw/osal/freertos/CountingSemaphore.h rename to src/fsfw/osal/freertos/CountingSemaphore.h diff --git a/src/osal/freertos/FixedTimeslotTask.cpp b/src/fsfw/osal/freertos/FixedTimeslotTask.cpp similarity index 100% rename from src/osal/freertos/FixedTimeslotTask.cpp rename to src/fsfw/osal/freertos/FixedTimeslotTask.cpp diff --git a/inc/fsfw/osal/freertos/FixedTimeslotTask.h b/src/fsfw/osal/freertos/FixedTimeslotTask.h similarity index 100% rename from inc/fsfw/osal/freertos/FixedTimeslotTask.h rename to src/fsfw/osal/freertos/FixedTimeslotTask.h diff --git a/inc/fsfw/osal/freertos/FreeRTOSTaskIF.h b/src/fsfw/osal/freertos/FreeRTOSTaskIF.h similarity index 100% rename from inc/fsfw/osal/freertos/FreeRTOSTaskIF.h rename to src/fsfw/osal/freertos/FreeRTOSTaskIF.h diff --git a/src/osal/freertos/MessageQueue.cpp b/src/fsfw/osal/freertos/MessageQueue.cpp similarity index 100% rename from src/osal/freertos/MessageQueue.cpp rename to src/fsfw/osal/freertos/MessageQueue.cpp diff --git a/inc/fsfw/osal/freertos/MessageQueue.h b/src/fsfw/osal/freertos/MessageQueue.h similarity index 100% rename from inc/fsfw/osal/freertos/MessageQueue.h rename to src/fsfw/osal/freertos/MessageQueue.h diff --git a/src/osal/freertos/Mutex.cpp b/src/fsfw/osal/freertos/Mutex.cpp similarity index 100% rename from src/osal/freertos/Mutex.cpp rename to src/fsfw/osal/freertos/Mutex.cpp diff --git a/inc/fsfw/osal/freertos/Mutex.h b/src/fsfw/osal/freertos/Mutex.h similarity index 100% rename from inc/fsfw/osal/freertos/Mutex.h rename to src/fsfw/osal/freertos/Mutex.h diff --git a/src/osal/freertos/MutexFactory.cpp b/src/fsfw/osal/freertos/MutexFactory.cpp similarity index 100% rename from src/osal/freertos/MutexFactory.cpp rename to src/fsfw/osal/freertos/MutexFactory.cpp diff --git a/src/osal/freertos/PeriodicTask.cpp b/src/fsfw/osal/freertos/PeriodicTask.cpp similarity index 100% rename from src/osal/freertos/PeriodicTask.cpp rename to src/fsfw/osal/freertos/PeriodicTask.cpp diff --git a/inc/fsfw/osal/freertos/PeriodicTask.h b/src/fsfw/osal/freertos/PeriodicTask.h similarity index 100% rename from inc/fsfw/osal/freertos/PeriodicTask.h rename to src/fsfw/osal/freertos/PeriodicTask.h diff --git a/src/osal/freertos/QueueFactory.cpp b/src/fsfw/osal/freertos/QueueFactory.cpp similarity index 100% rename from src/osal/freertos/QueueFactory.cpp rename to src/fsfw/osal/freertos/QueueFactory.cpp diff --git a/src/osal/freertos/QueueMapManager.cpp b/src/fsfw/osal/freertos/QueueMapManager.cpp similarity index 100% rename from src/osal/freertos/QueueMapManager.cpp rename to src/fsfw/osal/freertos/QueueMapManager.cpp diff --git a/inc/fsfw/osal/freertos/QueueMapManager.h b/src/fsfw/osal/freertos/QueueMapManager.h similarity index 100% rename from inc/fsfw/osal/freertos/QueueMapManager.h rename to src/fsfw/osal/freertos/QueueMapManager.h diff --git a/inc/fsfw/osal/freertos/README.md b/src/fsfw/osal/freertos/README.md similarity index 100% rename from inc/fsfw/osal/freertos/README.md rename to src/fsfw/osal/freertos/README.md diff --git a/src/osal/freertos/SemaphoreFactory.cpp b/src/fsfw/osal/freertos/SemaphoreFactory.cpp similarity index 100% rename from src/osal/freertos/SemaphoreFactory.cpp rename to src/fsfw/osal/freertos/SemaphoreFactory.cpp diff --git a/src/osal/freertos/TaskFactory.cpp b/src/fsfw/osal/freertos/TaskFactory.cpp similarity index 100% rename from src/osal/freertos/TaskFactory.cpp rename to src/fsfw/osal/freertos/TaskFactory.cpp diff --git a/src/osal/freertos/TaskManagement.cpp b/src/fsfw/osal/freertos/TaskManagement.cpp similarity index 100% rename from src/osal/freertos/TaskManagement.cpp rename to src/fsfw/osal/freertos/TaskManagement.cpp diff --git a/inc/fsfw/osal/freertos/TaskManagement.h b/src/fsfw/osal/freertos/TaskManagement.h similarity index 100% rename from inc/fsfw/osal/freertos/TaskManagement.h rename to src/fsfw/osal/freertos/TaskManagement.h diff --git a/src/osal/freertos/Timekeeper.cpp b/src/fsfw/osal/freertos/Timekeeper.cpp similarity index 100% rename from src/osal/freertos/Timekeeper.cpp rename to src/fsfw/osal/freertos/Timekeeper.cpp diff --git a/inc/fsfw/osal/freertos/Timekeeper.h b/src/fsfw/osal/freertos/Timekeeper.h similarity index 100% rename from inc/fsfw/osal/freertos/Timekeeper.h rename to src/fsfw/osal/freertos/Timekeeper.h diff --git a/src/osal/host/CMakeLists.txt b/src/fsfw/osal/host/CMakeLists.txt similarity index 100% rename from src/osal/host/CMakeLists.txt rename to src/fsfw/osal/host/CMakeLists.txt diff --git a/src/osal/host/Clock.cpp b/src/fsfw/osal/host/Clock.cpp similarity index 100% rename from src/osal/host/Clock.cpp rename to src/fsfw/osal/host/Clock.cpp diff --git a/src/osal/host/FixedTimeslotTask.cpp b/src/fsfw/osal/host/FixedTimeslotTask.cpp similarity index 100% rename from src/osal/host/FixedTimeslotTask.cpp rename to src/fsfw/osal/host/FixedTimeslotTask.cpp diff --git a/inc/fsfw/osal/host/FixedTimeslotTask.h b/src/fsfw/osal/host/FixedTimeslotTask.h similarity index 100% rename from inc/fsfw/osal/host/FixedTimeslotTask.h rename to src/fsfw/osal/host/FixedTimeslotTask.h diff --git a/src/osal/host/MessageQueue.cpp b/src/fsfw/osal/host/MessageQueue.cpp similarity index 100% rename from src/osal/host/MessageQueue.cpp rename to src/fsfw/osal/host/MessageQueue.cpp diff --git a/inc/fsfw/osal/host/MessageQueue.h b/src/fsfw/osal/host/MessageQueue.h similarity index 97% rename from inc/fsfw/osal/host/MessageQueue.h rename to src/fsfw/osal/host/MessageQueue.h index 1c9b5e33..0bdfd8fc 100644 --- a/inc/fsfw/osal/host/MessageQueue.h +++ b/src/fsfw/osal/host/MessageQueue.h @@ -1,11 +1,11 @@ #ifndef FRAMEWORK_OSAL_HOST_MESSAGEQUEUE_H_ #define FRAMEWORK_OSAL_HOST_MESSAGEQUEUE_H_ -#include "../../internalError/InternalErrorReporterIF.h" -#include "../../ipc/MessageQueueIF.h" -#include "../../ipc/MessageQueueMessage.h" -#include "../../ipc/MutexIF.h" -#include "../../timemanager/Clock.h" +#include "fsfw/internalerror/InternalErrorReporterIF.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/ipc/MessageQueueMessage.h" +#include "fsfw/ipc/MutexIF.h" +#include "fsfw/timemanager/Clock.h" #include #include diff --git a/src/osal/host/Mutex.cpp b/src/fsfw/osal/host/Mutex.cpp similarity index 95% rename from src/osal/host/Mutex.cpp rename to src/fsfw/osal/host/Mutex.cpp index 1c8b1dd8..e423ea93 100644 --- a/src/osal/host/Mutex.cpp +++ b/src/fsfw/osal/host/Mutex.cpp @@ -1,4 +1,4 @@ -#include "Mutex.h" +#include "fsfw/osal/host/Mutex.h" #include "fsfw/serviceinterface/ServiceInterface.h" Mutex::Mutex() {} diff --git a/inc/fsfw/osal/host/Mutex.h b/src/fsfw/osal/host/Mutex.h similarity index 100% rename from inc/fsfw/osal/host/Mutex.h rename to src/fsfw/osal/host/Mutex.h diff --git a/src/osal/host/MutexFactory.cpp b/src/fsfw/osal/host/MutexFactory.cpp similarity index 100% rename from src/osal/host/MutexFactory.cpp rename to src/fsfw/osal/host/MutexFactory.cpp diff --git a/src/osal/host/PeriodicTask.cpp b/src/fsfw/osal/host/PeriodicTask.cpp similarity index 100% rename from src/osal/host/PeriodicTask.cpp rename to src/fsfw/osal/host/PeriodicTask.cpp diff --git a/inc/fsfw/osal/host/PeriodicTask.h b/src/fsfw/osal/host/PeriodicTask.h similarity index 100% rename from inc/fsfw/osal/host/PeriodicTask.h rename to src/fsfw/osal/host/PeriodicTask.h diff --git a/src/osal/host/QueueFactory.cpp b/src/fsfw/osal/host/QueueFactory.cpp similarity index 100% rename from src/osal/host/QueueFactory.cpp rename to src/fsfw/osal/host/QueueFactory.cpp diff --git a/src/osal/host/QueueMapManager.cpp b/src/fsfw/osal/host/QueueMapManager.cpp similarity index 100% rename from src/osal/host/QueueMapManager.cpp rename to src/fsfw/osal/host/QueueMapManager.cpp diff --git a/inc/fsfw/osal/host/QueueMapManager.h b/src/fsfw/osal/host/QueueMapManager.h similarity index 100% rename from inc/fsfw/osal/host/QueueMapManager.h rename to src/fsfw/osal/host/QueueMapManager.h diff --git a/src/osal/host/SemaphoreFactory.cpp b/src/fsfw/osal/host/SemaphoreFactory.cpp similarity index 100% rename from src/osal/host/SemaphoreFactory.cpp rename to src/fsfw/osal/host/SemaphoreFactory.cpp diff --git a/src/osal/host/TaskFactory.cpp b/src/fsfw/osal/host/TaskFactory.cpp similarity index 100% rename from src/osal/host/TaskFactory.cpp rename to src/fsfw/osal/host/TaskFactory.cpp diff --git a/src/osal/host/taskHelpers.cpp b/src/fsfw/osal/host/taskHelpers.cpp similarity index 100% rename from src/osal/host/taskHelpers.cpp rename to src/fsfw/osal/host/taskHelpers.cpp diff --git a/inc/fsfw/osal/host/taskHelpers.h b/src/fsfw/osal/host/taskHelpers.h similarity index 100% rename from inc/fsfw/osal/host/taskHelpers.h rename to src/fsfw/osal/host/taskHelpers.h diff --git a/src/osal/linux/BinarySemaphore.cpp b/src/fsfw/osal/linux/BinarySemaphore.cpp similarity index 100% rename from src/osal/linux/BinarySemaphore.cpp rename to src/fsfw/osal/linux/BinarySemaphore.cpp diff --git a/inc/fsfw/osal/linux/BinarySemaphore.h b/src/fsfw/osal/linux/BinarySemaphore.h similarity index 100% rename from inc/fsfw/osal/linux/BinarySemaphore.h rename to src/fsfw/osal/linux/BinarySemaphore.h diff --git a/src/osal/linux/CMakeLists.txt b/src/fsfw/osal/linux/CMakeLists.txt similarity index 100% rename from src/osal/linux/CMakeLists.txt rename to src/fsfw/osal/linux/CMakeLists.txt diff --git a/src/osal/linux/Clock.cpp b/src/fsfw/osal/linux/Clock.cpp similarity index 100% rename from src/osal/linux/Clock.cpp rename to src/fsfw/osal/linux/Clock.cpp diff --git a/src/osal/linux/CountingSemaphore.cpp b/src/fsfw/osal/linux/CountingSemaphore.cpp similarity index 100% rename from src/osal/linux/CountingSemaphore.cpp rename to src/fsfw/osal/linux/CountingSemaphore.cpp diff --git a/inc/fsfw/osal/linux/CountingSemaphore.h b/src/fsfw/osal/linux/CountingSemaphore.h similarity index 100% rename from inc/fsfw/osal/linux/CountingSemaphore.h rename to src/fsfw/osal/linux/CountingSemaphore.h diff --git a/src/osal/linux/FixedTimeslotTask.cpp b/src/fsfw/osal/linux/FixedTimeslotTask.cpp similarity index 100% rename from src/osal/linux/FixedTimeslotTask.cpp rename to src/fsfw/osal/linux/FixedTimeslotTask.cpp diff --git a/inc/fsfw/osal/linux/FixedTimeslotTask.h b/src/fsfw/osal/linux/FixedTimeslotTask.h similarity index 100% rename from inc/fsfw/osal/linux/FixedTimeslotTask.h rename to src/fsfw/osal/linux/FixedTimeslotTask.h diff --git a/src/osal/linux/InternalErrorCodes.cpp b/src/fsfw/osal/linux/InternalErrorCodes.cpp similarity index 100% rename from src/osal/linux/InternalErrorCodes.cpp rename to src/fsfw/osal/linux/InternalErrorCodes.cpp diff --git a/src/osal/linux/MessageQueue.cpp b/src/fsfw/osal/linux/MessageQueue.cpp similarity index 100% rename from src/osal/linux/MessageQueue.cpp rename to src/fsfw/osal/linux/MessageQueue.cpp diff --git a/inc/fsfw/osal/linux/MessageQueue.h b/src/fsfw/osal/linux/MessageQueue.h similarity index 100% rename from inc/fsfw/osal/linux/MessageQueue.h rename to src/fsfw/osal/linux/MessageQueue.h diff --git a/src/osal/linux/Mutex.cpp b/src/fsfw/osal/linux/Mutex.cpp similarity index 100% rename from src/osal/linux/Mutex.cpp rename to src/fsfw/osal/linux/Mutex.cpp diff --git a/inc/fsfw/osal/linux/Mutex.h b/src/fsfw/osal/linux/Mutex.h similarity index 100% rename from inc/fsfw/osal/linux/Mutex.h rename to src/fsfw/osal/linux/Mutex.h diff --git a/src/osal/linux/MutexFactory.cpp b/src/fsfw/osal/linux/MutexFactory.cpp similarity index 100% rename from src/osal/linux/MutexFactory.cpp rename to src/fsfw/osal/linux/MutexFactory.cpp diff --git a/src/osal/linux/PeriodicPosixTask.cpp b/src/fsfw/osal/linux/PeriodicPosixTask.cpp similarity index 100% rename from src/osal/linux/PeriodicPosixTask.cpp rename to src/fsfw/osal/linux/PeriodicPosixTask.cpp diff --git a/inc/fsfw/osal/linux/PeriodicPosixTask.h b/src/fsfw/osal/linux/PeriodicPosixTask.h similarity index 100% rename from inc/fsfw/osal/linux/PeriodicPosixTask.h rename to src/fsfw/osal/linux/PeriodicPosixTask.h diff --git a/src/osal/linux/PosixThread.cpp b/src/fsfw/osal/linux/PosixThread.cpp similarity index 100% rename from src/osal/linux/PosixThread.cpp rename to src/fsfw/osal/linux/PosixThread.cpp diff --git a/inc/fsfw/osal/linux/PosixThread.h b/src/fsfw/osal/linux/PosixThread.h similarity index 100% rename from inc/fsfw/osal/linux/PosixThread.h rename to src/fsfw/osal/linux/PosixThread.h diff --git a/src/osal/linux/QueueFactory.cpp b/src/fsfw/osal/linux/QueueFactory.cpp similarity index 100% rename from src/osal/linux/QueueFactory.cpp rename to src/fsfw/osal/linux/QueueFactory.cpp diff --git a/src/osal/linux/SemaphoreFactory.cpp b/src/fsfw/osal/linux/SemaphoreFactory.cpp similarity index 100% rename from src/osal/linux/SemaphoreFactory.cpp rename to src/fsfw/osal/linux/SemaphoreFactory.cpp diff --git a/src/osal/linux/TaskFactory.cpp b/src/fsfw/osal/linux/TaskFactory.cpp similarity index 100% rename from src/osal/linux/TaskFactory.cpp rename to src/fsfw/osal/linux/TaskFactory.cpp diff --git a/src/osal/linux/Timer.cpp b/src/fsfw/osal/linux/Timer.cpp similarity index 100% rename from src/osal/linux/Timer.cpp rename to src/fsfw/osal/linux/Timer.cpp diff --git a/inc/fsfw/osal/linux/Timer.h b/src/fsfw/osal/linux/Timer.h similarity index 100% rename from inc/fsfw/osal/linux/Timer.h rename to src/fsfw/osal/linux/Timer.h diff --git a/src/osal/linux/tcpipHelpers.cpp b/src/fsfw/osal/linux/tcpipHelpers.cpp similarity index 100% rename from src/osal/linux/tcpipHelpers.cpp rename to src/fsfw/osal/linux/tcpipHelpers.cpp diff --git a/src/osal/linux/unixUtility.cpp b/src/fsfw/osal/linux/unixUtility.cpp similarity index 100% rename from src/osal/linux/unixUtility.cpp rename to src/fsfw/osal/linux/unixUtility.cpp diff --git a/inc/fsfw/osal/linux/unixUtility.h b/src/fsfw/osal/linux/unixUtility.h similarity index 100% rename from inc/fsfw/osal/linux/unixUtility.h rename to src/fsfw/osal/linux/unixUtility.h diff --git a/src/osal/rtems/BinarySemaphore.cpp b/src/fsfw/osal/rtems/BinarySemaphore.cpp similarity index 100% rename from src/osal/rtems/BinarySemaphore.cpp rename to src/fsfw/osal/rtems/BinarySemaphore.cpp diff --git a/src/osal/rtems/CMakeLists.txt b/src/fsfw/osal/rtems/CMakeLists.txt similarity index 100% rename from src/osal/rtems/CMakeLists.txt rename to src/fsfw/osal/rtems/CMakeLists.txt diff --git a/src/osal/rtems/Clock.cpp b/src/fsfw/osal/rtems/Clock.cpp similarity index 100% rename from src/osal/rtems/Clock.cpp rename to src/fsfw/osal/rtems/Clock.cpp diff --git a/src/osal/rtems/CpuUsage.cpp b/src/fsfw/osal/rtems/CpuUsage.cpp similarity index 100% rename from src/osal/rtems/CpuUsage.cpp rename to src/fsfw/osal/rtems/CpuUsage.cpp diff --git a/inc/fsfw/osal/rtems/CpuUsage.h b/src/fsfw/osal/rtems/CpuUsage.h similarity index 100% rename from inc/fsfw/osal/rtems/CpuUsage.h rename to src/fsfw/osal/rtems/CpuUsage.h diff --git a/src/osal/rtems/FixedTimeslotTask.cpp b/src/fsfw/osal/rtems/FixedTimeslotTask.cpp similarity index 100% rename from src/osal/rtems/FixedTimeslotTask.cpp rename to src/fsfw/osal/rtems/FixedTimeslotTask.cpp diff --git a/inc/fsfw/osal/rtems/FixedTimeslotTask.h b/src/fsfw/osal/rtems/FixedTimeslotTask.h similarity index 100% rename from inc/fsfw/osal/rtems/FixedTimeslotTask.h rename to src/fsfw/osal/rtems/FixedTimeslotTask.h diff --git a/src/osal/rtems/InitTask.cpp b/src/fsfw/osal/rtems/InitTask.cpp similarity index 100% rename from src/osal/rtems/InitTask.cpp rename to src/fsfw/osal/rtems/InitTask.cpp diff --git a/inc/fsfw/osal/rtems/InitTask.h b/src/fsfw/osal/rtems/InitTask.h similarity index 100% rename from inc/fsfw/osal/rtems/InitTask.h rename to src/fsfw/osal/rtems/InitTask.h diff --git a/src/osal/rtems/InternalErrorCodes.cpp b/src/fsfw/osal/rtems/InternalErrorCodes.cpp similarity index 100% rename from src/osal/rtems/InternalErrorCodes.cpp rename to src/fsfw/osal/rtems/InternalErrorCodes.cpp diff --git a/src/osal/rtems/MessageQueue.cpp b/src/fsfw/osal/rtems/MessageQueue.cpp similarity index 100% rename from src/osal/rtems/MessageQueue.cpp rename to src/fsfw/osal/rtems/MessageQueue.cpp diff --git a/inc/fsfw/osal/rtems/MessageQueue.h b/src/fsfw/osal/rtems/MessageQueue.h similarity index 100% rename from inc/fsfw/osal/rtems/MessageQueue.h rename to src/fsfw/osal/rtems/MessageQueue.h diff --git a/src/osal/rtems/Mutex.cpp b/src/fsfw/osal/rtems/Mutex.cpp similarity index 100% rename from src/osal/rtems/Mutex.cpp rename to src/fsfw/osal/rtems/Mutex.cpp diff --git a/inc/fsfw/osal/rtems/Mutex.h b/src/fsfw/osal/rtems/Mutex.h similarity index 100% rename from inc/fsfw/osal/rtems/Mutex.h rename to src/fsfw/osal/rtems/Mutex.h diff --git a/src/osal/rtems/MutexFactory.cpp b/src/fsfw/osal/rtems/MutexFactory.cpp similarity index 100% rename from src/osal/rtems/MutexFactory.cpp rename to src/fsfw/osal/rtems/MutexFactory.cpp diff --git a/src/osal/rtems/PeriodicTask.cpp b/src/fsfw/osal/rtems/PeriodicTask.cpp similarity index 100% rename from src/osal/rtems/PeriodicTask.cpp rename to src/fsfw/osal/rtems/PeriodicTask.cpp diff --git a/inc/fsfw/osal/rtems/PeriodicTask.h b/src/fsfw/osal/rtems/PeriodicTask.h similarity index 100% rename from inc/fsfw/osal/rtems/PeriodicTask.h rename to src/fsfw/osal/rtems/PeriodicTask.h diff --git a/src/osal/rtems/QueueFactory.cpp b/src/fsfw/osal/rtems/QueueFactory.cpp similarity index 100% rename from src/osal/rtems/QueueFactory.cpp rename to src/fsfw/osal/rtems/QueueFactory.cpp diff --git a/src/osal/rtems/RTEMSTaskBase.cpp b/src/fsfw/osal/rtems/RTEMSTaskBase.cpp similarity index 100% rename from src/osal/rtems/RTEMSTaskBase.cpp rename to src/fsfw/osal/rtems/RTEMSTaskBase.cpp diff --git a/inc/fsfw/osal/rtems/RTEMSTaskBase.h b/src/fsfw/osal/rtems/RTEMSTaskBase.h similarity index 100% rename from inc/fsfw/osal/rtems/RTEMSTaskBase.h rename to src/fsfw/osal/rtems/RTEMSTaskBase.h diff --git a/src/osal/rtems/RtemsBasic.cpp b/src/fsfw/osal/rtems/RtemsBasic.cpp similarity index 100% rename from src/osal/rtems/RtemsBasic.cpp rename to src/fsfw/osal/rtems/RtemsBasic.cpp diff --git a/inc/fsfw/osal/rtems/RtemsBasic.h b/src/fsfw/osal/rtems/RtemsBasic.h similarity index 100% rename from inc/fsfw/osal/rtems/RtemsBasic.h rename to src/fsfw/osal/rtems/RtemsBasic.h diff --git a/src/osal/rtems/SemaphoreFactory.cpp b/src/fsfw/osal/rtems/SemaphoreFactory.cpp similarity index 100% rename from src/osal/rtems/SemaphoreFactory.cpp rename to src/fsfw/osal/rtems/SemaphoreFactory.cpp diff --git a/src/osal/rtems/TaskFactory.cpp b/src/fsfw/osal/rtems/TaskFactory.cpp similarity index 100% rename from src/osal/rtems/TaskFactory.cpp rename to src/fsfw/osal/rtems/TaskFactory.cpp diff --git a/src/osal/windows/CMakeLists.txt b/src/fsfw/osal/windows/CMakeLists.txt similarity index 100% rename from src/osal/windows/CMakeLists.txt rename to src/fsfw/osal/windows/CMakeLists.txt diff --git a/src/osal/windows/tcpipHelpers.cpp b/src/fsfw/osal/windows/tcpipHelpers.cpp similarity index 100% rename from src/osal/windows/tcpipHelpers.cpp rename to src/fsfw/osal/windows/tcpipHelpers.cpp diff --git a/src/osal/windows/winTaskHelpers.cpp b/src/fsfw/osal/windows/winTaskHelpers.cpp similarity index 100% rename from src/osal/windows/winTaskHelpers.cpp rename to src/fsfw/osal/windows/winTaskHelpers.cpp diff --git a/inc/fsfw/osal/windows/winTaskHelpers.h b/src/fsfw/osal/windows/winTaskHelpers.h similarity index 100% rename from inc/fsfw/osal/windows/winTaskHelpers.h rename to src/fsfw/osal/windows/winTaskHelpers.h diff --git a/src/core/parameters/CMakeLists.txt b/src/fsfw/parameters/CMakeLists.txt similarity index 100% rename from src/core/parameters/CMakeLists.txt rename to src/fsfw/parameters/CMakeLists.txt diff --git a/inc/fsfw/parameters/HasParametersIF.h b/src/fsfw/parameters/HasParametersIF.h similarity index 100% rename from inc/fsfw/parameters/HasParametersIF.h rename to src/fsfw/parameters/HasParametersIF.h diff --git a/src/core/parameters/ParameterHelper.cpp b/src/fsfw/parameters/ParameterHelper.cpp similarity index 100% rename from src/core/parameters/ParameterHelper.cpp rename to src/fsfw/parameters/ParameterHelper.cpp diff --git a/inc/fsfw/parameters/ParameterHelper.h b/src/fsfw/parameters/ParameterHelper.h similarity index 100% rename from inc/fsfw/parameters/ParameterHelper.h rename to src/fsfw/parameters/ParameterHelper.h diff --git a/src/core/parameters/ParameterMessage.cpp b/src/fsfw/parameters/ParameterMessage.cpp similarity index 100% rename from src/core/parameters/ParameterMessage.cpp rename to src/fsfw/parameters/ParameterMessage.cpp diff --git a/inc/fsfw/parameters/ParameterMessage.h b/src/fsfw/parameters/ParameterMessage.h similarity index 100% rename from inc/fsfw/parameters/ParameterMessage.h rename to src/fsfw/parameters/ParameterMessage.h diff --git a/src/core/parameters/ParameterWrapper.cpp b/src/fsfw/parameters/ParameterWrapper.cpp similarity index 100% rename from src/core/parameters/ParameterWrapper.cpp rename to src/fsfw/parameters/ParameterWrapper.cpp diff --git a/inc/fsfw/parameters/ParameterWrapper.h b/src/fsfw/parameters/ParameterWrapper.h similarity index 100% rename from inc/fsfw/parameters/ParameterWrapper.h rename to src/fsfw/parameters/ParameterWrapper.h diff --git a/inc/fsfw/parameters/ReceivesParameterMessagesIF.h b/src/fsfw/parameters/ReceivesParameterMessagesIF.h similarity index 100% rename from inc/fsfw/parameters/ReceivesParameterMessagesIF.h rename to src/fsfw/parameters/ReceivesParameterMessagesIF.h diff --git a/inc/fsfw/platform.h b/src/fsfw/platform.h similarity index 100% rename from inc/fsfw/platform.h rename to src/fsfw/platform.h diff --git a/src/core/power/CMakeLists.txt b/src/fsfw/power/CMakeLists.txt similarity index 100% rename from src/core/power/CMakeLists.txt rename to src/fsfw/power/CMakeLists.txt diff --git a/src/core/power/Fuse.cpp b/src/fsfw/power/Fuse.cpp similarity index 100% rename from src/core/power/Fuse.cpp rename to src/fsfw/power/Fuse.cpp diff --git a/inc/fsfw/power/Fuse.h b/src/fsfw/power/Fuse.h similarity index 100% rename from inc/fsfw/power/Fuse.h rename to src/fsfw/power/Fuse.h diff --git a/src/core/power/PowerComponent.cpp b/src/fsfw/power/PowerComponent.cpp similarity index 100% rename from src/core/power/PowerComponent.cpp rename to src/fsfw/power/PowerComponent.cpp diff --git a/inc/fsfw/power/PowerComponent.h b/src/fsfw/power/PowerComponent.h similarity index 100% rename from inc/fsfw/power/PowerComponent.h rename to src/fsfw/power/PowerComponent.h diff --git a/inc/fsfw/power/PowerComponentIF.h b/src/fsfw/power/PowerComponentIF.h similarity index 100% rename from inc/fsfw/power/PowerComponentIF.h rename to src/fsfw/power/PowerComponentIF.h diff --git a/src/core/power/PowerSensor.cpp b/src/fsfw/power/PowerSensor.cpp similarity index 100% rename from src/core/power/PowerSensor.cpp rename to src/fsfw/power/PowerSensor.cpp diff --git a/inc/fsfw/power/PowerSensor.h b/src/fsfw/power/PowerSensor.h similarity index 100% rename from inc/fsfw/power/PowerSensor.h rename to src/fsfw/power/PowerSensor.h diff --git a/inc/fsfw/power/PowerSwitchIF.h b/src/fsfw/power/PowerSwitchIF.h similarity index 100% rename from inc/fsfw/power/PowerSwitchIF.h rename to src/fsfw/power/PowerSwitchIF.h diff --git a/src/core/power/PowerSwitcher.cpp b/src/fsfw/power/PowerSwitcher.cpp similarity index 100% rename from src/core/power/PowerSwitcher.cpp rename to src/fsfw/power/PowerSwitcher.cpp diff --git a/inc/fsfw/power/PowerSwitcher.h b/src/fsfw/power/PowerSwitcher.h similarity index 100% rename from inc/fsfw/power/PowerSwitcher.h rename to src/fsfw/power/PowerSwitcher.h diff --git a/src/opt/pus/CMakeLists.txt b/src/fsfw/pus/CMakeLists.txt similarity index 100% rename from src/opt/pus/CMakeLists.txt rename to src/fsfw/pus/CMakeLists.txt diff --git a/src/opt/pus/CService200ModeCommanding.cpp b/src/fsfw/pus/CService200ModeCommanding.cpp similarity index 100% rename from src/opt/pus/CService200ModeCommanding.cpp rename to src/fsfw/pus/CService200ModeCommanding.cpp diff --git a/inc/fsfw/pus/CService200ModeCommanding.h b/src/fsfw/pus/CService200ModeCommanding.h similarity index 100% rename from inc/fsfw/pus/CService200ModeCommanding.h rename to src/fsfw/pus/CService200ModeCommanding.h diff --git a/src/opt/pus/CService201HealthCommanding.cpp b/src/fsfw/pus/CService201HealthCommanding.cpp similarity index 100% rename from src/opt/pus/CService201HealthCommanding.cpp rename to src/fsfw/pus/CService201HealthCommanding.cpp diff --git a/inc/fsfw/pus/CService201HealthCommanding.h b/src/fsfw/pus/CService201HealthCommanding.h similarity index 100% rename from inc/fsfw/pus/CService201HealthCommanding.h rename to src/fsfw/pus/CService201HealthCommanding.h diff --git a/src/opt/pus/Service17Test.cpp b/src/fsfw/pus/Service17Test.cpp similarity index 100% rename from src/opt/pus/Service17Test.cpp rename to src/fsfw/pus/Service17Test.cpp diff --git a/inc/fsfw/pus/Service17Test.h b/src/fsfw/pus/Service17Test.h similarity index 100% rename from inc/fsfw/pus/Service17Test.h rename to src/fsfw/pus/Service17Test.h diff --git a/src/opt/pus/Service1TelecommandVerification.cpp b/src/fsfw/pus/Service1TelecommandVerification.cpp similarity index 100% rename from src/opt/pus/Service1TelecommandVerification.cpp rename to src/fsfw/pus/Service1TelecommandVerification.cpp diff --git a/inc/fsfw/pus/Service1TelecommandVerification.h b/src/fsfw/pus/Service1TelecommandVerification.h similarity index 100% rename from inc/fsfw/pus/Service1TelecommandVerification.h rename to src/fsfw/pus/Service1TelecommandVerification.h diff --git a/src/opt/pus/Service20ParameterManagement.cpp b/src/fsfw/pus/Service20ParameterManagement.cpp similarity index 100% rename from src/opt/pus/Service20ParameterManagement.cpp rename to src/fsfw/pus/Service20ParameterManagement.cpp diff --git a/inc/fsfw/pus/Service20ParameterManagement.h b/src/fsfw/pus/Service20ParameterManagement.h similarity index 100% rename from inc/fsfw/pus/Service20ParameterManagement.h rename to src/fsfw/pus/Service20ParameterManagement.h diff --git a/src/opt/pus/Service2DeviceAccess.cpp b/src/fsfw/pus/Service2DeviceAccess.cpp similarity index 100% rename from src/opt/pus/Service2DeviceAccess.cpp rename to src/fsfw/pus/Service2DeviceAccess.cpp diff --git a/inc/fsfw/pus/Service2DeviceAccess.h b/src/fsfw/pus/Service2DeviceAccess.h similarity index 100% rename from inc/fsfw/pus/Service2DeviceAccess.h rename to src/fsfw/pus/Service2DeviceAccess.h diff --git a/src/opt/pus/Service3Housekeeping.cpp b/src/fsfw/pus/Service3Housekeeping.cpp similarity index 100% rename from src/opt/pus/Service3Housekeeping.cpp rename to src/fsfw/pus/Service3Housekeeping.cpp diff --git a/inc/fsfw/pus/Service3Housekeeping.h b/src/fsfw/pus/Service3Housekeeping.h similarity index 100% rename from inc/fsfw/pus/Service3Housekeeping.h rename to src/fsfw/pus/Service3Housekeeping.h diff --git a/src/opt/pus/Service5EventReporting.cpp b/src/fsfw/pus/Service5EventReporting.cpp similarity index 100% rename from src/opt/pus/Service5EventReporting.cpp rename to src/fsfw/pus/Service5EventReporting.cpp diff --git a/inc/fsfw/pus/Service5EventReporting.h b/src/fsfw/pus/Service5EventReporting.h similarity index 100% rename from inc/fsfw/pus/Service5EventReporting.h rename to src/fsfw/pus/Service5EventReporting.h diff --git a/src/opt/pus/Service8FunctionManagement.cpp b/src/fsfw/pus/Service8FunctionManagement.cpp similarity index 100% rename from src/opt/pus/Service8FunctionManagement.cpp rename to src/fsfw/pus/Service8FunctionManagement.cpp diff --git a/inc/fsfw/pus/Service8FunctionManagement.h b/src/fsfw/pus/Service8FunctionManagement.h similarity index 100% rename from inc/fsfw/pus/Service8FunctionManagement.h rename to src/fsfw/pus/Service8FunctionManagement.h diff --git a/src/opt/pus/Service9TimeManagement.cpp b/src/fsfw/pus/Service9TimeManagement.cpp similarity index 100% rename from src/opt/pus/Service9TimeManagement.cpp rename to src/fsfw/pus/Service9TimeManagement.cpp diff --git a/inc/fsfw/pus/Service9TimeManagement.h b/src/fsfw/pus/Service9TimeManagement.h similarity index 100% rename from inc/fsfw/pus/Service9TimeManagement.h rename to src/fsfw/pus/Service9TimeManagement.h diff --git a/inc/fsfw/pus/servicepackets/Service1Packets.h b/src/fsfw/pus/servicepackets/Service1Packets.h similarity index 100% rename from inc/fsfw/pus/servicepackets/Service1Packets.h rename to src/fsfw/pus/servicepackets/Service1Packets.h diff --git a/inc/fsfw/pus/servicepackets/Service200Packets.h b/src/fsfw/pus/servicepackets/Service200Packets.h similarity index 100% rename from inc/fsfw/pus/servicepackets/Service200Packets.h rename to src/fsfw/pus/servicepackets/Service200Packets.h diff --git a/inc/fsfw/pus/servicepackets/Service201Packets.h b/src/fsfw/pus/servicepackets/Service201Packets.h similarity index 100% rename from inc/fsfw/pus/servicepackets/Service201Packets.h rename to src/fsfw/pus/servicepackets/Service201Packets.h diff --git a/inc/fsfw/pus/servicepackets/Service20Packets.h b/src/fsfw/pus/servicepackets/Service20Packets.h similarity index 100% rename from inc/fsfw/pus/servicepackets/Service20Packets.h rename to src/fsfw/pus/servicepackets/Service20Packets.h diff --git a/inc/fsfw/pus/servicepackets/Service2Packets.h b/src/fsfw/pus/servicepackets/Service2Packets.h similarity index 100% rename from inc/fsfw/pus/servicepackets/Service2Packets.h rename to src/fsfw/pus/servicepackets/Service2Packets.h diff --git a/inc/fsfw/pus/servicepackets/Service3Packets.h b/src/fsfw/pus/servicepackets/Service3Packets.h similarity index 100% rename from inc/fsfw/pus/servicepackets/Service3Packets.h rename to src/fsfw/pus/servicepackets/Service3Packets.h diff --git a/inc/fsfw/pus/servicepackets/Service5Packets.h b/src/fsfw/pus/servicepackets/Service5Packets.h similarity index 100% rename from inc/fsfw/pus/servicepackets/Service5Packets.h rename to src/fsfw/pus/servicepackets/Service5Packets.h diff --git a/inc/fsfw/pus/servicepackets/Service8Packets.h b/src/fsfw/pus/servicepackets/Service8Packets.h similarity index 100% rename from inc/fsfw/pus/servicepackets/Service8Packets.h rename to src/fsfw/pus/servicepackets/Service8Packets.h diff --git a/inc/fsfw/pus/servicepackets/Service9Packets.h b/src/fsfw/pus/servicepackets/Service9Packets.h similarity index 100% rename from inc/fsfw/pus/servicepackets/Service9Packets.h rename to src/fsfw/pus/servicepackets/Service9Packets.h diff --git a/inc/fsfw/returnvalues/FwClassIds.h b/src/fsfw/returnvalues/FwClassIds.h similarity index 100% rename from inc/fsfw/returnvalues/FwClassIds.h rename to src/fsfw/returnvalues/FwClassIds.h diff --git a/inc/fsfw/returnvalues/HasReturnvaluesIF.h b/src/fsfw/returnvalues/HasReturnvaluesIF.h similarity index 100% rename from inc/fsfw/returnvalues/HasReturnvaluesIF.h rename to src/fsfw/returnvalues/HasReturnvaluesIF.h diff --git a/src/opt/rmap/CMakeLists.txt b/src/fsfw/rmap/CMakeLists.txt similarity index 100% rename from src/opt/rmap/CMakeLists.txt rename to src/fsfw/rmap/CMakeLists.txt diff --git a/src/opt/rmap/RMAP.cpp b/src/fsfw/rmap/RMAP.cpp similarity index 100% rename from src/opt/rmap/RMAP.cpp rename to src/fsfw/rmap/RMAP.cpp diff --git a/inc/fsfw/rmap/RMAP.h b/src/fsfw/rmap/RMAP.h similarity index 100% rename from inc/fsfw/rmap/RMAP.h rename to src/fsfw/rmap/RMAP.h diff --git a/inc/fsfw/rmap/RMAPChannelIF.h b/src/fsfw/rmap/RMAPChannelIF.h similarity index 100% rename from inc/fsfw/rmap/RMAPChannelIF.h rename to src/fsfw/rmap/RMAPChannelIF.h diff --git a/src/opt/rmap/RMAPCookie.cpp b/src/fsfw/rmap/RMAPCookie.cpp similarity index 100% rename from src/opt/rmap/RMAPCookie.cpp rename to src/fsfw/rmap/RMAPCookie.cpp diff --git a/inc/fsfw/rmap/RMAPCookie.h b/src/fsfw/rmap/RMAPCookie.h similarity index 100% rename from inc/fsfw/rmap/RMAPCookie.h rename to src/fsfw/rmap/RMAPCookie.h diff --git a/src/opt/rmap/RmapDeviceCommunicationIF.cpp b/src/fsfw/rmap/RmapDeviceCommunicationIF.cpp similarity index 100% rename from src/opt/rmap/RmapDeviceCommunicationIF.cpp rename to src/fsfw/rmap/RmapDeviceCommunicationIF.cpp diff --git a/inc/fsfw/rmap/RmapDeviceCommunicationIF.h b/src/fsfw/rmap/RmapDeviceCommunicationIF.h similarity index 100% rename from inc/fsfw/rmap/RmapDeviceCommunicationIF.h rename to src/fsfw/rmap/RmapDeviceCommunicationIF.h diff --git a/inc/fsfw/rmap/rmapStructs.h b/src/fsfw/rmap/rmapStructs.h similarity index 100% rename from inc/fsfw/rmap/rmapStructs.h rename to src/fsfw/rmap/rmapStructs.h diff --git a/src/fsfw/serialize.h b/src/fsfw/serialize.h new file mode 100644 index 00000000..7cd735bb --- /dev/null +++ b/src/fsfw/serialize.h @@ -0,0 +1,10 @@ +#ifndef FSFW_INC_FSFW_SERIALIZE_H_ +#define FSFW_INC_FSFW_SERIALIZE_H_ + +#include "src/core/serialize/EndianConverter.h" +#include "src/core/serialize/SerialArrayListAdapter.h" +#include "src/core/serialize/SerialBufferAdapter.h" +#include "src/core/serialize/SerializeElement.h" +#include "src/core/serialize/SerialLinkedListAdapter.h" + +#endif /* FSFW_INC_FSFW_SERIALIZE_H_ */ diff --git a/src/core/serialize/CMakeLists.txt b/src/fsfw/serialize/CMakeLists.txt similarity index 100% rename from src/core/serialize/CMakeLists.txt rename to src/fsfw/serialize/CMakeLists.txt diff --git a/inc/fsfw/serialize/EndianConverter.h b/src/fsfw/serialize/EndianConverter.h similarity index 100% rename from inc/fsfw/serialize/EndianConverter.h rename to src/fsfw/serialize/EndianConverter.h diff --git a/inc/fsfw/serialize/SerialArrayListAdapter.h b/src/fsfw/serialize/SerialArrayListAdapter.h similarity index 100% rename from inc/fsfw/serialize/SerialArrayListAdapter.h rename to src/fsfw/serialize/SerialArrayListAdapter.h diff --git a/src/core/serialize/SerialBufferAdapter.cpp b/src/fsfw/serialize/SerialBufferAdapter.cpp similarity index 100% rename from src/core/serialize/SerialBufferAdapter.cpp rename to src/fsfw/serialize/SerialBufferAdapter.cpp diff --git a/inc/fsfw/serialize/SerialBufferAdapter.h b/src/fsfw/serialize/SerialBufferAdapter.h similarity index 100% rename from inc/fsfw/serialize/SerialBufferAdapter.h rename to src/fsfw/serialize/SerialBufferAdapter.h diff --git a/inc/fsfw/serialize/SerialFixedArrayListAdapter.h b/src/fsfw/serialize/SerialFixedArrayListAdapter.h similarity index 100% rename from inc/fsfw/serialize/SerialFixedArrayListAdapter.h rename to src/fsfw/serialize/SerialFixedArrayListAdapter.h diff --git a/inc/fsfw/serialize/SerialLinkedListAdapter.h b/src/fsfw/serialize/SerialLinkedListAdapter.h similarity index 100% rename from inc/fsfw/serialize/SerialLinkedListAdapter.h rename to src/fsfw/serialize/SerialLinkedListAdapter.h diff --git a/inc/fsfw/serialize/SerializeAdapter.h b/src/fsfw/serialize/SerializeAdapter.h similarity index 100% rename from inc/fsfw/serialize/SerializeAdapter.h rename to src/fsfw/serialize/SerializeAdapter.h diff --git a/inc/fsfw/serialize/SerializeElement.h b/src/fsfw/serialize/SerializeElement.h similarity index 100% rename from inc/fsfw/serialize/SerializeElement.h rename to src/fsfw/serialize/SerializeElement.h diff --git a/inc/fsfw/serialize/SerializeIF.h b/src/fsfw/serialize/SerializeIF.h similarity index 100% rename from inc/fsfw/serialize/SerializeIF.h rename to src/fsfw/serialize/SerializeIF.h diff --git a/src/core/serviceinterface/CMakeLists.txt b/src/fsfw/serviceinterface/CMakeLists.txt similarity index 100% rename from src/core/serviceinterface/CMakeLists.txt rename to src/fsfw/serviceinterface/CMakeLists.txt diff --git a/inc/fsfw/serviceinterface/ServiceInterface.h b/src/fsfw/serviceinterface/ServiceInterface.h similarity index 100% rename from inc/fsfw/serviceinterface/ServiceInterface.h rename to src/fsfw/serviceinterface/ServiceInterface.h diff --git a/src/core/serviceinterface/ServiceInterfaceBuffer.cpp b/src/fsfw/serviceinterface/ServiceInterfaceBuffer.cpp similarity index 100% rename from src/core/serviceinterface/ServiceInterfaceBuffer.cpp rename to src/fsfw/serviceinterface/ServiceInterfaceBuffer.cpp diff --git a/inc/fsfw/serviceinterface/ServiceInterfaceBuffer.h b/src/fsfw/serviceinterface/ServiceInterfaceBuffer.h similarity index 100% rename from inc/fsfw/serviceinterface/ServiceInterfaceBuffer.h rename to src/fsfw/serviceinterface/ServiceInterfaceBuffer.h diff --git a/src/core/serviceinterface/ServiceInterfacePrinter.cpp b/src/fsfw/serviceinterface/ServiceInterfacePrinter.cpp similarity index 100% rename from src/core/serviceinterface/ServiceInterfacePrinter.cpp rename to src/fsfw/serviceinterface/ServiceInterfacePrinter.cpp diff --git a/inc/fsfw/serviceinterface/ServiceInterfacePrinter.h b/src/fsfw/serviceinterface/ServiceInterfacePrinter.h similarity index 100% rename from inc/fsfw/serviceinterface/ServiceInterfacePrinter.h rename to src/fsfw/serviceinterface/ServiceInterfacePrinter.h diff --git a/src/core/serviceinterface/ServiceInterfaceStream.cpp b/src/fsfw/serviceinterface/ServiceInterfaceStream.cpp similarity index 100% rename from src/core/serviceinterface/ServiceInterfaceStream.cpp rename to src/fsfw/serviceinterface/ServiceInterfaceStream.cpp diff --git a/inc/fsfw/serviceinterface/ServiceInterfaceStream.h b/src/fsfw/serviceinterface/ServiceInterfaceStream.h similarity index 100% rename from inc/fsfw/serviceinterface/ServiceInterfaceStream.h rename to src/fsfw/serviceinterface/ServiceInterfaceStream.h diff --git a/inc/fsfw/serviceinterface/serviceInterfaceDefintions.h b/src/fsfw/serviceinterface/serviceInterfaceDefintions.h similarity index 100% rename from inc/fsfw/serviceinterface/serviceInterfaceDefintions.h rename to src/fsfw/serviceinterface/serviceInterfaceDefintions.h diff --git a/src/core/storagemanager/CMakeLists.txt b/src/fsfw/storagemanager/CMakeLists.txt similarity index 100% rename from src/core/storagemanager/CMakeLists.txt rename to src/fsfw/storagemanager/CMakeLists.txt diff --git a/src/core/storagemanager/ConstStorageAccessor.cpp b/src/fsfw/storagemanager/ConstStorageAccessor.cpp similarity index 100% rename from src/core/storagemanager/ConstStorageAccessor.cpp rename to src/fsfw/storagemanager/ConstStorageAccessor.cpp diff --git a/inc/fsfw/storagemanager/ConstStorageAccessor.h b/src/fsfw/storagemanager/ConstStorageAccessor.h similarity index 100% rename from inc/fsfw/storagemanager/ConstStorageAccessor.h rename to src/fsfw/storagemanager/ConstStorageAccessor.h diff --git a/src/core/storagemanager/LocalPool.cpp b/src/fsfw/storagemanager/LocalPool.cpp similarity index 100% rename from src/core/storagemanager/LocalPool.cpp rename to src/fsfw/storagemanager/LocalPool.cpp diff --git a/inc/fsfw/storagemanager/LocalPool.h b/src/fsfw/storagemanager/LocalPool.h similarity index 100% rename from inc/fsfw/storagemanager/LocalPool.h rename to src/fsfw/storagemanager/LocalPool.h diff --git a/src/core/storagemanager/PoolManager.cpp b/src/fsfw/storagemanager/PoolManager.cpp similarity index 100% rename from src/core/storagemanager/PoolManager.cpp rename to src/fsfw/storagemanager/PoolManager.cpp diff --git a/inc/fsfw/storagemanager/PoolManager.h b/src/fsfw/storagemanager/PoolManager.h similarity index 100% rename from inc/fsfw/storagemanager/PoolManager.h rename to src/fsfw/storagemanager/PoolManager.h diff --git a/src/core/storagemanager/StorageAccessor.cpp b/src/fsfw/storagemanager/StorageAccessor.cpp similarity index 100% rename from src/core/storagemanager/StorageAccessor.cpp rename to src/fsfw/storagemanager/StorageAccessor.cpp diff --git a/inc/fsfw/storagemanager/StorageAccessor.h b/src/fsfw/storagemanager/StorageAccessor.h similarity index 100% rename from inc/fsfw/storagemanager/StorageAccessor.h rename to src/fsfw/storagemanager/StorageAccessor.h diff --git a/inc/fsfw/storagemanager/StorageManagerIF.h b/src/fsfw/storagemanager/StorageManagerIF.h similarity index 100% rename from inc/fsfw/storagemanager/StorageManagerIF.h rename to src/fsfw/storagemanager/StorageManagerIF.h diff --git a/inc/fsfw/storagemanager/storeAddress.h b/src/fsfw/storagemanager/storeAddress.h similarity index 100% rename from inc/fsfw/storagemanager/storeAddress.h rename to src/fsfw/storagemanager/storeAddress.h diff --git a/src/core/subsystem/CMakeLists.txt b/src/fsfw/subsystem/CMakeLists.txt similarity index 100% rename from src/core/subsystem/CMakeLists.txt rename to src/fsfw/subsystem/CMakeLists.txt diff --git a/src/core/subsystem/Subsystem.cpp b/src/fsfw/subsystem/Subsystem.cpp similarity index 100% rename from src/core/subsystem/Subsystem.cpp rename to src/fsfw/subsystem/Subsystem.cpp diff --git a/inc/fsfw/subsystem/Subsystem.h b/src/fsfw/subsystem/Subsystem.h similarity index 100% rename from inc/fsfw/subsystem/Subsystem.h rename to src/fsfw/subsystem/Subsystem.h diff --git a/src/core/subsystem/SubsystemBase.cpp b/src/fsfw/subsystem/SubsystemBase.cpp similarity index 100% rename from src/core/subsystem/SubsystemBase.cpp rename to src/fsfw/subsystem/SubsystemBase.cpp diff --git a/inc/fsfw/subsystem/SubsystemBase.h b/src/fsfw/subsystem/SubsystemBase.h similarity index 100% rename from inc/fsfw/subsystem/SubsystemBase.h rename to src/fsfw/subsystem/SubsystemBase.h diff --git a/src/core/subsystem/modes/CMakeLists.txt b/src/fsfw/subsystem/modes/CMakeLists.txt similarity index 100% rename from src/core/subsystem/modes/CMakeLists.txt rename to src/fsfw/subsystem/modes/CMakeLists.txt diff --git a/inc/fsfw/subsystem/modes/HasModeSequenceIF.h b/src/fsfw/subsystem/modes/HasModeSequenceIF.h similarity index 100% rename from inc/fsfw/subsystem/modes/HasModeSequenceIF.h rename to src/fsfw/subsystem/modes/HasModeSequenceIF.h diff --git a/inc/fsfw/subsystem/modes/ModeDefinitions.h b/src/fsfw/subsystem/modes/ModeDefinitions.h similarity index 100% rename from inc/fsfw/subsystem/modes/ModeDefinitions.h rename to src/fsfw/subsystem/modes/ModeDefinitions.h diff --git a/src/core/subsystem/modes/ModeSequenceMessage.cpp b/src/fsfw/subsystem/modes/ModeSequenceMessage.cpp similarity index 100% rename from src/core/subsystem/modes/ModeSequenceMessage.cpp rename to src/fsfw/subsystem/modes/ModeSequenceMessage.cpp diff --git a/inc/fsfw/subsystem/modes/ModeSequenceMessage.h b/src/fsfw/subsystem/modes/ModeSequenceMessage.h similarity index 100% rename from inc/fsfw/subsystem/modes/ModeSequenceMessage.h rename to src/fsfw/subsystem/modes/ModeSequenceMessage.h diff --git a/src/core/subsystem/modes/ModeStore.cpp b/src/fsfw/subsystem/modes/ModeStore.cpp similarity index 100% rename from src/core/subsystem/modes/ModeStore.cpp rename to src/fsfw/subsystem/modes/ModeStore.cpp diff --git a/inc/fsfw/subsystem/modes/ModeStore.h b/src/fsfw/subsystem/modes/ModeStore.h similarity index 100% rename from inc/fsfw/subsystem/modes/ModeStore.h rename to src/fsfw/subsystem/modes/ModeStore.h diff --git a/inc/fsfw/subsystem/modes/ModeStoreIF.h b/src/fsfw/subsystem/modes/ModeStoreIF.h similarity index 100% rename from inc/fsfw/subsystem/modes/ModeStoreIF.h rename to src/fsfw/subsystem/modes/ModeStoreIF.h diff --git a/src/core/tasks/CMakeLists.txt b/src/fsfw/tasks/CMakeLists.txt similarity index 100% rename from src/core/tasks/CMakeLists.txt rename to src/fsfw/tasks/CMakeLists.txt diff --git a/inc/fsfw/tasks/ExecutableObjectIF.h b/src/fsfw/tasks/ExecutableObjectIF.h similarity index 100% rename from inc/fsfw/tasks/ExecutableObjectIF.h rename to src/fsfw/tasks/ExecutableObjectIF.h diff --git a/src/core/tasks/FixedSequenceSlot.cpp b/src/fsfw/tasks/FixedSequenceSlot.cpp similarity index 100% rename from src/core/tasks/FixedSequenceSlot.cpp rename to src/fsfw/tasks/FixedSequenceSlot.cpp diff --git a/inc/fsfw/tasks/FixedSequenceSlot.h b/src/fsfw/tasks/FixedSequenceSlot.h similarity index 100% rename from inc/fsfw/tasks/FixedSequenceSlot.h rename to src/fsfw/tasks/FixedSequenceSlot.h diff --git a/src/core/tasks/FixedSlotSequence.cpp b/src/fsfw/tasks/FixedSlotSequence.cpp similarity index 100% rename from src/core/tasks/FixedSlotSequence.cpp rename to src/fsfw/tasks/FixedSlotSequence.cpp diff --git a/inc/fsfw/tasks/FixedSlotSequence.h b/src/fsfw/tasks/FixedSlotSequence.h similarity index 100% rename from inc/fsfw/tasks/FixedSlotSequence.h rename to src/fsfw/tasks/FixedSlotSequence.h diff --git a/inc/fsfw/tasks/FixedTimeslotTaskIF.h b/src/fsfw/tasks/FixedTimeslotTaskIF.h similarity index 100% rename from inc/fsfw/tasks/FixedTimeslotTaskIF.h rename to src/fsfw/tasks/FixedTimeslotTaskIF.h diff --git a/inc/fsfw/tasks/PeriodicTaskIF.h b/src/fsfw/tasks/PeriodicTaskIF.h similarity index 100% rename from inc/fsfw/tasks/PeriodicTaskIF.h rename to src/fsfw/tasks/PeriodicTaskIF.h diff --git a/inc/fsfw/tasks/SemaphoreFactory.h b/src/fsfw/tasks/SemaphoreFactory.h similarity index 100% rename from inc/fsfw/tasks/SemaphoreFactory.h rename to src/fsfw/tasks/SemaphoreFactory.h diff --git a/inc/fsfw/tasks/SemaphoreIF.h b/src/fsfw/tasks/SemaphoreIF.h similarity index 100% rename from inc/fsfw/tasks/SemaphoreIF.h rename to src/fsfw/tasks/SemaphoreIF.h diff --git a/inc/fsfw/tasks/TaskFactory.h b/src/fsfw/tasks/TaskFactory.h similarity index 100% rename from inc/fsfw/tasks/TaskFactory.h rename to src/fsfw/tasks/TaskFactory.h diff --git a/inc/fsfw/tasks/Typedef.h b/src/fsfw/tasks/Typedef.h similarity index 100% rename from inc/fsfw/tasks/Typedef.h rename to src/fsfw/tasks/Typedef.h diff --git a/src/core/tcdistribution/CCSDSDistributor.cpp b/src/fsfw/tcdistribution/CCSDSDistributor.cpp similarity index 100% rename from src/core/tcdistribution/CCSDSDistributor.cpp rename to src/fsfw/tcdistribution/CCSDSDistributor.cpp diff --git a/inc/fsfw/tcdistribution/CCSDSDistributor.h b/src/fsfw/tcdistribution/CCSDSDistributor.h similarity index 100% rename from inc/fsfw/tcdistribution/CCSDSDistributor.h rename to src/fsfw/tcdistribution/CCSDSDistributor.h diff --git a/inc/fsfw/tcdistribution/CCSDSDistributorIF.h b/src/fsfw/tcdistribution/CCSDSDistributorIF.h similarity index 100% rename from inc/fsfw/tcdistribution/CCSDSDistributorIF.h rename to src/fsfw/tcdistribution/CCSDSDistributorIF.h diff --git a/src/core/tcdistribution/CMakeLists.txt b/src/fsfw/tcdistribution/CMakeLists.txt similarity index 100% rename from src/core/tcdistribution/CMakeLists.txt rename to src/fsfw/tcdistribution/CMakeLists.txt diff --git a/src/core/tcdistribution/PUSDistributor.cpp b/src/fsfw/tcdistribution/PUSDistributor.cpp similarity index 100% rename from src/core/tcdistribution/PUSDistributor.cpp rename to src/fsfw/tcdistribution/PUSDistributor.cpp diff --git a/inc/fsfw/tcdistribution/PUSDistributor.h b/src/fsfw/tcdistribution/PUSDistributor.h similarity index 100% rename from inc/fsfw/tcdistribution/PUSDistributor.h rename to src/fsfw/tcdistribution/PUSDistributor.h diff --git a/inc/fsfw/tcdistribution/PUSDistributorIF.h b/src/fsfw/tcdistribution/PUSDistributorIF.h similarity index 100% rename from inc/fsfw/tcdistribution/PUSDistributorIF.h rename to src/fsfw/tcdistribution/PUSDistributorIF.h diff --git a/src/core/tcdistribution/TcDistributor.cpp b/src/fsfw/tcdistribution/TcDistributor.cpp similarity index 100% rename from src/core/tcdistribution/TcDistributor.cpp rename to src/fsfw/tcdistribution/TcDistributor.cpp diff --git a/inc/fsfw/tcdistribution/TcDistributor.h b/src/fsfw/tcdistribution/TcDistributor.h similarity index 100% rename from inc/fsfw/tcdistribution/TcDistributor.h rename to src/fsfw/tcdistribution/TcDistributor.h diff --git a/src/core/tcdistribution/TcPacketCheck.cpp b/src/fsfw/tcdistribution/TcPacketCheck.cpp similarity index 100% rename from src/core/tcdistribution/TcPacketCheck.cpp rename to src/fsfw/tcdistribution/TcPacketCheck.cpp diff --git a/inc/fsfw/tcdistribution/TcPacketCheck.h b/src/fsfw/tcdistribution/TcPacketCheck.h similarity index 100% rename from inc/fsfw/tcdistribution/TcPacketCheck.h rename to src/fsfw/tcdistribution/TcPacketCheck.h diff --git a/src/core/thermal/AbstractTemperatureSensor.cpp b/src/fsfw/thermal/AbstractTemperatureSensor.cpp similarity index 100% rename from src/core/thermal/AbstractTemperatureSensor.cpp rename to src/fsfw/thermal/AbstractTemperatureSensor.cpp diff --git a/inc/fsfw/thermal/AbstractTemperatureSensor.h b/src/fsfw/thermal/AbstractTemperatureSensor.h similarity index 100% rename from inc/fsfw/thermal/AbstractTemperatureSensor.h rename to src/fsfw/thermal/AbstractTemperatureSensor.h diff --git a/inc/fsfw/thermal/AcceptsThermalMessagesIF.h b/src/fsfw/thermal/AcceptsThermalMessagesIF.h similarity index 100% rename from inc/fsfw/thermal/AcceptsThermalMessagesIF.h rename to src/fsfw/thermal/AcceptsThermalMessagesIF.h diff --git a/src/core/thermal/CMakeLists.txt b/src/fsfw/thermal/CMakeLists.txt similarity index 100% rename from src/core/thermal/CMakeLists.txt rename to src/fsfw/thermal/CMakeLists.txt diff --git a/src/core/thermal/Heater.cpp b/src/fsfw/thermal/Heater.cpp similarity index 100% rename from src/core/thermal/Heater.cpp rename to src/fsfw/thermal/Heater.cpp diff --git a/inc/fsfw/thermal/Heater.h b/src/fsfw/thermal/Heater.h similarity index 100% rename from inc/fsfw/thermal/Heater.h rename to src/fsfw/thermal/Heater.h diff --git a/src/core/thermal/RedundantHeater.cpp b/src/fsfw/thermal/RedundantHeater.cpp similarity index 100% rename from src/core/thermal/RedundantHeater.cpp rename to src/fsfw/thermal/RedundantHeater.cpp diff --git a/inc/fsfw/thermal/RedundantHeater.h b/src/fsfw/thermal/RedundantHeater.h similarity index 100% rename from inc/fsfw/thermal/RedundantHeater.h rename to src/fsfw/thermal/RedundantHeater.h diff --git a/inc/fsfw/thermal/TemperatureSensor.h b/src/fsfw/thermal/TemperatureSensor.h similarity index 100% rename from inc/fsfw/thermal/TemperatureSensor.h rename to src/fsfw/thermal/TemperatureSensor.h diff --git a/src/core/thermal/ThermalComponent.cpp b/src/fsfw/thermal/ThermalComponent.cpp similarity index 100% rename from src/core/thermal/ThermalComponent.cpp rename to src/fsfw/thermal/ThermalComponent.cpp diff --git a/inc/fsfw/thermal/ThermalComponent.h b/src/fsfw/thermal/ThermalComponent.h similarity index 100% rename from inc/fsfw/thermal/ThermalComponent.h rename to src/fsfw/thermal/ThermalComponent.h diff --git a/src/core/thermal/ThermalComponentCore.cpp b/src/fsfw/thermal/ThermalComponentCore.cpp similarity index 100% rename from src/core/thermal/ThermalComponentCore.cpp rename to src/fsfw/thermal/ThermalComponentCore.cpp diff --git a/inc/fsfw/thermal/ThermalComponentCore.h b/src/fsfw/thermal/ThermalComponentCore.h similarity index 100% rename from inc/fsfw/thermal/ThermalComponentCore.h rename to src/fsfw/thermal/ThermalComponentCore.h diff --git a/inc/fsfw/thermal/ThermalComponentIF.h b/src/fsfw/thermal/ThermalComponentIF.h similarity index 100% rename from inc/fsfw/thermal/ThermalComponentIF.h rename to src/fsfw/thermal/ThermalComponentIF.h diff --git a/src/core/thermal/ThermalModule.cpp b/src/fsfw/thermal/ThermalModule.cpp similarity index 100% rename from src/core/thermal/ThermalModule.cpp rename to src/fsfw/thermal/ThermalModule.cpp diff --git a/inc/fsfw/thermal/ThermalModule.h b/src/fsfw/thermal/ThermalModule.h similarity index 100% rename from inc/fsfw/thermal/ThermalModule.h rename to src/fsfw/thermal/ThermalModule.h diff --git a/inc/fsfw/thermal/ThermalModuleIF.h b/src/fsfw/thermal/ThermalModuleIF.h similarity index 100% rename from inc/fsfw/thermal/ThermalModuleIF.h rename to src/fsfw/thermal/ThermalModuleIF.h diff --git a/src/core/thermal/ThermalMonitorReporter.cpp b/src/fsfw/thermal/ThermalMonitorReporter.cpp similarity index 100% rename from src/core/thermal/ThermalMonitorReporter.cpp rename to src/fsfw/thermal/ThermalMonitorReporter.cpp diff --git a/inc/fsfw/thermal/ThermalMonitorReporter.h b/src/fsfw/thermal/ThermalMonitorReporter.h similarity index 100% rename from inc/fsfw/thermal/ThermalMonitorReporter.h rename to src/fsfw/thermal/ThermalMonitorReporter.h diff --git a/inc/fsfw/thermal/tcsDefinitions.h b/src/fsfw/thermal/tcsDefinitions.h similarity index 100% rename from inc/fsfw/thermal/tcsDefinitions.h rename to src/fsfw/thermal/tcsDefinitions.h diff --git a/src/core/timemanager/CCSDSTime.cpp b/src/fsfw/timemanager/CCSDSTime.cpp similarity index 100% rename from src/core/timemanager/CCSDSTime.cpp rename to src/fsfw/timemanager/CCSDSTime.cpp diff --git a/inc/fsfw/timemanager/CCSDSTime.h b/src/fsfw/timemanager/CCSDSTime.h similarity index 100% rename from inc/fsfw/timemanager/CCSDSTime.h rename to src/fsfw/timemanager/CCSDSTime.h diff --git a/src/core/timemanager/CMakeLists.txt b/src/fsfw/timemanager/CMakeLists.txt similarity index 100% rename from src/core/timemanager/CMakeLists.txt rename to src/fsfw/timemanager/CMakeLists.txt diff --git a/inc/fsfw/timemanager/Clock.h b/src/fsfw/timemanager/Clock.h similarity index 100% rename from inc/fsfw/timemanager/Clock.h rename to src/fsfw/timemanager/Clock.h diff --git a/src/core/timemanager/ClockCommon.cpp b/src/fsfw/timemanager/ClockCommon.cpp similarity index 100% rename from src/core/timemanager/ClockCommon.cpp rename to src/fsfw/timemanager/ClockCommon.cpp diff --git a/src/core/timemanager/Countdown.cpp b/src/fsfw/timemanager/Countdown.cpp similarity index 100% rename from src/core/timemanager/Countdown.cpp rename to src/fsfw/timemanager/Countdown.cpp diff --git a/inc/fsfw/timemanager/Countdown.h b/src/fsfw/timemanager/Countdown.h similarity index 100% rename from inc/fsfw/timemanager/Countdown.h rename to src/fsfw/timemanager/Countdown.h diff --git a/inc/fsfw/timemanager/ReceivesTimeInfoIF.h b/src/fsfw/timemanager/ReceivesTimeInfoIF.h similarity index 100% rename from inc/fsfw/timemanager/ReceivesTimeInfoIF.h rename to src/fsfw/timemanager/ReceivesTimeInfoIF.h diff --git a/src/core/timemanager/Stopwatch.cpp b/src/fsfw/timemanager/Stopwatch.cpp similarity index 100% rename from src/core/timemanager/Stopwatch.cpp rename to src/fsfw/timemanager/Stopwatch.cpp diff --git a/inc/fsfw/timemanager/Stopwatch.h b/src/fsfw/timemanager/Stopwatch.h similarity index 100% rename from inc/fsfw/timemanager/Stopwatch.h rename to src/fsfw/timemanager/Stopwatch.h diff --git a/src/core/timemanager/TimeMessage.cpp b/src/fsfw/timemanager/TimeMessage.cpp similarity index 100% rename from src/core/timemanager/TimeMessage.cpp rename to src/fsfw/timemanager/TimeMessage.cpp diff --git a/inc/fsfw/timemanager/TimeMessage.h b/src/fsfw/timemanager/TimeMessage.h similarity index 100% rename from inc/fsfw/timemanager/TimeMessage.h rename to src/fsfw/timemanager/TimeMessage.h diff --git a/src/core/timemanager/TimeStamper.cpp b/src/fsfw/timemanager/TimeStamper.cpp similarity index 100% rename from src/core/timemanager/TimeStamper.cpp rename to src/fsfw/timemanager/TimeStamper.cpp diff --git a/inc/fsfw/timemanager/TimeStamper.h b/src/fsfw/timemanager/TimeStamper.h similarity index 100% rename from inc/fsfw/timemanager/TimeStamper.h rename to src/fsfw/timemanager/TimeStamper.h diff --git a/inc/fsfw/timemanager/TimeStamperIF.h b/src/fsfw/timemanager/TimeStamperIF.h similarity index 100% rename from inc/fsfw/timemanager/TimeStamperIF.h rename to src/fsfw/timemanager/TimeStamperIF.h diff --git a/inc/fsfw/timemanager/clockDefinitions.h b/src/fsfw/timemanager/clockDefinitions.h similarity index 100% rename from inc/fsfw/timemanager/clockDefinitions.h rename to src/fsfw/timemanager/clockDefinitions.h diff --git a/src/opt/tmstorage/CMakeLists.txt b/src/fsfw/tmstorage/CMakeLists.txt similarity index 100% rename from src/opt/tmstorage/CMakeLists.txt rename to src/fsfw/tmstorage/CMakeLists.txt diff --git a/inc/fsfw/tmstorage/TmStoreBackendIF.h b/src/fsfw/tmstorage/TmStoreBackendIF.h similarity index 100% rename from inc/fsfw/tmstorage/TmStoreBackendIF.h rename to src/fsfw/tmstorage/TmStoreBackendIF.h diff --git a/inc/fsfw/tmstorage/TmStoreFrontendIF.h b/src/fsfw/tmstorage/TmStoreFrontendIF.h similarity index 100% rename from inc/fsfw/tmstorage/TmStoreFrontendIF.h rename to src/fsfw/tmstorage/TmStoreFrontendIF.h diff --git a/src/opt/tmstorage/TmStoreMessage.cpp b/src/fsfw/tmstorage/TmStoreMessage.cpp similarity index 100% rename from src/opt/tmstorage/TmStoreMessage.cpp rename to src/fsfw/tmstorage/TmStoreMessage.cpp diff --git a/inc/fsfw/tmstorage/TmStoreMessage.h b/src/fsfw/tmstorage/TmStoreMessage.h similarity index 100% rename from inc/fsfw/tmstorage/TmStoreMessage.h rename to src/fsfw/tmstorage/TmStoreMessage.h diff --git a/inc/fsfw/tmstorage/TmStorePackets.h b/src/fsfw/tmstorage/TmStorePackets.h similarity index 100% rename from inc/fsfw/tmstorage/TmStorePackets.h rename to src/fsfw/tmstorage/TmStorePackets.h diff --git a/src/core/tmtcpacket/CMakeLists.txt b/src/fsfw/tmtcpacket/CMakeLists.txt similarity index 100% rename from src/core/tmtcpacket/CMakeLists.txt rename to src/fsfw/tmtcpacket/CMakeLists.txt diff --git a/src/core/tmtcpacket/SpacePacket.cpp b/src/fsfw/tmtcpacket/SpacePacket.cpp similarity index 100% rename from src/core/tmtcpacket/SpacePacket.cpp rename to src/fsfw/tmtcpacket/SpacePacket.cpp diff --git a/inc/fsfw/tmtcpacket/SpacePacket.h b/src/fsfw/tmtcpacket/SpacePacket.h similarity index 100% rename from inc/fsfw/tmtcpacket/SpacePacket.h rename to src/fsfw/tmtcpacket/SpacePacket.h diff --git a/src/core/tmtcpacket/SpacePacketBase.cpp b/src/fsfw/tmtcpacket/SpacePacketBase.cpp similarity index 100% rename from src/core/tmtcpacket/SpacePacketBase.cpp rename to src/fsfw/tmtcpacket/SpacePacketBase.cpp diff --git a/inc/fsfw/tmtcpacket/SpacePacketBase.h b/src/fsfw/tmtcpacket/SpacePacketBase.h similarity index 100% rename from inc/fsfw/tmtcpacket/SpacePacketBase.h rename to src/fsfw/tmtcpacket/SpacePacketBase.h diff --git a/inc/fsfw/tmtcpacket/ccsds_header.h b/src/fsfw/tmtcpacket/ccsds_header.h similarity index 100% rename from inc/fsfw/tmtcpacket/ccsds_header.h rename to src/fsfw/tmtcpacket/ccsds_header.h diff --git a/inc/fsfw/tmtcpacket/packetmatcher/ApidMatcher.h b/src/fsfw/tmtcpacket/packetmatcher/ApidMatcher.h similarity index 100% rename from inc/fsfw/tmtcpacket/packetmatcher/ApidMatcher.h rename to src/fsfw/tmtcpacket/packetmatcher/ApidMatcher.h diff --git a/src/core/tmtcpacket/packetmatcher/CMakeLists.txt b/src/fsfw/tmtcpacket/packetmatcher/CMakeLists.txt similarity index 100% rename from src/core/tmtcpacket/packetmatcher/CMakeLists.txt rename to src/fsfw/tmtcpacket/packetmatcher/CMakeLists.txt diff --git a/src/core/tmtcpacket/packetmatcher/PacketMatchTree.cpp b/src/fsfw/tmtcpacket/packetmatcher/PacketMatchTree.cpp similarity index 100% rename from src/core/tmtcpacket/packetmatcher/PacketMatchTree.cpp rename to src/fsfw/tmtcpacket/packetmatcher/PacketMatchTree.cpp diff --git a/inc/fsfw/tmtcpacket/packetmatcher/PacketMatchTree.h b/src/fsfw/tmtcpacket/packetmatcher/PacketMatchTree.h similarity index 100% rename from inc/fsfw/tmtcpacket/packetmatcher/PacketMatchTree.h rename to src/fsfw/tmtcpacket/packetmatcher/PacketMatchTree.h diff --git a/inc/fsfw/tmtcpacket/packetmatcher/ServiceMatcher.h b/src/fsfw/tmtcpacket/packetmatcher/ServiceMatcher.h similarity index 100% rename from inc/fsfw/tmtcpacket/packetmatcher/ServiceMatcher.h rename to src/fsfw/tmtcpacket/packetmatcher/ServiceMatcher.h diff --git a/inc/fsfw/tmtcpacket/packetmatcher/SubserviceMatcher.h b/src/fsfw/tmtcpacket/packetmatcher/SubserviceMatcher.h similarity index 100% rename from inc/fsfw/tmtcpacket/packetmatcher/SubserviceMatcher.h rename to src/fsfw/tmtcpacket/packetmatcher/SubserviceMatcher.h diff --git a/src/core/tmtcpacket/pus/CMakeLists.txt b/src/fsfw/tmtcpacket/pus/CMakeLists.txt similarity index 100% rename from src/core/tmtcpacket/pus/CMakeLists.txt rename to src/fsfw/tmtcpacket/pus/CMakeLists.txt diff --git a/inc/fsfw/tmtcpacket/pus/PacketTimestampInterpreterIF.h b/src/fsfw/tmtcpacket/pus/PacketTimestampInterpreterIF.h similarity index 100% rename from inc/fsfw/tmtcpacket/pus/PacketTimestampInterpreterIF.h rename to src/fsfw/tmtcpacket/pus/PacketTimestampInterpreterIF.h diff --git a/inc/fsfw/tmtcpacket/pus/tc.h b/src/fsfw/tmtcpacket/pus/tc.h similarity index 100% rename from inc/fsfw/tmtcpacket/pus/tc.h rename to src/fsfw/tmtcpacket/pus/tc.h diff --git a/src/core/tmtcpacket/pus/tc/CMakeLists.txt b/src/fsfw/tmtcpacket/pus/tc/CMakeLists.txt similarity index 100% rename from src/core/tmtcpacket/pus/tc/CMakeLists.txt rename to src/fsfw/tmtcpacket/pus/tc/CMakeLists.txt diff --git a/src/core/tmtcpacket/pus/tc/TcPacketBase.cpp b/src/fsfw/tmtcpacket/pus/tc/TcPacketBase.cpp similarity index 100% rename from src/core/tmtcpacket/pus/tc/TcPacketBase.cpp rename to src/fsfw/tmtcpacket/pus/tc/TcPacketBase.cpp diff --git a/inc/fsfw/tmtcpacket/pus/tc/TcPacketBase.h b/src/fsfw/tmtcpacket/pus/tc/TcPacketBase.h similarity index 100% rename from inc/fsfw/tmtcpacket/pus/tc/TcPacketBase.h rename to src/fsfw/tmtcpacket/pus/tc/TcPacketBase.h diff --git a/src/core/tmtcpacket/pus/tc/TcPacketPus.cpp b/src/fsfw/tmtcpacket/pus/tc/TcPacketPus.cpp similarity index 100% rename from src/core/tmtcpacket/pus/tc/TcPacketPus.cpp rename to src/fsfw/tmtcpacket/pus/tc/TcPacketPus.cpp diff --git a/inc/fsfw/tmtcpacket/pus/tc/TcPacketPus.h b/src/fsfw/tmtcpacket/pus/tc/TcPacketPus.h similarity index 100% rename from inc/fsfw/tmtcpacket/pus/tc/TcPacketPus.h rename to src/fsfw/tmtcpacket/pus/tc/TcPacketPus.h diff --git a/src/core/tmtcpacket/pus/tc/TcPacketStoredBase.cpp b/src/fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.cpp similarity index 100% rename from src/core/tmtcpacket/pus/tc/TcPacketStoredBase.cpp rename to src/fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.cpp diff --git a/inc/fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.h b/src/fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.h similarity index 100% rename from inc/fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.h rename to src/fsfw/tmtcpacket/pus/tc/TcPacketStoredBase.h diff --git a/inc/fsfw/tmtcpacket/pus/tc/TcPacketStoredIF.h b/src/fsfw/tmtcpacket/pus/tc/TcPacketStoredIF.h similarity index 100% rename from inc/fsfw/tmtcpacket/pus/tc/TcPacketStoredIF.h rename to src/fsfw/tmtcpacket/pus/tc/TcPacketStoredIF.h diff --git a/src/core/tmtcpacket/pus/tc/TcPacketStoredPus.cpp b/src/fsfw/tmtcpacket/pus/tc/TcPacketStoredPus.cpp similarity index 100% rename from src/core/tmtcpacket/pus/tc/TcPacketStoredPus.cpp rename to src/fsfw/tmtcpacket/pus/tc/TcPacketStoredPus.cpp diff --git a/inc/fsfw/tmtcpacket/pus/tc/TcPacketStoredPus.h b/src/fsfw/tmtcpacket/pus/tc/TcPacketStoredPus.h similarity index 100% rename from inc/fsfw/tmtcpacket/pus/tc/TcPacketStoredPus.h rename to src/fsfw/tmtcpacket/pus/tc/TcPacketStoredPus.h diff --git a/inc/fsfw/tmtcpacket/pus/tm.h b/src/fsfw/tmtcpacket/pus/tm.h similarity index 100% rename from inc/fsfw/tmtcpacket/pus/tm.h rename to src/fsfw/tmtcpacket/pus/tm.h diff --git a/src/core/tmtcpacket/pus/tm/CMakeLists.txt b/src/fsfw/tmtcpacket/pus/tm/CMakeLists.txt similarity index 100% rename from src/core/tmtcpacket/pus/tm/CMakeLists.txt rename to src/fsfw/tmtcpacket/pus/tm/CMakeLists.txt diff --git a/src/core/tmtcpacket/pus/tm/TmPacketBase.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketBase.cpp similarity index 100% rename from src/core/tmtcpacket/pus/tm/TmPacketBase.cpp rename to src/fsfw/tmtcpacket/pus/tm/TmPacketBase.cpp diff --git a/inc/fsfw/tmtcpacket/pus/tm/TmPacketBase.h b/src/fsfw/tmtcpacket/pus/tm/TmPacketBase.h similarity index 100% rename from inc/fsfw/tmtcpacket/pus/tm/TmPacketBase.h rename to src/fsfw/tmtcpacket/pus/tm/TmPacketBase.h diff --git a/src/core/tmtcpacket/pus/tm/TmPacketMinimal.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketMinimal.cpp similarity index 100% rename from src/core/tmtcpacket/pus/tm/TmPacketMinimal.cpp rename to src/fsfw/tmtcpacket/pus/tm/TmPacketMinimal.cpp diff --git a/inc/fsfw/tmtcpacket/pus/tm/TmPacketMinimal.h b/src/fsfw/tmtcpacket/pus/tm/TmPacketMinimal.h similarity index 100% rename from inc/fsfw/tmtcpacket/pus/tm/TmPacketMinimal.h rename to src/fsfw/tmtcpacket/pus/tm/TmPacketMinimal.h diff --git a/src/core/tmtcpacket/pus/tm/TmPacketPusA.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.cpp similarity index 100% rename from src/core/tmtcpacket/pus/tm/TmPacketPusA.cpp rename to src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.cpp diff --git a/inc/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h similarity index 100% rename from inc/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h rename to src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h diff --git a/src/core/tmtcpacket/pus/tm/TmPacketPusC.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.cpp similarity index 100% rename from src/core/tmtcpacket/pus/tm/TmPacketPusC.cpp rename to src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.cpp diff --git a/inc/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h similarity index 100% rename from inc/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h rename to src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h diff --git a/inc/fsfw/tmtcpacket/pus/tm/TmPacketStored.h b/src/fsfw/tmtcpacket/pus/tm/TmPacketStored.h similarity index 100% rename from inc/fsfw/tmtcpacket/pus/tm/TmPacketStored.h rename to src/fsfw/tmtcpacket/pus/tm/TmPacketStored.h diff --git a/src/core/tmtcpacket/pus/tm/TmPacketStoredBase.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.cpp similarity index 100% rename from src/core/tmtcpacket/pus/tm/TmPacketStoredBase.cpp rename to src/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.cpp diff --git a/inc/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.h b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.h similarity index 100% rename from inc/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.h rename to src/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.h diff --git a/src/core/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp similarity index 100% rename from src/core/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp rename to src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp diff --git a/inc/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.h b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.h similarity index 100% rename from inc/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.h rename to src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.h diff --git a/src/core/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp similarity index 100% rename from src/core/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp rename to src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp diff --git a/inc/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.h b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.h similarity index 100% rename from inc/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.h rename to src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.h diff --git a/inc/fsfw/tmtcservices/AcceptsTelecommandsIF.h b/src/fsfw/tmtcservices/AcceptsTelecommandsIF.h similarity index 100% rename from inc/fsfw/tmtcservices/AcceptsTelecommandsIF.h rename to src/fsfw/tmtcservices/AcceptsTelecommandsIF.h diff --git a/inc/fsfw/tmtcservices/AcceptsTelemetryIF.h b/src/fsfw/tmtcservices/AcceptsTelemetryIF.h similarity index 100% rename from inc/fsfw/tmtcservices/AcceptsTelemetryIF.h rename to src/fsfw/tmtcservices/AcceptsTelemetryIF.h diff --git a/inc/fsfw/tmtcservices/AcceptsVerifyMessageIF.h b/src/fsfw/tmtcservices/AcceptsVerifyMessageIF.h similarity index 100% rename from inc/fsfw/tmtcservices/AcceptsVerifyMessageIF.h rename to src/fsfw/tmtcservices/AcceptsVerifyMessageIF.h diff --git a/src/core/tmtcservices/CMakeLists.txt b/src/fsfw/tmtcservices/CMakeLists.txt similarity index 100% rename from src/core/tmtcservices/CMakeLists.txt rename to src/fsfw/tmtcservices/CMakeLists.txt diff --git a/src/core/tmtcservices/CommandingServiceBase.cpp b/src/fsfw/tmtcservices/CommandingServiceBase.cpp similarity index 100% rename from src/core/tmtcservices/CommandingServiceBase.cpp rename to src/fsfw/tmtcservices/CommandingServiceBase.cpp diff --git a/inc/fsfw/tmtcservices/CommandingServiceBase.h b/src/fsfw/tmtcservices/CommandingServiceBase.h similarity index 100% rename from inc/fsfw/tmtcservices/CommandingServiceBase.h rename to src/fsfw/tmtcservices/CommandingServiceBase.h diff --git a/src/core/tmtcservices/PusServiceBase.cpp b/src/fsfw/tmtcservices/PusServiceBase.cpp similarity index 100% rename from src/core/tmtcservices/PusServiceBase.cpp rename to src/fsfw/tmtcservices/PusServiceBase.cpp diff --git a/inc/fsfw/tmtcservices/PusServiceBase.h b/src/fsfw/tmtcservices/PusServiceBase.h similarity index 100% rename from inc/fsfw/tmtcservices/PusServiceBase.h rename to src/fsfw/tmtcservices/PusServiceBase.h diff --git a/src/core/tmtcservices/PusVerificationReport.cpp b/src/fsfw/tmtcservices/PusVerificationReport.cpp similarity index 100% rename from src/core/tmtcservices/PusVerificationReport.cpp rename to src/fsfw/tmtcservices/PusVerificationReport.cpp diff --git a/inc/fsfw/tmtcservices/PusVerificationReport.h b/src/fsfw/tmtcservices/PusVerificationReport.h similarity index 100% rename from inc/fsfw/tmtcservices/PusVerificationReport.h rename to src/fsfw/tmtcservices/PusVerificationReport.h diff --git a/inc/fsfw/tmtcservices/SourceSequenceCounter.h b/src/fsfw/tmtcservices/SourceSequenceCounter.h similarity index 100% rename from inc/fsfw/tmtcservices/SourceSequenceCounter.h rename to src/fsfw/tmtcservices/SourceSequenceCounter.h diff --git a/src/core/tmtcservices/TmTcBridge.cpp b/src/fsfw/tmtcservices/TmTcBridge.cpp similarity index 100% rename from src/core/tmtcservices/TmTcBridge.cpp rename to src/fsfw/tmtcservices/TmTcBridge.cpp diff --git a/inc/fsfw/tmtcservices/TmTcBridge.h b/src/fsfw/tmtcservices/TmTcBridge.h similarity index 100% rename from inc/fsfw/tmtcservices/TmTcBridge.h rename to src/fsfw/tmtcservices/TmTcBridge.h diff --git a/src/core/tmtcservices/TmTcMessage.cpp b/src/fsfw/tmtcservices/TmTcMessage.cpp similarity index 100% rename from src/core/tmtcservices/TmTcMessage.cpp rename to src/fsfw/tmtcservices/TmTcMessage.cpp diff --git a/inc/fsfw/tmtcservices/TmTcMessage.h b/src/fsfw/tmtcservices/TmTcMessage.h similarity index 100% rename from inc/fsfw/tmtcservices/TmTcMessage.h rename to src/fsfw/tmtcservices/TmTcMessage.h diff --git a/inc/fsfw/tmtcservices/VerificationCodes.h b/src/fsfw/tmtcservices/VerificationCodes.h similarity index 100% rename from inc/fsfw/tmtcservices/VerificationCodes.h rename to src/fsfw/tmtcservices/VerificationCodes.h diff --git a/src/core/tmtcservices/VerificationReporter.cpp b/src/fsfw/tmtcservices/VerificationReporter.cpp similarity index 100% rename from src/core/tmtcservices/VerificationReporter.cpp rename to src/fsfw/tmtcservices/VerificationReporter.cpp diff --git a/inc/fsfw/tmtcservices/VerificationReporter.h b/src/fsfw/tmtcservices/VerificationReporter.h similarity index 100% rename from inc/fsfw/tmtcservices/VerificationReporter.h rename to src/fsfw/tmtcservices/VerificationReporter.h diff --git a/src/opt/CMakeLists.txt b/src/opt/CMakeLists.txt deleted file mode 100644 index 48ee664b..00000000 --- a/src/opt/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -add_subdirectory(coordinates) -add_subdirectory(datalinklayer) -add_subdirectory(monitoring) -add_subdirectory(pus) -add_subdirectory(rmap) -add_subdirectory(tmstorage) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 26ce12e8..febd4f0a 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,2 +1 @@ add_subdirectory(src) -add_subdirectory(inc) \ No newline at end of file diff --git a/tests/inc/CMakeLists.txt b/tests/inc/CMakeLists.txt deleted file mode 100644 index abf6a3d2..00000000 --- a/tests/inc/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -target_include_directories(${LIB_FSFW_NAME} PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} -) - -target_include_directories(${LIB_FSFW_NAME} INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR} -) diff --git a/tests/src/CMakeLists.txt b/tests/src/CMakeLists.txt index 3f5d21b5..ed2f2522 100644 --- a/tests/src/CMakeLists.txt +++ b/tests/src/CMakeLists.txt @@ -1,7 +1,9 @@ -if(FSFW_ADD_INTERNAL_TESTS) - add_subdirectory(internal) -endif() +target_include_directories(${LIB_FSFW_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} +) -if(FSFW_ADD_UNITTESTS) - add_subdirectory(tests) -endif() +target_include_directories(${LIB_FSFW_NAME} INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_subdirectory(fsfw) diff --git a/tests/src/fsfw/CMakeLists.txt b/tests/src/fsfw/CMakeLists.txt new file mode 100644 index 00000000..571a126e --- /dev/null +++ b/tests/src/fsfw/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(tests) \ No newline at end of file diff --git a/tests/src/fsfw/tests/CMakeLists.txt b/tests/src/fsfw/tests/CMakeLists.txt new file mode 100644 index 00000000..e4a6be80 --- /dev/null +++ b/tests/src/fsfw/tests/CMakeLists.txt @@ -0,0 +1,8 @@ + +if(FSFW_ADD_INTERNAL_TESTS) + add_subdirectory(internal) +endif() + +if(FSFW_ADD_UNITTESTS) + add_subdirectory(unit) +endif() diff --git a/tests/src/internal/CMakeLists.txt b/tests/src/fsfw/tests/internal/CMakeLists.txt similarity index 100% rename from tests/src/internal/CMakeLists.txt rename to tests/src/fsfw/tests/internal/CMakeLists.txt diff --git a/tests/src/internal/InternalUnitTester.cpp b/tests/src/fsfw/tests/internal/InternalUnitTester.cpp similarity index 100% rename from tests/src/internal/InternalUnitTester.cpp rename to tests/src/fsfw/tests/internal/InternalUnitTester.cpp diff --git a/tests/inc/fsfw/tests/internal/InternalUnitTester.h b/tests/src/fsfw/tests/internal/InternalUnitTester.h similarity index 100% rename from tests/inc/fsfw/tests/internal/InternalUnitTester.h rename to tests/src/fsfw/tests/internal/InternalUnitTester.h diff --git a/tests/src/internal/UnittDefinitions.cpp b/tests/src/fsfw/tests/internal/UnittDefinitions.cpp similarity index 100% rename from tests/src/internal/UnittDefinitions.cpp rename to tests/src/fsfw/tests/internal/UnittDefinitions.cpp diff --git a/tests/inc/fsfw/tests/internal/UnittDefinitions.h b/tests/src/fsfw/tests/internal/UnittDefinitions.h similarity index 100% rename from tests/inc/fsfw/tests/internal/UnittDefinitions.h rename to tests/src/fsfw/tests/internal/UnittDefinitions.h diff --git a/tests/src/internal/globalfunctions/CMakeLists.txt b/tests/src/fsfw/tests/internal/globalfunctions/CMakeLists.txt similarity index 100% rename from tests/src/internal/globalfunctions/CMakeLists.txt rename to tests/src/fsfw/tests/internal/globalfunctions/CMakeLists.txt diff --git a/tests/src/internal/globalfunctions/TestArrayPrinter.cpp b/tests/src/fsfw/tests/internal/globalfunctions/TestArrayPrinter.cpp similarity index 100% rename from tests/src/internal/globalfunctions/TestArrayPrinter.cpp rename to tests/src/fsfw/tests/internal/globalfunctions/TestArrayPrinter.cpp diff --git a/tests/inc/fsfw/tests/internal/globalfunctions/TestArrayPrinter.h b/tests/src/fsfw/tests/internal/globalfunctions/TestArrayPrinter.h similarity index 100% rename from tests/inc/fsfw/tests/internal/globalfunctions/TestArrayPrinter.h rename to tests/src/fsfw/tests/internal/globalfunctions/TestArrayPrinter.h diff --git a/tests/src/internal/osal/CMakeLists.txt b/tests/src/fsfw/tests/internal/osal/CMakeLists.txt similarity index 100% rename from tests/src/internal/osal/CMakeLists.txt rename to tests/src/fsfw/tests/internal/osal/CMakeLists.txt diff --git a/tests/src/internal/osal/IntTestMq.cpp b/tests/src/fsfw/tests/internal/osal/IntTestMq.cpp similarity index 100% rename from tests/src/internal/osal/IntTestMq.cpp rename to tests/src/fsfw/tests/internal/osal/IntTestMq.cpp diff --git a/tests/inc/fsfw/tests/internal/osal/IntTestMq.h b/tests/src/fsfw/tests/internal/osal/IntTestMq.h similarity index 100% rename from tests/inc/fsfw/tests/internal/osal/IntTestMq.h rename to tests/src/fsfw/tests/internal/osal/IntTestMq.h diff --git a/tests/src/internal/osal/IntTestMutex.cpp b/tests/src/fsfw/tests/internal/osal/IntTestMutex.cpp similarity index 100% rename from tests/src/internal/osal/IntTestMutex.cpp rename to tests/src/fsfw/tests/internal/osal/IntTestMutex.cpp diff --git a/tests/inc/fsfw/tests/internal/osal/IntTestMutex.h b/tests/src/fsfw/tests/internal/osal/IntTestMutex.h similarity index 100% rename from tests/inc/fsfw/tests/internal/osal/IntTestMutex.h rename to tests/src/fsfw/tests/internal/osal/IntTestMutex.h diff --git a/tests/src/internal/osal/IntTestSemaphore.cpp b/tests/src/fsfw/tests/internal/osal/IntTestSemaphore.cpp similarity index 100% rename from tests/src/internal/osal/IntTestSemaphore.cpp rename to tests/src/fsfw/tests/internal/osal/IntTestSemaphore.cpp diff --git a/tests/inc/fsfw/tests/internal/osal/IntTestSemaphore.h b/tests/src/fsfw/tests/internal/osal/IntTestSemaphore.h similarity index 100% rename from tests/inc/fsfw/tests/internal/osal/IntTestSemaphore.h rename to tests/src/fsfw/tests/internal/osal/IntTestSemaphore.h diff --git a/tests/src/internal/serialize/CMakeLists.txt b/tests/src/fsfw/tests/internal/serialize/CMakeLists.txt similarity index 100% rename from tests/src/internal/serialize/CMakeLists.txt rename to tests/src/fsfw/tests/internal/serialize/CMakeLists.txt diff --git a/tests/src/internal/serialize/IntTestSerialization.cpp b/tests/src/fsfw/tests/internal/serialize/IntTestSerialization.cpp similarity index 100% rename from tests/src/internal/serialize/IntTestSerialization.cpp rename to tests/src/fsfw/tests/internal/serialize/IntTestSerialization.cpp diff --git a/tests/inc/fsfw/tests/internal/serialize/IntTestSerialization.h b/tests/src/fsfw/tests/internal/serialize/IntTestSerialization.h similarity index 100% rename from tests/inc/fsfw/tests/internal/serialize/IntTestSerialization.h rename to tests/src/fsfw/tests/internal/serialize/IntTestSerialization.h diff --git a/tests/src/tests/CMakeLists.txt b/tests/src/fsfw/tests/unit/CMakeLists.txt similarity index 72% rename from tests/src/tests/CMakeLists.txt rename to tests/src/fsfw/tests/unit/CMakeLists.txt index 2f3d9f70..255063f3 100644 --- a/tests/src/tests/CMakeLists.txt +++ b/tests/src/fsfw/tests/unit/CMakeLists.txt @@ -4,3 +4,5 @@ add_subdirectory(osal) add_subdirectory(serialize) add_subdirectory(datapoollocal) add_subdirectory(storagemanager) +add_subdirectory(globalfunctions) +add_subdirectory(tmtcpacket) diff --git a/tests/src/tests/action/CMakeLists.txt b/tests/src/fsfw/tests/unit/action/CMakeLists.txt similarity index 100% rename from tests/src/tests/action/CMakeLists.txt rename to tests/src/fsfw/tests/unit/action/CMakeLists.txt diff --git a/tests/src/tests/action/TestActionHelper.cpp b/tests/src/fsfw/tests/unit/action/TestActionHelper.cpp similarity index 100% rename from tests/src/tests/action/TestActionHelper.cpp rename to tests/src/fsfw/tests/unit/action/TestActionHelper.cpp diff --git a/tests/src/tests/action/TestActionHelper.h b/tests/src/fsfw/tests/unit/action/TestActionHelper.h similarity index 100% rename from tests/src/tests/action/TestActionHelper.h rename to tests/src/fsfw/tests/unit/action/TestActionHelper.h diff --git a/tests/src/tests/container/CMakeLists.txt b/tests/src/fsfw/tests/unit/container/CMakeLists.txt similarity index 100% rename from tests/src/tests/container/CMakeLists.txt rename to tests/src/fsfw/tests/unit/container/CMakeLists.txt diff --git a/tests/src/tests/container/RingBufferTest.cpp b/tests/src/fsfw/tests/unit/container/RingBufferTest.cpp similarity index 100% rename from tests/src/tests/container/RingBufferTest.cpp rename to tests/src/fsfw/tests/unit/container/RingBufferTest.cpp diff --git a/tests/src/tests/container/TestArrayList.cpp b/tests/src/fsfw/tests/unit/container/TestArrayList.cpp similarity index 100% rename from tests/src/tests/container/TestArrayList.cpp rename to tests/src/fsfw/tests/unit/container/TestArrayList.cpp diff --git a/tests/src/tests/container/TestDynamicFifo.cpp b/tests/src/fsfw/tests/unit/container/TestDynamicFifo.cpp similarity index 100% rename from tests/src/tests/container/TestDynamicFifo.cpp rename to tests/src/fsfw/tests/unit/container/TestDynamicFifo.cpp diff --git a/tests/src/tests/container/TestFifo.cpp b/tests/src/fsfw/tests/unit/container/TestFifo.cpp similarity index 100% rename from tests/src/tests/container/TestFifo.cpp rename to tests/src/fsfw/tests/unit/container/TestFifo.cpp diff --git a/tests/src/tests/container/TestFixedArrayList.cpp b/tests/src/fsfw/tests/unit/container/TestFixedArrayList.cpp similarity index 100% rename from tests/src/tests/container/TestFixedArrayList.cpp rename to tests/src/fsfw/tests/unit/container/TestFixedArrayList.cpp diff --git a/tests/src/tests/container/TestFixedMap.cpp b/tests/src/fsfw/tests/unit/container/TestFixedMap.cpp similarity index 100% rename from tests/src/tests/container/TestFixedMap.cpp rename to tests/src/fsfw/tests/unit/container/TestFixedMap.cpp diff --git a/tests/src/tests/container/TestFixedOrderedMultimap.cpp b/tests/src/fsfw/tests/unit/container/TestFixedOrderedMultimap.cpp similarity index 100% rename from tests/src/tests/container/TestFixedOrderedMultimap.cpp rename to tests/src/fsfw/tests/unit/container/TestFixedOrderedMultimap.cpp diff --git a/tests/src/tests/container/TestPlacementFactory.cpp b/tests/src/fsfw/tests/unit/container/TestPlacementFactory.cpp similarity index 100% rename from tests/src/tests/container/TestPlacementFactory.cpp rename to tests/src/fsfw/tests/unit/container/TestPlacementFactory.cpp diff --git a/tests/src/tests/datapoollocal/CMakeLists.txt b/tests/src/fsfw/tests/unit/datapoollocal/CMakeLists.txt similarity index 100% rename from tests/src/tests/datapoollocal/CMakeLists.txt rename to tests/src/fsfw/tests/unit/datapoollocal/CMakeLists.txt diff --git a/tests/src/tests/datapoollocal/DataSetTest.cpp b/tests/src/fsfw/tests/unit/datapoollocal/DataSetTest.cpp similarity index 100% rename from tests/src/tests/datapoollocal/DataSetTest.cpp rename to tests/src/fsfw/tests/unit/datapoollocal/DataSetTest.cpp diff --git a/tests/src/tests/datapoollocal/LocalPoolManagerTest.cpp b/tests/src/fsfw/tests/unit/datapoollocal/LocalPoolManagerTest.cpp similarity index 100% rename from tests/src/tests/datapoollocal/LocalPoolManagerTest.cpp rename to tests/src/fsfw/tests/unit/datapoollocal/LocalPoolManagerTest.cpp diff --git a/tests/src/tests/datapoollocal/LocalPoolOwnerBase.cpp b/tests/src/fsfw/tests/unit/datapoollocal/LocalPoolOwnerBase.cpp similarity index 100% rename from tests/src/tests/datapoollocal/LocalPoolOwnerBase.cpp rename to tests/src/fsfw/tests/unit/datapoollocal/LocalPoolOwnerBase.cpp diff --git a/tests/src/tests/datapoollocal/LocalPoolOwnerBase.h b/tests/src/fsfw/tests/unit/datapoollocal/LocalPoolOwnerBase.h similarity index 100% rename from tests/src/tests/datapoollocal/LocalPoolOwnerBase.h rename to tests/src/fsfw/tests/unit/datapoollocal/LocalPoolOwnerBase.h diff --git a/tests/src/tests/datapoollocal/LocalPoolVariableTest.cpp b/tests/src/fsfw/tests/unit/datapoollocal/LocalPoolVariableTest.cpp similarity index 100% rename from tests/src/tests/datapoollocal/LocalPoolVariableTest.cpp rename to tests/src/fsfw/tests/unit/datapoollocal/LocalPoolVariableTest.cpp diff --git a/tests/src/tests/datapoollocal/LocalPoolVectorTest.cpp b/tests/src/fsfw/tests/unit/datapoollocal/LocalPoolVectorTest.cpp similarity index 100% rename from tests/src/tests/datapoollocal/LocalPoolVectorTest.cpp rename to tests/src/fsfw/tests/unit/datapoollocal/LocalPoolVectorTest.cpp diff --git a/tests/src/tests/globalfunctions/CMakeLists.txt b/tests/src/fsfw/tests/unit/globalfunctions/CMakeLists.txt similarity index 100% rename from tests/src/tests/globalfunctions/CMakeLists.txt rename to tests/src/fsfw/tests/unit/globalfunctions/CMakeLists.txt diff --git a/tests/src/tests/mocks/HkReceiverMock.h b/tests/src/fsfw/tests/unit/mocks/HkReceiverMock.h similarity index 100% rename from tests/src/tests/mocks/HkReceiverMock.h rename to tests/src/fsfw/tests/unit/mocks/HkReceiverMock.h diff --git a/tests/src/tests/mocks/MessageQueueMockBase.h b/tests/src/fsfw/tests/unit/mocks/MessageQueueMockBase.h similarity index 100% rename from tests/src/tests/mocks/MessageQueueMockBase.h rename to tests/src/fsfw/tests/unit/mocks/MessageQueueMockBase.h diff --git a/tests/src/tests/osal/CMakeLists.txt b/tests/src/fsfw/tests/unit/osal/CMakeLists.txt similarity index 100% rename from tests/src/tests/osal/CMakeLists.txt rename to tests/src/fsfw/tests/unit/osal/CMakeLists.txt diff --git a/tests/src/tests/osal/TestMessageQueue.cpp b/tests/src/fsfw/tests/unit/osal/TestMessageQueue.cpp similarity index 100% rename from tests/src/tests/osal/TestMessageQueue.cpp rename to tests/src/fsfw/tests/unit/osal/TestMessageQueue.cpp diff --git a/tests/src/tests/osal/TestSemaphore.cpp b/tests/src/fsfw/tests/unit/osal/TestSemaphore.cpp similarity index 100% rename from tests/src/tests/osal/TestSemaphore.cpp rename to tests/src/fsfw/tests/unit/osal/TestSemaphore.cpp diff --git a/tests/src/tests/serialize/CMakeLists.txt b/tests/src/fsfw/tests/unit/serialize/CMakeLists.txt similarity index 100% rename from tests/src/tests/serialize/CMakeLists.txt rename to tests/src/fsfw/tests/unit/serialize/CMakeLists.txt diff --git a/tests/src/tests/serialize/TestSerialBufferAdapter.cpp b/tests/src/fsfw/tests/unit/serialize/TestSerialBufferAdapter.cpp similarity index 100% rename from tests/src/tests/serialize/TestSerialBufferAdapter.cpp rename to tests/src/fsfw/tests/unit/serialize/TestSerialBufferAdapter.cpp diff --git a/tests/src/tests/serialize/TestSerialLinkedPacket.cpp b/tests/src/fsfw/tests/unit/serialize/TestSerialLinkedPacket.cpp similarity index 100% rename from tests/src/tests/serialize/TestSerialLinkedPacket.cpp rename to tests/src/fsfw/tests/unit/serialize/TestSerialLinkedPacket.cpp diff --git a/tests/src/tests/serialize/TestSerialLinkedPacket.h b/tests/src/fsfw/tests/unit/serialize/TestSerialLinkedPacket.h similarity index 100% rename from tests/src/tests/serialize/TestSerialLinkedPacket.h rename to tests/src/fsfw/tests/unit/serialize/TestSerialLinkedPacket.h diff --git a/tests/src/tests/serialize/TestSerialization.cpp b/tests/src/fsfw/tests/unit/serialize/TestSerialization.cpp similarity index 100% rename from tests/src/tests/serialize/TestSerialization.cpp rename to tests/src/fsfw/tests/unit/serialize/TestSerialization.cpp diff --git a/tests/src/tests/storagemanager/CMakeLists.txt b/tests/src/fsfw/tests/unit/storagemanager/CMakeLists.txt similarity index 100% rename from tests/src/tests/storagemanager/CMakeLists.txt rename to tests/src/fsfw/tests/unit/storagemanager/CMakeLists.txt diff --git a/tests/src/tests/storagemanager/TestNewAccessor.cpp b/tests/src/fsfw/tests/unit/storagemanager/TestNewAccessor.cpp similarity index 100% rename from tests/src/tests/storagemanager/TestNewAccessor.cpp rename to tests/src/fsfw/tests/unit/storagemanager/TestNewAccessor.cpp diff --git a/tests/src/tests/storagemanager/TestPool.cpp b/tests/src/fsfw/tests/unit/storagemanager/TestPool.cpp similarity index 100% rename from tests/src/tests/storagemanager/TestPool.cpp rename to tests/src/fsfw/tests/unit/storagemanager/TestPool.cpp diff --git a/tests/src/tests/tmtcpacket/CMakeLists.txt b/tests/src/fsfw/tests/unit/tmtcpacket/CMakeLists.txt similarity index 100% rename from tests/src/tests/tmtcpacket/CMakeLists.txt rename to tests/src/fsfw/tests/unit/tmtcpacket/CMakeLists.txt diff --git a/tests/src/tests/tmtcpacket/PusTmTest.cpp b/tests/src/fsfw/tests/unit/tmtcpacket/PusTmTest.cpp similarity index 100% rename from tests/src/tests/tmtcpacket/PusTmTest.cpp rename to tests/src/fsfw/tests/unit/tmtcpacket/PusTmTest.cpp From d4f5c31881745f406f50a4fcb50a383e4e5c742c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 19 Jul 2021 18:26:54 +0200 Subject: [PATCH 208/389] optional module handling complete --- CMakeLists.txt | 16 ++++++++++---- src/CMakeLists.txt | 13 ++++++++++- src/fsfw/CMakeLists.txt | 22 ++++++++++++++----- src/fsfw/FSFW.h | 7 ------ src/fsfw/FSFW.h.in | 12 ++++++++++ .../coordinates/CoordinateTransformations.h | 1 + src/fsfw/coordinates/Jgm3Model.h | 11 +++++----- src/fsfw/coordinates/Sgp4Propagator.h | 2 ++ src/fsfw/coordinates/coordinatesConf.h | 11 ++++++++++ src/fsfw/datalinklayer/BCFrame.h | 1 + src/fsfw/datalinklayer/CCSDSReturnValuesIF.h | 3 ++- src/fsfw/datalinklayer/Clcw.h | 2 ++ src/fsfw/datalinklayer/DataLinkLayer.h | 4 +++- src/fsfw/datalinklayer/Farm1StateIF.h | 2 ++ src/fsfw/datalinklayer/Farm1StateLockout.h | 1 + src/fsfw/datalinklayer/Farm1StateOpen.h | 1 + src/fsfw/datalinklayer/Farm1StateWait.h | 1 + src/fsfw/datalinklayer/MapPacketExtraction.h | 1 + .../datalinklayer/MapPacketExtractionIF.h | 1 + src/fsfw/datalinklayer/TcTransferFrame.h | 2 ++ src/fsfw/datalinklayer/TcTransferFrameLocal.h | 1 + .../datalinklayer/VirtualChannelReception.h | 2 ++ .../datalinklayer/VirtualChannelReceptionIF.h | 3 ++- src/fsfw/datalinklayer/dllConf.h | 11 ++++++++++ src/fsfw/ipc/CommandMessageCleaner.cpp | 3 +++ src/fsfw/monitoring/AbsLimitMonitor.h | 1 + src/fsfw/monitoring/HasMonitorsIF.h | 1 + src/fsfw/monitoring/LimitMonitor.h | 1 + src/fsfw/monitoring/LimitViolationReporter.h | 1 + src/fsfw/monitoring/MonitorBase.h | 1 + src/fsfw/monitoring/MonitorReporter.h | 1 + src/fsfw/monitoring/MonitoringIF.h | 1 + src/fsfw/monitoring/MonitoringMessage.h | 5 +++-- .../monitoring/MonitoringMessageContent.h | 1 + .../monitoring/ReceivesMonitoringReportsIF.h | 3 ++- src/fsfw/monitoring/TriplexMonitor.h | 1 + src/fsfw/monitoring/TwoValueLimitMonitor.h | 1 + src/fsfw/monitoring/monitoringConf.h | 11 ++++++++++ src/fsfw/objectmanager.h | 8 +++++++ src/fsfw/rmap/RMAP.h | 1 + src/fsfw/rmap/RMAPChannelIF.h | 3 ++- src/fsfw/rmap/RMAPCookie.h | 1 + src/fsfw/rmap/RmapDeviceCommunicationIF.h | 1 + src/fsfw/rmap/rmapConf.h | 10 +++++++++ src/fsfw/rmap/rmapStructs.h | 2 ++ src/fsfw/serviceinterface.h | 6 +++++ src/fsfw/tcdistribution/TcPacketCheck.h | 6 ++--- src/fsfw/tmstorage/TmStoreBackendIF.h | 12 +++++----- src/fsfw/tmstorage/TmStoreFrontendIF.h | 5 +++-- src/fsfw/tmstorage/TmStoreMessage.cpp | 2 +- src/fsfw/tmstorage/TmStoreMessage.h | 7 +++--- src/fsfw/tmstorage/TmStorePackets.h | 17 +++++++------- src/fsfw/tmstorage/tmStorageConf.h | 11 ++++++++++ src/fsfw/tmtcpacket/pus/tc/TcPacketPus.h | 4 ++-- src/fsfw/tmtcpacket/pus/tm.h | 2 +- 55 files changed, 207 insertions(+), 54 deletions(-) delete mode 100644 src/fsfw/FSFW.h create mode 100644 src/fsfw/FSFW.h.in create mode 100644 src/fsfw/coordinates/coordinatesConf.h create mode 100644 src/fsfw/datalinklayer/dllConf.h create mode 100644 src/fsfw/monitoring/monitoringConf.h create mode 100644 src/fsfw/objectmanager.h create mode 100644 src/fsfw/rmap/rmapConf.h create mode 100644 src/fsfw/serviceinterface.h create mode 100644 src/fsfw/tmstorage/tmStorageConf.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ea8c9b1..c75d711f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.13) option(FSFW_GENERATE_SECTIONS "Generate function and data sections. Required to remove unused code" ON ) - if(FSFW_GENERATE_SECTIONS) option(FSFW_REMOVE_UNUSED_CODE "Remove unused code" ON) endif() @@ -11,9 +10,18 @@ endif() option(FSFW_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON) # Options to exclude parts of the FSFW from compilation. option(FSFW_ADD_INTERNAL_TESTS "Add internal unit tests" ON) -option(FSFW_USE_RMAP "Compile with RMAP" ON) -option(FSFW_USE_DATALINKLAYER "Compile with Data Link Layer" ON) -option(FSFW_ADD_SPG4_PROPAGATOR "Add SPG4 propagator code" ON) + +# Optional sources +option(FSFW_ADD_PUS "Compile with PUS sources" ON) +option(FSFW_ADD_MONITORING "Compile with monitoring components" ON) + +option(FSFW_ADD_RMAP "Compile with RMAP" OFF) +option(FSFW_ADD_DATALINKLAYER "Compile with Data Link Layer" OFF) +option(FSFW_ADD_COORDINATES "Compile with coordinate components" OFF) +option(FSFW_ADD_TMSTORAGE "Compile with tm storage components" OFF) + +# Contrib sources +option(FSFW_ADD_SPG4_PROPAGATOR "Add SPG4 propagator code" OFF) set(LIB_FSFW_NAME fsfw) add_library(${LIB_FSFW_NAME}) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 81ecb6e4..5a8f139b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,4 +6,15 @@ target_include_directories(${LIB_FSFW_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ) -add_subdirectory(fsfw) \ No newline at end of file +add_subdirectory(fsfw) + +# Configure File + +target_include_directories(${LIB_FSFW_NAME} PRIVATE + ${CMAKE_CURRENT_BINARY_DIR} +) +target_include_directories(${LIB_FSFW_NAME} INTERFACE + ${CMAKE_CURRENT_BINARY_DIR} +) + +configure_file(fsfw/FSFW.h.in fsfw/FSFW.h) diff --git a/src/fsfw/CMakeLists.txt b/src/fsfw/CMakeLists.txt index 2944f2b6..7c665e28 100644 --- a/src/fsfw/CMakeLists.txt +++ b/src/fsfw/CMakeLists.txt @@ -31,12 +31,24 @@ add_subdirectory(tmtcservices) # Optional -add_subdirectory(coordinates) -add_subdirectory(datalinklayer) +if(FSFW_ADD_MONITORING) add_subdirectory(monitoring) -add_subdirectory(pus) -add_subdirectory(rmap) -add_subdirectory(tmstorage) +endif() +if(FSFW_ADD_PUS) + add_subdirectory(pus) +endif() +if(FSFW_ADD_TMSTORAGE) + add_subdirectory(tmstorage) +endif() +if(FSFW_ADD_COORDINATES) + add_subdirectory(coordinates) +endif() +if(FSFW_ADD_RMAP) + add_subdirectory(rmap) +endif() +if(FSFW_ADD_DATALINKLAYER) + add_subdirectory(datalinklayer) +endif() # OSAL diff --git a/src/fsfw/FSFW.h b/src/fsfw/FSFW.h deleted file mode 100644 index df06ff3d..00000000 --- a/src/fsfw/FSFW.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef FSFW_FSFW_H_ -#define FSFW_FSFW_H_ - -#include "FSFWConfig.h" - - -#endif /* FSFW_FSFW_H_ */ diff --git a/src/fsfw/FSFW.h.in b/src/fsfw/FSFW.h.in new file mode 100644 index 00000000..c644f0b7 --- /dev/null +++ b/src/fsfw/FSFW.h.in @@ -0,0 +1,12 @@ +#ifndef FSFW_FSFW_H_ +#define FSFW_FSFW_H_ + +#include "FSFWConfig.h" + +#cmakedefine FSFW_ADD_RMAP +#cmakedefine FSFW_ADD_DATALINKLAYER +#cmakedefine FSFW_ADD_TMSTORAGE +#cmakedefine FSFW_ADD_COORDINATES +#cmakedefine FSFW_ADD_PUS + +#endif /* FSFW_FSFW_H_ */ diff --git a/src/fsfw/coordinates/CoordinateTransformations.h b/src/fsfw/coordinates/CoordinateTransformations.h index a22e0bd4..ddc715d1 100644 --- a/src/fsfw/coordinates/CoordinateTransformations.h +++ b/src/fsfw/coordinates/CoordinateTransformations.h @@ -1,6 +1,7 @@ #ifndef COORDINATETRANSFORMATIONS_H_ #define COORDINATETRANSFORMATIONS_H_ +#include "coordinatesConf.h" #include "fsfw/timemanager/Clock.h" #include diff --git a/src/fsfw/coordinates/Jgm3Model.h b/src/fsfw/coordinates/Jgm3Model.h index 884ed141..0eeaf08f 100644 --- a/src/fsfw/coordinates/Jgm3Model.h +++ b/src/fsfw/coordinates/Jgm3Model.h @@ -1,13 +1,14 @@ #ifndef FRAMEWORK_COORDINATES_JGM3MODEL_H_ #define FRAMEWORK_COORDINATES_JGM3MODEL_H_ -#include +#include "coordinatesConf.h" #include "CoordinateTransformations.h" -#include "../globalfunctions/math/VectorOperations.h" -#include "../globalfunctions/timevalOperations.h" -#include "../globalfunctions/constants.h" -#include +#include "fsfw/globalfunctions/math/VectorOperations.h" +#include "fsfw/globalfunctions/timevalOperations.h" +#include "fsfw/globalfunctions/constants.h" +#include +#include template class Jgm3Model { diff --git a/src/fsfw/coordinates/Sgp4Propagator.h b/src/fsfw/coordinates/Sgp4Propagator.h index 53c5d3e5..4f29509f 100644 --- a/src/fsfw/coordinates/Sgp4Propagator.h +++ b/src/fsfw/coordinates/Sgp4Propagator.h @@ -1,7 +1,9 @@ #ifndef SGP4PROPAGATOR_H_ #define SGP4PROPAGATOR_H_ +#include "coordinatesConf.h" #include "fsfw/platform.h" + #ifndef PLATFORM_WIN #include #endif diff --git a/src/fsfw/coordinates/coordinatesConf.h b/src/fsfw/coordinates/coordinatesConf.h new file mode 100644 index 00000000..ce798e6f --- /dev/null +++ b/src/fsfw/coordinates/coordinatesConf.h @@ -0,0 +1,11 @@ +#ifndef FSFW_SRC_FSFW_COORDINATES_COORDINATESCONF_H_ +#define FSFW_SRC_FSFW_COORDINATES_COORDINATESCONF_H_ + +#include "fsfw/FSFW.h" + +#ifndef FSFW_ADD_COORDINATES +#warning Coordinates files were included but compilation was \ + not enabled with FSFW_ADD_COORDINATES +#endif + +#endif /* FSFW_SRC_FSFW_COORDINATES_COORDINATESCONF_H_ */ diff --git a/src/fsfw/datalinklayer/BCFrame.h b/src/fsfw/datalinklayer/BCFrame.h index b7795556..9cedd41b 100644 --- a/src/fsfw/datalinklayer/BCFrame.h +++ b/src/fsfw/datalinklayer/BCFrame.h @@ -8,6 +8,7 @@ #ifndef BCFRAME_H_ #define BCFRAME_H_ +#include "dllConf.h" #include "CCSDSReturnValuesIF.h" /** diff --git a/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h b/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h index 805b6969..a31f9ced 100644 --- a/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h +++ b/src/fsfw/datalinklayer/CCSDSReturnValuesIF.h @@ -8,7 +8,8 @@ #ifndef CCSDSRETURNVALUESIF_H_ #define CCSDSRETURNVALUESIF_H_ -#include "../returnvalues/HasReturnvaluesIF.h" +#include "dllConf.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" /** * This is a helper class to collect special return values that come up during CCSDS Handling. * @ingroup ccsds_handling diff --git a/src/fsfw/datalinklayer/Clcw.h b/src/fsfw/datalinklayer/Clcw.h index f6c77230..aa1ee35b 100644 --- a/src/fsfw/datalinklayer/Clcw.h +++ b/src/fsfw/datalinklayer/Clcw.h @@ -1,7 +1,9 @@ #ifndef CLCW_H_ #define CLCW_H_ +#include "dllConf.h" #include "ClcwIF.h" + /** * Small helper method to handle the Clcw values. * It has a content struct that manages the register and can be set externally. diff --git a/src/fsfw/datalinklayer/DataLinkLayer.h b/src/fsfw/datalinklayer/DataLinkLayer.h index aa203785..9c2a2952 100644 --- a/src/fsfw/datalinklayer/DataLinkLayer.h +++ b/src/fsfw/datalinklayer/DataLinkLayer.h @@ -1,11 +1,13 @@ #ifndef DATALINKLAYER_H_ #define DATALINKLAYER_H_ +#include "dllConf.h" #include "CCSDSReturnValuesIF.h" #include "ClcwIF.h" #include "TcTransferFrame.h" #include "VirtualChannelReceptionIF.h" -#include "../events/Event.h" +#include "fsfw/events/Event.h" + #include diff --git a/src/fsfw/datalinklayer/Farm1StateIF.h b/src/fsfw/datalinklayer/Farm1StateIF.h index 71794d75..7e1ba2ec 100644 --- a/src/fsfw/datalinklayer/Farm1StateIF.h +++ b/src/fsfw/datalinklayer/Farm1StateIF.h @@ -8,7 +8,9 @@ #ifndef FARM1STATEIF_H_ #define FARM1STATEIF_H_ +#include "dllConf.h" #include "CCSDSReturnValuesIF.h" + class VirtualChannelReception; class TcTransferFrame; class ClcwIF; diff --git a/src/fsfw/datalinklayer/Farm1StateLockout.h b/src/fsfw/datalinklayer/Farm1StateLockout.h index 28abf4e6..a039c89b 100644 --- a/src/fsfw/datalinklayer/Farm1StateLockout.h +++ b/src/fsfw/datalinklayer/Farm1StateLockout.h @@ -1,6 +1,7 @@ #ifndef FARM1STATELOCKOUT_H_ #define FARM1STATELOCKOUT_H_ +#include "dllConf.h" #include "Farm1StateIF.h" /** diff --git a/src/fsfw/datalinklayer/Farm1StateOpen.h b/src/fsfw/datalinklayer/Farm1StateOpen.h index 3b3a2604..c5506e7a 100644 --- a/src/fsfw/datalinklayer/Farm1StateOpen.h +++ b/src/fsfw/datalinklayer/Farm1StateOpen.h @@ -8,6 +8,7 @@ #ifndef FARM1STATEOPEN_H_ #define FARM1STATEOPEN_H_ +#include "dllConf.h" #include "Farm1StateIF.h" /** diff --git a/src/fsfw/datalinklayer/Farm1StateWait.h b/src/fsfw/datalinklayer/Farm1StateWait.h index 877c36c2..76704fdb 100644 --- a/src/fsfw/datalinklayer/Farm1StateWait.h +++ b/src/fsfw/datalinklayer/Farm1StateWait.h @@ -8,6 +8,7 @@ #ifndef FARM1STATEWAIT_H_ #define FARM1STATEWAIT_H_ +#include "dllConf.h" #include "Farm1StateIF.h" /** diff --git a/src/fsfw/datalinklayer/MapPacketExtraction.h b/src/fsfw/datalinklayer/MapPacketExtraction.h index c74ab803..30552a8e 100644 --- a/src/fsfw/datalinklayer/MapPacketExtraction.h +++ b/src/fsfw/datalinklayer/MapPacketExtraction.h @@ -1,6 +1,7 @@ #ifndef FSFW_DATALINKLAYER_MAPPACKETEXTRACTION_H_ #define FSFW_DATALINKLAYER_MAPPACKETEXTRACTION_H_ +#include "dllConf.h" #include "MapPacketExtractionIF.h" #include "fsfw/objectmanager/ObjectManagerIF.h" #include "fsfw/returnvalues/HasReturnvaluesIF.h" diff --git a/src/fsfw/datalinklayer/MapPacketExtractionIF.h b/src/fsfw/datalinklayer/MapPacketExtractionIF.h index e29ac666..7f8a60af 100644 --- a/src/fsfw/datalinklayer/MapPacketExtractionIF.h +++ b/src/fsfw/datalinklayer/MapPacketExtractionIF.h @@ -8,6 +8,7 @@ #ifndef MAPPACKETEXTRACTIONIF_H_ #define MAPPACKETEXTRACTIONIF_H_ +#include "dllConf.h" #include "CCSDSReturnValuesIF.h" #include "TcTransferFrame.h" diff --git a/src/fsfw/datalinklayer/TcTransferFrame.h b/src/fsfw/datalinklayer/TcTransferFrame.h index ca96536f..9d4f6349 100644 --- a/src/fsfw/datalinklayer/TcTransferFrame.h +++ b/src/fsfw/datalinklayer/TcTransferFrame.h @@ -1,6 +1,8 @@ #ifndef TCTRANSFERFRAME_H_ #define TCTRANSFERFRAME_H_ +#include "dllConf.h" + #include #include diff --git a/src/fsfw/datalinklayer/TcTransferFrameLocal.h b/src/fsfw/datalinklayer/TcTransferFrameLocal.h index 487d8940..f2bf3275 100644 --- a/src/fsfw/datalinklayer/TcTransferFrameLocal.h +++ b/src/fsfw/datalinklayer/TcTransferFrameLocal.h @@ -8,6 +8,7 @@ #ifndef TCTRANSFERFRAMELOCAL_H_ #define TCTRANSFERFRAMELOCAL_H_ +#include "dllConf.h" #include "TcTransferFrame.h" /** diff --git a/src/fsfw/datalinklayer/VirtualChannelReception.h b/src/fsfw/datalinklayer/VirtualChannelReception.h index 9b4e2987..314e18ec 100644 --- a/src/fsfw/datalinklayer/VirtualChannelReception.h +++ b/src/fsfw/datalinklayer/VirtualChannelReception.h @@ -8,6 +8,7 @@ #ifndef VIRTUALCHANNELRECEPTION_H_ #define VIRTUALCHANNELRECEPTION_H_ +#include "dllConf.h" #include "CCSDSReturnValuesIF.h" #include "Clcw.h" #include "Farm1StateIF.h" @@ -16,6 +17,7 @@ #include "Farm1StateWait.h" #include "MapPacketExtractionIF.h" #include "VirtualChannelReceptionIF.h" + #include /** * Implementation of a TC Virtual Channel. diff --git a/src/fsfw/datalinklayer/VirtualChannelReceptionIF.h b/src/fsfw/datalinklayer/VirtualChannelReceptionIF.h index 36f60e8c..e7a21b3c 100644 --- a/src/fsfw/datalinklayer/VirtualChannelReceptionIF.h +++ b/src/fsfw/datalinklayer/VirtualChannelReceptionIF.h @@ -8,9 +8,10 @@ #ifndef VIRTUALCHANNELRECEPTIONIF_H_ #define VIRTUALCHANNELRECEPTIONIF_H_ +#include "dllConf.h" #include "ClcwIF.h" #include "TcTransferFrame.h" -#include "../returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" /** * This is the interface for Virtual Channel reception classes. diff --git a/src/fsfw/datalinklayer/dllConf.h b/src/fsfw/datalinklayer/dllConf.h new file mode 100644 index 00000000..dce63ff0 --- /dev/null +++ b/src/fsfw/datalinklayer/dllConf.h @@ -0,0 +1,11 @@ +#ifndef FSFW_SRC_FSFW_DATALINKLAYER_DLLCONF_H_ +#define FSFW_SRC_FSFW_DATALINKLAYER_DLLCONF_H_ + +#include "fsfw/FSFW.h" + +#ifndef FSFW_ADD_DATALINKLAYER +#warning Datalinklayer files were included but compilation was \ + not enabled with FSFW_ADD_DATALINKLAYER +#endif + +#endif /* FSFW_SRC_FSFW_DATALINKLAYER_DLLCONF_H_ */ diff --git a/src/fsfw/ipc/CommandMessageCleaner.cpp b/src/fsfw/ipc/CommandMessageCleaner.cpp index ca835509..70b7dd4b 100644 --- a/src/fsfw/ipc/CommandMessageCleaner.cpp +++ b/src/fsfw/ipc/CommandMessageCleaner.cpp @@ -1,3 +1,4 @@ +#include "fsfw/FSFW.h" #include "fsfw/ipc/CommandMessageCleaner.h" #include "fsfw/memory/GenericFileSystemMessage.h" @@ -34,9 +35,11 @@ void CommandMessageCleaner::clearCommandMessage(CommandMessage* message) { case messagetypes::MONITORING: MonitoringMessage::clear(message); break; +#ifdef FSFW_ADD_TMSTORAGE case messagetypes::TM_STORE: TmStoreMessage::clear(message); break; +#endif case messagetypes::PARAMETER: ParameterMessage::clear(message); break; diff --git a/src/fsfw/monitoring/AbsLimitMonitor.h b/src/fsfw/monitoring/AbsLimitMonitor.h index 5feb369c..f3bbf04c 100644 --- a/src/fsfw/monitoring/AbsLimitMonitor.h +++ b/src/fsfw/monitoring/AbsLimitMonitor.h @@ -1,6 +1,7 @@ #ifndef FSFW_MONITORING_ABSLIMITMONITOR_H_ #define FSFW_MONITORING_ABSLIMITMONITOR_H_ +#include "monitoringConf.h" #include "MonitorBase.h" #include diff --git a/src/fsfw/monitoring/HasMonitorsIF.h b/src/fsfw/monitoring/HasMonitorsIF.h index 04f63437..20520952 100644 --- a/src/fsfw/monitoring/HasMonitorsIF.h +++ b/src/fsfw/monitoring/HasMonitorsIF.h @@ -1,6 +1,7 @@ #ifndef FSFW_MONITORING_HASMONITORSIF_H_ #define FSFW_MONITORING_HASMONITORSIF_H_ +#include "monitoringConf.h" #include "../events/EventReportingProxyIF.h" #include "../objectmanager/ObjectManagerIF.h" #include "../ipc/MessageQueueSenderIF.h" diff --git a/src/fsfw/monitoring/LimitMonitor.h b/src/fsfw/monitoring/LimitMonitor.h index cd8b8d13..2565ebaa 100644 --- a/src/fsfw/monitoring/LimitMonitor.h +++ b/src/fsfw/monitoring/LimitMonitor.h @@ -1,6 +1,7 @@ #ifndef FRAMEWORK_MONITORING_LIMITMONITOR_H_ #define FRAMEWORK_MONITORING_LIMITMONITOR_H_ +#include "monitoringConf.h" #include "MonitorBase.h" /** diff --git a/src/fsfw/monitoring/LimitViolationReporter.h b/src/fsfw/monitoring/LimitViolationReporter.h index a71b972f..b254e312 100644 --- a/src/fsfw/monitoring/LimitViolationReporter.h +++ b/src/fsfw/monitoring/LimitViolationReporter.h @@ -7,6 +7,7 @@ #ifndef LIMITVIOLATIONREPORTER_H_ #define LIMITVIOLATIONREPORTER_H_ +#include "monitoringConf.h" #include "../returnvalues/HasReturnvaluesIF.h" #include "../serialize/SerializeIF.h" #include "../storagemanager/StorageManagerIF.h" diff --git a/src/fsfw/monitoring/MonitorBase.h b/src/fsfw/monitoring/MonitorBase.h index 967f0f62..261b3eac 100644 --- a/src/fsfw/monitoring/MonitorBase.h +++ b/src/fsfw/monitoring/MonitorBase.h @@ -1,6 +1,7 @@ #ifndef FSFW_MONITORING_MONITORBASE_H_ #define FSFW_MONITORING_MONITORBASE_H_ +#include "monitoringConf.h" #include "LimitViolationReporter.h" #include "MonitoringIF.h" #include "MonitoringMessageContent.h" diff --git a/src/fsfw/monitoring/MonitorReporter.h b/src/fsfw/monitoring/MonitorReporter.h index d155594d..e27d0101 100644 --- a/src/fsfw/monitoring/MonitorReporter.h +++ b/src/fsfw/monitoring/MonitorReporter.h @@ -1,6 +1,7 @@ #ifndef FSFW_MONITORING_MONITORREPORTER_H_ #define FSFW_MONITORING_MONITORREPORTER_H_ +#include "monitoringConf.h" #include "LimitViolationReporter.h" #include "MonitoringIF.h" #include "MonitoringMessageContent.h" diff --git a/src/fsfw/monitoring/MonitoringIF.h b/src/fsfw/monitoring/MonitoringIF.h index aae29475..9c35b419 100644 --- a/src/fsfw/monitoring/MonitoringIF.h +++ b/src/fsfw/monitoring/MonitoringIF.h @@ -1,6 +1,7 @@ #ifndef FSFW_MONITORING_MONITORINGIF_H_ #define FSFW_MONITORING_MONITORINGIF_H_ +#include "monitoringConf.h" #include "MonitoringMessage.h" #include "../serialize/SerializeIF.h" diff --git a/src/fsfw/monitoring/MonitoringMessage.h b/src/fsfw/monitoring/MonitoringMessage.h index 84b02750..a625e388 100644 --- a/src/fsfw/monitoring/MonitoringMessage.h +++ b/src/fsfw/monitoring/MonitoringMessage.h @@ -1,8 +1,9 @@ #ifndef MONITORINGMESSAGE_H_ #define MONITORINGMESSAGE_H_ -#include "../ipc/CommandMessage.h" -#include "../storagemanager/StorageManagerIF.h" +#include "monitoringConf.h" +#include "fsfw/ipc/CommandMessage.h" +#include "fsfw/storagemanager/StorageManagerIF.h" class MonitoringMessage: public CommandMessage { public: diff --git a/src/fsfw/monitoring/MonitoringMessageContent.h b/src/fsfw/monitoring/MonitoringMessageContent.h index 1d5f9c92..cf8c8752 100644 --- a/src/fsfw/monitoring/MonitoringMessageContent.h +++ b/src/fsfw/monitoring/MonitoringMessageContent.h @@ -1,6 +1,7 @@ #ifndef FSFW_MONITORING_MONITORINGMESSAGECONTENT_H_ #define FSFW_MONITORING_MONITORINGMESSAGECONTENT_H_ +#include "monitoringConf.h" #include "HasMonitorsIF.h" #include "MonitoringIF.h" diff --git a/src/fsfw/monitoring/ReceivesMonitoringReportsIF.h b/src/fsfw/monitoring/ReceivesMonitoringReportsIF.h index fb37c16c..6c126c84 100644 --- a/src/fsfw/monitoring/ReceivesMonitoringReportsIF.h +++ b/src/fsfw/monitoring/ReceivesMonitoringReportsIF.h @@ -1,7 +1,8 @@ #ifndef RECEIVESMONITORINGREPORTSIF_H_ #define RECEIVESMONITORINGREPORTSIF_H_ -#include "../ipc/MessageQueueSenderIF.h" +#include "monitoringConf.h" +#include "fsfw/ipc/messageQueueDefinitions.h" class ReceivesMonitoringReportsIF { public: diff --git a/src/fsfw/monitoring/TriplexMonitor.h b/src/fsfw/monitoring/TriplexMonitor.h index 295a6174..ff995b5d 100644 --- a/src/fsfw/monitoring/TriplexMonitor.h +++ b/src/fsfw/monitoring/TriplexMonitor.h @@ -1,6 +1,7 @@ #ifndef FRAMEWORK_MONITORING_TRIPLEXMONITOR_H_ #define FRAMEWORK_MONITORING_TRIPLEXMONITOR_H_ +#include "monitoringConf.h" #include "../datapool/DataSet.h" #include "../datapool/PIDReaderList.h" #include "../health/HealthTableIF.h" diff --git a/src/fsfw/monitoring/TwoValueLimitMonitor.h b/src/fsfw/monitoring/TwoValueLimitMonitor.h index e690cdae..cd34391c 100644 --- a/src/fsfw/monitoring/TwoValueLimitMonitor.h +++ b/src/fsfw/monitoring/TwoValueLimitMonitor.h @@ -1,6 +1,7 @@ #ifndef FRAMEWORK_MONITORING_TWOVALUELIMITMONITOR_H_ #define FRAMEWORK_MONITORING_TWOVALUELIMITMONITOR_H_ +#include "monitoringConf.h" #include "LimitMonitor.h" template diff --git a/src/fsfw/monitoring/monitoringConf.h b/src/fsfw/monitoring/monitoringConf.h new file mode 100644 index 00000000..25cac8db --- /dev/null +++ b/src/fsfw/monitoring/monitoringConf.h @@ -0,0 +1,11 @@ +#ifndef FSFW_MONITORING_MONITORINGCONF_H_ +#define FSFW_MONITORING_MONITORINGCONF_H_ + +#include "fsfw/FSFW.h" + +#ifndef FSFW_ADD_MONITORING +#warning Monitoring files were included but compilation was \ + not enabled with FSFW_ADD_MONITORING +#endif + +#endif /* FSFW_MONITORING_MONITORINGCONF_H_ */ diff --git a/src/fsfw/objectmanager.h b/src/fsfw/objectmanager.h new file mode 100644 index 00000000..50a90c9f --- /dev/null +++ b/src/fsfw/objectmanager.h @@ -0,0 +1,8 @@ +#ifndef FSFW_SRC_FSFW_OBJECTMANAGER_H_ +#define FSFW_SRC_FSFW_OBJECTMANAGER_H_ + +#include "objectmanager/ObjectManager.h" +#include "objectmanager/SystemObject.h" +#include "objectmanager/frameworkObjects.h" + +#endif /* FSFW_SRC_FSFW_OBJECTMANAGER_H_ */ diff --git a/src/fsfw/rmap/RMAP.h b/src/fsfw/rmap/RMAP.h index 7fa0021d..ff310db0 100644 --- a/src/fsfw/rmap/RMAP.h +++ b/src/fsfw/rmap/RMAP.h @@ -1,6 +1,7 @@ #ifndef FSFW_RMAP_RMAP_H_ #define FSFW_RMAP_RMAP_H_ +#include "rmapConf.h" #include "fsfw/returnvalues/HasReturnvaluesIF.h" #include "fsfw/rmap/RMAPCookie.h" diff --git a/src/fsfw/rmap/RMAPChannelIF.h b/src/fsfw/rmap/RMAPChannelIF.h index 0aa809c5..7fbda348 100644 --- a/src/fsfw/rmap/RMAPChannelIF.h +++ b/src/fsfw/rmap/RMAPChannelIF.h @@ -1,8 +1,9 @@ #ifndef FSFW_RMAP_RMAPCHANNELIF_H_ #define FSFW_RMAP_RMAPCHANNELIF_H_ +#include "rmapConf.h" #include "RMAPCookie.h" -#include "../returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" #include class RMAPChannelIF { diff --git a/src/fsfw/rmap/RMAPCookie.h b/src/fsfw/rmap/RMAPCookie.h index 97aaa6d0..032e5a46 100644 --- a/src/fsfw/rmap/RMAPCookie.h +++ b/src/fsfw/rmap/RMAPCookie.h @@ -1,6 +1,7 @@ #ifndef FSFW_RMAP_RMAPCOOKIE_H_ #define FSFW_RMAP_RMAPCOOKIE_H_ +#include "rmapConf.h" #include "rmapStructs.h" #include "fsfw/devicehandlers/CookieIF.h" #include diff --git a/src/fsfw/rmap/RmapDeviceCommunicationIF.h b/src/fsfw/rmap/RmapDeviceCommunicationIF.h index 3714b7e7..36baf87b 100644 --- a/src/fsfw/rmap/RmapDeviceCommunicationIF.h +++ b/src/fsfw/rmap/RmapDeviceCommunicationIF.h @@ -1,6 +1,7 @@ #ifndef FSFW_RMAP_RMAPDEVICECOMMUNICATIONINTERFACE_H_ #define FSFW_RMAP_RMAPDEVICECOMMUNICATIONINTERFACE_H_ +#include "rmapConf.h" #include "fsfw/devicehandlers/DeviceCommunicationIF.h" /** diff --git a/src/fsfw/rmap/rmapConf.h b/src/fsfw/rmap/rmapConf.h new file mode 100644 index 00000000..c4fa1e54 --- /dev/null +++ b/src/fsfw/rmap/rmapConf.h @@ -0,0 +1,10 @@ +#ifndef FSFW_SRC_FSFW_RMAP_RAMCONF_H_ +#define FSFW_SRC_FSFW_RMAP_RAMCONF_H_ + +#include "fsfw/FSFW.h" + +#ifndef FSFW_ADD_RMAP +#warning RMAP was included but compilation was not enabled with FSFW_ADD_RMAP +#endif + +#endif /* FSFW_SRC_FSFW_RMAP_RAMCONF_H_ */ diff --git a/src/fsfw/rmap/rmapStructs.h b/src/fsfw/rmap/rmapStructs.h index 11d8bb85..de8b3a59 100644 --- a/src/fsfw/rmap/rmapStructs.h +++ b/src/fsfw/rmap/rmapStructs.h @@ -1,6 +1,8 @@ #ifndef FSFW_RMAP_RMAPSTRUCTS_H_ #define FSFW_RMAP_RMAPSTRUCTS_H_ +#include "rmapConf.h" + #include //SHOULDDO: having the defines within a namespace would be nice. Problem are the defines referencing the previous define, eg RMAP_COMMAND_WRITE diff --git a/src/fsfw/serviceinterface.h b/src/fsfw/serviceinterface.h new file mode 100644 index 00000000..2e9a0b7e --- /dev/null +++ b/src/fsfw/serviceinterface.h @@ -0,0 +1,6 @@ +#ifndef FSFW_SRC_FSFW_SERVICEINTERFACE_H_ +#define FSFW_SRC_FSFW_SERVICEINTERFACE_H_ + +#include "serviceinterface/ServiceInterface.h" + +#endif /* FSFW_SRC_FSFW_SERVICEINTERFACE_H_ */ diff --git a/src/fsfw/tcdistribution/TcPacketCheck.h b/src/fsfw/tcdistribution/TcPacketCheck.h index 7106b7e4..519943c7 100644 --- a/src/fsfw/tcdistribution/TcPacketCheck.h +++ b/src/fsfw/tcdistribution/TcPacketCheck.h @@ -1,9 +1,9 @@ #ifndef FSFW_TCDISTRIBUTION_TCPACKETCHECK_H_ #define FSFW_TCDISTRIBUTION_TCPACKETCHECK_H_ -#include "../FSFW.h" -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../tmtcservices/PusVerificationReport.h" +#include "fsfw/FSFW.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/tmtcservices/PusVerificationReport.h" class TcPacketStoredBase; diff --git a/src/fsfw/tmstorage/TmStoreBackendIF.h b/src/fsfw/tmstorage/TmStoreBackendIF.h index 4ae77609..4183334b 100644 --- a/src/fsfw/tmstorage/TmStoreBackendIF.h +++ b/src/fsfw/tmstorage/TmStoreBackendIF.h @@ -1,11 +1,13 @@ #ifndef FSFW_TMTCSERVICES_TMSTOREBACKENDIF_H_ #define FSFW_TMTCSERVICES_TMSTOREBACKENDIF_H_ -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../objectmanager/SystemObjectIF.h" -#include "../parameters/HasParametersIF.h" -#include "../storagemanager/StorageManagerIF.h" -#include "../timemanager/Clock.h" +#include "tmStorageConf.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/objectmanager/SystemObjectIF.h" +#include "fsfw/parameters/HasParametersIF.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/timemanager/Clock.h" + class TmPacketInformation; class TmPacketMinimal; class SpacePacketBase; diff --git a/src/fsfw/tmstorage/TmStoreFrontendIF.h b/src/fsfw/tmstorage/TmStoreFrontendIF.h index beee7ede..11b2a686 100644 --- a/src/fsfw/tmstorage/TmStoreFrontendIF.h +++ b/src/fsfw/tmstorage/TmStoreFrontendIF.h @@ -1,9 +1,10 @@ #ifndef FSFW_TMTCSERVICES_TMSTOREFRONTENDIF_H_ #define FSFW_TMTCSERVICES_TMSTOREFRONTENDIF_H_ +#include "tmStorageConf.h" #include "TmStorePackets.h" -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../ipc/MessageQueueSenderIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/ipc/MessageQueueSenderIF.h" class TmPacketMinimal; class SpacePacketBase; diff --git a/src/fsfw/tmstorage/TmStoreMessage.cpp b/src/fsfw/tmstorage/TmStoreMessage.cpp index f63a4757..fa5fb541 100644 --- a/src/fsfw/tmstorage/TmStoreMessage.cpp +++ b/src/fsfw/tmstorage/TmStoreMessage.cpp @@ -1,4 +1,4 @@ -#include "fsfw/tmstorage/TmStoreMessage.h" +#include "TmStoreMessage.h" #include "fsfw/objectmanager/ObjectManager.h" TmStoreMessage::~TmStoreMessage() { diff --git a/src/fsfw/tmstorage/TmStoreMessage.h b/src/fsfw/tmstorage/TmStoreMessage.h index d0178920..51f86b3a 100644 --- a/src/fsfw/tmstorage/TmStoreMessage.h +++ b/src/fsfw/tmstorage/TmStoreMessage.h @@ -1,10 +1,11 @@ #ifndef FSFW_TMSTORAGE_TMSTOREMESSAGE_H_ #define FSFW_TMSTORAGE_TMSTOREMESSAGE_H_ +#include "tmStorageConf.h" #include "TmStorePackets.h" -#include "../ipc/CommandMessage.h" -#include "../storagemanager/StorageManagerIF.h" -#include "../objectmanager/SystemObjectIF.h" +#include "fsfw/ipc/CommandMessage.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/objectmanager/SystemObjectIF.h" class TmStoreMessage { public: diff --git a/src/fsfw/tmstorage/TmStorePackets.h b/src/fsfw/tmstorage/TmStorePackets.h index 53a5d8d6..738f7ac2 100644 --- a/src/fsfw/tmstorage/TmStorePackets.h +++ b/src/fsfw/tmstorage/TmStorePackets.h @@ -1,14 +1,15 @@ #ifndef FSFW_TMSTORAGE_TMSTOREPACKETS_H_ #define FSFW_TMSTORAGE_TMSTOREPACKETS_H_ -#include "../serialize/SerialFixedArrayListAdapter.h" -#include "../serialize/SerializeElement.h" -#include "../serialize/SerialLinkedListAdapter.h" -#include "../serialize/SerialBufferAdapter.h" -#include "../tmtcpacket/pus/tm/TmPacketMinimal.h" -#include "../timemanager/TimeStamperIF.h" -#include "../timemanager/CCSDSTime.h" -#include "../globalfunctions/timevalOperations.h" +#include "tmStorageConf.h" +#include "fsfw/serialize/SerialFixedArrayListAdapter.h" +#include "fsfw/serialize/SerializeElement.h" +#include "fsfw/serialize/SerialLinkedListAdapter.h" +#include "fsfw/serialize/SerialBufferAdapter.h" +#include "fsfw/tmtcpacket/pus/tm/TmPacketMinimal.h" +#include "fsfw/timemanager/TimeStamperIF.h" +#include "fsfw/timemanager/CCSDSTime.h" +#include "fsfw/globalfunctions/timevalOperations.h" class ServiceSubservice: public SerialLinkedListAdapter { public: diff --git a/src/fsfw/tmstorage/tmStorageConf.h b/src/fsfw/tmstorage/tmStorageConf.h new file mode 100644 index 00000000..e5c3d0d5 --- /dev/null +++ b/src/fsfw/tmstorage/tmStorageConf.h @@ -0,0 +1,11 @@ +#ifndef FSFW_TMSTORAGE_TMSTORAGECONF_H_ +#define FSFW_TMSTORAGE_TMSTORAGECONF_H_ + +#include "fsfw/FSFW.h" + +#ifndef FSFW_ADD_TMSTORAGE +#warning TM storage files were includes but compilation was \ + not enabled with FSFW_ADD_TMSTORAGE +#endif + +#endif /* FSFW_TMSTORAGE_TMSTORAGECONF_H_ */ diff --git a/src/fsfw/tmtcpacket/pus/tc/TcPacketPus.h b/src/fsfw/tmtcpacket/pus/tc/TcPacketPus.h index 7a28a957..082541ba 100644 --- a/src/fsfw/tmtcpacket/pus/tc/TcPacketPus.h +++ b/src/fsfw/tmtcpacket/pus/tc/TcPacketPus.h @@ -1,8 +1,8 @@ #ifndef FSFW_TMTCPACKET_PUS_TCPACKETPUSA_H_ #define FSFW_TMTCPACKET_PUS_TCPACKETPUSA_H_ -#include "../../../FSFW.h" -#include "../../ccsds_header.h" +#include "fsfw/FSFW.h" +#include "fsfw/tmtcpacket/ccsds_header.h" #include "TcPacketBase.h" #include diff --git a/src/fsfw/tmtcpacket/pus/tm.h b/src/fsfw/tmtcpacket/pus/tm.h index 591ada7c..afbe8251 100644 --- a/src/fsfw/tmtcpacket/pus/tm.h +++ b/src/fsfw/tmtcpacket/pus/tm.h @@ -1,7 +1,7 @@ #ifndef FSFW_TMTCPACKET_PUS_TM_H_ #define FSFW_TMTCPACKET_PUS_TM_H_ -#include "../../FSFW.h" +#include "fsfw/FSFW.h" #if FSFW_USE_PUS_C_TELEMETRY == 1 #include "tm/TmPacketPusC.h" From ce93b9220e4bc8002ca1d7608d64403052b8241a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 19 Jul 2021 18:29:57 +0200 Subject: [PATCH 209/389] command message cleaner include fix --- src/fsfw/FSFW.h.in | 1 + src/fsfw/ipc/CommandMessageCleaner.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/fsfw/FSFW.h.in b/src/fsfw/FSFW.h.in index c644f0b7..9b74d04c 100644 --- a/src/fsfw/FSFW.h.in +++ b/src/fsfw/FSFW.h.in @@ -8,5 +8,6 @@ #cmakedefine FSFW_ADD_TMSTORAGE #cmakedefine FSFW_ADD_COORDINATES #cmakedefine FSFW_ADD_PUS +#cmakedefine FSFW_ADD_MONITORING #endif /* FSFW_FSFW_H_ */ diff --git a/src/fsfw/ipc/CommandMessageCleaner.cpp b/src/fsfw/ipc/CommandMessageCleaner.cpp index 70b7dd4b..0918d739 100644 --- a/src/fsfw/ipc/CommandMessageCleaner.cpp +++ b/src/fsfw/ipc/CommandMessageCleaner.cpp @@ -8,9 +8,11 @@ #include "fsfw/modes/ModeMessage.h" #include "fsfw/monitoring/MonitoringMessage.h" #include "fsfw/subsystem/modes/ModeSequenceMessage.h" -#include "fsfw/tmstorage/TmStoreMessage.h" #include "fsfw/housekeeping/HousekeepingMessage.h" #include "fsfw/parameters/ParameterMessage.h" +#ifdef FSFW_ADD_TMSTORAGE +#include "fsfw/tmstorage/TmStoreMessage.h" +#endif void CommandMessageCleaner::clearCommandMessage(CommandMessage* message) { switch(message->getMessageType()){ From 10e81fdfb88e116538f8c7c70a19e6bbe3a54a70 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 19 Jul 2021 18:35:16 +0200 Subject: [PATCH 210/389] update changelog --- CHANGELOG | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 75e7ced5..8f86c147 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,10 +4,11 @@ ### FSFW Architecture -- Internal API changed completely to have separation of sources and headers -- External API mostly stayed the same +- New src folder which contains all source files except the HAL, contributed code and test code +- External and internal API mostly stayed the same - Folder names are now all smaller case: internalError was renamed to internalerror and FreeRTOS was renamed to freertos +- Warning if optional headers are used but the modules was not added to the source files to compile ### HAL From ee4449b74d29cadd6e250d9ef11f796d33befb42 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 19 Jul 2021 18:36:55 +0200 Subject: [PATCH 211/389] override is not a good idea --- src/fsfw/osal/freertos/BinarySemaphore.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsfw/osal/freertos/BinarySemaphore.h b/src/fsfw/osal/freertos/BinarySemaphore.h index 6e70bf70..1ae56ff6 100644 --- a/src/fsfw/osal/freertos/BinarySemaphore.h +++ b/src/fsfw/osal/freertos/BinarySemaphore.h @@ -98,7 +98,7 @@ public: * already available. */ static ReturnValue_t releaseFromISR(SemaphoreHandle_t semaphore, - BaseType_t * higherPriorityTaskWoken) override; + BaseType_t * higherPriorityTaskWoken); protected: SemaphoreHandle_t handle; From ab6c616cdb7d95bbfb3d0b05b3a45bf4ea32c790 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 19 Jul 2021 18:40:35 +0200 Subject: [PATCH 212/389] added binary semaphore header stub --- src/fsfw/osal/rtems/BinarySemaphore.cpp | 3 +-- src/fsfw/osal/rtems/BinarySemaphore.h | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 src/fsfw/osal/rtems/BinarySemaphore.h diff --git a/src/fsfw/osal/rtems/BinarySemaphore.cpp b/src/fsfw/osal/rtems/BinarySemaphore.cpp index f9db1009..6d145d98 100644 --- a/src/fsfw/osal/rtems/BinarySemaphore.cpp +++ b/src/fsfw/osal/rtems/BinarySemaphore.cpp @@ -1,4 +1,4 @@ -#include "fsfw/osal/rtems/BinarySemaphore.h" +#include "BinarySemaphore.h" #include @@ -9,7 +9,6 @@ BinarySemaphore::~BinarySemaphore() { } -// Interface implementation ReturnValue_t BinarySemaphore::acquire(TimeoutType timeoutType, uint32_t timeoutMs) { return HasReturnvaluesIF::RETURN_OK; } diff --git a/src/fsfw/osal/rtems/BinarySemaphore.h b/src/fsfw/osal/rtems/BinarySemaphore.h new file mode 100644 index 00000000..a2796af1 --- /dev/null +++ b/src/fsfw/osal/rtems/BinarySemaphore.h @@ -0,0 +1,23 @@ +#ifndef FSFW_OSAL_RTEMS_BINARYSEMAPHORE_H_ +#define FSFW_OSAL_RTEMS_BINARYSEMAPHORE_H_ + +#include "fsfw/tasks/SemaphoreIF.h" + +class BinarySemaphore: public SemaphoreIF { +public: + BinarySemaphore(); + virtual ~BinarySemaphore(); + + // Semaphore IF implementations + ReturnValue_t acquire(TimeoutType timeoutType = + TimeoutType::BLOCKING, uint32_t timeoutMs = 0) override; + ReturnValue_t release() override; + uint8_t getSemaphoreCounter() const override; + +private: + +}; + + + +#endif /* FSFW_SRC_FSFW_OSAL_RTEMS_BINARYSEMAPHORE_H_ */ From 1515d59432fb1bc2ed62f223d741e77f4089f2ff Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 21 Jul 2021 09:45:36 +0200 Subject: [PATCH 213/389] EventManager fixes and tweaks 1. Using sif::info consistently now 2. Fix for printf support: Event translation is printed now as well --- events/EventManager.cpp | 147 ++++++++++++++++++++-------------------- 1 file changed, 74 insertions(+), 73 deletions(-) diff --git a/events/EventManager.cpp b/events/EventManager.cpp index 8e2a2a82..7eb30553 100644 --- a/events/EventManager.cpp +++ b/events/EventManager.cpp @@ -12,119 +12,119 @@ MessageQueueId_t EventManagerIF::eventmanagerQueue = MessageQueueIF::NO_QUEUE; // So a good guess is 75 to a max of 100 pools required for each, which fits well. const LocalPool::LocalPoolConfig EventManager::poolConfig = { {fsfwconfig::FSFW_EVENTMGMR_MATCHTREE_NODES, - sizeof(EventMatchTree::Node)}, + sizeof(EventMatchTree::Node)}, {fsfwconfig::FSFW_EVENTMGMT_EVENTIDMATCHERS, - sizeof(EventIdRangeMatcher)}, + sizeof(EventIdRangeMatcher)}, {fsfwconfig::FSFW_EVENTMGMR_RANGEMATCHERS, - sizeof(ReporterRangeMatcher)} + sizeof(ReporterRangeMatcher)} }; EventManager::EventManager(object_id_t setObjectId) : - SystemObject(setObjectId), - factoryBackend(0, poolConfig, false, true) { - mutex = MutexFactory::instance()->createMutex(); - eventReportQueue = QueueFactory::instance()->createMessageQueue( - MAX_EVENTS_PER_CYCLE, EventMessage::EVENT_MESSAGE_SIZE); + SystemObject(setObjectId), + factoryBackend(0, poolConfig, false, true) { + mutex = MutexFactory::instance()->createMutex(); + eventReportQueue = QueueFactory::instance()->createMessageQueue( + MAX_EVENTS_PER_CYCLE, EventMessage::EVENT_MESSAGE_SIZE); } EventManager::~EventManager() { - QueueFactory::instance()->deleteMessageQueue(eventReportQueue); - MutexFactory::instance()->deleteMutex(mutex); + QueueFactory::instance()->deleteMessageQueue(eventReportQueue); + MutexFactory::instance()->deleteMutex(mutex); } MessageQueueId_t EventManager::getEventReportQueue() { - return eventReportQueue->getId(); + return eventReportQueue->getId(); } ReturnValue_t EventManager::performOperation(uint8_t opCode) { - ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; - while (result == HasReturnvaluesIF::RETURN_OK) { - EventMessage message; - result = eventReportQueue->receiveMessage(&message); - if (result == HasReturnvaluesIF::RETURN_OK) { + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + while (result == HasReturnvaluesIF::RETURN_OK) { + EventMessage message; + result = eventReportQueue->receiveMessage(&message); + if (result == HasReturnvaluesIF::RETURN_OK) { #if FSFW_OBJ_EVENT_TRANSLATION == 1 - printEvent(&message); + printEvent(&message); #endif - notifyListeners(&message); - } - } - return HasReturnvaluesIF::RETURN_OK; + notifyListeners(&message); + } + } + return HasReturnvaluesIF::RETURN_OK; } void EventManager::notifyListeners(EventMessage* message) { - lockMutex(); - for (auto iter = listenerList.begin(); iter != listenerList.end(); ++iter) { - if (iter->second.match(message)) { - MessageQueueSenderIF::sendMessage(iter->first, message, - message->getSender()); - } - } - unlockMutex(); + lockMutex(); + for (auto iter = listenerList.begin(); iter != listenerList.end(); ++iter) { + if (iter->second.match(message)) { + MessageQueueSenderIF::sendMessage(iter->first, message, + message->getSender()); + } + } + unlockMutex(); } ReturnValue_t EventManager::registerListener(MessageQueueId_t listener, bool forwardAllButSelected) { - auto result = listenerList.insert( - std::pair(listener, - EventMatchTree(&factoryBackend, forwardAllButSelected))); - if (!result.second) { - return HasReturnvaluesIF::RETURN_FAILED; - } - return HasReturnvaluesIF::RETURN_OK; + auto result = listenerList.insert( + std::pair(listener, + EventMatchTree(&factoryBackend, forwardAllButSelected))); + if (!result.second) { + return HasReturnvaluesIF::RETURN_FAILED; + } + return HasReturnvaluesIF::RETURN_OK; } ReturnValue_t EventManager::subscribeToEvent(MessageQueueId_t listener, - EventId_t event) { - return subscribeToEventRange(listener, event); + EventId_t event) { + return subscribeToEventRange(listener, event); } ReturnValue_t EventManager::subscribeToAllEventsFrom(MessageQueueId_t listener, - object_id_t object) { - return subscribeToEventRange(listener, 0, 0, true, object); + object_id_t object) { + return subscribeToEventRange(listener, 0, 0, true, object); } ReturnValue_t EventManager::subscribeToEventRange(MessageQueueId_t listener, - EventId_t idFrom, EventId_t idTo, bool idInverted, - object_id_t reporterFrom, object_id_t reporterTo, - bool reporterInverted) { - auto iter = listenerList.find(listener); - if (iter == listenerList.end()) { - return LISTENER_NOT_FOUND; - } - lockMutex(); - ReturnValue_t result = iter->second.addMatch(idFrom, idTo, idInverted, - reporterFrom, reporterTo, reporterInverted); - unlockMutex(); - return result; + EventId_t idFrom, EventId_t idTo, bool idInverted, + object_id_t reporterFrom, object_id_t reporterTo, + bool reporterInverted) { + auto iter = listenerList.find(listener); + if (iter == listenerList.end()) { + return LISTENER_NOT_FOUND; + } + lockMutex(); + ReturnValue_t result = iter->second.addMatch(idFrom, idTo, idInverted, + reporterFrom, reporterTo, reporterInverted); + unlockMutex(); + return result; } ReturnValue_t EventManager::unsubscribeFromEventRange(MessageQueueId_t listener, - EventId_t idFrom, EventId_t idTo, bool idInverted, - object_id_t reporterFrom, object_id_t reporterTo, - bool reporterInverted) { - auto iter = listenerList.find(listener); - if (iter == listenerList.end()) { - return LISTENER_NOT_FOUND; - } - lockMutex(); - ReturnValue_t result = iter->second.removeMatch(idFrom, idTo, idInverted, - reporterFrom, reporterTo, reporterInverted); - unlockMutex(); - return result; + EventId_t idFrom, EventId_t idTo, bool idInverted, + object_id_t reporterFrom, object_id_t reporterTo, + bool reporterInverted) { + auto iter = listenerList.find(listener); + if (iter == listenerList.end()) { + return LISTENER_NOT_FOUND; + } + lockMutex(); + ReturnValue_t result = iter->second.removeMatch(idFrom, idTo, idInverted, + reporterFrom, reporterTo, reporterInverted); + unlockMutex(); + return result; } void EventManager::lockMutex() { - mutex->lockMutex(timeoutType, timeoutMs); + mutex->lockMutex(timeoutType, timeoutMs); } void EventManager::unlockMutex() { - mutex->unlockMutex(); + mutex->unlockMutex(); } void EventManager::setMutexTimeout(MutexIF::TimeoutType timeoutType, - uint32_t timeoutMs) { - this->timeoutType = timeoutType; - this->timeoutMs = timeoutMs; + uint32_t timeoutMs) { + this->timeoutType = timeoutType; + this->timeoutMs = timeoutMs; } #if FSFW_OBJ_EVENT_TRANSLATION == 1 @@ -157,7 +157,7 @@ void EventManager::printUtility(sif::OutputTypes printType, EventMessage *messag message->getReporter() << std::setfill(' ') << std::dec; } sif::info << " reported event with ID " << message->getEventId() << std::endl; - sif::debug << translateEvents(message->getEvent()) << " | " <getEvent()) << " | " <getParameter1() << " | P1 Dec: " << std::dec << message->getParameter1() << std::hex << " | P2 Hex: 0x" << message->getParameter2() << " | P2 Dec: " << std::dec << message->getParameter2() << std::endl; @@ -170,9 +170,10 @@ void EventManager::printUtility(sif::OutputTypes printType, EventMessage *messag sif::printInfo("Event Manager: Reporter ID 0x%08x reported event with ID %d\n", message->getReporter(), message->getEventId()); } - sif::printInfo("P1 Hex: 0x%x | P1 Dec: %d | P2 Hex: 0x%x | P2 Dec: %d\n", - message->getParameter1(), message->getParameter1(), - message->getParameter2(), message->getParameter2()); + + sif::printInfo("%s | P1 Hex: 0x%x | P1 Dec: %d | P2 Hex: 0x%x | P2 Dec: %d\n", + translateEvents(message->getEvent()), message->getParameter1(), + message->getParameter1(), message->getParameter2(), message->getParameter2()); #endif /* FSFW_CPP_OSTREAM_ENABLED == 0 */ } else { From 2489276350ab5b280afddf027af657bb0b202622 Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" <–meierj@irs.uni-stuttgart.de> Date: Tue, 27 Jul 2021 10:05:56 +0200 Subject: [PATCH 214/389] removed double include --- osal/FreeRTOS/MessageQueue.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/osal/FreeRTOS/MessageQueue.h b/osal/FreeRTOS/MessageQueue.h index ad2534c0..af0dc4e1 100644 --- a/osal/FreeRTOS/MessageQueue.h +++ b/osal/FreeRTOS/MessageQueue.h @@ -11,9 +11,6 @@ #include "FreeRTOS.h" #include "queue.h" -#include "FreeRTOS.h" -#include "queue.h" - /** * @brief This class manages sending and receiving of * message queue messages. From 3d80d5d036ae78c1619336e878dfe03207ea52d6 Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" <–meierj@irs.uni-stuttgart.de> Date: Tue, 27 Jul 2021 12:59:21 +0200 Subject: [PATCH 215/389] added proposed changes --- serviceinterface/ServiceInterfaceBuffer.cpp | 6 +++--- unittest/tests/mocks/MessageQueueMockBase.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/serviceinterface/ServiceInterfaceBuffer.cpp b/serviceinterface/ServiceInterfaceBuffer.cpp index 76128f5d..f9fe8327 100644 --- a/serviceinterface/ServiceInterfaceBuffer.cpp +++ b/serviceinterface/ServiceInterfaceBuffer.cpp @@ -172,9 +172,9 @@ bool ServiceInterfaceBuffer::crAdditionEnabled() const { } #if FSFW_COLORED_OUTPUT == 1 - void ServiceInterfaceBuffer::setAsciiColorPrefix(std::string colorPrefix) { - this->colorPrefix = colorPrefix; - } +void ServiceInterfaceBuffer::setAsciiColorPrefix(std::string colorPrefix) { + this->colorPrefix = colorPrefix; +} #endif #ifdef UT699 diff --git a/unittest/tests/mocks/MessageQueueMockBase.h b/unittest/tests/mocks/MessageQueueMockBase.h index 86958d53..3000f7fb 100644 --- a/unittest/tests/mocks/MessageQueueMockBase.h +++ b/unittest/tests/mocks/MessageQueueMockBase.h @@ -3,7 +3,7 @@ #include #include -#include +#include #include #include From e1f92b3da4dc1fb5adcab2785da1570030506458 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 30 Jul 2021 13:47:29 +0200 Subject: [PATCH 216/389] various fixes and improvements --- CMakeLists.txt | 5 ++++- hal/src/fsfw/hal/devicehandlers/GyroL3GD20Handler.h | 4 ++-- src/fsfw/FSFW.h.in | 4 ++++ tests/src/fsfw/tests/unit/action/TestActionHelper.cpp | 2 +- tests/src/fsfw/tests/unit/datapoollocal/LocalPoolOwnerBase.h | 2 +- tests/src/fsfw/tests/unit/globalfunctions/CMakeLists.txt | 1 - 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c75d711f..3823bedf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ endif() option(FSFW_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON) # Options to exclude parts of the FSFW from compilation. option(FSFW_ADD_INTERNAL_TESTS "Add internal unit tests" ON) +option(FSFW_ADD_HAL "Add Hardware Abstraction Layer" ON) # Optional sources option(FSFW_ADD_PUS "Compile with PUS sources" ON) @@ -94,7 +95,9 @@ message(STATUS "Compiling FSFW for the ${OS_FSFW_NAME} operating system.") add_subdirectory(src) add_subdirectory(tests) -add_subdirectory(hal) +if(FSFW_ADD_HAL) + add_subdirectory(hal) +endif() add_subdirectory(contrib) # The project CMakeLists file has to set the FSFW_CONFIG_PATH and add it. diff --git a/hal/src/fsfw/hal/devicehandlers/GyroL3GD20Handler.h b/hal/src/fsfw/hal/devicehandlers/GyroL3GD20Handler.h index f82ba935..020c5a32 100644 --- a/hal/src/fsfw/hal/devicehandlers/GyroL3GD20Handler.h +++ b/hal/src/fsfw/hal/devicehandlers/GyroL3GD20Handler.h @@ -1,14 +1,14 @@ #ifndef MISSION_DEVICES_GYROL3GD20HANDLER_H_ #define MISSION_DEVICES_GYROL3GD20HANDLER_H_ -#include "OBSWConfig.h" +#include "fsfw/FSFW.h" #include "devicedefinitions/GyroL3GD20Definitions.h" #include #include #ifndef FSFW_HAL_L3GD20_GYRO_DEBUG -#define FSFW_HAL_L3GD20_GYRO_DEBUG 1 +#define FSFW_HAL_L3GD20_GYRO_DEBUG 0 #endif /* FSFW_HAL_L3GD20_GYRO_DEBUG */ /** diff --git a/src/fsfw/FSFW.h.in b/src/fsfw/FSFW.h.in index 9b74d04c..a23ef43f 100644 --- a/src/fsfw/FSFW.h.in +++ b/src/fsfw/FSFW.h.in @@ -10,4 +10,8 @@ #cmakedefine FSFW_ADD_PUS #cmakedefine FSFW_ADD_MONITORING +#ifndef FSFW_HAL_L3GD20_GYRO_DEBUG +#define FSFW_HAL_L3GD20_GYRO_DEBUG 0 +#endif /* FSFW_HAL_L3GD20_GYRO_DEBUG */ + #endif /* FSFW_FSFW_H_ */ diff --git a/tests/src/fsfw/tests/unit/action/TestActionHelper.cpp b/tests/src/fsfw/tests/unit/action/TestActionHelper.cpp index d8bd58c9..126979f6 100644 --- a/tests/src/fsfw/tests/unit/action/TestActionHelper.cpp +++ b/tests/src/fsfw/tests/unit/action/TestActionHelper.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include diff --git a/tests/src/fsfw/tests/unit/datapoollocal/LocalPoolOwnerBase.h b/tests/src/fsfw/tests/unit/datapoollocal/LocalPoolOwnerBase.h index 4c244b16..c0e41ddf 100644 --- a/tests/src/fsfw/tests/unit/datapoollocal/LocalPoolOwnerBase.h +++ b/tests/src/fsfw/tests/unit/datapoollocal/LocalPoolOwnerBase.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include namespace lpool { diff --git a/tests/src/fsfw/tests/unit/globalfunctions/CMakeLists.txt b/tests/src/fsfw/tests/unit/globalfunctions/CMakeLists.txt index 4ea49bf7..8e57e01b 100644 --- a/tests/src/fsfw/tests/unit/globalfunctions/CMakeLists.txt +++ b/tests/src/fsfw/tests/unit/globalfunctions/CMakeLists.txt @@ -1,3 +1,2 @@ target_sources(${TARGET_NAME} PRIVATE - TestArrayPrinter.cpp ) From 0b207b2b1a73f098db898d2b4f4cbba3855a7c4b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 30 Jul 2021 14:18:47 +0200 Subject: [PATCH 217/389] updated user folder --- src/fsfw/serviceinterface/ServiceInterface.h | 2 +- tests/user/CMakeLists.txt | 46 +- .../testcfg/{FSFWConfig.h => FSFWConfig.h.in} | 28 +- tests/user/testcfg/Makefile-FSFW-Tests | 416 ------------------ tests/user/testcfg/OBSWConfig.h.in | 8 + tests/user/testcfg/TestsConfig.h | 8 - tests/user/testcfg/TestsConfig.h.in | 19 + tests/user/testcfg/cdatapool/dataPoolInit.cpp | 5 - tests/user/testcfg/cdatapool/dataPoolInit.h | 17 - tests/user/testcfg/objects/systemObjectList.h | 9 +- .../PollingSequenceFactory.cpp | 18 +- tests/user/testcfg/testcfg.mk | 8 - 12 files changed, 103 insertions(+), 481 deletions(-) rename tests/user/testcfg/{FSFWConfig.h => FSFWConfig.h.in} (68%) delete mode 100644 tests/user/testcfg/Makefile-FSFW-Tests create mode 100644 tests/user/testcfg/OBSWConfig.h.in delete mode 100644 tests/user/testcfg/TestsConfig.h create mode 100644 tests/user/testcfg/TestsConfig.h.in delete mode 100644 tests/user/testcfg/cdatapool/dataPoolInit.cpp delete mode 100644 tests/user/testcfg/cdatapool/dataPoolInit.h delete mode 100644 tests/user/testcfg/testcfg.mk diff --git a/src/fsfw/serviceinterface/ServiceInterface.h b/src/fsfw/serviceinterface/ServiceInterface.h index e95dd9a4..9f05b96c 100644 --- a/src/fsfw/serviceinterface/ServiceInterface.h +++ b/src/fsfw/serviceinterface/ServiceInterface.h @@ -1,7 +1,7 @@ #ifndef FSFW_SERVICEINTERFACE_SERVICEINTERFACE_H_ #define FSFW_SERVICEINTERFACE_SERVICEINTERFACE_H_ -#include +#include "fsfw/FSFW.h" #include "serviceInterfaceDefintions.h" #if FSFW_CPP_OSTREAM_ENABLED == 1 diff --git a/tests/user/CMakeLists.txt b/tests/user/CMakeLists.txt index 722cc424..e95edc2b 100644 --- a/tests/user/CMakeLists.txt +++ b/tests/user/CMakeLists.txt @@ -12,6 +12,7 @@ cmake_minimum_required(VERSION 3.13) # set(CMAKE_VERBOSE TRUE) +# set(CODE_COVERAGE_VERBOSE TRUE) set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") @@ -21,6 +22,8 @@ option(GENERATE_COVERAGE TRUE ) +set(FSFW_ADD_UNITTESTS ON) + if(TMTC_TEST) set(LINK_CATCH2 FALSE) else() @@ -28,8 +31,8 @@ else() endif() # Tests can be built with the Host OSAL or with the Linux OSAL. -if(NOT OS_FSFW) - set(OS_FSFW host CACHE STRING "OS for the FSFW.") +if(NOT FSFW_OSAL) + set(FSFW_OSAL host CACHE STRING "OS for the FSFW.") endif() option(CUSTOM_UNITTEST_RUNNER @@ -41,7 +44,7 @@ option(CUSTOM_UNITTEST_RUNNER #pre_project_config() # Project Name -project(fsfw_tests C CXX) +project(fsfw-tests C CXX) ################################################################################ # Pre-Sources preparation @@ -71,7 +74,7 @@ set(TMTC_TEST_PATH tests) # determine BSP_PATH # FreeRTOS -if(${OS_FSFW} STREQUAL linux) +if(FSFW_OSAL STREQUAL linux) add_definitions(-DUNIX -DLINUX) find_package(Threads REQUIRED) # Hosted @@ -94,6 +97,11 @@ if(GENERATE_COVERAGE) endif() set(FSFW_CONFIG_PATH testcfg) +set(FSFW_ADDITIONAL_INC_PATHS ${CMAKE_CURRENT_BINARY_DIR}) + +configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h) +configure_file(${FSFW_CONFIG_PATH}/OBSWConfig.h.in OBSWConfig.h) +configure_file(${FSFW_CONFIG_PATH}/TestsConfig.h.in TestsConfig.h) ################################################################################ # Executable and Sources @@ -108,10 +116,16 @@ add_subdirectory(${FSFW_CONFIG_PATH}) if(LINK_CATCH2) add_subdirectory(${CATCH2_PATH}) - add_subdirectory(${FSFW_TESTS_PATH}) add_subdirectory(${TEST_SETUP_PATH}) else() + target_compile_definitions(${TARGET_NAME} PRIVATE + FSFW_DISABLE_PRINTOUT=0 + ) + target_compile_definitions(${LIB_FSFW_NAME} PRIVATE + FSFW_DISABLE_PRINTOUT=0 + ) add_subdirectory(${TMTC_TEST_PATH}) + add_subdirectory(${FSFW_TESTS_PATH}) endif() @@ -132,7 +146,7 @@ endif() if(GENERATE_COVERAGE) if(CMAKE_COMPILER_IS_GNUCXX) - set(CODE_COVERAGE_VERBOSE TRUE) + # set(CODE_COVERAGE_VERBOSE TRUE) include(CodeCoverage) # Remove quotes. @@ -194,6 +208,7 @@ endif() target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${FSFW_CONFIG_PATH} + ${CMAKE_CURRENT_BINARY_DIR} ) if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") @@ -225,12 +240,9 @@ if(CMAKE_VERBOSE) message(STATUS "Warning flags: ${WARNING_FLAGS}") endif() - # Compile options for all sources. target_compile_options(${TARGET_NAME} PRIVATE - $<$:${WARNING_FLAGS} ${COMPILER_FLAGS}> - $<$:${WARNING_FLAGS} ${COMPILER_FLAGS}> - ${ABI_FLAGS} + ${WARNING_FLAGS} ) if(NOT CMAKE_SIZE) @@ -240,12 +252,16 @@ if(NOT CMAKE_SIZE) endif() endif() +string(CONCAT POST_BUILD_COMMENT + "Build directory: ${CMAKE_BINARY_DIR}\n" + "Target OSAL: ${FSFW_OSAL}\n" + "Target Build Type: ${CMAKE_BUILD_TYPE}" +) + add_custom_command(TARGET ${TARGET_NAME} - POST_BUILD - COMMAND echo "Build directory: ${CMAKE_BINARY_DIR}" - COMMAND echo "Target OSAL: ${OS_FSFW}" - COMMAND echo "Target Build Type: ${CMAKE_BUILD_TYPE}" - COMMAND ${CMAKE_SIZE} ${TARGET_NAME}${FILE_SUFFIX} + POST_BUILD + COMMAND ${CMAKE_SIZE} ${TARGET_NAME}${FILE_SUFFIX} + COMMENT ${POST_BUILD_COMMENT} ) include (${CMAKE_SCRIPT_PATH}/BuildType.cmake) diff --git a/tests/user/testcfg/FSFWConfig.h b/tests/user/testcfg/FSFWConfig.h.in similarity index 68% rename from tests/user/testcfg/FSFWConfig.h rename to tests/user/testcfg/FSFWConfig.h.in index ed86e6e1..d38f0648 100644 --- a/tests/user/testcfg/FSFWConfig.h +++ b/tests/user/testcfg/FSFWConfig.h.in @@ -7,18 +7,24 @@ //! Used to determine whether C++ ostreams are used which can increase //! the binary size significantly. If this is disabled, //! the C stdio functions can be used alternatively -#define FSFW_CPP_OSTREAM_ENABLED 1 +#define FSFW_CPP_OSTREAM_ENABLED 0 -//! More FSFW related printouts depending on level. Useful for development. -#define FSFW_VERBOSE_LEVEL 1 +//! More FSFW related printouts. Useful for development. +#define FSFW_ENHANCED_PRINTOUT 0 //! Can be used to completely disable printouts, even the C stdio ones. -#if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_VERBOSE_LEVEL == 0 - #define FSFW_DISABLE_PRINTOUT 0 +//! By default, printouts will be disabled for the unit tests. +#if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_ENHANCED_PRINTOUT == 0 + #ifndef FSFW_DISABLE_PRINTOUT + #define FSFW_DISABLE_PRINTOUT 1 + #endif #endif +//! Can be used to enable additional debugging printouts for developing the FSFW +#define FSFW_PRINT_VERBOSITY_LEVEL 0 + //! Can be used to disable the ANSI color sequences for C stdio. -#define FSFW_COLORED_OUTPUT 1 +#define FSFW_COLORED_OUTPUT 0 //! If FSFW_OBJ_EVENT_TRANSLATION is set to one, //! additional output which requires the translation files translateObjects @@ -40,6 +46,13 @@ //! Specify whether a special mode store is used for Subsystem components. #define FSFW_USE_MODESTORE 0 +//! Defines if the real time scheduler for linux should be used. +//! If set to 0, this will also disable priority settings for linux +//! as most systems will not allow to set nice values without privileges +//! For embedded linux system set this to 1. +//! If set to 1 the binary needs "cap_sys_nice=eip" privileges to run +#define FSFW_USE_REALTIME_FOR_LINUX 1 + namespace fsfwconfig { //! Default timestamp size. The default timestamp will be an eight byte CDC //! short timestamp. @@ -57,6 +70,9 @@ static constexpr size_t FSFW_EVENTMGMR_RANGEMATCHERS = 120; static constexpr uint8_t FSFW_CSB_FIFO_DEPTH = 6; static constexpr size_t FSFW_PRINT_BUFFER_SIZE = 124; + +static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 1500; + } #endif /* CONFIG_FSFWCONFIG_H_ */ diff --git a/tests/user/testcfg/Makefile-FSFW-Tests b/tests/user/testcfg/Makefile-FSFW-Tests deleted file mode 100644 index 550fd1de..00000000 --- a/tests/user/testcfg/Makefile-FSFW-Tests +++ /dev/null @@ -1,416 +0,0 @@ -#------------------------------------------------------------------------------- -# Makefile for FSFW Test -#------------------------------------------------------------------------------- -# User-modifiable options -#------------------------------------------------------------------------------- -# Fundamentals on the build process of C/C++ Software: -# https://www3.ntu.edu.sg/home/ehchua/programming/cpp/gcc_make.html - -# Make documentation: https://www.gnu.org/software/make/manual/make.pdf -# Online: https://www.gnu.org/software/make/manual/make.html -# General rules: http://make.mad-scientist.net/papers/rules-of-makefiles/#rule3 -SHELL = /bin/sh - -# Chip & board used for compilation -# (can be overriden by adding CHIP=chip and BOARD=board to the command-line) -# Unit Test can only be run on host machine for now (Linux) -FRAMEWORK_PATH = fsfw -TEST_FILE_ROOT = $(FRAMEWORK_PATH)/unittest -BOARD = unittest -LINUX = 1 -OS_FSFW = linux -CUSTOM_DEFINES += -D$(OS_FSFW) - -# Copied from stackoverflow, can be used to differentiate between Windows -# and Linux -ifeq ($(OS),Windows_NT) - CUSTOM_DEFINES += -DWIN32 - ifeq ($(PROCESSOR_ARCHITEW6432),AMD64) - CUSTOM_DEFINES += -DAMD64 - else - ifeq ($(PROCESSOR_ARCHITECTURE),AMD64) - CUSTOM_DEFINES += -DAMD64 - endif - ifeq ($(PROCESSOR_ARCHITECTURE),x86) - CUSTOM_DEFINES += -DIA32 - endif - endif -else - UNAME_S := $(shell uname -s) - ifeq ($(UNAME_S),Linux) - DETECTED_OS = LINUX - CUSTOM_DEFINES += -DLINUX - endif - ifeq ($(UNAME_S),Darwin) - CUSTOM_DEFINES += -DOSX - endif - UNAME_P := $(shell uname -p) - ifeq ($(UNAME_P),x86_64) - CUSTOM_DEFINES += -DAMD64 - endif - ifneq ($(filter %86,$(UNAME_P)),) - CUSTOM_DEFINES += -DIA32 - endif - ifneq ($(filter arm%,$(UNAME_P)),) - CUSTOM_DEFINES += -DARM - endif -endif - -UNIT_TEST = 1 -# General folder paths -CONFIG_PATH = testcfg -# Core copy has to be copied as well. -CORE_PATH = core -UNIT_TEST_PATH = $(TEST_FILE_ROOT)/tests - -# Output file basename -BASENAME = fsfw -BINARY_NAME := $(BASENAME)-$(BOARD) -# Output files will be put in this directory inside -OUTPUT_FOLDER = $(OS) - -# Optimization level. Optimized for debugging. -OPTIMIZATION = -O0 - -# Default debug output. Optimized for debugging. -DEBUG_LEVEL = -g3 - -ifdef GCOV -CUSTOM_DEFINES += -DGCOV -endif - - -# Output directories -BUILDPATH = _bin -DEPENDPATH = _dep -OBJECTPATH = _obj - -ifeq ($(MAKECMDGOALS),mission) -BUILD_FOLDER = mission -else -BUILD_FOLDER = devel -endif - -DEPENDDIR = $(DEPENDPATH)/$(OUTPUT_FOLDER)/$(BUILD_FOLDER) -OBJDIR = $(OBJECTPATH)/$(OUTPUT_FOLDER)/$(BUILD_FOLDER) -BINDIR = $(BUILDPATH) - -CLEANDEP = $(DEPENDPATH)/$(OUTPUT_FOLDER) -CLEANOBJ = $(OBJECTPATH)/$(OUTPUT_FOLDER) -CLEANBIN = $(BUILDPATH) -#------------------------------------------------------------------------------- -# Tools and Includes -#------------------------------------------------------------------------------- - -# Tool suffix when cross-compiling -CROSS_COMPILE = - -# C Compiler -CC = $(CROSS_COMPILE)gcc - -# C++ compiler -CXX = $(CROSS_COMPILE)g++ - -# Additional Tools -SIZE = $(CROSS_COMPILE)size -STRIP = $(CROSS_COMPILE)strip -CP = $(CROSS_COMPILE)objcopy - -HEXCOPY = $(CP) -O ihex -BINCOPY = $(CP) -O binary -# files to be compiled, will be filled in by include makefiles -# := assignment is neccessary so we get all paths right -# https://www.gnu.org/software/make/manual/html_node/Flavors.html -CSRC := -CXXSRC := -ASRC := -INCLUDES := - -# Directories where $(directoryname).mk files should be included from -SUBDIRS := $(FRAMEWORK_PATH) $(TEST_PATH) $(UNIT_TEST_PATH) $(CONFIG_PATH) \ - $(CORE_PATH) - - -I_INCLUDES += $(addprefix -I, $(INCLUDES)) - -# This is a hack from http://make.mad-scientist.net/the-eval-function/ -# -# The problem is, that included makefiles should be aware of their relative path -# but not need to guess or hardcode it. So we set $(CURRENTPATH) for them. If -# we do this globally and the included makefiles want to include other makefiles as -# well, they would overwrite $(CURRENTPATH), screwing the include after them. -# -# By using a for-loop with an eval'd macro, we can generate the code to include all -# sub-makefiles (with the correct $(CURRENTPATH) set) before actually evaluating -# (and by this possibly changing $(CURRENTPATH)) them. -# -# This works recursively, if an included makefile wants to include, it can safely set -# $(SUBDIRS) (which has already been evaluated here) and do -# "$(foreach S,$(SUBDIRS),$(eval $(INCLUDE_FILE)))" -# $(SUBDIRS) must be relative to the project root, so to include subdir foo, set -# $(SUBDIRS) = $(CURRENTPATH)/foo. -define INCLUDE_FILE -CURRENTPATH := $S -include $(S)/$(notdir $S).mk -endef -$(foreach S,$(SUBDIRS),$(eval $(INCLUDE_FILE))) - -INCLUDES += $(TEST_FILE_ROOT) -INCLUDES += $(TEST_FILE_ROOT)/catch2/ - -#------------------------------------------------------------------------------- -# Source Files -#------------------------------------------------------------------------------- - -# All source files which are not includes by the .mk files are added here -# Please ensure that no files are included by both .mk file and here ! - -# if a target is not listed in the current directory, -# make searches in the directories specified with VPATH - -# All C Sources included by .mk files are assigned here -# Add the objects to sources so dependency handling works -C_OBJECTS += $(CSRC:.c=.o) - -# Objects built from Assembly source files -ASM_OBJECTS = $(ASRC:.S=.o) - -# Objects built from C++ source files -CXX_OBJECTS += $(CXXSRC:.cpp=.o) - -#------------------------------------------------------------------------------- -# Build Configuration + Output -#------------------------------------------------------------------------------- - -TARGET = Debug build. -DEBUG_MESSAGE = Off -OPTIMIZATION_MESSAGE = Off - -# Define Messages -MSG_INFO = Software: Hosted unittest \(Catch2\) for the FSFW. -MSG_OPTIMIZATION = Optimization: $(OPTIMIZATION), $(OPTIMIZATION_MESSAGE) -MSG_TARGET = Target Build: $(TARGET) -MSG_DEBUG = Debug level: $(DEBUG_LEVEL), FSFW Debugging: $(DEBUG_MESSAGE) - -MSG_LINKING = Linking: -MSG_COMPILING = Compiling: -MSG_ASSEMBLING = Assembling: -MSG_DEPENDENCY = Collecting dependencies for: -MSG_BINARY = Generate binary: - -# See https://stackoverflow.com/questions/6687630/how-to-remove-unused-c-c-symbols-with-gcc-and-ld -# Used to throw away unused code. Reduces code size significantly ! -# -Wl,--gc-sections: needs to be passed to the linker to throw aways unused code -ifdef KEEP_UNUSED_CODE -PROTOTYPE_OPTIMIZATION = -UNUSED_CODE_REMOVAL = -else -PROTOTYPE_OPTIMIZATION = -ffunction-sections -fdata-sections -UNUSED_CODE_REMOVAL = -Wl,--gc-sections -# Link time optimization -# See https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html for reference -# Link time is larger and size of object files can not be retrieved -# but resulting binary is smaller. Could be used in mission/deployment build -# Requires -ffunction-section in linker call -LINK_TIME_OPTIMIZATION = -flto -OPTIMIZATION += $(PROTOTYPE_OPTIMIZATION) -endif - -# Dependency Flags -# These flags tell the compiler to build dependencies -# See: https://www.gnu.org/software/make/manual/html_node/Automatic-Prerequisites.html -# Using following guide: http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/#combine -DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPENDDIR)/$*.d - -# Flags for the compiler call -# - std: Which C++ version to use. Common versions: c++11, c++14 and c++17 -# - Wall: enable all warnings -# - Wextra: enable extra warnings -# - g: defines debug level -# - fmessage-length: to control the formatting algorithm for diagnostic messages; -# =0 means no line-wrapping is done; each error message appears on a single line -# - fno-exceptions: stops generating extra code needed to propagate exceptions, -# which can produce significant data size overhead -CUSTOM_DEFINES += -DUNIT_TEST -WARNING_FLAGS = -Wall -Wshadow=local -Wextra -Wimplicit-fallthrough=1 \ - -Wno-unused-parameter - -CXXDEFINES := $(CUSTOM_DEFINES) -CFLAGS += -CXXFLAGS += -I. $(DEBUG_LEVEL) $(WARNING_FLAGS) $(DEPFLAGS) -fmessage-length=0 $(OPTIMIZATION)\ - $(I_INCLUDES) $(CXXDEFINES) -CPPFLAGS += -std=c++11 - -# Flags for the linker call -# LINK_INCLUDES specify the path to used libraries and the linker script -# LINK_LIBRARIES: Link real time support -LDFLAGS := $(DEBUG_LEVEL) $(UNUSED_CODE_REMOVAL) $(OPTIMIZATION) -pthread -LINK_INCLUDES := -LINK_LIBRARIES := - -ifdef LINUX -LINK_LIBRARIES += -lrt -endif - -ifeq ($(OS),Windows_NT) -LINK_LIBRARIES += -lwsock32 -lws2_32 -LDFLASGS += -fuse-ld=lld -endif - -# Gnu Coverage Tools Flags -ifdef GCOV -GCOV_CXXFLAGS = -fprofile-arcs -ftest-coverage --coverage -fno-inline \ - -fno-inline-small-functions -fno-default-inline -CXXFLAGS += $(GCOV_CXXFLAGS) -GCOV_LINKER_LIBS = -lgcov -fprofile-arcs -ftest-coverage -LINK_LIBRARIES += $(GCOV_LINKER_LIBS) -endif - -# $(info $${CXXFLAGS} is [${CXXFLAGS}]) - -#------------------------------------------------------------------------------- -# Rules -#------------------------------------------------------------------------------- -# the call function assigns parameters to temporary variables -# https://www.gnu.org/software/make/manual/make.html#Call-Function -# $(1) = Memory names -# Rules are called for each memory type -# Two Expansion Symbols $$ are to escape the dollar sign for eval. -# See: http://make.mad-scientist.net/the-eval-function/ - -default: all - -# Cleans all files -hardclean: - -rm -rf $(BUILDPATH) - -rm -rf $(OBJECTPATH) - -rm -rf $(DEPENDPATH) - -# Only clean files for current build -clean: - -rm -rf $(CLEANOBJ) - -rm -rf $(CLEANBIN) - -rm -rf $(CLEANDEP) - -# Only clean binaries. Useful for changing the binary type when object files -# are already compiled so complete rebuild is not necessary -cleanbin: - -rm -rf $(CLEANBIN) - -# In this section, the binaries are built for all selected memories -# notestfw: all -all: executable - -# Build target configuration -release: OPTIMIZATION = -Os $(PROTOTYPE_OPTIMIZATION) $(LINK_TIME_OPTIMIZATION) -release: LINK_TIME_OPTIMIZATION = -flto -release: TARGET = Mission build. -release: OPTIMIZATION_MESSAGE = On with Link Time Optimization - -debug: CXXDEFINES += -DDEBUG -debug: TARGET = Debug -debug: DEBUG_MESSAGE = On - -ifndef KEEP_UNUSED_CODE -debug release: OPTIMIZATION_MESSAGE += , no unused code removal -endif - -debug release notestfw: executable - -executable: $(BINDIR)/$(BINARY_NAME).elf - @echo - @echo $(MSG_INFO) - @echo $(MSG_TARGET) - @echo $(MSG_OPTIMIZATION) - @echo $(MSG_DEBUG) - -C_OBJECTS_PREFIXED = $(addprefix $(OBJDIR)/, $(C_OBJECTS)) -CXX_OBJECTS_PREFIXED = $(addprefix $(OBJDIR)/, $(CXX_OBJECTS)) -ASM_OBJECTS_PREFIXED = $(addprefix $(OBJDIR)/, $(ASM_OBJECTS)) -ALL_OBJECTS = $(ASM_OBJECTS_PREFIXED) $(C_OBJECTS_PREFIXED) \ - $(CXX_OBJECTS_PREFIXED) - -# Useful for debugging the Makefile -# Also see: https://www.oreilly.com/openbook/make3/book/ch12.pdf -# $(info $${ALL_OBJECTS} is [${ALL_OBJECTS}]) -# $(info $${CXXSRC} is [${CXXSRC}]) - -# Automatic variables are used here extensively. Some of them -# are escaped($$) to suppress immediate evaluation. The most important ones are: -# $@: Name of Target (left side of rule) -# $<: Name of the first prerequisite (right side of rule) -# @^: List of all prerequisite, omitting duplicates -# @D: Directory and file-within-directory part of $@ - -# Generates binary and displays all build properties -# -p with mkdir ignores error and creates directory when needed. - -# SHOW_DETAILS = 1 - - -# Link with required libraries: HAL (Hardware Abstraction Layer) and -# HCC (File System Library) -$(BINDIR)/$(BINARY_NAME).elf: $(ALL_OBJECTS) - @echo - @echo $(MSG_LINKING) Target $@ - @mkdir -p $(@D) -ifdef SHOW_DETAILS - $(CXX) $(LDFLAGS) $(LINK_INCLUDES) -o $@ $^ $(LINK_LIBRARIES) -else - @$(CXX) $(LDFLAGS) $(LINK_INCLUDES) -o $@ $^ $(LINK_LIBRARIES) -endif -ifeq ($(BUILD_FOLDER), mission) -# With Link Time Optimization, section size is not available - $(SIZE) $@ -else - $(SIZE) $^ $@ -endif - -$(BINDIR)/$(BINARY_NAME).hex: $(BINDIR)/$(BINARY_NAME).elf - @echo - @echo $(MSG_BINARY) - @mkdir -p $(@D) - $(HEXCOPY) $< $@ - -# Build new objects for changed dependencies. -$(OBJDIR)/%.o: %.cpp -$(OBJDIR)/%.o: %.cpp $(DEPENDDIR)/%.d | $(DEPENDDIR) - @echo - @echo $(MSG_COMPILING) $< - @mkdir -p $(@D) -ifdef SHOW_DETAILS - $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< -else - @$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< -endif - -$(OBJDIR)/%.o: %.c -$(OBJDIR)/%.o: %.c $(DEPENDDIR)/%.d | $(DEPENDDIR) - @echo - @echo $(MSG_COMPILING) $< - @mkdir -p $(@D) -ifdef SHOW_DETAILS - $(CC) $(CXXFLAGS) $(CFLAGS) -c -o $@ $< -else - @$(CC) $(CXXFLAGS) $(CFLAGS) -c -o $@ $< -endif - -#------------------------------------------------------------------------------- -# Dependency Handling -#------------------------------------------------------------------------------- - -# Dependency Handling according to following guide: -# http://make.mad-scientist.net/papers/advanced-auto-dependency-generation/ -$(DEPENDDIR): - @mkdir -p $(@D) -DEPENDENCY_RELATIVE = $(CSRC:.c=.d) $(CXXSRC:.cpp=.d) -# This is the list of all dependencies -DEPFILES = $(addprefix $(DEPENDDIR)/, $(DEPENDENCY_RELATIVE)) -# Create subdirectories for dependencies -$(DEPFILES): - @mkdir -p $(@D) -# Include all dependencies -include $(wildcard $(DEPFILES)) - -# .PHONY tells make that these targets aren't files -.PHONY: clean release debug all hardclean cleanbin diff --git a/tests/user/testcfg/OBSWConfig.h.in b/tests/user/testcfg/OBSWConfig.h.in new file mode 100644 index 00000000..34eda31f --- /dev/null +++ b/tests/user/testcfg/OBSWConfig.h.in @@ -0,0 +1,8 @@ +#ifndef TESTCFG_OBSWCONFIG_H_ +#define TESTCFG_OBSWCONFIG_H_ + + + + + +#endif /* TESTCFG_OBSWCONFIG_H_ */ diff --git a/tests/user/testcfg/TestsConfig.h b/tests/user/testcfg/TestsConfig.h deleted file mode 100644 index cd967fa7..00000000 --- a/tests/user/testcfg/TestsConfig.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_ -#define FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_ - - -#define CUSTOM_UNITTEST_RUNNER 0 - - -#endif /* FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_ */ diff --git a/tests/user/testcfg/TestsConfig.h.in b/tests/user/testcfg/TestsConfig.h.in new file mode 100644 index 00000000..0341583d --- /dev/null +++ b/tests/user/testcfg/TestsConfig.h.in @@ -0,0 +1,19 @@ +#ifndef FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_ +#define FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_ + +#ifdef __cplusplus + +#include "objects/systemObjectList.h" +#include "events/subsystemIdRanges.h" +#include "returnvalues/classIds.h" + +namespace config { +#endif + +/* Add mission configuration flags here */ + +#ifdef __cplusplus +} +#endif + +#endif /* FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_ */ diff --git a/tests/user/testcfg/cdatapool/dataPoolInit.cpp b/tests/user/testcfg/cdatapool/dataPoolInit.cpp deleted file mode 100644 index ad2dc4ef..00000000 --- a/tests/user/testcfg/cdatapool/dataPoolInit.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "dataPoolInit.h" - -void datapool::dataPoolInit(std::map * poolMap) { - -} diff --git a/tests/user/testcfg/cdatapool/dataPoolInit.h b/tests/user/testcfg/cdatapool/dataPoolInit.h deleted file mode 100644 index 9425d767..00000000 --- a/tests/user/testcfg/cdatapool/dataPoolInit.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef HOSTED_CONFIG_CDATAPOOL_DATAPOOLINIT_H_ -#define HOSTED_CONFIG_CDATAPOOL_DATAPOOLINIT_H_ - -#include -#include -#include -#include - - -namespace datapool { - void dataPoolInit(std::map * poolMap); - - enum datapoolvariables { - NO_PARAMETER = 0, - }; -} -#endif /* CONFIG_CDATAPOOL_DATAPOOLINIT_H_ */ diff --git a/tests/user/testcfg/objects/systemObjectList.h b/tests/user/testcfg/objects/systemObjectList.h index 76f1ff90..efd21e0d 100644 --- a/tests/user/testcfg/objects/systemObjectList.h +++ b/tests/user/testcfg/objects/systemObjectList.h @@ -15,14 +15,17 @@ namespace objects { PUS_DISTRIBUTOR = 11, TM_FUNNEL = 12, - TCPIP_BRIDGE = 15, - TCPIP_HELPER = 16, + UDP_BRIDGE = 15, + UDP_POLLING_TASK = 16, TEST_ECHO_COM_IF = 20, TEST_DEVICE = 21, HK_RECEIVER_MOCK = 22, - TEST_LOCAL_POOL_OWNER_BASE = 25 + TEST_LOCAL_POOL_OWNER_BASE = 25, + + SHARED_SET_ID = 26 + }; } diff --git a/tests/user/testcfg/pollingsequence/PollingSequenceFactory.cpp b/tests/user/testcfg/pollingsequence/PollingSequenceFactory.cpp index b7f1fb3e..e3ee874a 100644 --- a/tests/user/testcfg/pollingsequence/PollingSequenceFactory.cpp +++ b/tests/user/testcfg/pollingsequence/PollingSequenceFactory.cpp @@ -1,6 +1,8 @@ #include "PollingSequenceFactory.h" -#include +#include + +#include #include #include @@ -10,14 +12,26 @@ ReturnValue_t pst::pollingSequenceInitDefault( uint32_t length = thisSequence->getPeriodMs(); /* Add polling sequence table here */ + thisSequence->addSlot(objects::TEST_DEVICE, 0, + DeviceHandlerIF::PERFORM_OPERATION); + thisSequence->addSlot(objects::TEST_DEVICE, 0.3, + DeviceHandlerIF::SEND_WRITE); + thisSequence->addSlot(objects::TEST_DEVICE, 0.45 * length, + DeviceHandlerIF::GET_WRITE); + thisSequence->addSlot(objects::TEST_DEVICE, 0.6 * length, + DeviceHandlerIF::SEND_READ); + thisSequence->addSlot(objects::TEST_DEVICE, 0.8 * length, + DeviceHandlerIF::GET_READ); if (thisSequence->checkSequence() == HasReturnvaluesIF::RETURN_OK) { return HasReturnvaluesIF::RETURN_OK; } else { -#if FSFW_CPP_OSTREAM_ENABLED == 1 +#if FSFW_CPP_OSTREAM_ENABLED sif::error << "pst::pollingSequenceInitDefault: Sequence invalid!" << std::endl; +#else + sif::printError("pst::pollingSequenceInitDefault: Sequence invalid!"); #endif return HasReturnvaluesIF::RETURN_FAILED; } diff --git a/tests/user/testcfg/testcfg.mk b/tests/user/testcfg/testcfg.mk deleted file mode 100644 index fca2f732..00000000 --- a/tests/user/testcfg/testcfg.mk +++ /dev/null @@ -1,8 +0,0 @@ -CXXSRC += $(wildcard $(CURRENTPATH)/cdatapool/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/ipc/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/objects/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/pollingsequence/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/events/*.cpp) -CXXSRC += $(wildcard $(CURRENTPATH)/*.cpp) - -INCLUDES += $(CURRENTPATH) From 490ab440e5917af11ebb474098e0671acfe8d403 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 30 Jul 2021 14:21:37 +0200 Subject: [PATCH 218/389] smaller tweaks in CMakelists files --- tests/CMakeLists.txt | 1 - tests/user/CMakeLists.txt | 12 ------------ 2 files changed, 13 deletions(-) delete mode 100644 tests/CMakeLists.txt diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt deleted file mode 100644 index febd4f0a..00000000 --- a/tests/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(src) diff --git a/tests/user/CMakeLists.txt b/tests/user/CMakeLists.txt index e95edc2b..df16c756 100644 --- a/tests/user/CMakeLists.txt +++ b/tests/user/CMakeLists.txt @@ -1,8 +1,5 @@ ################################################################################ # CMake support for the Flight Software Framework Tests -# -# Developed in an effort to replace Make with a modern build system. -# # Author: R. Mueller ################################################################################ @@ -39,10 +36,6 @@ option(CUSTOM_UNITTEST_RUNNER "Specify whether custom main or Catch2 main is used" TRUE ) -# Perform steps like loading toolchain files where applicable. -#include(${CMAKE_SCRIPT_PATH}/PreProjectConfig.cmake) -#pre_project_config() - # Project Name project(fsfw-tests C CXX) @@ -266,8 +259,3 @@ add_custom_command(TARGET ${TARGET_NAME} include (${CMAKE_SCRIPT_PATH}/BuildType.cmake) set_build_type() - - - - - From 5bbe16081f78ea9ca8df30387ed3134e67f972fd Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 30 Jul 2021 14:38:20 +0200 Subject: [PATCH 219/389] added missing CMakeLists.txt --- tests/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 tests/CMakeLists.txt diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 00000000..febd4f0a --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1 @@ +add_subdirectory(src) From c0591c3d24531fdc591bf150eeef1637cef908b7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 2 Aug 2021 15:31:13 +0200 Subject: [PATCH 220/389] renamed some folders --- contrib/CMakeLists.txt | 20 +++++++++---------- contrib/fsfw-contrib/CMakeLists.txt | 11 ++++++++++ contrib/{ => fsfw-contrib}/sgp4/LICENSE | 0 contrib/{ => fsfw-contrib}/sgp4/sgp4unit.cpp | 0 contrib/{ => fsfw-contrib}/sgp4/sgp4unit.h | 0 hal/src/CMakeLists.txt | 2 +- hal/src/{fsfw/hal => fsfw-hal}/CMakeLists.txt | 0 .../hal => fsfw-hal}/common/CMakeLists.txt | 0 .../common/gpio/CMakeLists.txt | 0 .../common/gpio/GpioCookie.cpp | 0 .../hal => fsfw-hal}/common/gpio/GpioCookie.h | 0 .../hal => fsfw-hal}/common/gpio/GpioIF.h | 0 .../common/gpio/gpioDefinitions.h | 0 .../hal => fsfw-hal}/common/spi/spiCommon.h | 0 .../devicehandlers/CMakeLists.txt | 0 .../devicehandlers/GyroL3GD20Handler.cpp | 0 .../devicehandlers/GyroL3GD20Handler.h | 0 .../devicedefinitions/GyroL3GD20Definitions.h | 0 .../hal => fsfw-hal}/host/CMakeLists.txt | 0 .../hal => fsfw-hal}/linux/CMakeLists.txt | 0 .../hal => fsfw-hal}/linux/UnixFileGuard.cpp | 0 .../hal => fsfw-hal}/linux/UnixFileGuard.h | 0 .../linux/gpio/CMakeLists.txt | 0 .../linux/gpio/LinuxLibgpioIF.cpp | 0 .../linux/gpio/LinuxLibgpioIF.h | 0 .../hal => fsfw-hal}/linux/i2c/CMakeLists.txt | 0 .../hal => fsfw-hal}/linux/i2c/I2cComIF.cpp | 0 .../hal => fsfw-hal}/linux/i2c/I2cComIF.h | 0 .../hal => fsfw-hal}/linux/i2c/I2cCookie.cpp | 0 .../hal => fsfw-hal}/linux/i2c/I2cCookie.h | 0 .../hal => fsfw-hal}/linux/rpi/CMakeLists.txt | 0 .../hal => fsfw-hal}/linux/rpi/GpioRPi.cpp | 0 .../hal => fsfw-hal}/linux/rpi/GpioRPi.h | 0 .../hal => fsfw-hal}/linux/spi/CMakeLists.txt | 0 .../hal => fsfw-hal}/linux/spi/SpiComIF.cpp | 0 .../hal => fsfw-hal}/linux/spi/SpiComIF.h | 0 .../hal => fsfw-hal}/linux/spi/SpiCookie.cpp | 0 .../hal => fsfw-hal}/linux/spi/SpiCookie.h | 0 .../linux/spi/spiDefinitions.h | 0 .../linux/uart/CMakeLists.txt | 0 .../hal => fsfw-hal}/linux/uart/UartComIF.cpp | 0 .../hal => fsfw-hal}/linux/uart/UartComIF.h | 0 .../linux/uart/UartCookie.cpp | 0 .../hal => fsfw-hal}/linux/uart/UartCookie.h | 0 .../{fsfw/hal => fsfw-hal}/linux/utility.cpp | 0 .../{fsfw/hal => fsfw-hal}/linux/utility.h | 0 .../hal => fsfw-hal}/stm32h7/CMakeLists.txt | 0 .../stm32h7/devicetest/CMakeLists.txt | 0 .../stm32h7/devicetest/GyroL3GD20H.cpp | 0 .../stm32h7/devicetest/GyroL3GD20H.h | 0 .../{fsfw/hal => fsfw-hal}/stm32h7/dma.cpp | 0 hal/src/{fsfw/hal => fsfw-hal}/stm32h7/dma.h | 0 .../stm32h7/gpio/CMakeLists.txt | 0 .../hal => fsfw-hal}/stm32h7/gpio/gpio.cpp | 0 .../hal => fsfw-hal}/stm32h7/gpio/gpio.h | 0 .../stm32h7/i2c/CMakeLists.txt | 0 .../hal => fsfw-hal}/stm32h7/interrupts.h | 0 .../stm32h7/spi/CMakeLists.txt | 0 .../hal => fsfw-hal}/stm32h7/spi/SpiComIF.cpp | 0 .../hal => fsfw-hal}/stm32h7/spi/SpiComIF.h | 0 .../stm32h7/spi/SpiCookie.cpp | 0 .../hal => fsfw-hal}/stm32h7/spi/SpiCookie.h | 0 .../hal => fsfw-hal}/stm32h7/spi/mspInit.cpp | 0 .../hal => fsfw-hal}/stm32h7/spi/mspInit.h | 0 .../hal => fsfw-hal}/stm32h7/spi/spiCore.cpp | 0 .../hal => fsfw-hal}/stm32h7/spi/spiCore.h | 0 .../stm32h7/spi/spiDefinitions.cpp | 0 .../stm32h7/spi/spiDefinitions.h | 0 .../stm32h7/spi/spiInterrupts.cpp | 0 .../stm32h7/spi/spiInterrupts.h | 0 .../stm32h7/spi/stm32h743ziSpi.cpp | 0 .../stm32h7/spi/stm32h743ziSpi.h | 0 .../stm32h7/uart/CMakeLists.txt | 0 hal/src/fsfw/CMakeLists.txt | 1 - tests/src/CMakeLists.txt | 2 +- .../{fsfw/tests => fsfw-tests}/CMakeLists.txt | 0 .../internal/CMakeLists.txt | 0 .../internal/InternalUnitTester.cpp | 0 .../internal/InternalUnitTester.h | 0 .../internal/UnittDefinitions.cpp | 0 .../internal/UnittDefinitions.h | 0 .../internal/globalfunctions/CMakeLists.txt | 0 .../globalfunctions/TestArrayPrinter.cpp | 0 .../globalfunctions/TestArrayPrinter.h | 0 .../internal/osal/CMakeLists.txt | 0 .../internal/osal/IntTestMq.cpp | 0 .../internal/osal/IntTestMq.h | 0 .../internal/osal/IntTestMutex.cpp | 0 .../internal/osal/IntTestMutex.h | 0 .../internal/osal/IntTestSemaphore.cpp | 0 .../internal/osal/IntTestSemaphore.h | 0 .../internal/serialize/CMakeLists.txt | 0 .../serialize/IntTestSerialization.cpp | 0 .../internal/serialize/IntTestSerialization.h | 0 .../tests => fsfw-tests}/unit/CMakeLists.txt | 0 .../unit/action/CMakeLists.txt | 0 .../unit/action/TestActionHelper.cpp | 0 .../unit/action/TestActionHelper.h | 0 .../unit/container/CMakeLists.txt | 0 .../unit/container/RingBufferTest.cpp | 0 .../unit/container/TestArrayList.cpp | 0 .../unit/container/TestDynamicFifo.cpp | 0 .../unit/container/TestFifo.cpp | 0 .../unit/container/TestFixedArrayList.cpp | 0 .../unit/container/TestFixedMap.cpp | 0 .../container/TestFixedOrderedMultimap.cpp | 0 .../unit/container/TestPlacementFactory.cpp | 0 .../unit/datapoollocal/CMakeLists.txt | 0 .../unit/datapoollocal/DataSetTest.cpp | 0 .../datapoollocal/LocalPoolManagerTest.cpp | 0 .../unit/datapoollocal/LocalPoolOwnerBase.cpp | 0 .../unit/datapoollocal/LocalPoolOwnerBase.h | 0 .../datapoollocal/LocalPoolVariableTest.cpp | 0 .../datapoollocal/LocalPoolVectorTest.cpp | 0 .../unit/globalfunctions/CMakeLists.txt | 0 .../unit/mocks/HkReceiverMock.h | 0 .../unit/mocks/MessageQueueMockBase.h | 0 .../unit/osal/CMakeLists.txt | 0 .../unit/osal/TestMessageQueue.cpp | 0 .../unit/osal/TestSemaphore.cpp | 0 .../unit/serialize/CMakeLists.txt | 0 .../serialize/TestSerialBufferAdapter.cpp | 0 .../unit/serialize/TestSerialLinkedPacket.cpp | 0 .../unit/serialize/TestSerialLinkedPacket.h | 0 .../unit/serialize/TestSerialization.cpp | 0 .../unit/storagemanager/CMakeLists.txt | 0 .../unit/storagemanager/TestNewAccessor.cpp | 0 .../unit/storagemanager/TestPool.cpp | 0 .../unit/tmtcpacket/CMakeLists.txt | 0 .../unit/tmtcpacket/PusTmTest.cpp | 0 tests/src/fsfw/CMakeLists.txt | 1 - 131 files changed, 22 insertions(+), 15 deletions(-) create mode 100644 contrib/fsfw-contrib/CMakeLists.txt rename contrib/{ => fsfw-contrib}/sgp4/LICENSE (100%) rename contrib/{ => fsfw-contrib}/sgp4/sgp4unit.cpp (100%) rename contrib/{ => fsfw-contrib}/sgp4/sgp4unit.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/CMakeLists.txt (100%) rename hal/src/{fsfw/hal => fsfw-hal}/common/CMakeLists.txt (100%) rename hal/src/{fsfw/hal => fsfw-hal}/common/gpio/CMakeLists.txt (100%) rename hal/src/{fsfw/hal => fsfw-hal}/common/gpio/GpioCookie.cpp (100%) rename hal/src/{fsfw/hal => fsfw-hal}/common/gpio/GpioCookie.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/common/gpio/GpioIF.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/common/gpio/gpioDefinitions.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/common/spi/spiCommon.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/devicehandlers/CMakeLists.txt (100%) rename hal/src/{fsfw/hal => fsfw-hal}/devicehandlers/GyroL3GD20Handler.cpp (100%) rename hal/src/{fsfw/hal => fsfw-hal}/devicehandlers/GyroL3GD20Handler.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/host/CMakeLists.txt (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/CMakeLists.txt (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/UnixFileGuard.cpp (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/UnixFileGuard.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/gpio/CMakeLists.txt (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/gpio/LinuxLibgpioIF.cpp (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/gpio/LinuxLibgpioIF.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/i2c/CMakeLists.txt (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/i2c/I2cComIF.cpp (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/i2c/I2cComIF.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/i2c/I2cCookie.cpp (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/i2c/I2cCookie.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/rpi/CMakeLists.txt (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/rpi/GpioRPi.cpp (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/rpi/GpioRPi.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/spi/CMakeLists.txt (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/spi/SpiComIF.cpp (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/spi/SpiComIF.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/spi/SpiCookie.cpp (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/spi/SpiCookie.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/spi/spiDefinitions.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/uart/CMakeLists.txt (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/uart/UartComIF.cpp (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/uart/UartComIF.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/uart/UartCookie.cpp (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/uart/UartCookie.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/utility.cpp (100%) rename hal/src/{fsfw/hal => fsfw-hal}/linux/utility.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/CMakeLists.txt (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/devicetest/CMakeLists.txt (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/devicetest/GyroL3GD20H.cpp (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/devicetest/GyroL3GD20H.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/dma.cpp (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/dma.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/gpio/CMakeLists.txt (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/gpio/gpio.cpp (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/gpio/gpio.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/i2c/CMakeLists.txt (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/interrupts.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/spi/CMakeLists.txt (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/spi/SpiComIF.cpp (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/spi/SpiComIF.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/spi/SpiCookie.cpp (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/spi/SpiCookie.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/spi/mspInit.cpp (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/spi/mspInit.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/spi/spiCore.cpp (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/spi/spiCore.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/spi/spiDefinitions.cpp (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/spi/spiDefinitions.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/spi/spiInterrupts.cpp (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/spi/spiInterrupts.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/spi/stm32h743ziSpi.cpp (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/spi/stm32h743ziSpi.h (100%) rename hal/src/{fsfw/hal => fsfw-hal}/stm32h7/uart/CMakeLists.txt (100%) delete mode 100644 hal/src/fsfw/CMakeLists.txt rename tests/src/{fsfw/tests => fsfw-tests}/CMakeLists.txt (100%) rename tests/src/{fsfw/tests => fsfw-tests}/internal/CMakeLists.txt (100%) rename tests/src/{fsfw/tests => fsfw-tests}/internal/InternalUnitTester.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/internal/InternalUnitTester.h (100%) rename tests/src/{fsfw/tests => fsfw-tests}/internal/UnittDefinitions.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/internal/UnittDefinitions.h (100%) rename tests/src/{fsfw/tests => fsfw-tests}/internal/globalfunctions/CMakeLists.txt (100%) rename tests/src/{fsfw/tests => fsfw-tests}/internal/globalfunctions/TestArrayPrinter.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/internal/globalfunctions/TestArrayPrinter.h (100%) rename tests/src/{fsfw/tests => fsfw-tests}/internal/osal/CMakeLists.txt (100%) rename tests/src/{fsfw/tests => fsfw-tests}/internal/osal/IntTestMq.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/internal/osal/IntTestMq.h (100%) rename tests/src/{fsfw/tests => fsfw-tests}/internal/osal/IntTestMutex.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/internal/osal/IntTestMutex.h (100%) rename tests/src/{fsfw/tests => fsfw-tests}/internal/osal/IntTestSemaphore.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/internal/osal/IntTestSemaphore.h (100%) rename tests/src/{fsfw/tests => fsfw-tests}/internal/serialize/CMakeLists.txt (100%) rename tests/src/{fsfw/tests => fsfw-tests}/internal/serialize/IntTestSerialization.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/internal/serialize/IntTestSerialization.h (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/CMakeLists.txt (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/action/CMakeLists.txt (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/action/TestActionHelper.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/action/TestActionHelper.h (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/container/CMakeLists.txt (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/container/RingBufferTest.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/container/TestArrayList.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/container/TestDynamicFifo.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/container/TestFifo.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/container/TestFixedArrayList.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/container/TestFixedMap.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/container/TestFixedOrderedMultimap.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/container/TestPlacementFactory.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/datapoollocal/CMakeLists.txt (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/datapoollocal/DataSetTest.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/datapoollocal/LocalPoolManagerTest.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/datapoollocal/LocalPoolOwnerBase.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/datapoollocal/LocalPoolOwnerBase.h (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/datapoollocal/LocalPoolVariableTest.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/datapoollocal/LocalPoolVectorTest.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/globalfunctions/CMakeLists.txt (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/mocks/HkReceiverMock.h (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/mocks/MessageQueueMockBase.h (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/osal/CMakeLists.txt (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/osal/TestMessageQueue.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/osal/TestSemaphore.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/serialize/CMakeLists.txt (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/serialize/TestSerialBufferAdapter.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/serialize/TestSerialLinkedPacket.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/serialize/TestSerialLinkedPacket.h (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/serialize/TestSerialization.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/storagemanager/CMakeLists.txt (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/storagemanager/TestNewAccessor.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/storagemanager/TestPool.cpp (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/tmtcpacket/CMakeLists.txt (100%) rename tests/src/{fsfw/tests => fsfw-tests}/unit/tmtcpacket/PusTmTest.cpp (100%) delete mode 100644 tests/src/fsfw/CMakeLists.txt diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index 3a987228..8c252e82 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -1,11 +1,9 @@ -if(FSFW_ADD_SPG4_PROPAGATOR) - target_sources(${LIB_FSFW_NAME} PRIVATE - sgp4/sgp4unit.cpp - ) - target_include_directories(${LIB_FSFW_NAME} PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/sgp4 - ) - target_include_directories(${LIB_FSFW_NAME} INTERFACE - ${CMAKE_CURRENT_SOURCE_DIR}/sgp4 - ) -endif() +target_include_directories(${LIB_FSFW_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} +) + +target_include_directories(${LIB_FSFW_NAME} INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR} +) + +add_subdirectory(fsfw-contrib) diff --git a/contrib/fsfw-contrib/CMakeLists.txt b/contrib/fsfw-contrib/CMakeLists.txt new file mode 100644 index 00000000..3a987228 --- /dev/null +++ b/contrib/fsfw-contrib/CMakeLists.txt @@ -0,0 +1,11 @@ +if(FSFW_ADD_SPG4_PROPAGATOR) + target_sources(${LIB_FSFW_NAME} PRIVATE + sgp4/sgp4unit.cpp + ) + target_include_directories(${LIB_FSFW_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/sgp4 + ) + target_include_directories(${LIB_FSFW_NAME} INTERFACE + ${CMAKE_CURRENT_SOURCE_DIR}/sgp4 + ) +endif() diff --git a/contrib/sgp4/LICENSE b/contrib/fsfw-contrib/sgp4/LICENSE similarity index 100% rename from contrib/sgp4/LICENSE rename to contrib/fsfw-contrib/sgp4/LICENSE diff --git a/contrib/sgp4/sgp4unit.cpp b/contrib/fsfw-contrib/sgp4/sgp4unit.cpp similarity index 100% rename from contrib/sgp4/sgp4unit.cpp rename to contrib/fsfw-contrib/sgp4/sgp4unit.cpp diff --git a/contrib/sgp4/sgp4unit.h b/contrib/fsfw-contrib/sgp4/sgp4unit.h similarity index 100% rename from contrib/sgp4/sgp4unit.h rename to contrib/fsfw-contrib/sgp4/sgp4unit.h diff --git a/hal/src/CMakeLists.txt b/hal/src/CMakeLists.txt index ed2f2522..ff3f1beb 100644 --- a/hal/src/CMakeLists.txt +++ b/hal/src/CMakeLists.txt @@ -6,4 +6,4 @@ target_include_directories(${LIB_FSFW_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ) -add_subdirectory(fsfw) +add_subdirectory(fsfw-hal) diff --git a/hal/src/fsfw/hal/CMakeLists.txt b/hal/src/fsfw-hal/CMakeLists.txt similarity index 100% rename from hal/src/fsfw/hal/CMakeLists.txt rename to hal/src/fsfw-hal/CMakeLists.txt diff --git a/hal/src/fsfw/hal/common/CMakeLists.txt b/hal/src/fsfw-hal/common/CMakeLists.txt similarity index 100% rename from hal/src/fsfw/hal/common/CMakeLists.txt rename to hal/src/fsfw-hal/common/CMakeLists.txt diff --git a/hal/src/fsfw/hal/common/gpio/CMakeLists.txt b/hal/src/fsfw-hal/common/gpio/CMakeLists.txt similarity index 100% rename from hal/src/fsfw/hal/common/gpio/CMakeLists.txt rename to hal/src/fsfw-hal/common/gpio/CMakeLists.txt diff --git a/hal/src/fsfw/hal/common/gpio/GpioCookie.cpp b/hal/src/fsfw-hal/common/gpio/GpioCookie.cpp similarity index 100% rename from hal/src/fsfw/hal/common/gpio/GpioCookie.cpp rename to hal/src/fsfw-hal/common/gpio/GpioCookie.cpp diff --git a/hal/src/fsfw/hal/common/gpio/GpioCookie.h b/hal/src/fsfw-hal/common/gpio/GpioCookie.h similarity index 100% rename from hal/src/fsfw/hal/common/gpio/GpioCookie.h rename to hal/src/fsfw-hal/common/gpio/GpioCookie.h diff --git a/hal/src/fsfw/hal/common/gpio/GpioIF.h b/hal/src/fsfw-hal/common/gpio/GpioIF.h similarity index 100% rename from hal/src/fsfw/hal/common/gpio/GpioIF.h rename to hal/src/fsfw-hal/common/gpio/GpioIF.h diff --git a/hal/src/fsfw/hal/common/gpio/gpioDefinitions.h b/hal/src/fsfw-hal/common/gpio/gpioDefinitions.h similarity index 100% rename from hal/src/fsfw/hal/common/gpio/gpioDefinitions.h rename to hal/src/fsfw-hal/common/gpio/gpioDefinitions.h diff --git a/hal/src/fsfw/hal/common/spi/spiCommon.h b/hal/src/fsfw-hal/common/spi/spiCommon.h similarity index 100% rename from hal/src/fsfw/hal/common/spi/spiCommon.h rename to hal/src/fsfw-hal/common/spi/spiCommon.h diff --git a/hal/src/fsfw/hal/devicehandlers/CMakeLists.txt b/hal/src/fsfw-hal/devicehandlers/CMakeLists.txt similarity index 100% rename from hal/src/fsfw/hal/devicehandlers/CMakeLists.txt rename to hal/src/fsfw-hal/devicehandlers/CMakeLists.txt diff --git a/hal/src/fsfw/hal/devicehandlers/GyroL3GD20Handler.cpp b/hal/src/fsfw-hal/devicehandlers/GyroL3GD20Handler.cpp similarity index 100% rename from hal/src/fsfw/hal/devicehandlers/GyroL3GD20Handler.cpp rename to hal/src/fsfw-hal/devicehandlers/GyroL3GD20Handler.cpp diff --git a/hal/src/fsfw/hal/devicehandlers/GyroL3GD20Handler.h b/hal/src/fsfw-hal/devicehandlers/GyroL3GD20Handler.h similarity index 100% rename from hal/src/fsfw/hal/devicehandlers/GyroL3GD20Handler.h rename to hal/src/fsfw-hal/devicehandlers/GyroL3GD20Handler.h diff --git a/hal/src/fsfw/hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h b/hal/src/fsfw-hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h similarity index 100% rename from hal/src/fsfw/hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h rename to hal/src/fsfw-hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h diff --git a/hal/src/fsfw/hal/host/CMakeLists.txt b/hal/src/fsfw-hal/host/CMakeLists.txt similarity index 100% rename from hal/src/fsfw/hal/host/CMakeLists.txt rename to hal/src/fsfw-hal/host/CMakeLists.txt diff --git a/hal/src/fsfw/hal/linux/CMakeLists.txt b/hal/src/fsfw-hal/linux/CMakeLists.txt similarity index 100% rename from hal/src/fsfw/hal/linux/CMakeLists.txt rename to hal/src/fsfw-hal/linux/CMakeLists.txt diff --git a/hal/src/fsfw/hal/linux/UnixFileGuard.cpp b/hal/src/fsfw-hal/linux/UnixFileGuard.cpp similarity index 100% rename from hal/src/fsfw/hal/linux/UnixFileGuard.cpp rename to hal/src/fsfw-hal/linux/UnixFileGuard.cpp diff --git a/hal/src/fsfw/hal/linux/UnixFileGuard.h b/hal/src/fsfw-hal/linux/UnixFileGuard.h similarity index 100% rename from hal/src/fsfw/hal/linux/UnixFileGuard.h rename to hal/src/fsfw-hal/linux/UnixFileGuard.h diff --git a/hal/src/fsfw/hal/linux/gpio/CMakeLists.txt b/hal/src/fsfw-hal/linux/gpio/CMakeLists.txt similarity index 100% rename from hal/src/fsfw/hal/linux/gpio/CMakeLists.txt rename to hal/src/fsfw-hal/linux/gpio/CMakeLists.txt diff --git a/hal/src/fsfw/hal/linux/gpio/LinuxLibgpioIF.cpp b/hal/src/fsfw-hal/linux/gpio/LinuxLibgpioIF.cpp similarity index 100% rename from hal/src/fsfw/hal/linux/gpio/LinuxLibgpioIF.cpp rename to hal/src/fsfw-hal/linux/gpio/LinuxLibgpioIF.cpp diff --git a/hal/src/fsfw/hal/linux/gpio/LinuxLibgpioIF.h b/hal/src/fsfw-hal/linux/gpio/LinuxLibgpioIF.h similarity index 100% rename from hal/src/fsfw/hal/linux/gpio/LinuxLibgpioIF.h rename to hal/src/fsfw-hal/linux/gpio/LinuxLibgpioIF.h diff --git a/hal/src/fsfw/hal/linux/i2c/CMakeLists.txt b/hal/src/fsfw-hal/linux/i2c/CMakeLists.txt similarity index 100% rename from hal/src/fsfw/hal/linux/i2c/CMakeLists.txt rename to hal/src/fsfw-hal/linux/i2c/CMakeLists.txt diff --git a/hal/src/fsfw/hal/linux/i2c/I2cComIF.cpp b/hal/src/fsfw-hal/linux/i2c/I2cComIF.cpp similarity index 100% rename from hal/src/fsfw/hal/linux/i2c/I2cComIF.cpp rename to hal/src/fsfw-hal/linux/i2c/I2cComIF.cpp diff --git a/hal/src/fsfw/hal/linux/i2c/I2cComIF.h b/hal/src/fsfw-hal/linux/i2c/I2cComIF.h similarity index 100% rename from hal/src/fsfw/hal/linux/i2c/I2cComIF.h rename to hal/src/fsfw-hal/linux/i2c/I2cComIF.h diff --git a/hal/src/fsfw/hal/linux/i2c/I2cCookie.cpp b/hal/src/fsfw-hal/linux/i2c/I2cCookie.cpp similarity index 100% rename from hal/src/fsfw/hal/linux/i2c/I2cCookie.cpp rename to hal/src/fsfw-hal/linux/i2c/I2cCookie.cpp diff --git a/hal/src/fsfw/hal/linux/i2c/I2cCookie.h b/hal/src/fsfw-hal/linux/i2c/I2cCookie.h similarity index 100% rename from hal/src/fsfw/hal/linux/i2c/I2cCookie.h rename to hal/src/fsfw-hal/linux/i2c/I2cCookie.h diff --git a/hal/src/fsfw/hal/linux/rpi/CMakeLists.txt b/hal/src/fsfw-hal/linux/rpi/CMakeLists.txt similarity index 100% rename from hal/src/fsfw/hal/linux/rpi/CMakeLists.txt rename to hal/src/fsfw-hal/linux/rpi/CMakeLists.txt diff --git a/hal/src/fsfw/hal/linux/rpi/GpioRPi.cpp b/hal/src/fsfw-hal/linux/rpi/GpioRPi.cpp similarity index 100% rename from hal/src/fsfw/hal/linux/rpi/GpioRPi.cpp rename to hal/src/fsfw-hal/linux/rpi/GpioRPi.cpp diff --git a/hal/src/fsfw/hal/linux/rpi/GpioRPi.h b/hal/src/fsfw-hal/linux/rpi/GpioRPi.h similarity index 100% rename from hal/src/fsfw/hal/linux/rpi/GpioRPi.h rename to hal/src/fsfw-hal/linux/rpi/GpioRPi.h diff --git a/hal/src/fsfw/hal/linux/spi/CMakeLists.txt b/hal/src/fsfw-hal/linux/spi/CMakeLists.txt similarity index 100% rename from hal/src/fsfw/hal/linux/spi/CMakeLists.txt rename to hal/src/fsfw-hal/linux/spi/CMakeLists.txt diff --git a/hal/src/fsfw/hal/linux/spi/SpiComIF.cpp b/hal/src/fsfw-hal/linux/spi/SpiComIF.cpp similarity index 100% rename from hal/src/fsfw/hal/linux/spi/SpiComIF.cpp rename to hal/src/fsfw-hal/linux/spi/SpiComIF.cpp diff --git a/hal/src/fsfw/hal/linux/spi/SpiComIF.h b/hal/src/fsfw-hal/linux/spi/SpiComIF.h similarity index 100% rename from hal/src/fsfw/hal/linux/spi/SpiComIF.h rename to hal/src/fsfw-hal/linux/spi/SpiComIF.h diff --git a/hal/src/fsfw/hal/linux/spi/SpiCookie.cpp b/hal/src/fsfw-hal/linux/spi/SpiCookie.cpp similarity index 100% rename from hal/src/fsfw/hal/linux/spi/SpiCookie.cpp rename to hal/src/fsfw-hal/linux/spi/SpiCookie.cpp diff --git a/hal/src/fsfw/hal/linux/spi/SpiCookie.h b/hal/src/fsfw-hal/linux/spi/SpiCookie.h similarity index 100% rename from hal/src/fsfw/hal/linux/spi/SpiCookie.h rename to hal/src/fsfw-hal/linux/spi/SpiCookie.h diff --git a/hal/src/fsfw/hal/linux/spi/spiDefinitions.h b/hal/src/fsfw-hal/linux/spi/spiDefinitions.h similarity index 100% rename from hal/src/fsfw/hal/linux/spi/spiDefinitions.h rename to hal/src/fsfw-hal/linux/spi/spiDefinitions.h diff --git a/hal/src/fsfw/hal/linux/uart/CMakeLists.txt b/hal/src/fsfw-hal/linux/uart/CMakeLists.txt similarity index 100% rename from hal/src/fsfw/hal/linux/uart/CMakeLists.txt rename to hal/src/fsfw-hal/linux/uart/CMakeLists.txt diff --git a/hal/src/fsfw/hal/linux/uart/UartComIF.cpp b/hal/src/fsfw-hal/linux/uart/UartComIF.cpp similarity index 100% rename from hal/src/fsfw/hal/linux/uart/UartComIF.cpp rename to hal/src/fsfw-hal/linux/uart/UartComIF.cpp diff --git a/hal/src/fsfw/hal/linux/uart/UartComIF.h b/hal/src/fsfw-hal/linux/uart/UartComIF.h similarity index 100% rename from hal/src/fsfw/hal/linux/uart/UartComIF.h rename to hal/src/fsfw-hal/linux/uart/UartComIF.h diff --git a/hal/src/fsfw/hal/linux/uart/UartCookie.cpp b/hal/src/fsfw-hal/linux/uart/UartCookie.cpp similarity index 100% rename from hal/src/fsfw/hal/linux/uart/UartCookie.cpp rename to hal/src/fsfw-hal/linux/uart/UartCookie.cpp diff --git a/hal/src/fsfw/hal/linux/uart/UartCookie.h b/hal/src/fsfw-hal/linux/uart/UartCookie.h similarity index 100% rename from hal/src/fsfw/hal/linux/uart/UartCookie.h rename to hal/src/fsfw-hal/linux/uart/UartCookie.h diff --git a/hal/src/fsfw/hal/linux/utility.cpp b/hal/src/fsfw-hal/linux/utility.cpp similarity index 100% rename from hal/src/fsfw/hal/linux/utility.cpp rename to hal/src/fsfw-hal/linux/utility.cpp diff --git a/hal/src/fsfw/hal/linux/utility.h b/hal/src/fsfw-hal/linux/utility.h similarity index 100% rename from hal/src/fsfw/hal/linux/utility.h rename to hal/src/fsfw-hal/linux/utility.h diff --git a/hal/src/fsfw/hal/stm32h7/CMakeLists.txt b/hal/src/fsfw-hal/stm32h7/CMakeLists.txt similarity index 100% rename from hal/src/fsfw/hal/stm32h7/CMakeLists.txt rename to hal/src/fsfw-hal/stm32h7/CMakeLists.txt diff --git a/hal/src/fsfw/hal/stm32h7/devicetest/CMakeLists.txt b/hal/src/fsfw-hal/stm32h7/devicetest/CMakeLists.txt similarity index 100% rename from hal/src/fsfw/hal/stm32h7/devicetest/CMakeLists.txt rename to hal/src/fsfw-hal/stm32h7/devicetest/CMakeLists.txt diff --git a/hal/src/fsfw/hal/stm32h7/devicetest/GyroL3GD20H.cpp b/hal/src/fsfw-hal/stm32h7/devicetest/GyroL3GD20H.cpp similarity index 100% rename from hal/src/fsfw/hal/stm32h7/devicetest/GyroL3GD20H.cpp rename to hal/src/fsfw-hal/stm32h7/devicetest/GyroL3GD20H.cpp diff --git a/hal/src/fsfw/hal/stm32h7/devicetest/GyroL3GD20H.h b/hal/src/fsfw-hal/stm32h7/devicetest/GyroL3GD20H.h similarity index 100% rename from hal/src/fsfw/hal/stm32h7/devicetest/GyroL3GD20H.h rename to hal/src/fsfw-hal/stm32h7/devicetest/GyroL3GD20H.h diff --git a/hal/src/fsfw/hal/stm32h7/dma.cpp b/hal/src/fsfw-hal/stm32h7/dma.cpp similarity index 100% rename from hal/src/fsfw/hal/stm32h7/dma.cpp rename to hal/src/fsfw-hal/stm32h7/dma.cpp diff --git a/hal/src/fsfw/hal/stm32h7/dma.h b/hal/src/fsfw-hal/stm32h7/dma.h similarity index 100% rename from hal/src/fsfw/hal/stm32h7/dma.h rename to hal/src/fsfw-hal/stm32h7/dma.h diff --git a/hal/src/fsfw/hal/stm32h7/gpio/CMakeLists.txt b/hal/src/fsfw-hal/stm32h7/gpio/CMakeLists.txt similarity index 100% rename from hal/src/fsfw/hal/stm32h7/gpio/CMakeLists.txt rename to hal/src/fsfw-hal/stm32h7/gpio/CMakeLists.txt diff --git a/hal/src/fsfw/hal/stm32h7/gpio/gpio.cpp b/hal/src/fsfw-hal/stm32h7/gpio/gpio.cpp similarity index 100% rename from hal/src/fsfw/hal/stm32h7/gpio/gpio.cpp rename to hal/src/fsfw-hal/stm32h7/gpio/gpio.cpp diff --git a/hal/src/fsfw/hal/stm32h7/gpio/gpio.h b/hal/src/fsfw-hal/stm32h7/gpio/gpio.h similarity index 100% rename from hal/src/fsfw/hal/stm32h7/gpio/gpio.h rename to hal/src/fsfw-hal/stm32h7/gpio/gpio.h diff --git a/hal/src/fsfw/hal/stm32h7/i2c/CMakeLists.txt b/hal/src/fsfw-hal/stm32h7/i2c/CMakeLists.txt similarity index 100% rename from hal/src/fsfw/hal/stm32h7/i2c/CMakeLists.txt rename to hal/src/fsfw-hal/stm32h7/i2c/CMakeLists.txt diff --git a/hal/src/fsfw/hal/stm32h7/interrupts.h b/hal/src/fsfw-hal/stm32h7/interrupts.h similarity index 100% rename from hal/src/fsfw/hal/stm32h7/interrupts.h rename to hal/src/fsfw-hal/stm32h7/interrupts.h diff --git a/hal/src/fsfw/hal/stm32h7/spi/CMakeLists.txt b/hal/src/fsfw-hal/stm32h7/spi/CMakeLists.txt similarity index 100% rename from hal/src/fsfw/hal/stm32h7/spi/CMakeLists.txt rename to hal/src/fsfw-hal/stm32h7/spi/CMakeLists.txt diff --git a/hal/src/fsfw/hal/stm32h7/spi/SpiComIF.cpp b/hal/src/fsfw-hal/stm32h7/spi/SpiComIF.cpp similarity index 100% rename from hal/src/fsfw/hal/stm32h7/spi/SpiComIF.cpp rename to hal/src/fsfw-hal/stm32h7/spi/SpiComIF.cpp diff --git a/hal/src/fsfw/hal/stm32h7/spi/SpiComIF.h b/hal/src/fsfw-hal/stm32h7/spi/SpiComIF.h similarity index 100% rename from hal/src/fsfw/hal/stm32h7/spi/SpiComIF.h rename to hal/src/fsfw-hal/stm32h7/spi/SpiComIF.h diff --git a/hal/src/fsfw/hal/stm32h7/spi/SpiCookie.cpp b/hal/src/fsfw-hal/stm32h7/spi/SpiCookie.cpp similarity index 100% rename from hal/src/fsfw/hal/stm32h7/spi/SpiCookie.cpp rename to hal/src/fsfw-hal/stm32h7/spi/SpiCookie.cpp diff --git a/hal/src/fsfw/hal/stm32h7/spi/SpiCookie.h b/hal/src/fsfw-hal/stm32h7/spi/SpiCookie.h similarity index 100% rename from hal/src/fsfw/hal/stm32h7/spi/SpiCookie.h rename to hal/src/fsfw-hal/stm32h7/spi/SpiCookie.h diff --git a/hal/src/fsfw/hal/stm32h7/spi/mspInit.cpp b/hal/src/fsfw-hal/stm32h7/spi/mspInit.cpp similarity index 100% rename from hal/src/fsfw/hal/stm32h7/spi/mspInit.cpp rename to hal/src/fsfw-hal/stm32h7/spi/mspInit.cpp diff --git a/hal/src/fsfw/hal/stm32h7/spi/mspInit.h b/hal/src/fsfw-hal/stm32h7/spi/mspInit.h similarity index 100% rename from hal/src/fsfw/hal/stm32h7/spi/mspInit.h rename to hal/src/fsfw-hal/stm32h7/spi/mspInit.h diff --git a/hal/src/fsfw/hal/stm32h7/spi/spiCore.cpp b/hal/src/fsfw-hal/stm32h7/spi/spiCore.cpp similarity index 100% rename from hal/src/fsfw/hal/stm32h7/spi/spiCore.cpp rename to hal/src/fsfw-hal/stm32h7/spi/spiCore.cpp diff --git a/hal/src/fsfw/hal/stm32h7/spi/spiCore.h b/hal/src/fsfw-hal/stm32h7/spi/spiCore.h similarity index 100% rename from hal/src/fsfw/hal/stm32h7/spi/spiCore.h rename to hal/src/fsfw-hal/stm32h7/spi/spiCore.h diff --git a/hal/src/fsfw/hal/stm32h7/spi/spiDefinitions.cpp b/hal/src/fsfw-hal/stm32h7/spi/spiDefinitions.cpp similarity index 100% rename from hal/src/fsfw/hal/stm32h7/spi/spiDefinitions.cpp rename to hal/src/fsfw-hal/stm32h7/spi/spiDefinitions.cpp diff --git a/hal/src/fsfw/hal/stm32h7/spi/spiDefinitions.h b/hal/src/fsfw-hal/stm32h7/spi/spiDefinitions.h similarity index 100% rename from hal/src/fsfw/hal/stm32h7/spi/spiDefinitions.h rename to hal/src/fsfw-hal/stm32h7/spi/spiDefinitions.h diff --git a/hal/src/fsfw/hal/stm32h7/spi/spiInterrupts.cpp b/hal/src/fsfw-hal/stm32h7/spi/spiInterrupts.cpp similarity index 100% rename from hal/src/fsfw/hal/stm32h7/spi/spiInterrupts.cpp rename to hal/src/fsfw-hal/stm32h7/spi/spiInterrupts.cpp diff --git a/hal/src/fsfw/hal/stm32h7/spi/spiInterrupts.h b/hal/src/fsfw-hal/stm32h7/spi/spiInterrupts.h similarity index 100% rename from hal/src/fsfw/hal/stm32h7/spi/spiInterrupts.h rename to hal/src/fsfw-hal/stm32h7/spi/spiInterrupts.h diff --git a/hal/src/fsfw/hal/stm32h7/spi/stm32h743ziSpi.cpp b/hal/src/fsfw-hal/stm32h7/spi/stm32h743ziSpi.cpp similarity index 100% rename from hal/src/fsfw/hal/stm32h7/spi/stm32h743ziSpi.cpp rename to hal/src/fsfw-hal/stm32h7/spi/stm32h743ziSpi.cpp diff --git a/hal/src/fsfw/hal/stm32h7/spi/stm32h743ziSpi.h b/hal/src/fsfw-hal/stm32h7/spi/stm32h743ziSpi.h similarity index 100% rename from hal/src/fsfw/hal/stm32h7/spi/stm32h743ziSpi.h rename to hal/src/fsfw-hal/stm32h7/spi/stm32h743ziSpi.h diff --git a/hal/src/fsfw/hal/stm32h7/uart/CMakeLists.txt b/hal/src/fsfw-hal/stm32h7/uart/CMakeLists.txt similarity index 100% rename from hal/src/fsfw/hal/stm32h7/uart/CMakeLists.txt rename to hal/src/fsfw-hal/stm32h7/uart/CMakeLists.txt diff --git a/hal/src/fsfw/CMakeLists.txt b/hal/src/fsfw/CMakeLists.txt deleted file mode 100644 index c034e0b7..00000000 --- a/hal/src/fsfw/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(hal) diff --git a/tests/src/CMakeLists.txt b/tests/src/CMakeLists.txt index ed2f2522..18bf7f8c 100644 --- a/tests/src/CMakeLists.txt +++ b/tests/src/CMakeLists.txt @@ -6,4 +6,4 @@ target_include_directories(${LIB_FSFW_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ) -add_subdirectory(fsfw) +add_subdirectory(fsfw-tests) diff --git a/tests/src/fsfw/tests/CMakeLists.txt b/tests/src/fsfw-tests/CMakeLists.txt similarity index 100% rename from tests/src/fsfw/tests/CMakeLists.txt rename to tests/src/fsfw-tests/CMakeLists.txt diff --git a/tests/src/fsfw/tests/internal/CMakeLists.txt b/tests/src/fsfw-tests/internal/CMakeLists.txt similarity index 100% rename from tests/src/fsfw/tests/internal/CMakeLists.txt rename to tests/src/fsfw-tests/internal/CMakeLists.txt diff --git a/tests/src/fsfw/tests/internal/InternalUnitTester.cpp b/tests/src/fsfw-tests/internal/InternalUnitTester.cpp similarity index 100% rename from tests/src/fsfw/tests/internal/InternalUnitTester.cpp rename to tests/src/fsfw-tests/internal/InternalUnitTester.cpp diff --git a/tests/src/fsfw/tests/internal/InternalUnitTester.h b/tests/src/fsfw-tests/internal/InternalUnitTester.h similarity index 100% rename from tests/src/fsfw/tests/internal/InternalUnitTester.h rename to tests/src/fsfw-tests/internal/InternalUnitTester.h diff --git a/tests/src/fsfw/tests/internal/UnittDefinitions.cpp b/tests/src/fsfw-tests/internal/UnittDefinitions.cpp similarity index 100% rename from tests/src/fsfw/tests/internal/UnittDefinitions.cpp rename to tests/src/fsfw-tests/internal/UnittDefinitions.cpp diff --git a/tests/src/fsfw/tests/internal/UnittDefinitions.h b/tests/src/fsfw-tests/internal/UnittDefinitions.h similarity index 100% rename from tests/src/fsfw/tests/internal/UnittDefinitions.h rename to tests/src/fsfw-tests/internal/UnittDefinitions.h diff --git a/tests/src/fsfw/tests/internal/globalfunctions/CMakeLists.txt b/tests/src/fsfw-tests/internal/globalfunctions/CMakeLists.txt similarity index 100% rename from tests/src/fsfw/tests/internal/globalfunctions/CMakeLists.txt rename to tests/src/fsfw-tests/internal/globalfunctions/CMakeLists.txt diff --git a/tests/src/fsfw/tests/internal/globalfunctions/TestArrayPrinter.cpp b/tests/src/fsfw-tests/internal/globalfunctions/TestArrayPrinter.cpp similarity index 100% rename from tests/src/fsfw/tests/internal/globalfunctions/TestArrayPrinter.cpp rename to tests/src/fsfw-tests/internal/globalfunctions/TestArrayPrinter.cpp diff --git a/tests/src/fsfw/tests/internal/globalfunctions/TestArrayPrinter.h b/tests/src/fsfw-tests/internal/globalfunctions/TestArrayPrinter.h similarity index 100% rename from tests/src/fsfw/tests/internal/globalfunctions/TestArrayPrinter.h rename to tests/src/fsfw-tests/internal/globalfunctions/TestArrayPrinter.h diff --git a/tests/src/fsfw/tests/internal/osal/CMakeLists.txt b/tests/src/fsfw-tests/internal/osal/CMakeLists.txt similarity index 100% rename from tests/src/fsfw/tests/internal/osal/CMakeLists.txt rename to tests/src/fsfw-tests/internal/osal/CMakeLists.txt diff --git a/tests/src/fsfw/tests/internal/osal/IntTestMq.cpp b/tests/src/fsfw-tests/internal/osal/IntTestMq.cpp similarity index 100% rename from tests/src/fsfw/tests/internal/osal/IntTestMq.cpp rename to tests/src/fsfw-tests/internal/osal/IntTestMq.cpp diff --git a/tests/src/fsfw/tests/internal/osal/IntTestMq.h b/tests/src/fsfw-tests/internal/osal/IntTestMq.h similarity index 100% rename from tests/src/fsfw/tests/internal/osal/IntTestMq.h rename to tests/src/fsfw-tests/internal/osal/IntTestMq.h diff --git a/tests/src/fsfw/tests/internal/osal/IntTestMutex.cpp b/tests/src/fsfw-tests/internal/osal/IntTestMutex.cpp similarity index 100% rename from tests/src/fsfw/tests/internal/osal/IntTestMutex.cpp rename to tests/src/fsfw-tests/internal/osal/IntTestMutex.cpp diff --git a/tests/src/fsfw/tests/internal/osal/IntTestMutex.h b/tests/src/fsfw-tests/internal/osal/IntTestMutex.h similarity index 100% rename from tests/src/fsfw/tests/internal/osal/IntTestMutex.h rename to tests/src/fsfw-tests/internal/osal/IntTestMutex.h diff --git a/tests/src/fsfw/tests/internal/osal/IntTestSemaphore.cpp b/tests/src/fsfw-tests/internal/osal/IntTestSemaphore.cpp similarity index 100% rename from tests/src/fsfw/tests/internal/osal/IntTestSemaphore.cpp rename to tests/src/fsfw-tests/internal/osal/IntTestSemaphore.cpp diff --git a/tests/src/fsfw/tests/internal/osal/IntTestSemaphore.h b/tests/src/fsfw-tests/internal/osal/IntTestSemaphore.h similarity index 100% rename from tests/src/fsfw/tests/internal/osal/IntTestSemaphore.h rename to tests/src/fsfw-tests/internal/osal/IntTestSemaphore.h diff --git a/tests/src/fsfw/tests/internal/serialize/CMakeLists.txt b/tests/src/fsfw-tests/internal/serialize/CMakeLists.txt similarity index 100% rename from tests/src/fsfw/tests/internal/serialize/CMakeLists.txt rename to tests/src/fsfw-tests/internal/serialize/CMakeLists.txt diff --git a/tests/src/fsfw/tests/internal/serialize/IntTestSerialization.cpp b/tests/src/fsfw-tests/internal/serialize/IntTestSerialization.cpp similarity index 100% rename from tests/src/fsfw/tests/internal/serialize/IntTestSerialization.cpp rename to tests/src/fsfw-tests/internal/serialize/IntTestSerialization.cpp diff --git a/tests/src/fsfw/tests/internal/serialize/IntTestSerialization.h b/tests/src/fsfw-tests/internal/serialize/IntTestSerialization.h similarity index 100% rename from tests/src/fsfw/tests/internal/serialize/IntTestSerialization.h rename to tests/src/fsfw-tests/internal/serialize/IntTestSerialization.h diff --git a/tests/src/fsfw/tests/unit/CMakeLists.txt b/tests/src/fsfw-tests/unit/CMakeLists.txt similarity index 100% rename from tests/src/fsfw/tests/unit/CMakeLists.txt rename to tests/src/fsfw-tests/unit/CMakeLists.txt diff --git a/tests/src/fsfw/tests/unit/action/CMakeLists.txt b/tests/src/fsfw-tests/unit/action/CMakeLists.txt similarity index 100% rename from tests/src/fsfw/tests/unit/action/CMakeLists.txt rename to tests/src/fsfw-tests/unit/action/CMakeLists.txt diff --git a/tests/src/fsfw/tests/unit/action/TestActionHelper.cpp b/tests/src/fsfw-tests/unit/action/TestActionHelper.cpp similarity index 100% rename from tests/src/fsfw/tests/unit/action/TestActionHelper.cpp rename to tests/src/fsfw-tests/unit/action/TestActionHelper.cpp diff --git a/tests/src/fsfw/tests/unit/action/TestActionHelper.h b/tests/src/fsfw-tests/unit/action/TestActionHelper.h similarity index 100% rename from tests/src/fsfw/tests/unit/action/TestActionHelper.h rename to tests/src/fsfw-tests/unit/action/TestActionHelper.h diff --git a/tests/src/fsfw/tests/unit/container/CMakeLists.txt b/tests/src/fsfw-tests/unit/container/CMakeLists.txt similarity index 100% rename from tests/src/fsfw/tests/unit/container/CMakeLists.txt rename to tests/src/fsfw-tests/unit/container/CMakeLists.txt diff --git a/tests/src/fsfw/tests/unit/container/RingBufferTest.cpp b/tests/src/fsfw-tests/unit/container/RingBufferTest.cpp similarity index 100% rename from tests/src/fsfw/tests/unit/container/RingBufferTest.cpp rename to tests/src/fsfw-tests/unit/container/RingBufferTest.cpp diff --git a/tests/src/fsfw/tests/unit/container/TestArrayList.cpp b/tests/src/fsfw-tests/unit/container/TestArrayList.cpp similarity index 100% rename from tests/src/fsfw/tests/unit/container/TestArrayList.cpp rename to tests/src/fsfw-tests/unit/container/TestArrayList.cpp diff --git a/tests/src/fsfw/tests/unit/container/TestDynamicFifo.cpp b/tests/src/fsfw-tests/unit/container/TestDynamicFifo.cpp similarity index 100% rename from tests/src/fsfw/tests/unit/container/TestDynamicFifo.cpp rename to tests/src/fsfw-tests/unit/container/TestDynamicFifo.cpp diff --git a/tests/src/fsfw/tests/unit/container/TestFifo.cpp b/tests/src/fsfw-tests/unit/container/TestFifo.cpp similarity index 100% rename from tests/src/fsfw/tests/unit/container/TestFifo.cpp rename to tests/src/fsfw-tests/unit/container/TestFifo.cpp diff --git a/tests/src/fsfw/tests/unit/container/TestFixedArrayList.cpp b/tests/src/fsfw-tests/unit/container/TestFixedArrayList.cpp similarity index 100% rename from tests/src/fsfw/tests/unit/container/TestFixedArrayList.cpp rename to tests/src/fsfw-tests/unit/container/TestFixedArrayList.cpp diff --git a/tests/src/fsfw/tests/unit/container/TestFixedMap.cpp b/tests/src/fsfw-tests/unit/container/TestFixedMap.cpp similarity index 100% rename from tests/src/fsfw/tests/unit/container/TestFixedMap.cpp rename to tests/src/fsfw-tests/unit/container/TestFixedMap.cpp diff --git a/tests/src/fsfw/tests/unit/container/TestFixedOrderedMultimap.cpp b/tests/src/fsfw-tests/unit/container/TestFixedOrderedMultimap.cpp similarity index 100% rename from tests/src/fsfw/tests/unit/container/TestFixedOrderedMultimap.cpp rename to tests/src/fsfw-tests/unit/container/TestFixedOrderedMultimap.cpp diff --git a/tests/src/fsfw/tests/unit/container/TestPlacementFactory.cpp b/tests/src/fsfw-tests/unit/container/TestPlacementFactory.cpp similarity index 100% rename from tests/src/fsfw/tests/unit/container/TestPlacementFactory.cpp rename to tests/src/fsfw-tests/unit/container/TestPlacementFactory.cpp diff --git a/tests/src/fsfw/tests/unit/datapoollocal/CMakeLists.txt b/tests/src/fsfw-tests/unit/datapoollocal/CMakeLists.txt similarity index 100% rename from tests/src/fsfw/tests/unit/datapoollocal/CMakeLists.txt rename to tests/src/fsfw-tests/unit/datapoollocal/CMakeLists.txt diff --git a/tests/src/fsfw/tests/unit/datapoollocal/DataSetTest.cpp b/tests/src/fsfw-tests/unit/datapoollocal/DataSetTest.cpp similarity index 100% rename from tests/src/fsfw/tests/unit/datapoollocal/DataSetTest.cpp rename to tests/src/fsfw-tests/unit/datapoollocal/DataSetTest.cpp diff --git a/tests/src/fsfw/tests/unit/datapoollocal/LocalPoolManagerTest.cpp b/tests/src/fsfw-tests/unit/datapoollocal/LocalPoolManagerTest.cpp similarity index 100% rename from tests/src/fsfw/tests/unit/datapoollocal/LocalPoolManagerTest.cpp rename to tests/src/fsfw-tests/unit/datapoollocal/LocalPoolManagerTest.cpp diff --git a/tests/src/fsfw/tests/unit/datapoollocal/LocalPoolOwnerBase.cpp b/tests/src/fsfw-tests/unit/datapoollocal/LocalPoolOwnerBase.cpp similarity index 100% rename from tests/src/fsfw/tests/unit/datapoollocal/LocalPoolOwnerBase.cpp rename to tests/src/fsfw-tests/unit/datapoollocal/LocalPoolOwnerBase.cpp diff --git a/tests/src/fsfw/tests/unit/datapoollocal/LocalPoolOwnerBase.h b/tests/src/fsfw-tests/unit/datapoollocal/LocalPoolOwnerBase.h similarity index 100% rename from tests/src/fsfw/tests/unit/datapoollocal/LocalPoolOwnerBase.h rename to tests/src/fsfw-tests/unit/datapoollocal/LocalPoolOwnerBase.h diff --git a/tests/src/fsfw/tests/unit/datapoollocal/LocalPoolVariableTest.cpp b/tests/src/fsfw-tests/unit/datapoollocal/LocalPoolVariableTest.cpp similarity index 100% rename from tests/src/fsfw/tests/unit/datapoollocal/LocalPoolVariableTest.cpp rename to tests/src/fsfw-tests/unit/datapoollocal/LocalPoolVariableTest.cpp diff --git a/tests/src/fsfw/tests/unit/datapoollocal/LocalPoolVectorTest.cpp b/tests/src/fsfw-tests/unit/datapoollocal/LocalPoolVectorTest.cpp similarity index 100% rename from tests/src/fsfw/tests/unit/datapoollocal/LocalPoolVectorTest.cpp rename to tests/src/fsfw-tests/unit/datapoollocal/LocalPoolVectorTest.cpp diff --git a/tests/src/fsfw/tests/unit/globalfunctions/CMakeLists.txt b/tests/src/fsfw-tests/unit/globalfunctions/CMakeLists.txt similarity index 100% rename from tests/src/fsfw/tests/unit/globalfunctions/CMakeLists.txt rename to tests/src/fsfw-tests/unit/globalfunctions/CMakeLists.txt diff --git a/tests/src/fsfw/tests/unit/mocks/HkReceiverMock.h b/tests/src/fsfw-tests/unit/mocks/HkReceiverMock.h similarity index 100% rename from tests/src/fsfw/tests/unit/mocks/HkReceiverMock.h rename to tests/src/fsfw-tests/unit/mocks/HkReceiverMock.h diff --git a/tests/src/fsfw/tests/unit/mocks/MessageQueueMockBase.h b/tests/src/fsfw-tests/unit/mocks/MessageQueueMockBase.h similarity index 100% rename from tests/src/fsfw/tests/unit/mocks/MessageQueueMockBase.h rename to tests/src/fsfw-tests/unit/mocks/MessageQueueMockBase.h diff --git a/tests/src/fsfw/tests/unit/osal/CMakeLists.txt b/tests/src/fsfw-tests/unit/osal/CMakeLists.txt similarity index 100% rename from tests/src/fsfw/tests/unit/osal/CMakeLists.txt rename to tests/src/fsfw-tests/unit/osal/CMakeLists.txt diff --git a/tests/src/fsfw/tests/unit/osal/TestMessageQueue.cpp b/tests/src/fsfw-tests/unit/osal/TestMessageQueue.cpp similarity index 100% rename from tests/src/fsfw/tests/unit/osal/TestMessageQueue.cpp rename to tests/src/fsfw-tests/unit/osal/TestMessageQueue.cpp diff --git a/tests/src/fsfw/tests/unit/osal/TestSemaphore.cpp b/tests/src/fsfw-tests/unit/osal/TestSemaphore.cpp similarity index 100% rename from tests/src/fsfw/tests/unit/osal/TestSemaphore.cpp rename to tests/src/fsfw-tests/unit/osal/TestSemaphore.cpp diff --git a/tests/src/fsfw/tests/unit/serialize/CMakeLists.txt b/tests/src/fsfw-tests/unit/serialize/CMakeLists.txt similarity index 100% rename from tests/src/fsfw/tests/unit/serialize/CMakeLists.txt rename to tests/src/fsfw-tests/unit/serialize/CMakeLists.txt diff --git a/tests/src/fsfw/tests/unit/serialize/TestSerialBufferAdapter.cpp b/tests/src/fsfw-tests/unit/serialize/TestSerialBufferAdapter.cpp similarity index 100% rename from tests/src/fsfw/tests/unit/serialize/TestSerialBufferAdapter.cpp rename to tests/src/fsfw-tests/unit/serialize/TestSerialBufferAdapter.cpp diff --git a/tests/src/fsfw/tests/unit/serialize/TestSerialLinkedPacket.cpp b/tests/src/fsfw-tests/unit/serialize/TestSerialLinkedPacket.cpp similarity index 100% rename from tests/src/fsfw/tests/unit/serialize/TestSerialLinkedPacket.cpp rename to tests/src/fsfw-tests/unit/serialize/TestSerialLinkedPacket.cpp diff --git a/tests/src/fsfw/tests/unit/serialize/TestSerialLinkedPacket.h b/tests/src/fsfw-tests/unit/serialize/TestSerialLinkedPacket.h similarity index 100% rename from tests/src/fsfw/tests/unit/serialize/TestSerialLinkedPacket.h rename to tests/src/fsfw-tests/unit/serialize/TestSerialLinkedPacket.h diff --git a/tests/src/fsfw/tests/unit/serialize/TestSerialization.cpp b/tests/src/fsfw-tests/unit/serialize/TestSerialization.cpp similarity index 100% rename from tests/src/fsfw/tests/unit/serialize/TestSerialization.cpp rename to tests/src/fsfw-tests/unit/serialize/TestSerialization.cpp diff --git a/tests/src/fsfw/tests/unit/storagemanager/CMakeLists.txt b/tests/src/fsfw-tests/unit/storagemanager/CMakeLists.txt similarity index 100% rename from tests/src/fsfw/tests/unit/storagemanager/CMakeLists.txt rename to tests/src/fsfw-tests/unit/storagemanager/CMakeLists.txt diff --git a/tests/src/fsfw/tests/unit/storagemanager/TestNewAccessor.cpp b/tests/src/fsfw-tests/unit/storagemanager/TestNewAccessor.cpp similarity index 100% rename from tests/src/fsfw/tests/unit/storagemanager/TestNewAccessor.cpp rename to tests/src/fsfw-tests/unit/storagemanager/TestNewAccessor.cpp diff --git a/tests/src/fsfw/tests/unit/storagemanager/TestPool.cpp b/tests/src/fsfw-tests/unit/storagemanager/TestPool.cpp similarity index 100% rename from tests/src/fsfw/tests/unit/storagemanager/TestPool.cpp rename to tests/src/fsfw-tests/unit/storagemanager/TestPool.cpp diff --git a/tests/src/fsfw/tests/unit/tmtcpacket/CMakeLists.txt b/tests/src/fsfw-tests/unit/tmtcpacket/CMakeLists.txt similarity index 100% rename from tests/src/fsfw/tests/unit/tmtcpacket/CMakeLists.txt rename to tests/src/fsfw-tests/unit/tmtcpacket/CMakeLists.txt diff --git a/tests/src/fsfw/tests/unit/tmtcpacket/PusTmTest.cpp b/tests/src/fsfw-tests/unit/tmtcpacket/PusTmTest.cpp similarity index 100% rename from tests/src/fsfw/tests/unit/tmtcpacket/PusTmTest.cpp rename to tests/src/fsfw-tests/unit/tmtcpacket/PusTmTest.cpp diff --git a/tests/src/fsfw/CMakeLists.txt b/tests/src/fsfw/CMakeLists.txt deleted file mode 100644 index 571a126e..00000000 --- a/tests/src/fsfw/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(tests) \ No newline at end of file From aabc729e77622de9d80cddd8dedd3cb5690f8f8a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 2 Aug 2021 15:47:12 +0200 Subject: [PATCH 221/389] include changes --- CMakeLists.txt | 2 +- contrib/fsfw-contrib/CMakeLists.txt | 2 +- hal/src/fsfw-hal/common/gpio/GpioCookie.cpp | 2 +- .../fsfw-hal/devicehandlers/GyroL3GD20Handler.cpp | 2 +- hal/src/fsfw-hal/linux/UnixFileGuard.cpp | 2 +- hal/src/fsfw-hal/linux/gpio/LinuxLibgpioIF.cpp | 6 +++--- hal/src/fsfw-hal/linux/i2c/I2cComIF.cpp | 6 +++--- hal/src/fsfw-hal/linux/i2c/I2cCookie.cpp | 2 +- hal/src/fsfw-hal/linux/rpi/GpioRPi.cpp | 4 ++-- hal/src/fsfw-hal/linux/spi/SpiComIF.cpp | 8 ++++---- hal/src/fsfw-hal/linux/spi/SpiComIF.h | 2 +- hal/src/fsfw-hal/linux/spi/SpiCookie.cpp | 2 +- hal/src/fsfw-hal/linux/uart/UartComIF.cpp | 2 +- hal/src/fsfw-hal/linux/uart/UartCookie.cpp | 2 +- hal/src/fsfw-hal/linux/utility.cpp | 2 +- .../fsfw-hal/stm32h7/devicetest/GyroL3GD20H.cpp | 12 ++++++------ hal/src/fsfw-hal/stm32h7/dma.cpp | 2 +- hal/src/fsfw-hal/stm32h7/gpio/gpio.cpp | 2 +- hal/src/fsfw-hal/stm32h7/spi/SpiComIF.cpp | 12 ++++++------ hal/src/fsfw-hal/stm32h7/spi/SpiComIF.h | 2 +- hal/src/fsfw-hal/stm32h7/spi/SpiCookie.cpp | 2 +- hal/src/fsfw-hal/stm32h7/spi/mspInit.cpp | 8 ++++---- hal/src/fsfw-hal/stm32h7/spi/spiCore.cpp | 4 ++-- hal/src/fsfw-hal/stm32h7/spi/spiCore.h | 4 ++-- hal/src/fsfw-hal/stm32h7/spi/spiDefinitions.cpp | 2 +- hal/src/fsfw-hal/stm32h7/spi/spiInterrupts.cpp | 4 ++-- hal/src/fsfw-hal/stm32h7/spi/stm32h743ziSpi.cpp | 6 +++--- src/fsfw/FSFW.h.in | 1 + src/fsfw/coordinates/Sgp4Propagator.h | 2 +- src/fsfw/coordinates/coordinatesConf.h | 5 +++++ .../src/fsfw-tests/internal/InternalUnitTester.cpp | 14 +++++++------- tests/src/fsfw-tests/internal/UnittDefinitions.cpp | 2 +- .../internal/globalfunctions/TestArrayPrinter.cpp | 2 +- tests/src/fsfw-tests/internal/osal/IntTestMq.cpp | 4 ++-- .../src/fsfw-tests/internal/osal/IntTestMutex.cpp | 4 ++-- .../fsfw-tests/internal/osal/IntTestSemaphore.cpp | 4 ++-- .../internal/serialize/IntTestSerialization.cpp | 4 ++-- 37 files changed, 77 insertions(+), 71 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c75d711f..e3a526f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ option(FSFW_ADD_COORDINATES "Compile with coordinate components" OFF) option(FSFW_ADD_TMSTORAGE "Compile with tm storage components" OFF) # Contrib sources -option(FSFW_ADD_SPG4_PROPAGATOR "Add SPG4 propagator code" OFF) +option(FSFW_ADD_SGP4_PROPAGATOR "Add SGP4 propagator code" OFF) set(LIB_FSFW_NAME fsfw) add_library(${LIB_FSFW_NAME}) diff --git a/contrib/fsfw-contrib/CMakeLists.txt b/contrib/fsfw-contrib/CMakeLists.txt index 3a987228..3a7e4182 100644 --- a/contrib/fsfw-contrib/CMakeLists.txt +++ b/contrib/fsfw-contrib/CMakeLists.txt @@ -1,4 +1,4 @@ -if(FSFW_ADD_SPG4_PROPAGATOR) +if(FSFW_ADD_SGP4_PROPAGATOR) target_sources(${LIB_FSFW_NAME} PRIVATE sgp4/sgp4unit.cpp ) diff --git a/hal/src/fsfw-hal/common/gpio/GpioCookie.cpp b/hal/src/fsfw-hal/common/gpio/GpioCookie.cpp index 31832070..4d221ed9 100644 --- a/hal/src/fsfw-hal/common/gpio/GpioCookie.cpp +++ b/hal/src/fsfw-hal/common/gpio/GpioCookie.cpp @@ -1,4 +1,4 @@ -#include "fsfw/hal/common/gpio/GpioCookie.h" +#include "fsfw-hal/common/gpio/GpioCookie.h" #include "fsfw/serviceinterface/ServiceInterface.h" GpioCookie::GpioCookie() { diff --git a/hal/src/fsfw-hal/devicehandlers/GyroL3GD20Handler.cpp b/hal/src/fsfw-hal/devicehandlers/GyroL3GD20Handler.cpp index 11f7e92d..539877cc 100644 --- a/hal/src/fsfw-hal/devicehandlers/GyroL3GD20Handler.cpp +++ b/hal/src/fsfw-hal/devicehandlers/GyroL3GD20Handler.cpp @@ -1,4 +1,4 @@ -#include "fsfw/hal/devicehandlers/GyroL3GD20Handler.h" +#include "fsfw-hal/devicehandlers/GyroL3GD20Handler.h" #include "fsfw/datapool/PoolReadGuard.h" diff --git a/hal/src/fsfw-hal/linux/UnixFileGuard.cpp b/hal/src/fsfw-hal/linux/UnixFileGuard.cpp index c47e35b1..31280844 100644 --- a/hal/src/fsfw-hal/linux/UnixFileGuard.cpp +++ b/hal/src/fsfw-hal/linux/UnixFileGuard.cpp @@ -1,4 +1,4 @@ -#include "fsfw/hal/linux/UnixFileGuard.h" +#include "fsfw-hal/linux/UnixFileGuard.h" UnixFileGuard::UnixFileGuard(std::string device, int* fileDescriptor, int flags, std::string diagnosticPrefix): diff --git a/hal/src/fsfw-hal/linux/gpio/LinuxLibgpioIF.cpp b/hal/src/fsfw-hal/linux/gpio/LinuxLibgpioIF.cpp index 98e02796..57396169 100644 --- a/hal/src/fsfw-hal/linux/gpio/LinuxLibgpioIF.cpp +++ b/hal/src/fsfw-hal/linux/gpio/LinuxLibgpioIF.cpp @@ -1,6 +1,6 @@ -#include "fsfw/hal/linux/gpio/LinuxLibgpioIF.h" -#include "fsfw/hal/common/gpio/gpioDefinitions.h" -#include "fsfw/hal/common/gpio/GpioCookie.h" +#include "fsfw-hal/linux/gpio/LinuxLibgpioIF.h" +#include "fsfw-hal/common/gpio/gpioDefinitions.h" +#include "fsfw-hal/common/gpio/GpioCookie.h" #include diff --git a/hal/src/fsfw-hal/linux/i2c/I2cComIF.cpp b/hal/src/fsfw-hal/linux/i2c/I2cComIF.cpp index d756e75e..b1d3da9e 100644 --- a/hal/src/fsfw-hal/linux/i2c/I2cComIF.cpp +++ b/hal/src/fsfw-hal/linux/i2c/I2cComIF.cpp @@ -1,6 +1,6 @@ -#include "fsfw/hal/linux/i2c/I2cComIF.h" -#include "fsfw/hal/linux/utility.h" -#include "fsfw/hal/linux/UnixFileGuard.h" +#include "fsfw-hal/linux/i2c/I2cComIF.h" +#include "fsfw-hal/linux/utility.h" +#include "fsfw-hal/linux/UnixFileGuard.h" #include "fsfw/serviceinterface/ServiceInterface.h" diff --git a/hal/src/fsfw-hal/linux/i2c/I2cCookie.cpp b/hal/src/fsfw-hal/linux/i2c/I2cCookie.cpp index fd0f654d..c3297f1e 100644 --- a/hal/src/fsfw-hal/linux/i2c/I2cCookie.cpp +++ b/hal/src/fsfw-hal/linux/i2c/I2cCookie.cpp @@ -1,4 +1,4 @@ -#include "fsfw/hal/linux/i2c/I2cCookie.h" +#include "fsfw-hal/linux/i2c/I2cCookie.h" I2cCookie::I2cCookie(address_t i2cAddress_, size_t maxReplyLen_, std::string deviceFile_) : diff --git a/hal/src/fsfw-hal/linux/rpi/GpioRPi.cpp b/hal/src/fsfw-hal/linux/rpi/GpioRPi.cpp index 277a9fb2..c4cc51ff 100644 --- a/hal/src/fsfw-hal/linux/rpi/GpioRPi.cpp +++ b/hal/src/fsfw-hal/linux/rpi/GpioRPi.cpp @@ -1,7 +1,7 @@ #include "fsfw/FSFW.h" -#include "fsfw/hal/linux/rpi/GpioRPi.h" -#include "fsfw/hal/common/gpio/GpioCookie.h" +#include "fsfw-hal/linux/rpi/GpioRPi.h" +#include "fsfw-hal/common/gpio/GpioCookie.h" #include diff --git a/hal/src/fsfw-hal/linux/spi/SpiComIF.cpp b/hal/src/fsfw-hal/linux/spi/SpiComIF.cpp index f3d8ab09..35aa6c29 100644 --- a/hal/src/fsfw-hal/linux/spi/SpiComIF.cpp +++ b/hal/src/fsfw-hal/linux/spi/SpiComIF.cpp @@ -1,8 +1,8 @@ #include "fsfw/FSFW.h" -#include "fsfw/hal/linux/spi/SpiComIF.h" -#include "fsfw/hal/linux/spi/SpiCookie.h" -#include "fsfw/hal/linux/utility.h" -#include "fsfw/hal/linux/UnixFileGuard.h" +#include "fsfw-hal/linux/spi/SpiComIF.h" +#include "fsfw-hal/linux/spi/SpiCookie.h" +#include "fsfw-hal/linux/utility.h" +#include "fsfw-hal/linux/UnixFileGuard.h" #include #include diff --git a/hal/src/fsfw-hal/linux/spi/SpiComIF.h b/hal/src/fsfw-hal/linux/spi/SpiComIF.h index 7f66b8e5..daabf6be 100644 --- a/hal/src/fsfw-hal/linux/spi/SpiComIF.h +++ b/hal/src/fsfw-hal/linux/spi/SpiComIF.h @@ -3,7 +3,7 @@ #include "spiDefinitions.h" #include "returnvalues/classIds.h" -#include "fsfw/hal/common/gpio/GpioIF.h" +#include "fsfw-hal/common/gpio/GpioIF.h" #include "fsfw/devicehandlers/DeviceCommunicationIF.h" #include "fsfw/objectmanager/SystemObject.h" diff --git a/hal/src/fsfw-hal/linux/spi/SpiCookie.cpp b/hal/src/fsfw-hal/linux/spi/SpiCookie.cpp index a74bc419..1f1806c2 100644 --- a/hal/src/fsfw-hal/linux/spi/SpiCookie.cpp +++ b/hal/src/fsfw-hal/linux/spi/SpiCookie.cpp @@ -1,4 +1,4 @@ -#include "fsfw/hal/linux/spi/SpiCookie.h" +#include "fsfw-hal/linux/spi/SpiCookie.h" SpiCookie::SpiCookie(address_t spiAddress, gpioId_t chipSelect, std::string spiDev, const size_t maxSize, spi::SpiModes spiMode, uint32_t spiSpeed): diff --git a/hal/src/fsfw-hal/linux/uart/UartComIF.cpp b/hal/src/fsfw-hal/linux/uart/UartComIF.cpp index e5fc90c3..c6e192c5 100644 --- a/hal/src/fsfw-hal/linux/uart/UartComIF.cpp +++ b/hal/src/fsfw-hal/linux/uart/UartComIF.cpp @@ -1,4 +1,4 @@ -#include "fsfw/hal/linux/uart/UartComIF.h" +#include "fsfw-hal/linux/uart/UartComIF.h" #include "OBSWConfig.h" #include "fsfw/serviceinterface/ServiceInterface.h" diff --git a/hal/src/fsfw-hal/linux/uart/UartCookie.cpp b/hal/src/fsfw-hal/linux/uart/UartCookie.cpp index bfd091a8..5156d9b8 100644 --- a/hal/src/fsfw-hal/linux/uart/UartCookie.cpp +++ b/hal/src/fsfw-hal/linux/uart/UartCookie.cpp @@ -1,4 +1,4 @@ -#include "fsfw/hal/linux/uart/UartCookie.h" +#include "fsfw-hal/linux/uart/UartCookie.h" #include diff --git a/hal/src/fsfw-hal/linux/utility.cpp b/hal/src/fsfw-hal/linux/utility.cpp index 04fded6c..6120f983 100644 --- a/hal/src/fsfw-hal/linux/utility.cpp +++ b/hal/src/fsfw-hal/linux/utility.cpp @@ -1,6 +1,6 @@ #include "fsfw/FSFW.h" #include "fsfw/serviceinterface/ServiceInterface.h" -#include "fsfw/hal/linux/utility.h" +#include "fsfw-hal/linux/utility.h" #include #include diff --git a/hal/src/fsfw-hal/stm32h7/devicetest/GyroL3GD20H.cpp b/hal/src/fsfw-hal/stm32h7/devicetest/GyroL3GD20H.cpp index 04b1de3b..7e5d0d51 100644 --- a/hal/src/fsfw-hal/stm32h7/devicetest/GyroL3GD20H.cpp +++ b/hal/src/fsfw-hal/stm32h7/devicetest/GyroL3GD20H.cpp @@ -1,10 +1,10 @@ -#include "fsfw/hal/stm32h7/devicetest/GyroL3GD20H.h" +#include "fsfw-hal/stm32h7/devicetest/GyroL3GD20H.h" -#include "fsfw/hal/stm32h7/spi/mspInit.h" -#include "fsfw/hal/stm32h7/spi/spiDefinitions.h" -#include "fsfw/hal/stm32h7/spi/spiCore.h" -#include "fsfw/hal/stm32h7/spi/spiInterrupts.h" -#include "fsfw/hal/stm32h7/spi/stm32h743ziSpi.h" +#include "fsfw-hal/stm32h7/spi/mspInit.h" +#include "fsfw-hal/stm32h7/spi/spiDefinitions.h" +#include "fsfw-hal/stm32h7/spi/spiCore.h" +#include "fsfw-hal/stm32h7/spi/spiInterrupts.h" +#include "fsfw-hal/stm32h7/spi/stm32h743ziSpi.h" #include "fsfw/tasks/TaskFactory.h" #include "fsfw/serviceinterface/ServiceInterface.h" diff --git a/hal/src/fsfw-hal/stm32h7/dma.cpp b/hal/src/fsfw-hal/stm32h7/dma.cpp index 288e4294..97cd93a2 100644 --- a/hal/src/fsfw-hal/stm32h7/dma.cpp +++ b/hal/src/fsfw-hal/stm32h7/dma.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/hal/src/fsfw-hal/stm32h7/gpio/gpio.cpp b/hal/src/fsfw-hal/stm32h7/gpio/gpio.cpp index 927588a3..d8b24270 100644 --- a/hal/src/fsfw-hal/stm32h7/gpio/gpio.cpp +++ b/hal/src/fsfw-hal/stm32h7/gpio/gpio.cpp @@ -1,4 +1,4 @@ -#include "fsfw/hal/stm32h7/gpio/gpio.h" +#include "fsfw-hal/stm32h7/gpio/gpio.h" #include "stm32h7xx_hal_rcc.h" diff --git a/hal/src/fsfw-hal/stm32h7/spi/SpiComIF.cpp b/hal/src/fsfw-hal/stm32h7/spi/SpiComIF.cpp index da34c4c0..f91602f9 100644 --- a/hal/src/fsfw-hal/stm32h7/spi/SpiComIF.cpp +++ b/hal/src/fsfw-hal/stm32h7/spi/SpiComIF.cpp @@ -1,11 +1,11 @@ -#include "fsfw/hal/stm32h7/spi/SpiComIF.h" -#include "fsfw/hal/stm32h7/spi/SpiCookie.h" +#include "fsfw-hal/stm32h7/spi/SpiComIF.h" +#include "fsfw-hal/stm32h7/spi/SpiCookie.h" #include "fsfw/tasks/SemaphoreFactory.h" -#include "fsfw/hal/stm32h7/spi/spiCore.h" -#include "fsfw/hal/stm32h7/spi/spiInterrupts.h" -#include "fsfw/hal/stm32h7/spi/mspInit.h" -#include "fsfw/hal/stm32h7/gpio/gpio.h" +#include "fsfw-hal/stm32h7/spi/spiCore.h" +#include "fsfw-hal/stm32h7/spi/spiInterrupts.h" +#include "fsfw-hal/stm32h7/spi/mspInit.h" +#include "fsfw-hal/stm32h7/gpio/gpio.h" // FreeRTOS required special Semaphore handling from an ISR. Therefore, we use the concrete // instance here, because RTEMS and FreeRTOS are the only relevant OSALs currently diff --git a/hal/src/fsfw-hal/stm32h7/spi/SpiComIF.h b/hal/src/fsfw-hal/stm32h7/spi/SpiComIF.h index 00625b34..e97aebe7 100644 --- a/hal/src/fsfw-hal/stm32h7/spi/SpiComIF.h +++ b/hal/src/fsfw-hal/stm32h7/spi/SpiComIF.h @@ -5,7 +5,7 @@ #include "fsfw/devicehandlers/DeviceCommunicationIF.h" #include "fsfw/objectmanager/SystemObject.h" -#include "fsfw/hal/stm32h7/spi/spiDefinitions.h" +#include "fsfw-hal/stm32h7/spi/spiDefinitions.h" #include "stm32h7xx_hal_spi.h" #include "stm32h743xx.h" diff --git a/hal/src/fsfw-hal/stm32h7/spi/SpiCookie.cpp b/hal/src/fsfw-hal/stm32h7/spi/SpiCookie.cpp index 82d705c2..b37d3ae9 100644 --- a/hal/src/fsfw-hal/stm32h7/spi/SpiCookie.cpp +++ b/hal/src/fsfw-hal/stm32h7/spi/SpiCookie.cpp @@ -1,4 +1,4 @@ -#include "fsfw/hal/stm32h7/spi/SpiCookie.h" +#include "fsfw-hal/stm32h7/spi/SpiCookie.h" SpiCookie::SpiCookie(address_t deviceAddress, spi::SpiBus spiIdx, spi::TransferModes transferMode, diff --git a/hal/src/fsfw-hal/stm32h7/spi/mspInit.cpp b/hal/src/fsfw-hal/stm32h7/spi/mspInit.cpp index 424a8bfb..17ff45f9 100644 --- a/hal/src/fsfw-hal/stm32h7/spi/mspInit.cpp +++ b/hal/src/fsfw-hal/stm32h7/spi/mspInit.cpp @@ -1,7 +1,7 @@ -#include "fsfw/hal/stm32h7/dma.h" -#include "fsfw/hal/stm32h7/spi/mspInit.h" -#include "fsfw/hal/stm32h7/spi/spiCore.h" -#include "fsfw/hal/stm32h7/spi/spiInterrupts.h" +#include "fsfw-hal/stm32h7/dma.h" +#include "fsfw-hal/stm32h7/spi/mspInit.h" +#include "fsfw-hal/stm32h7/spi/spiCore.h" +#include "fsfw-hal/stm32h7/spi/spiInterrupts.h" #include "stm32h743xx.h" #include "stm32h7xx_hal_spi.h" diff --git a/hal/src/fsfw-hal/stm32h7/spi/spiCore.cpp b/hal/src/fsfw-hal/stm32h7/spi/spiCore.cpp index a72bf12b..aa3c32ce 100644 --- a/hal/src/fsfw-hal/stm32h7/spi/spiCore.cpp +++ b/hal/src/fsfw-hal/stm32h7/spi/spiCore.cpp @@ -1,5 +1,5 @@ -#include "fsfw/hal/stm32h7/spi/spiCore.h" -#include "fsfw/hal/stm32h7/spi/spiDefinitions.h" +#include "fsfw-hal/stm32h7/spi/spiCore.h" +#include "fsfw-hal/stm32h7/spi/spiDefinitions.h" #include diff --git a/hal/src/fsfw-hal/stm32h7/spi/spiCore.h b/hal/src/fsfw-hal/stm32h7/spi/spiCore.h index bff90a5b..ba4e1430 100644 --- a/hal/src/fsfw-hal/stm32h7/spi/spiCore.h +++ b/hal/src/fsfw-hal/stm32h7/spi/spiCore.h @@ -1,8 +1,8 @@ #ifndef FSFW_HAL_STM32H7_SPI_SPICORE_H_ #define FSFW_HAL_STM32H7_SPI_SPICORE_H_ -#include "fsfw/hal/stm32h7/dma.h" -#include "fsfw/hal/stm32h7/spi/spiDefinitions.h" +#include "fsfw-hal/stm32h7/dma.h" +#include "fsfw-hal/stm32h7/spi/spiDefinitions.h" #include "stm32h7xx_hal.h" #include "stm32h7xx_hal_dma.h" diff --git a/hal/src/fsfw-hal/stm32h7/spi/spiDefinitions.cpp b/hal/src/fsfw-hal/stm32h7/spi/spiDefinitions.cpp index 6a83ae42..7573640c 100644 --- a/hal/src/fsfw-hal/stm32h7/spi/spiDefinitions.cpp +++ b/hal/src/fsfw-hal/stm32h7/spi/spiDefinitions.cpp @@ -1,4 +1,4 @@ -#include "fsfw/hal/stm32h7/spi/spiDefinitions.h" +#include "fsfw-hal/stm32h7/spi/spiDefinitions.h" void spi::assignSpiMode(SpiModes spiMode, SPI_HandleTypeDef& spiHandle) { switch(spiMode) { diff --git a/hal/src/fsfw-hal/stm32h7/spi/spiInterrupts.cpp b/hal/src/fsfw-hal/stm32h7/spi/spiInterrupts.cpp index 90cfe706..c3ca6603 100644 --- a/hal/src/fsfw-hal/stm32h7/spi/spiInterrupts.cpp +++ b/hal/src/fsfw-hal/stm32h7/spi/spiInterrupts.cpp @@ -1,5 +1,5 @@ -#include "fsfw/hal/stm32h7/spi/spiInterrupts.h" -#include "fsfw/hal/stm32h7/spi/spiCore.h" +#include "fsfw-hal/stm32h7/spi/spiInterrupts.h" +#include "fsfw-hal/stm32h7/spi/spiCore.h" #include "stm32h7xx_hal.h" #include "stm32h7xx_hal_dma.h" diff --git a/hal/src/fsfw-hal/stm32h7/spi/stm32h743ziSpi.cpp b/hal/src/fsfw-hal/stm32h7/spi/stm32h743ziSpi.cpp index f1f2815e..c6be862f 100644 --- a/hal/src/fsfw-hal/stm32h7/spi/stm32h743ziSpi.cpp +++ b/hal/src/fsfw-hal/stm32h7/spi/stm32h743ziSpi.cpp @@ -1,6 +1,6 @@ -#include "fsfw/hal/stm32h7/spi/stm32h743ziSpi.h" -#include "fsfw/hal/stm32h7/spi/spiCore.h" -#include "fsfw/hal/stm32h7/spi/spiInterrupts.h" +#include "fsfw-hal/stm32h7/spi/stm32h743ziSpi.h" +#include "fsfw-hal/stm32h7/spi/spiCore.h" +#include "fsfw-hal/stm32h7/spi/spiInterrupts.h" #include "stm32h7xx_hal.h" #include "stm32h7xx_hal_rcc.h" diff --git a/src/fsfw/FSFW.h.in b/src/fsfw/FSFW.h.in index 9b74d04c..01379c5f 100644 --- a/src/fsfw/FSFW.h.in +++ b/src/fsfw/FSFW.h.in @@ -9,5 +9,6 @@ #cmakedefine FSFW_ADD_COORDINATES #cmakedefine FSFW_ADD_PUS #cmakedefine FSFW_ADD_MONITORING +#cmakedefine FSFW_ADD_SGP4_PROPAGATOR #endif /* FSFW_FSFW_H_ */ diff --git a/src/fsfw/coordinates/Sgp4Propagator.h b/src/fsfw/coordinates/Sgp4Propagator.h index 4f29509f..aa1e821f 100644 --- a/src/fsfw/coordinates/Sgp4Propagator.h +++ b/src/fsfw/coordinates/Sgp4Propagator.h @@ -7,7 +7,7 @@ #ifndef PLATFORM_WIN #include #endif -#include "fsfw/contrib/sgp4/sgp4unit.h" +#include "fsfw-contrib/sgp4/sgp4unit.h" #include "fsfw/returnvalues/HasReturnvaluesIF.h" class Sgp4Propagator { diff --git a/src/fsfw/coordinates/coordinatesConf.h b/src/fsfw/coordinates/coordinatesConf.h index ce798e6f..9c1c3754 100644 --- a/src/fsfw/coordinates/coordinatesConf.h +++ b/src/fsfw/coordinates/coordinatesConf.h @@ -8,4 +8,9 @@ not enabled with FSFW_ADD_COORDINATES #endif +#ifndef FSFW_ADD_SGP4_PROPAGATOR +#warning Coordinates files were included but SGP4 contributed code compilation was \ + not enabled with FSFW_ADD_SGP4_PROPAGATOR +#endif + #endif /* FSFW_SRC_FSFW_COORDINATES_COORDINATESCONF_H_ */ diff --git a/tests/src/fsfw-tests/internal/InternalUnitTester.cpp b/tests/src/fsfw-tests/internal/InternalUnitTester.cpp index 8631ce0d..8fc7cb68 100644 --- a/tests/src/fsfw-tests/internal/InternalUnitTester.cpp +++ b/tests/src/fsfw-tests/internal/InternalUnitTester.cpp @@ -1,11 +1,11 @@ -#include "fsfw/tests/internal/InternalUnitTester.h" -#include "fsfw/tests/internal/UnittDefinitions.h" +#include "fsfw-tests/internal/InternalUnitTester.h" +#include "fsfw-tests/internal/UnittDefinitions.h" -#include "fsfw/tests/internal/osal/IntTestMq.h" -#include "fsfw/tests/internal/osal/IntTestSemaphore.h" -#include "fsfw/tests/internal/osal/IntTestMutex.h" -#include "fsfw/tests/internal/serialize/IntTestSerialization.h" -#include "fsfw/tests/internal/globalfunctions/TestArrayPrinter.h" +#include "fsfw-tests/internal/osal/IntTestMq.h" +#include "fsfw-tests/internal/osal/IntTestSemaphore.h" +#include "fsfw-tests/internal/osal/IntTestMutex.h" +#include "fsfw-tests/internal/serialize/IntTestSerialization.h" +#include "fsfw-tests/internal/globalfunctions/TestArrayPrinter.h" #include diff --git a/tests/src/fsfw-tests/internal/UnittDefinitions.cpp b/tests/src/fsfw-tests/internal/UnittDefinitions.cpp index 74fd53be..eaef0bfe 100644 --- a/tests/src/fsfw-tests/internal/UnittDefinitions.cpp +++ b/tests/src/fsfw-tests/internal/UnittDefinitions.cpp @@ -1,4 +1,4 @@ -#include "fsfw/tests/internal/UnittDefinitions.h" +#include "fsfw-tests/internal/UnittDefinitions.h" ReturnValue_t unitt::put_error(std::string errorId) { #if FSFW_CPP_OSTREAM_ENABLED == 1 diff --git a/tests/src/fsfw-tests/internal/globalfunctions/TestArrayPrinter.cpp b/tests/src/fsfw-tests/internal/globalfunctions/TestArrayPrinter.cpp index 90578095..f1a0378e 100644 --- a/tests/src/fsfw-tests/internal/globalfunctions/TestArrayPrinter.cpp +++ b/tests/src/fsfw-tests/internal/globalfunctions/TestArrayPrinter.cpp @@ -1,4 +1,4 @@ -#include "fsfw/tests/internal/globalfunctions/TestArrayPrinter.h" +#include "fsfw-tests/internal/globalfunctions/TestArrayPrinter.h" void arrayprinter::testArrayPrinter() { { diff --git a/tests/src/fsfw-tests/internal/osal/IntTestMq.cpp b/tests/src/fsfw-tests/internal/osal/IntTestMq.cpp index 91bc2c6d..5ea3ec34 100644 --- a/tests/src/fsfw-tests/internal/osal/IntTestMq.cpp +++ b/tests/src/fsfw-tests/internal/osal/IntTestMq.cpp @@ -1,5 +1,5 @@ -#include "fsfw/tests/internal/osal/IntTestMq.h" -#include "fsfw/tests/internal/UnittDefinitions.h" +#include "fsfw-tests/internal/osal/IntTestMq.h" +#include "fsfw-tests/internal/UnittDefinitions.h" #include #include diff --git a/tests/src/fsfw-tests/internal/osal/IntTestMutex.cpp b/tests/src/fsfw-tests/internal/osal/IntTestMutex.cpp index 9e7c1481..2d8a50c2 100644 --- a/tests/src/fsfw-tests/internal/osal/IntTestMutex.cpp +++ b/tests/src/fsfw-tests/internal/osal/IntTestMutex.cpp @@ -1,5 +1,5 @@ -#include "fsfw/tests/internal/osal/IntTestMutex.h" -#include "fsfw/tests/internal/UnittDefinitions.h" +#include "fsfw-tests/internal/osal/IntTestMutex.h" +#include "fsfw-tests/internal/UnittDefinitions.h" #include diff --git a/tests/src/fsfw-tests/internal/osal/IntTestSemaphore.cpp b/tests/src/fsfw-tests/internal/osal/IntTestSemaphore.cpp index e278e3c1..8a848d92 100644 --- a/tests/src/fsfw-tests/internal/osal/IntTestSemaphore.cpp +++ b/tests/src/fsfw-tests/internal/osal/IntTestSemaphore.cpp @@ -1,5 +1,5 @@ -#include "fsfw/tests/internal/osal/IntTestSemaphore.h" -#include "fsfw/tests/internal/UnittDefinitions.h" +#include "fsfw-tests/internal/osal/IntTestSemaphore.h" +#include "fsfw-tests/internal/UnittDefinitions.h" #include #include diff --git a/tests/src/fsfw-tests/internal/serialize/IntTestSerialization.cpp b/tests/src/fsfw-tests/internal/serialize/IntTestSerialization.cpp index 3489c759..42b4861f 100644 --- a/tests/src/fsfw-tests/internal/serialize/IntTestSerialization.cpp +++ b/tests/src/fsfw-tests/internal/serialize/IntTestSerialization.cpp @@ -1,5 +1,5 @@ -#include "fsfw/tests/internal/serialize/IntTestSerialization.h" -#include "fsfw/tests/internal/UnittDefinitions.h" +#include "fsfw-tests/internal/serialize/IntTestSerialization.h" +#include "fsfw-tests/internal/UnittDefinitions.h" #include #include From 0e5cfcf28f0183d7286d1160a40dcff2017f7795 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 2 Aug 2021 16:19:37 +0200 Subject: [PATCH 222/389] minor improvement for printout --- src/fsfw/osal/linux/unixUtility.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fsfw/osal/linux/unixUtility.cpp b/src/fsfw/osal/linux/unixUtility.cpp index 40d8c212..57e1f17a 100644 --- a/src/fsfw/osal/linux/unixUtility.cpp +++ b/src/fsfw/osal/linux/unixUtility.cpp @@ -14,7 +14,7 @@ void utility::printUnixErrorGeneric(const char* const className, #if FSFW_VERBOSE_LEVEL >= 1 if(outputType == sif::OutputTypes::OUT_ERROR) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << className << "::" << function << ":" << failString << " error: " + sif::error << className << "::" << function << ": " << failString << " error: " << strerror(errno) << std::endl; #else sif::printError("%s::%s: %s error: %s\n", className, function, failString, strerror(errno)); @@ -22,7 +22,7 @@ void utility::printUnixErrorGeneric(const char* const className, } else { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << className << "::" << function << ":" << failString << " error: " + sif::warning << className << "::" << function << ": " << failString << " error: " << strerror(errno) << std::endl; #else sif::printWarning("%s::%s: %s error: %s\n", className, function, failString, strerror(errno)); From f1f167c2d1ae2111cbbc750d3bbc411b89f950a5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 2 Aug 2021 20:55:03 +0200 Subject: [PATCH 223/389] using _ instead of - now --- contrib/CMakeLists.txt | 2 +- contrib/{fsfw-contrib => fsfw_contrib}/CMakeLists.txt | 0 contrib/{fsfw-contrib => fsfw_contrib}/sgp4/LICENSE | 0 contrib/{fsfw-contrib => fsfw_contrib}/sgp4/sgp4unit.cpp | 0 contrib/{fsfw-contrib => fsfw_contrib}/sgp4/sgp4unit.h | 0 hal/src/CMakeLists.txt | 2 +- hal/src/{fsfw-hal => fsfw_hal}/CMakeLists.txt | 0 hal/src/{fsfw-hal => fsfw_hal}/common/CMakeLists.txt | 0 hal/src/{fsfw-hal => fsfw_hal}/common/gpio/CMakeLists.txt | 0 hal/src/{fsfw-hal => fsfw_hal}/common/gpio/GpioCookie.cpp | 0 hal/src/{fsfw-hal => fsfw_hal}/common/gpio/GpioCookie.h | 0 hal/src/{fsfw-hal => fsfw_hal}/common/gpio/GpioIF.h | 0 hal/src/{fsfw-hal => fsfw_hal}/common/gpio/gpioDefinitions.h | 0 hal/src/{fsfw-hal => fsfw_hal}/common/spi/spiCommon.h | 0 hal/src/{fsfw-hal => fsfw_hal}/devicehandlers/CMakeLists.txt | 0 .../{fsfw-hal => fsfw_hal}/devicehandlers/GyroL3GD20Handler.cpp | 0 .../{fsfw-hal => fsfw_hal}/devicehandlers/GyroL3GD20Handler.h | 0 .../devicehandlers/devicedefinitions/GyroL3GD20Definitions.h | 0 hal/src/{fsfw-hal => fsfw_hal}/host/CMakeLists.txt | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/CMakeLists.txt | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/UnixFileGuard.cpp | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/UnixFileGuard.h | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/gpio/CMakeLists.txt | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/gpio/LinuxLibgpioIF.cpp | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/gpio/LinuxLibgpioIF.h | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/i2c/CMakeLists.txt | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/i2c/I2cComIF.cpp | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/i2c/I2cComIF.h | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/i2c/I2cCookie.cpp | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/i2c/I2cCookie.h | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/rpi/CMakeLists.txt | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/rpi/GpioRPi.cpp | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/rpi/GpioRPi.h | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/spi/CMakeLists.txt | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/spi/SpiComIF.cpp | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/spi/SpiComIF.h | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/spi/SpiCookie.cpp | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/spi/SpiCookie.h | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/spi/spiDefinitions.h | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/uart/CMakeLists.txt | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/uart/UartComIF.cpp | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/uart/UartComIF.h | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/uart/UartCookie.cpp | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/uart/UartCookie.h | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/utility.cpp | 0 hal/src/{fsfw-hal => fsfw_hal}/linux/utility.h | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/CMakeLists.txt | 0 .../{fsfw-hal => fsfw_hal}/stm32h7/devicetest/CMakeLists.txt | 0 .../{fsfw-hal => fsfw_hal}/stm32h7/devicetest/GyroL3GD20H.cpp | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/devicetest/GyroL3GD20H.h | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/dma.cpp | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/dma.h | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/gpio/CMakeLists.txt | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/gpio/gpio.cpp | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/gpio/gpio.h | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/i2c/CMakeLists.txt | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/interrupts.h | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/CMakeLists.txt | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/SpiComIF.cpp | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/SpiComIF.h | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/SpiCookie.cpp | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/SpiCookie.h | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/mspInit.cpp | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/mspInit.h | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/spiCore.cpp | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/spiCore.h | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/spiDefinitions.cpp | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/spiDefinitions.h | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/spiInterrupts.cpp | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/spiInterrupts.h | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/stm32h743ziSpi.cpp | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/stm32h743ziSpi.h | 0 hal/src/{fsfw-hal => fsfw_hal}/stm32h7/uart/CMakeLists.txt | 0 tests/src/CMakeLists.txt | 2 +- tests/src/{fsfw-tests => fsfw_tests}/CMakeLists.txt | 0 tests/src/{fsfw-tests => fsfw_tests}/internal/CMakeLists.txt | 0 .../{fsfw-tests => fsfw_tests}/internal/InternalUnitTester.cpp | 0 .../{fsfw-tests => fsfw_tests}/internal/InternalUnitTester.h | 0 .../{fsfw-tests => fsfw_tests}/internal/UnittDefinitions.cpp | 0 .../src/{fsfw-tests => fsfw_tests}/internal/UnittDefinitions.h | 0 .../internal/globalfunctions/CMakeLists.txt | 0 .../internal/globalfunctions/TestArrayPrinter.cpp | 0 .../internal/globalfunctions/TestArrayPrinter.h | 0 .../src/{fsfw-tests => fsfw_tests}/internal/osal/CMakeLists.txt | 0 .../src/{fsfw-tests => fsfw_tests}/internal/osal/IntTestMq.cpp | 0 tests/src/{fsfw-tests => fsfw_tests}/internal/osal/IntTestMq.h | 0 .../{fsfw-tests => fsfw_tests}/internal/osal/IntTestMutex.cpp | 0 .../src/{fsfw-tests => fsfw_tests}/internal/osal/IntTestMutex.h | 0 .../internal/osal/IntTestSemaphore.cpp | 0 .../{fsfw-tests => fsfw_tests}/internal/osal/IntTestSemaphore.h | 0 .../internal/serialize/CMakeLists.txt | 0 .../internal/serialize/IntTestSerialization.cpp | 0 .../internal/serialize/IntTestSerialization.h | 0 tests/src/{fsfw-tests => fsfw_tests}/unit/CMakeLists.txt | 0 tests/src/{fsfw-tests => fsfw_tests}/unit/action/CMakeLists.txt | 0 .../{fsfw-tests => fsfw_tests}/unit/action/TestActionHelper.cpp | 0 .../{fsfw-tests => fsfw_tests}/unit/action/TestActionHelper.h | 0 .../{fsfw-tests => fsfw_tests}/unit/container/CMakeLists.txt | 0 .../unit/container/RingBufferTest.cpp | 0 .../{fsfw-tests => fsfw_tests}/unit/container/TestArrayList.cpp | 0 .../unit/container/TestDynamicFifo.cpp | 0 .../src/{fsfw-tests => fsfw_tests}/unit/container/TestFifo.cpp | 0 .../unit/container/TestFixedArrayList.cpp | 0 .../{fsfw-tests => fsfw_tests}/unit/container/TestFixedMap.cpp | 0 .../unit/container/TestFixedOrderedMultimap.cpp | 0 .../unit/container/TestPlacementFactory.cpp | 0 .../unit/datapoollocal/CMakeLists.txt | 0 .../unit/datapoollocal/DataSetTest.cpp | 0 .../unit/datapoollocal/LocalPoolManagerTest.cpp | 0 .../unit/datapoollocal/LocalPoolOwnerBase.cpp | 0 .../unit/datapoollocal/LocalPoolOwnerBase.h | 0 .../unit/datapoollocal/LocalPoolVariableTest.cpp | 0 .../unit/datapoollocal/LocalPoolVectorTest.cpp | 0 .../unit/globalfunctions/CMakeLists.txt | 0 .../src/{fsfw-tests => fsfw_tests}/unit/mocks/HkReceiverMock.h | 0 .../unit/mocks/MessageQueueMockBase.h | 0 tests/src/{fsfw-tests => fsfw_tests}/unit/osal/CMakeLists.txt | 0 .../{fsfw-tests => fsfw_tests}/unit/osal/TestMessageQueue.cpp | 0 .../src/{fsfw-tests => fsfw_tests}/unit/osal/TestSemaphore.cpp | 0 .../{fsfw-tests => fsfw_tests}/unit/serialize/CMakeLists.txt | 0 .../unit/serialize/TestSerialBufferAdapter.cpp | 0 .../unit/serialize/TestSerialLinkedPacket.cpp | 0 .../unit/serialize/TestSerialLinkedPacket.h | 0 .../unit/serialize/TestSerialization.cpp | 0 .../unit/storagemanager/CMakeLists.txt | 0 .../unit/storagemanager/TestNewAccessor.cpp | 0 .../{fsfw-tests => fsfw_tests}/unit/storagemanager/TestPool.cpp | 0 .../{fsfw-tests => fsfw_tests}/unit/tmtcpacket/CMakeLists.txt | 0 .../{fsfw-tests => fsfw_tests}/unit/tmtcpacket/PusTmTest.cpp | 0 129 files changed, 3 insertions(+), 3 deletions(-) rename contrib/{fsfw-contrib => fsfw_contrib}/CMakeLists.txt (100%) rename contrib/{fsfw-contrib => fsfw_contrib}/sgp4/LICENSE (100%) rename contrib/{fsfw-contrib => fsfw_contrib}/sgp4/sgp4unit.cpp (100%) rename contrib/{fsfw-contrib => fsfw_contrib}/sgp4/sgp4unit.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/CMakeLists.txt (100%) rename hal/src/{fsfw-hal => fsfw_hal}/common/CMakeLists.txt (100%) rename hal/src/{fsfw-hal => fsfw_hal}/common/gpio/CMakeLists.txt (100%) rename hal/src/{fsfw-hal => fsfw_hal}/common/gpio/GpioCookie.cpp (100%) rename hal/src/{fsfw-hal => fsfw_hal}/common/gpio/GpioCookie.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/common/gpio/GpioIF.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/common/gpio/gpioDefinitions.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/common/spi/spiCommon.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/devicehandlers/CMakeLists.txt (100%) rename hal/src/{fsfw-hal => fsfw_hal}/devicehandlers/GyroL3GD20Handler.cpp (100%) rename hal/src/{fsfw-hal => fsfw_hal}/devicehandlers/GyroL3GD20Handler.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/host/CMakeLists.txt (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/CMakeLists.txt (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/UnixFileGuard.cpp (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/UnixFileGuard.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/gpio/CMakeLists.txt (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/gpio/LinuxLibgpioIF.cpp (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/gpio/LinuxLibgpioIF.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/i2c/CMakeLists.txt (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/i2c/I2cComIF.cpp (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/i2c/I2cComIF.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/i2c/I2cCookie.cpp (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/i2c/I2cCookie.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/rpi/CMakeLists.txt (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/rpi/GpioRPi.cpp (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/rpi/GpioRPi.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/spi/CMakeLists.txt (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/spi/SpiComIF.cpp (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/spi/SpiComIF.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/spi/SpiCookie.cpp (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/spi/SpiCookie.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/spi/spiDefinitions.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/uart/CMakeLists.txt (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/uart/UartComIF.cpp (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/uart/UartComIF.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/uart/UartCookie.cpp (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/uart/UartCookie.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/utility.cpp (100%) rename hal/src/{fsfw-hal => fsfw_hal}/linux/utility.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/CMakeLists.txt (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/devicetest/CMakeLists.txt (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/devicetest/GyroL3GD20H.cpp (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/devicetest/GyroL3GD20H.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/dma.cpp (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/dma.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/gpio/CMakeLists.txt (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/gpio/gpio.cpp (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/gpio/gpio.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/i2c/CMakeLists.txt (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/interrupts.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/CMakeLists.txt (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/SpiComIF.cpp (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/SpiComIF.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/SpiCookie.cpp (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/SpiCookie.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/mspInit.cpp (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/mspInit.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/spiCore.cpp (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/spiCore.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/spiDefinitions.cpp (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/spiDefinitions.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/spiInterrupts.cpp (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/spiInterrupts.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/stm32h743ziSpi.cpp (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/spi/stm32h743ziSpi.h (100%) rename hal/src/{fsfw-hal => fsfw_hal}/stm32h7/uart/CMakeLists.txt (100%) rename tests/src/{fsfw-tests => fsfw_tests}/CMakeLists.txt (100%) rename tests/src/{fsfw-tests => fsfw_tests}/internal/CMakeLists.txt (100%) rename tests/src/{fsfw-tests => fsfw_tests}/internal/InternalUnitTester.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/internal/InternalUnitTester.h (100%) rename tests/src/{fsfw-tests => fsfw_tests}/internal/UnittDefinitions.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/internal/UnittDefinitions.h (100%) rename tests/src/{fsfw-tests => fsfw_tests}/internal/globalfunctions/CMakeLists.txt (100%) rename tests/src/{fsfw-tests => fsfw_tests}/internal/globalfunctions/TestArrayPrinter.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/internal/globalfunctions/TestArrayPrinter.h (100%) rename tests/src/{fsfw-tests => fsfw_tests}/internal/osal/CMakeLists.txt (100%) rename tests/src/{fsfw-tests => fsfw_tests}/internal/osal/IntTestMq.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/internal/osal/IntTestMq.h (100%) rename tests/src/{fsfw-tests => fsfw_tests}/internal/osal/IntTestMutex.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/internal/osal/IntTestMutex.h (100%) rename tests/src/{fsfw-tests => fsfw_tests}/internal/osal/IntTestSemaphore.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/internal/osal/IntTestSemaphore.h (100%) rename tests/src/{fsfw-tests => fsfw_tests}/internal/serialize/CMakeLists.txt (100%) rename tests/src/{fsfw-tests => fsfw_tests}/internal/serialize/IntTestSerialization.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/internal/serialize/IntTestSerialization.h (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/CMakeLists.txt (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/action/CMakeLists.txt (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/action/TestActionHelper.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/action/TestActionHelper.h (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/container/CMakeLists.txt (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/container/RingBufferTest.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/container/TestArrayList.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/container/TestDynamicFifo.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/container/TestFifo.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/container/TestFixedArrayList.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/container/TestFixedMap.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/container/TestFixedOrderedMultimap.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/container/TestPlacementFactory.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/datapoollocal/CMakeLists.txt (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/datapoollocal/DataSetTest.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/datapoollocal/LocalPoolManagerTest.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/datapoollocal/LocalPoolOwnerBase.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/datapoollocal/LocalPoolOwnerBase.h (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/datapoollocal/LocalPoolVariableTest.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/datapoollocal/LocalPoolVectorTest.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/globalfunctions/CMakeLists.txt (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/mocks/HkReceiverMock.h (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/mocks/MessageQueueMockBase.h (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/osal/CMakeLists.txt (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/osal/TestMessageQueue.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/osal/TestSemaphore.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/serialize/CMakeLists.txt (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/serialize/TestSerialBufferAdapter.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/serialize/TestSerialLinkedPacket.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/serialize/TestSerialLinkedPacket.h (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/serialize/TestSerialization.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/storagemanager/CMakeLists.txt (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/storagemanager/TestNewAccessor.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/storagemanager/TestPool.cpp (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/tmtcpacket/CMakeLists.txt (100%) rename tests/src/{fsfw-tests => fsfw_tests}/unit/tmtcpacket/PusTmTest.cpp (100%) diff --git a/contrib/CMakeLists.txt b/contrib/CMakeLists.txt index 8c252e82..e83da6af 100644 --- a/contrib/CMakeLists.txt +++ b/contrib/CMakeLists.txt @@ -6,4 +6,4 @@ target_include_directories(${LIB_FSFW_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ) -add_subdirectory(fsfw-contrib) +add_subdirectory(fsfw_contrib) diff --git a/contrib/fsfw-contrib/CMakeLists.txt b/contrib/fsfw_contrib/CMakeLists.txt similarity index 100% rename from contrib/fsfw-contrib/CMakeLists.txt rename to contrib/fsfw_contrib/CMakeLists.txt diff --git a/contrib/fsfw-contrib/sgp4/LICENSE b/contrib/fsfw_contrib/sgp4/LICENSE similarity index 100% rename from contrib/fsfw-contrib/sgp4/LICENSE rename to contrib/fsfw_contrib/sgp4/LICENSE diff --git a/contrib/fsfw-contrib/sgp4/sgp4unit.cpp b/contrib/fsfw_contrib/sgp4/sgp4unit.cpp similarity index 100% rename from contrib/fsfw-contrib/sgp4/sgp4unit.cpp rename to contrib/fsfw_contrib/sgp4/sgp4unit.cpp diff --git a/contrib/fsfw-contrib/sgp4/sgp4unit.h b/contrib/fsfw_contrib/sgp4/sgp4unit.h similarity index 100% rename from contrib/fsfw-contrib/sgp4/sgp4unit.h rename to contrib/fsfw_contrib/sgp4/sgp4unit.h diff --git a/hal/src/CMakeLists.txt b/hal/src/CMakeLists.txt index ff3f1beb..76ee45c6 100644 --- a/hal/src/CMakeLists.txt +++ b/hal/src/CMakeLists.txt @@ -6,4 +6,4 @@ target_include_directories(${LIB_FSFW_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ) -add_subdirectory(fsfw-hal) +add_subdirectory(fsfw_hal) diff --git a/hal/src/fsfw-hal/CMakeLists.txt b/hal/src/fsfw_hal/CMakeLists.txt similarity index 100% rename from hal/src/fsfw-hal/CMakeLists.txt rename to hal/src/fsfw_hal/CMakeLists.txt diff --git a/hal/src/fsfw-hal/common/CMakeLists.txt b/hal/src/fsfw_hal/common/CMakeLists.txt similarity index 100% rename from hal/src/fsfw-hal/common/CMakeLists.txt rename to hal/src/fsfw_hal/common/CMakeLists.txt diff --git a/hal/src/fsfw-hal/common/gpio/CMakeLists.txt b/hal/src/fsfw_hal/common/gpio/CMakeLists.txt similarity index 100% rename from hal/src/fsfw-hal/common/gpio/CMakeLists.txt rename to hal/src/fsfw_hal/common/gpio/CMakeLists.txt diff --git a/hal/src/fsfw-hal/common/gpio/GpioCookie.cpp b/hal/src/fsfw_hal/common/gpio/GpioCookie.cpp similarity index 100% rename from hal/src/fsfw-hal/common/gpio/GpioCookie.cpp rename to hal/src/fsfw_hal/common/gpio/GpioCookie.cpp diff --git a/hal/src/fsfw-hal/common/gpio/GpioCookie.h b/hal/src/fsfw_hal/common/gpio/GpioCookie.h similarity index 100% rename from hal/src/fsfw-hal/common/gpio/GpioCookie.h rename to hal/src/fsfw_hal/common/gpio/GpioCookie.h diff --git a/hal/src/fsfw-hal/common/gpio/GpioIF.h b/hal/src/fsfw_hal/common/gpio/GpioIF.h similarity index 100% rename from hal/src/fsfw-hal/common/gpio/GpioIF.h rename to hal/src/fsfw_hal/common/gpio/GpioIF.h diff --git a/hal/src/fsfw-hal/common/gpio/gpioDefinitions.h b/hal/src/fsfw_hal/common/gpio/gpioDefinitions.h similarity index 100% rename from hal/src/fsfw-hal/common/gpio/gpioDefinitions.h rename to hal/src/fsfw_hal/common/gpio/gpioDefinitions.h diff --git a/hal/src/fsfw-hal/common/spi/spiCommon.h b/hal/src/fsfw_hal/common/spi/spiCommon.h similarity index 100% rename from hal/src/fsfw-hal/common/spi/spiCommon.h rename to hal/src/fsfw_hal/common/spi/spiCommon.h diff --git a/hal/src/fsfw-hal/devicehandlers/CMakeLists.txt b/hal/src/fsfw_hal/devicehandlers/CMakeLists.txt similarity index 100% rename from hal/src/fsfw-hal/devicehandlers/CMakeLists.txt rename to hal/src/fsfw_hal/devicehandlers/CMakeLists.txt diff --git a/hal/src/fsfw-hal/devicehandlers/GyroL3GD20Handler.cpp b/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.cpp similarity index 100% rename from hal/src/fsfw-hal/devicehandlers/GyroL3GD20Handler.cpp rename to hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.cpp diff --git a/hal/src/fsfw-hal/devicehandlers/GyroL3GD20Handler.h b/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.h similarity index 100% rename from hal/src/fsfw-hal/devicehandlers/GyroL3GD20Handler.h rename to hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.h diff --git a/hal/src/fsfw-hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h b/hal/src/fsfw_hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h similarity index 100% rename from hal/src/fsfw-hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h rename to hal/src/fsfw_hal/devicehandlers/devicedefinitions/GyroL3GD20Definitions.h diff --git a/hal/src/fsfw-hal/host/CMakeLists.txt b/hal/src/fsfw_hal/host/CMakeLists.txt similarity index 100% rename from hal/src/fsfw-hal/host/CMakeLists.txt rename to hal/src/fsfw_hal/host/CMakeLists.txt diff --git a/hal/src/fsfw-hal/linux/CMakeLists.txt b/hal/src/fsfw_hal/linux/CMakeLists.txt similarity index 100% rename from hal/src/fsfw-hal/linux/CMakeLists.txt rename to hal/src/fsfw_hal/linux/CMakeLists.txt diff --git a/hal/src/fsfw-hal/linux/UnixFileGuard.cpp b/hal/src/fsfw_hal/linux/UnixFileGuard.cpp similarity index 100% rename from hal/src/fsfw-hal/linux/UnixFileGuard.cpp rename to hal/src/fsfw_hal/linux/UnixFileGuard.cpp diff --git a/hal/src/fsfw-hal/linux/UnixFileGuard.h b/hal/src/fsfw_hal/linux/UnixFileGuard.h similarity index 100% rename from hal/src/fsfw-hal/linux/UnixFileGuard.h rename to hal/src/fsfw_hal/linux/UnixFileGuard.h diff --git a/hal/src/fsfw-hal/linux/gpio/CMakeLists.txt b/hal/src/fsfw_hal/linux/gpio/CMakeLists.txt similarity index 100% rename from hal/src/fsfw-hal/linux/gpio/CMakeLists.txt rename to hal/src/fsfw_hal/linux/gpio/CMakeLists.txt diff --git a/hal/src/fsfw-hal/linux/gpio/LinuxLibgpioIF.cpp b/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp similarity index 100% rename from hal/src/fsfw-hal/linux/gpio/LinuxLibgpioIF.cpp rename to hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp diff --git a/hal/src/fsfw-hal/linux/gpio/LinuxLibgpioIF.h b/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h similarity index 100% rename from hal/src/fsfw-hal/linux/gpio/LinuxLibgpioIF.h rename to hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h diff --git a/hal/src/fsfw-hal/linux/i2c/CMakeLists.txt b/hal/src/fsfw_hal/linux/i2c/CMakeLists.txt similarity index 100% rename from hal/src/fsfw-hal/linux/i2c/CMakeLists.txt rename to hal/src/fsfw_hal/linux/i2c/CMakeLists.txt diff --git a/hal/src/fsfw-hal/linux/i2c/I2cComIF.cpp b/hal/src/fsfw_hal/linux/i2c/I2cComIF.cpp similarity index 100% rename from hal/src/fsfw-hal/linux/i2c/I2cComIF.cpp rename to hal/src/fsfw_hal/linux/i2c/I2cComIF.cpp diff --git a/hal/src/fsfw-hal/linux/i2c/I2cComIF.h b/hal/src/fsfw_hal/linux/i2c/I2cComIF.h similarity index 100% rename from hal/src/fsfw-hal/linux/i2c/I2cComIF.h rename to hal/src/fsfw_hal/linux/i2c/I2cComIF.h diff --git a/hal/src/fsfw-hal/linux/i2c/I2cCookie.cpp b/hal/src/fsfw_hal/linux/i2c/I2cCookie.cpp similarity index 100% rename from hal/src/fsfw-hal/linux/i2c/I2cCookie.cpp rename to hal/src/fsfw_hal/linux/i2c/I2cCookie.cpp diff --git a/hal/src/fsfw-hal/linux/i2c/I2cCookie.h b/hal/src/fsfw_hal/linux/i2c/I2cCookie.h similarity index 100% rename from hal/src/fsfw-hal/linux/i2c/I2cCookie.h rename to hal/src/fsfw_hal/linux/i2c/I2cCookie.h diff --git a/hal/src/fsfw-hal/linux/rpi/CMakeLists.txt b/hal/src/fsfw_hal/linux/rpi/CMakeLists.txt similarity index 100% rename from hal/src/fsfw-hal/linux/rpi/CMakeLists.txt rename to hal/src/fsfw_hal/linux/rpi/CMakeLists.txt diff --git a/hal/src/fsfw-hal/linux/rpi/GpioRPi.cpp b/hal/src/fsfw_hal/linux/rpi/GpioRPi.cpp similarity index 100% rename from hal/src/fsfw-hal/linux/rpi/GpioRPi.cpp rename to hal/src/fsfw_hal/linux/rpi/GpioRPi.cpp diff --git a/hal/src/fsfw-hal/linux/rpi/GpioRPi.h b/hal/src/fsfw_hal/linux/rpi/GpioRPi.h similarity index 100% rename from hal/src/fsfw-hal/linux/rpi/GpioRPi.h rename to hal/src/fsfw_hal/linux/rpi/GpioRPi.h diff --git a/hal/src/fsfw-hal/linux/spi/CMakeLists.txt b/hal/src/fsfw_hal/linux/spi/CMakeLists.txt similarity index 100% rename from hal/src/fsfw-hal/linux/spi/CMakeLists.txt rename to hal/src/fsfw_hal/linux/spi/CMakeLists.txt diff --git a/hal/src/fsfw-hal/linux/spi/SpiComIF.cpp b/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp similarity index 100% rename from hal/src/fsfw-hal/linux/spi/SpiComIF.cpp rename to hal/src/fsfw_hal/linux/spi/SpiComIF.cpp diff --git a/hal/src/fsfw-hal/linux/spi/SpiComIF.h b/hal/src/fsfw_hal/linux/spi/SpiComIF.h similarity index 100% rename from hal/src/fsfw-hal/linux/spi/SpiComIF.h rename to hal/src/fsfw_hal/linux/spi/SpiComIF.h diff --git a/hal/src/fsfw-hal/linux/spi/SpiCookie.cpp b/hal/src/fsfw_hal/linux/spi/SpiCookie.cpp similarity index 100% rename from hal/src/fsfw-hal/linux/spi/SpiCookie.cpp rename to hal/src/fsfw_hal/linux/spi/SpiCookie.cpp diff --git a/hal/src/fsfw-hal/linux/spi/SpiCookie.h b/hal/src/fsfw_hal/linux/spi/SpiCookie.h similarity index 100% rename from hal/src/fsfw-hal/linux/spi/SpiCookie.h rename to hal/src/fsfw_hal/linux/spi/SpiCookie.h diff --git a/hal/src/fsfw-hal/linux/spi/spiDefinitions.h b/hal/src/fsfw_hal/linux/spi/spiDefinitions.h similarity index 100% rename from hal/src/fsfw-hal/linux/spi/spiDefinitions.h rename to hal/src/fsfw_hal/linux/spi/spiDefinitions.h diff --git a/hal/src/fsfw-hal/linux/uart/CMakeLists.txt b/hal/src/fsfw_hal/linux/uart/CMakeLists.txt similarity index 100% rename from hal/src/fsfw-hal/linux/uart/CMakeLists.txt rename to hal/src/fsfw_hal/linux/uart/CMakeLists.txt diff --git a/hal/src/fsfw-hal/linux/uart/UartComIF.cpp b/hal/src/fsfw_hal/linux/uart/UartComIF.cpp similarity index 100% rename from hal/src/fsfw-hal/linux/uart/UartComIF.cpp rename to hal/src/fsfw_hal/linux/uart/UartComIF.cpp diff --git a/hal/src/fsfw-hal/linux/uart/UartComIF.h b/hal/src/fsfw_hal/linux/uart/UartComIF.h similarity index 100% rename from hal/src/fsfw-hal/linux/uart/UartComIF.h rename to hal/src/fsfw_hal/linux/uart/UartComIF.h diff --git a/hal/src/fsfw-hal/linux/uart/UartCookie.cpp b/hal/src/fsfw_hal/linux/uart/UartCookie.cpp similarity index 100% rename from hal/src/fsfw-hal/linux/uart/UartCookie.cpp rename to hal/src/fsfw_hal/linux/uart/UartCookie.cpp diff --git a/hal/src/fsfw-hal/linux/uart/UartCookie.h b/hal/src/fsfw_hal/linux/uart/UartCookie.h similarity index 100% rename from hal/src/fsfw-hal/linux/uart/UartCookie.h rename to hal/src/fsfw_hal/linux/uart/UartCookie.h diff --git a/hal/src/fsfw-hal/linux/utility.cpp b/hal/src/fsfw_hal/linux/utility.cpp similarity index 100% rename from hal/src/fsfw-hal/linux/utility.cpp rename to hal/src/fsfw_hal/linux/utility.cpp diff --git a/hal/src/fsfw-hal/linux/utility.h b/hal/src/fsfw_hal/linux/utility.h similarity index 100% rename from hal/src/fsfw-hal/linux/utility.h rename to hal/src/fsfw_hal/linux/utility.h diff --git a/hal/src/fsfw-hal/stm32h7/CMakeLists.txt b/hal/src/fsfw_hal/stm32h7/CMakeLists.txt similarity index 100% rename from hal/src/fsfw-hal/stm32h7/CMakeLists.txt rename to hal/src/fsfw_hal/stm32h7/CMakeLists.txt diff --git a/hal/src/fsfw-hal/stm32h7/devicetest/CMakeLists.txt b/hal/src/fsfw_hal/stm32h7/devicetest/CMakeLists.txt similarity index 100% rename from hal/src/fsfw-hal/stm32h7/devicetest/CMakeLists.txt rename to hal/src/fsfw_hal/stm32h7/devicetest/CMakeLists.txt diff --git a/hal/src/fsfw-hal/stm32h7/devicetest/GyroL3GD20H.cpp b/hal/src/fsfw_hal/stm32h7/devicetest/GyroL3GD20H.cpp similarity index 100% rename from hal/src/fsfw-hal/stm32h7/devicetest/GyroL3GD20H.cpp rename to hal/src/fsfw_hal/stm32h7/devicetest/GyroL3GD20H.cpp diff --git a/hal/src/fsfw-hal/stm32h7/devicetest/GyroL3GD20H.h b/hal/src/fsfw_hal/stm32h7/devicetest/GyroL3GD20H.h similarity index 100% rename from hal/src/fsfw-hal/stm32h7/devicetest/GyroL3GD20H.h rename to hal/src/fsfw_hal/stm32h7/devicetest/GyroL3GD20H.h diff --git a/hal/src/fsfw-hal/stm32h7/dma.cpp b/hal/src/fsfw_hal/stm32h7/dma.cpp similarity index 100% rename from hal/src/fsfw-hal/stm32h7/dma.cpp rename to hal/src/fsfw_hal/stm32h7/dma.cpp diff --git a/hal/src/fsfw-hal/stm32h7/dma.h b/hal/src/fsfw_hal/stm32h7/dma.h similarity index 100% rename from hal/src/fsfw-hal/stm32h7/dma.h rename to hal/src/fsfw_hal/stm32h7/dma.h diff --git a/hal/src/fsfw-hal/stm32h7/gpio/CMakeLists.txt b/hal/src/fsfw_hal/stm32h7/gpio/CMakeLists.txt similarity index 100% rename from hal/src/fsfw-hal/stm32h7/gpio/CMakeLists.txt rename to hal/src/fsfw_hal/stm32h7/gpio/CMakeLists.txt diff --git a/hal/src/fsfw-hal/stm32h7/gpio/gpio.cpp b/hal/src/fsfw_hal/stm32h7/gpio/gpio.cpp similarity index 100% rename from hal/src/fsfw-hal/stm32h7/gpio/gpio.cpp rename to hal/src/fsfw_hal/stm32h7/gpio/gpio.cpp diff --git a/hal/src/fsfw-hal/stm32h7/gpio/gpio.h b/hal/src/fsfw_hal/stm32h7/gpio/gpio.h similarity index 100% rename from hal/src/fsfw-hal/stm32h7/gpio/gpio.h rename to hal/src/fsfw_hal/stm32h7/gpio/gpio.h diff --git a/hal/src/fsfw-hal/stm32h7/i2c/CMakeLists.txt b/hal/src/fsfw_hal/stm32h7/i2c/CMakeLists.txt similarity index 100% rename from hal/src/fsfw-hal/stm32h7/i2c/CMakeLists.txt rename to hal/src/fsfw_hal/stm32h7/i2c/CMakeLists.txt diff --git a/hal/src/fsfw-hal/stm32h7/interrupts.h b/hal/src/fsfw_hal/stm32h7/interrupts.h similarity index 100% rename from hal/src/fsfw-hal/stm32h7/interrupts.h rename to hal/src/fsfw_hal/stm32h7/interrupts.h diff --git a/hal/src/fsfw-hal/stm32h7/spi/CMakeLists.txt b/hal/src/fsfw_hal/stm32h7/spi/CMakeLists.txt similarity index 100% rename from hal/src/fsfw-hal/stm32h7/spi/CMakeLists.txt rename to hal/src/fsfw_hal/stm32h7/spi/CMakeLists.txt diff --git a/hal/src/fsfw-hal/stm32h7/spi/SpiComIF.cpp b/hal/src/fsfw_hal/stm32h7/spi/SpiComIF.cpp similarity index 100% rename from hal/src/fsfw-hal/stm32h7/spi/SpiComIF.cpp rename to hal/src/fsfw_hal/stm32h7/spi/SpiComIF.cpp diff --git a/hal/src/fsfw-hal/stm32h7/spi/SpiComIF.h b/hal/src/fsfw_hal/stm32h7/spi/SpiComIF.h similarity index 100% rename from hal/src/fsfw-hal/stm32h7/spi/SpiComIF.h rename to hal/src/fsfw_hal/stm32h7/spi/SpiComIF.h diff --git a/hal/src/fsfw-hal/stm32h7/spi/SpiCookie.cpp b/hal/src/fsfw_hal/stm32h7/spi/SpiCookie.cpp similarity index 100% rename from hal/src/fsfw-hal/stm32h7/spi/SpiCookie.cpp rename to hal/src/fsfw_hal/stm32h7/spi/SpiCookie.cpp diff --git a/hal/src/fsfw-hal/stm32h7/spi/SpiCookie.h b/hal/src/fsfw_hal/stm32h7/spi/SpiCookie.h similarity index 100% rename from hal/src/fsfw-hal/stm32h7/spi/SpiCookie.h rename to hal/src/fsfw_hal/stm32h7/spi/SpiCookie.h diff --git a/hal/src/fsfw-hal/stm32h7/spi/mspInit.cpp b/hal/src/fsfw_hal/stm32h7/spi/mspInit.cpp similarity index 100% rename from hal/src/fsfw-hal/stm32h7/spi/mspInit.cpp rename to hal/src/fsfw_hal/stm32h7/spi/mspInit.cpp diff --git a/hal/src/fsfw-hal/stm32h7/spi/mspInit.h b/hal/src/fsfw_hal/stm32h7/spi/mspInit.h similarity index 100% rename from hal/src/fsfw-hal/stm32h7/spi/mspInit.h rename to hal/src/fsfw_hal/stm32h7/spi/mspInit.h diff --git a/hal/src/fsfw-hal/stm32h7/spi/spiCore.cpp b/hal/src/fsfw_hal/stm32h7/spi/spiCore.cpp similarity index 100% rename from hal/src/fsfw-hal/stm32h7/spi/spiCore.cpp rename to hal/src/fsfw_hal/stm32h7/spi/spiCore.cpp diff --git a/hal/src/fsfw-hal/stm32h7/spi/spiCore.h b/hal/src/fsfw_hal/stm32h7/spi/spiCore.h similarity index 100% rename from hal/src/fsfw-hal/stm32h7/spi/spiCore.h rename to hal/src/fsfw_hal/stm32h7/spi/spiCore.h diff --git a/hal/src/fsfw-hal/stm32h7/spi/spiDefinitions.cpp b/hal/src/fsfw_hal/stm32h7/spi/spiDefinitions.cpp similarity index 100% rename from hal/src/fsfw-hal/stm32h7/spi/spiDefinitions.cpp rename to hal/src/fsfw_hal/stm32h7/spi/spiDefinitions.cpp diff --git a/hal/src/fsfw-hal/stm32h7/spi/spiDefinitions.h b/hal/src/fsfw_hal/stm32h7/spi/spiDefinitions.h similarity index 100% rename from hal/src/fsfw-hal/stm32h7/spi/spiDefinitions.h rename to hal/src/fsfw_hal/stm32h7/spi/spiDefinitions.h diff --git a/hal/src/fsfw-hal/stm32h7/spi/spiInterrupts.cpp b/hal/src/fsfw_hal/stm32h7/spi/spiInterrupts.cpp similarity index 100% rename from hal/src/fsfw-hal/stm32h7/spi/spiInterrupts.cpp rename to hal/src/fsfw_hal/stm32h7/spi/spiInterrupts.cpp diff --git a/hal/src/fsfw-hal/stm32h7/spi/spiInterrupts.h b/hal/src/fsfw_hal/stm32h7/spi/spiInterrupts.h similarity index 100% rename from hal/src/fsfw-hal/stm32h7/spi/spiInterrupts.h rename to hal/src/fsfw_hal/stm32h7/spi/spiInterrupts.h diff --git a/hal/src/fsfw-hal/stm32h7/spi/stm32h743ziSpi.cpp b/hal/src/fsfw_hal/stm32h7/spi/stm32h743ziSpi.cpp similarity index 100% rename from hal/src/fsfw-hal/stm32h7/spi/stm32h743ziSpi.cpp rename to hal/src/fsfw_hal/stm32h7/spi/stm32h743ziSpi.cpp diff --git a/hal/src/fsfw-hal/stm32h7/spi/stm32h743ziSpi.h b/hal/src/fsfw_hal/stm32h7/spi/stm32h743ziSpi.h similarity index 100% rename from hal/src/fsfw-hal/stm32h7/spi/stm32h743ziSpi.h rename to hal/src/fsfw_hal/stm32h7/spi/stm32h743ziSpi.h diff --git a/hal/src/fsfw-hal/stm32h7/uart/CMakeLists.txt b/hal/src/fsfw_hal/stm32h7/uart/CMakeLists.txt similarity index 100% rename from hal/src/fsfw-hal/stm32h7/uart/CMakeLists.txt rename to hal/src/fsfw_hal/stm32h7/uart/CMakeLists.txt diff --git a/tests/src/CMakeLists.txt b/tests/src/CMakeLists.txt index 18bf7f8c..6673f1e4 100644 --- a/tests/src/CMakeLists.txt +++ b/tests/src/CMakeLists.txt @@ -6,4 +6,4 @@ target_include_directories(${LIB_FSFW_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} ) -add_subdirectory(fsfw-tests) +add_subdirectory(fsfw_tests) diff --git a/tests/src/fsfw-tests/CMakeLists.txt b/tests/src/fsfw_tests/CMakeLists.txt similarity index 100% rename from tests/src/fsfw-tests/CMakeLists.txt rename to tests/src/fsfw_tests/CMakeLists.txt diff --git a/tests/src/fsfw-tests/internal/CMakeLists.txt b/tests/src/fsfw_tests/internal/CMakeLists.txt similarity index 100% rename from tests/src/fsfw-tests/internal/CMakeLists.txt rename to tests/src/fsfw_tests/internal/CMakeLists.txt diff --git a/tests/src/fsfw-tests/internal/InternalUnitTester.cpp b/tests/src/fsfw_tests/internal/InternalUnitTester.cpp similarity index 100% rename from tests/src/fsfw-tests/internal/InternalUnitTester.cpp rename to tests/src/fsfw_tests/internal/InternalUnitTester.cpp diff --git a/tests/src/fsfw-tests/internal/InternalUnitTester.h b/tests/src/fsfw_tests/internal/InternalUnitTester.h similarity index 100% rename from tests/src/fsfw-tests/internal/InternalUnitTester.h rename to tests/src/fsfw_tests/internal/InternalUnitTester.h diff --git a/tests/src/fsfw-tests/internal/UnittDefinitions.cpp b/tests/src/fsfw_tests/internal/UnittDefinitions.cpp similarity index 100% rename from tests/src/fsfw-tests/internal/UnittDefinitions.cpp rename to tests/src/fsfw_tests/internal/UnittDefinitions.cpp diff --git a/tests/src/fsfw-tests/internal/UnittDefinitions.h b/tests/src/fsfw_tests/internal/UnittDefinitions.h similarity index 100% rename from tests/src/fsfw-tests/internal/UnittDefinitions.h rename to tests/src/fsfw_tests/internal/UnittDefinitions.h diff --git a/tests/src/fsfw-tests/internal/globalfunctions/CMakeLists.txt b/tests/src/fsfw_tests/internal/globalfunctions/CMakeLists.txt similarity index 100% rename from tests/src/fsfw-tests/internal/globalfunctions/CMakeLists.txt rename to tests/src/fsfw_tests/internal/globalfunctions/CMakeLists.txt diff --git a/tests/src/fsfw-tests/internal/globalfunctions/TestArrayPrinter.cpp b/tests/src/fsfw_tests/internal/globalfunctions/TestArrayPrinter.cpp similarity index 100% rename from tests/src/fsfw-tests/internal/globalfunctions/TestArrayPrinter.cpp rename to tests/src/fsfw_tests/internal/globalfunctions/TestArrayPrinter.cpp diff --git a/tests/src/fsfw-tests/internal/globalfunctions/TestArrayPrinter.h b/tests/src/fsfw_tests/internal/globalfunctions/TestArrayPrinter.h similarity index 100% rename from tests/src/fsfw-tests/internal/globalfunctions/TestArrayPrinter.h rename to tests/src/fsfw_tests/internal/globalfunctions/TestArrayPrinter.h diff --git a/tests/src/fsfw-tests/internal/osal/CMakeLists.txt b/tests/src/fsfw_tests/internal/osal/CMakeLists.txt similarity index 100% rename from tests/src/fsfw-tests/internal/osal/CMakeLists.txt rename to tests/src/fsfw_tests/internal/osal/CMakeLists.txt diff --git a/tests/src/fsfw-tests/internal/osal/IntTestMq.cpp b/tests/src/fsfw_tests/internal/osal/IntTestMq.cpp similarity index 100% rename from tests/src/fsfw-tests/internal/osal/IntTestMq.cpp rename to tests/src/fsfw_tests/internal/osal/IntTestMq.cpp diff --git a/tests/src/fsfw-tests/internal/osal/IntTestMq.h b/tests/src/fsfw_tests/internal/osal/IntTestMq.h similarity index 100% rename from tests/src/fsfw-tests/internal/osal/IntTestMq.h rename to tests/src/fsfw_tests/internal/osal/IntTestMq.h diff --git a/tests/src/fsfw-tests/internal/osal/IntTestMutex.cpp b/tests/src/fsfw_tests/internal/osal/IntTestMutex.cpp similarity index 100% rename from tests/src/fsfw-tests/internal/osal/IntTestMutex.cpp rename to tests/src/fsfw_tests/internal/osal/IntTestMutex.cpp diff --git a/tests/src/fsfw-tests/internal/osal/IntTestMutex.h b/tests/src/fsfw_tests/internal/osal/IntTestMutex.h similarity index 100% rename from tests/src/fsfw-tests/internal/osal/IntTestMutex.h rename to tests/src/fsfw_tests/internal/osal/IntTestMutex.h diff --git a/tests/src/fsfw-tests/internal/osal/IntTestSemaphore.cpp b/tests/src/fsfw_tests/internal/osal/IntTestSemaphore.cpp similarity index 100% rename from tests/src/fsfw-tests/internal/osal/IntTestSemaphore.cpp rename to tests/src/fsfw_tests/internal/osal/IntTestSemaphore.cpp diff --git a/tests/src/fsfw-tests/internal/osal/IntTestSemaphore.h b/tests/src/fsfw_tests/internal/osal/IntTestSemaphore.h similarity index 100% rename from tests/src/fsfw-tests/internal/osal/IntTestSemaphore.h rename to tests/src/fsfw_tests/internal/osal/IntTestSemaphore.h diff --git a/tests/src/fsfw-tests/internal/serialize/CMakeLists.txt b/tests/src/fsfw_tests/internal/serialize/CMakeLists.txt similarity index 100% rename from tests/src/fsfw-tests/internal/serialize/CMakeLists.txt rename to tests/src/fsfw_tests/internal/serialize/CMakeLists.txt diff --git a/tests/src/fsfw-tests/internal/serialize/IntTestSerialization.cpp b/tests/src/fsfw_tests/internal/serialize/IntTestSerialization.cpp similarity index 100% rename from tests/src/fsfw-tests/internal/serialize/IntTestSerialization.cpp rename to tests/src/fsfw_tests/internal/serialize/IntTestSerialization.cpp diff --git a/tests/src/fsfw-tests/internal/serialize/IntTestSerialization.h b/tests/src/fsfw_tests/internal/serialize/IntTestSerialization.h similarity index 100% rename from tests/src/fsfw-tests/internal/serialize/IntTestSerialization.h rename to tests/src/fsfw_tests/internal/serialize/IntTestSerialization.h diff --git a/tests/src/fsfw-tests/unit/CMakeLists.txt b/tests/src/fsfw_tests/unit/CMakeLists.txt similarity index 100% rename from tests/src/fsfw-tests/unit/CMakeLists.txt rename to tests/src/fsfw_tests/unit/CMakeLists.txt diff --git a/tests/src/fsfw-tests/unit/action/CMakeLists.txt b/tests/src/fsfw_tests/unit/action/CMakeLists.txt similarity index 100% rename from tests/src/fsfw-tests/unit/action/CMakeLists.txt rename to tests/src/fsfw_tests/unit/action/CMakeLists.txt diff --git a/tests/src/fsfw-tests/unit/action/TestActionHelper.cpp b/tests/src/fsfw_tests/unit/action/TestActionHelper.cpp similarity index 100% rename from tests/src/fsfw-tests/unit/action/TestActionHelper.cpp rename to tests/src/fsfw_tests/unit/action/TestActionHelper.cpp diff --git a/tests/src/fsfw-tests/unit/action/TestActionHelper.h b/tests/src/fsfw_tests/unit/action/TestActionHelper.h similarity index 100% rename from tests/src/fsfw-tests/unit/action/TestActionHelper.h rename to tests/src/fsfw_tests/unit/action/TestActionHelper.h diff --git a/tests/src/fsfw-tests/unit/container/CMakeLists.txt b/tests/src/fsfw_tests/unit/container/CMakeLists.txt similarity index 100% rename from tests/src/fsfw-tests/unit/container/CMakeLists.txt rename to tests/src/fsfw_tests/unit/container/CMakeLists.txt diff --git a/tests/src/fsfw-tests/unit/container/RingBufferTest.cpp b/tests/src/fsfw_tests/unit/container/RingBufferTest.cpp similarity index 100% rename from tests/src/fsfw-tests/unit/container/RingBufferTest.cpp rename to tests/src/fsfw_tests/unit/container/RingBufferTest.cpp diff --git a/tests/src/fsfw-tests/unit/container/TestArrayList.cpp b/tests/src/fsfw_tests/unit/container/TestArrayList.cpp similarity index 100% rename from tests/src/fsfw-tests/unit/container/TestArrayList.cpp rename to tests/src/fsfw_tests/unit/container/TestArrayList.cpp diff --git a/tests/src/fsfw-tests/unit/container/TestDynamicFifo.cpp b/tests/src/fsfw_tests/unit/container/TestDynamicFifo.cpp similarity index 100% rename from tests/src/fsfw-tests/unit/container/TestDynamicFifo.cpp rename to tests/src/fsfw_tests/unit/container/TestDynamicFifo.cpp diff --git a/tests/src/fsfw-tests/unit/container/TestFifo.cpp b/tests/src/fsfw_tests/unit/container/TestFifo.cpp similarity index 100% rename from tests/src/fsfw-tests/unit/container/TestFifo.cpp rename to tests/src/fsfw_tests/unit/container/TestFifo.cpp diff --git a/tests/src/fsfw-tests/unit/container/TestFixedArrayList.cpp b/tests/src/fsfw_tests/unit/container/TestFixedArrayList.cpp similarity index 100% rename from tests/src/fsfw-tests/unit/container/TestFixedArrayList.cpp rename to tests/src/fsfw_tests/unit/container/TestFixedArrayList.cpp diff --git a/tests/src/fsfw-tests/unit/container/TestFixedMap.cpp b/tests/src/fsfw_tests/unit/container/TestFixedMap.cpp similarity index 100% rename from tests/src/fsfw-tests/unit/container/TestFixedMap.cpp rename to tests/src/fsfw_tests/unit/container/TestFixedMap.cpp diff --git a/tests/src/fsfw-tests/unit/container/TestFixedOrderedMultimap.cpp b/tests/src/fsfw_tests/unit/container/TestFixedOrderedMultimap.cpp similarity index 100% rename from tests/src/fsfw-tests/unit/container/TestFixedOrderedMultimap.cpp rename to tests/src/fsfw_tests/unit/container/TestFixedOrderedMultimap.cpp diff --git a/tests/src/fsfw-tests/unit/container/TestPlacementFactory.cpp b/tests/src/fsfw_tests/unit/container/TestPlacementFactory.cpp similarity index 100% rename from tests/src/fsfw-tests/unit/container/TestPlacementFactory.cpp rename to tests/src/fsfw_tests/unit/container/TestPlacementFactory.cpp diff --git a/tests/src/fsfw-tests/unit/datapoollocal/CMakeLists.txt b/tests/src/fsfw_tests/unit/datapoollocal/CMakeLists.txt similarity index 100% rename from tests/src/fsfw-tests/unit/datapoollocal/CMakeLists.txt rename to tests/src/fsfw_tests/unit/datapoollocal/CMakeLists.txt diff --git a/tests/src/fsfw-tests/unit/datapoollocal/DataSetTest.cpp b/tests/src/fsfw_tests/unit/datapoollocal/DataSetTest.cpp similarity index 100% rename from tests/src/fsfw-tests/unit/datapoollocal/DataSetTest.cpp rename to tests/src/fsfw_tests/unit/datapoollocal/DataSetTest.cpp diff --git a/tests/src/fsfw-tests/unit/datapoollocal/LocalPoolManagerTest.cpp b/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolManagerTest.cpp similarity index 100% rename from tests/src/fsfw-tests/unit/datapoollocal/LocalPoolManagerTest.cpp rename to tests/src/fsfw_tests/unit/datapoollocal/LocalPoolManagerTest.cpp diff --git a/tests/src/fsfw-tests/unit/datapoollocal/LocalPoolOwnerBase.cpp b/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.cpp similarity index 100% rename from tests/src/fsfw-tests/unit/datapoollocal/LocalPoolOwnerBase.cpp rename to tests/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.cpp diff --git a/tests/src/fsfw-tests/unit/datapoollocal/LocalPoolOwnerBase.h b/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.h similarity index 100% rename from tests/src/fsfw-tests/unit/datapoollocal/LocalPoolOwnerBase.h rename to tests/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.h diff --git a/tests/src/fsfw-tests/unit/datapoollocal/LocalPoolVariableTest.cpp b/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVariableTest.cpp similarity index 100% rename from tests/src/fsfw-tests/unit/datapoollocal/LocalPoolVariableTest.cpp rename to tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVariableTest.cpp diff --git a/tests/src/fsfw-tests/unit/datapoollocal/LocalPoolVectorTest.cpp b/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVectorTest.cpp similarity index 100% rename from tests/src/fsfw-tests/unit/datapoollocal/LocalPoolVectorTest.cpp rename to tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVectorTest.cpp diff --git a/tests/src/fsfw-tests/unit/globalfunctions/CMakeLists.txt b/tests/src/fsfw_tests/unit/globalfunctions/CMakeLists.txt similarity index 100% rename from tests/src/fsfw-tests/unit/globalfunctions/CMakeLists.txt rename to tests/src/fsfw_tests/unit/globalfunctions/CMakeLists.txt diff --git a/tests/src/fsfw-tests/unit/mocks/HkReceiverMock.h b/tests/src/fsfw_tests/unit/mocks/HkReceiverMock.h similarity index 100% rename from tests/src/fsfw-tests/unit/mocks/HkReceiverMock.h rename to tests/src/fsfw_tests/unit/mocks/HkReceiverMock.h diff --git a/tests/src/fsfw-tests/unit/mocks/MessageQueueMockBase.h b/tests/src/fsfw_tests/unit/mocks/MessageQueueMockBase.h similarity index 100% rename from tests/src/fsfw-tests/unit/mocks/MessageQueueMockBase.h rename to tests/src/fsfw_tests/unit/mocks/MessageQueueMockBase.h diff --git a/tests/src/fsfw-tests/unit/osal/CMakeLists.txt b/tests/src/fsfw_tests/unit/osal/CMakeLists.txt similarity index 100% rename from tests/src/fsfw-tests/unit/osal/CMakeLists.txt rename to tests/src/fsfw_tests/unit/osal/CMakeLists.txt diff --git a/tests/src/fsfw-tests/unit/osal/TestMessageQueue.cpp b/tests/src/fsfw_tests/unit/osal/TestMessageQueue.cpp similarity index 100% rename from tests/src/fsfw-tests/unit/osal/TestMessageQueue.cpp rename to tests/src/fsfw_tests/unit/osal/TestMessageQueue.cpp diff --git a/tests/src/fsfw-tests/unit/osal/TestSemaphore.cpp b/tests/src/fsfw_tests/unit/osal/TestSemaphore.cpp similarity index 100% rename from tests/src/fsfw-tests/unit/osal/TestSemaphore.cpp rename to tests/src/fsfw_tests/unit/osal/TestSemaphore.cpp diff --git a/tests/src/fsfw-tests/unit/serialize/CMakeLists.txt b/tests/src/fsfw_tests/unit/serialize/CMakeLists.txt similarity index 100% rename from tests/src/fsfw-tests/unit/serialize/CMakeLists.txt rename to tests/src/fsfw_tests/unit/serialize/CMakeLists.txt diff --git a/tests/src/fsfw-tests/unit/serialize/TestSerialBufferAdapter.cpp b/tests/src/fsfw_tests/unit/serialize/TestSerialBufferAdapter.cpp similarity index 100% rename from tests/src/fsfw-tests/unit/serialize/TestSerialBufferAdapter.cpp rename to tests/src/fsfw_tests/unit/serialize/TestSerialBufferAdapter.cpp diff --git a/tests/src/fsfw-tests/unit/serialize/TestSerialLinkedPacket.cpp b/tests/src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.cpp similarity index 100% rename from tests/src/fsfw-tests/unit/serialize/TestSerialLinkedPacket.cpp rename to tests/src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.cpp diff --git a/tests/src/fsfw-tests/unit/serialize/TestSerialLinkedPacket.h b/tests/src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.h similarity index 100% rename from tests/src/fsfw-tests/unit/serialize/TestSerialLinkedPacket.h rename to tests/src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.h diff --git a/tests/src/fsfw-tests/unit/serialize/TestSerialization.cpp b/tests/src/fsfw_tests/unit/serialize/TestSerialization.cpp similarity index 100% rename from tests/src/fsfw-tests/unit/serialize/TestSerialization.cpp rename to tests/src/fsfw_tests/unit/serialize/TestSerialization.cpp diff --git a/tests/src/fsfw-tests/unit/storagemanager/CMakeLists.txt b/tests/src/fsfw_tests/unit/storagemanager/CMakeLists.txt similarity index 100% rename from tests/src/fsfw-tests/unit/storagemanager/CMakeLists.txt rename to tests/src/fsfw_tests/unit/storagemanager/CMakeLists.txt diff --git a/tests/src/fsfw-tests/unit/storagemanager/TestNewAccessor.cpp b/tests/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp similarity index 100% rename from tests/src/fsfw-tests/unit/storagemanager/TestNewAccessor.cpp rename to tests/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp diff --git a/tests/src/fsfw-tests/unit/storagemanager/TestPool.cpp b/tests/src/fsfw_tests/unit/storagemanager/TestPool.cpp similarity index 100% rename from tests/src/fsfw-tests/unit/storagemanager/TestPool.cpp rename to tests/src/fsfw_tests/unit/storagemanager/TestPool.cpp diff --git a/tests/src/fsfw-tests/unit/tmtcpacket/CMakeLists.txt b/tests/src/fsfw_tests/unit/tmtcpacket/CMakeLists.txt similarity index 100% rename from tests/src/fsfw-tests/unit/tmtcpacket/CMakeLists.txt rename to tests/src/fsfw_tests/unit/tmtcpacket/CMakeLists.txt diff --git a/tests/src/fsfw-tests/unit/tmtcpacket/PusTmTest.cpp b/tests/src/fsfw_tests/unit/tmtcpacket/PusTmTest.cpp similarity index 100% rename from tests/src/fsfw-tests/unit/tmtcpacket/PusTmTest.cpp rename to tests/src/fsfw_tests/unit/tmtcpacket/PusTmTest.cpp From c3fbe04fc675c6cf928e9d2326127af3c66ae53f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 2 Aug 2021 20:58:56 +0200 Subject: [PATCH 224/389] all include corrections --- hal/src/fsfw_hal/common/gpio/GpioCookie.cpp | 2 +- .../fsfw_hal/devicehandlers/GyroL3GD20Handler.cpp | 2 +- hal/src/fsfw_hal/linux/UnixFileGuard.cpp | 2 +- hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp | 6 +++--- hal/src/fsfw_hal/linux/i2c/I2cComIF.cpp | 6 +++--- hal/src/fsfw_hal/linux/i2c/I2cCookie.cpp | 2 +- hal/src/fsfw_hal/linux/rpi/GpioRPi.cpp | 4 ++-- hal/src/fsfw_hal/linux/spi/SpiComIF.cpp | 8 ++++---- hal/src/fsfw_hal/linux/spi/SpiComIF.h | 2 +- hal/src/fsfw_hal/linux/spi/SpiCookie.cpp | 2 +- hal/src/fsfw_hal/linux/uart/UartComIF.cpp | 2 +- hal/src/fsfw_hal/linux/uart/UartCookie.cpp | 2 +- hal/src/fsfw_hal/linux/utility.cpp | 2 +- .../fsfw_hal/stm32h7/devicetest/GyroL3GD20H.cpp | 12 ++++++------ hal/src/fsfw_hal/stm32h7/dma.cpp | 2 +- hal/src/fsfw_hal/stm32h7/gpio/gpio.cpp | 2 +- hal/src/fsfw_hal/stm32h7/spi/SpiComIF.cpp | 12 ++++++------ hal/src/fsfw_hal/stm32h7/spi/SpiComIF.h | 2 +- hal/src/fsfw_hal/stm32h7/spi/SpiCookie.cpp | 2 +- hal/src/fsfw_hal/stm32h7/spi/mspInit.cpp | 8 ++++---- hal/src/fsfw_hal/stm32h7/spi/spiCore.cpp | 4 ++-- hal/src/fsfw_hal/stm32h7/spi/spiCore.h | 4 ++-- hal/src/fsfw_hal/stm32h7/spi/spiDefinitions.cpp | 2 +- hal/src/fsfw_hal/stm32h7/spi/spiInterrupts.cpp | 4 ++-- hal/src/fsfw_hal/stm32h7/spi/stm32h743ziSpi.cpp | 6 +++--- .../src/fsfw_tests/internal/InternalUnitTester.cpp | 14 +++++++------- tests/src/fsfw_tests/internal/UnittDefinitions.cpp | 2 +- .../internal/globalfunctions/TestArrayPrinter.cpp | 2 +- tests/src/fsfw_tests/internal/osal/IntTestMq.cpp | 4 ++-- .../src/fsfw_tests/internal/osal/IntTestMutex.cpp | 4 ++-- .../fsfw_tests/internal/osal/IntTestSemaphore.cpp | 4 ++-- .../internal/serialize/IntTestSerialization.cpp | 4 ++-- 32 files changed, 68 insertions(+), 68 deletions(-) diff --git a/hal/src/fsfw_hal/common/gpio/GpioCookie.cpp b/hal/src/fsfw_hal/common/gpio/GpioCookie.cpp index 4d221ed9..7c56ebcf 100644 --- a/hal/src/fsfw_hal/common/gpio/GpioCookie.cpp +++ b/hal/src/fsfw_hal/common/gpio/GpioCookie.cpp @@ -1,4 +1,4 @@ -#include "fsfw-hal/common/gpio/GpioCookie.h" +#include "fsfw_hal/common/gpio/GpioCookie.h" #include "fsfw/serviceinterface/ServiceInterface.h" GpioCookie::GpioCookie() { diff --git a/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.cpp b/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.cpp index 539877cc..96d284e1 100644 --- a/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.cpp +++ b/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.cpp @@ -1,4 +1,4 @@ -#include "fsfw-hal/devicehandlers/GyroL3GD20Handler.h" +#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h" #include "fsfw/datapool/PoolReadGuard.h" diff --git a/hal/src/fsfw_hal/linux/UnixFileGuard.cpp b/hal/src/fsfw_hal/linux/UnixFileGuard.cpp index 31280844..f7901018 100644 --- a/hal/src/fsfw_hal/linux/UnixFileGuard.cpp +++ b/hal/src/fsfw_hal/linux/UnixFileGuard.cpp @@ -1,4 +1,4 @@ -#include "fsfw-hal/linux/UnixFileGuard.h" +#include "fsfw_hal/linux/UnixFileGuard.h" UnixFileGuard::UnixFileGuard(std::string device, int* fileDescriptor, int flags, std::string diagnosticPrefix): diff --git a/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp b/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp index 57396169..eef61e58 100644 --- a/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp +++ b/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp @@ -1,6 +1,6 @@ -#include "fsfw-hal/linux/gpio/LinuxLibgpioIF.h" -#include "fsfw-hal/common/gpio/gpioDefinitions.h" -#include "fsfw-hal/common/gpio/GpioCookie.h" +#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h" +#include "fsfw_hal/common/gpio/gpioDefinitions.h" +#include "fsfw_hal/common/gpio/GpioCookie.h" #include diff --git a/hal/src/fsfw_hal/linux/i2c/I2cComIF.cpp b/hal/src/fsfw_hal/linux/i2c/I2cComIF.cpp index b1d3da9e..98d9a510 100644 --- a/hal/src/fsfw_hal/linux/i2c/I2cComIF.cpp +++ b/hal/src/fsfw_hal/linux/i2c/I2cComIF.cpp @@ -1,6 +1,6 @@ -#include "fsfw-hal/linux/i2c/I2cComIF.h" -#include "fsfw-hal/linux/utility.h" -#include "fsfw-hal/linux/UnixFileGuard.h" +#include "fsfw_hal/linux/i2c/I2cComIF.h" +#include "fsfw_hal/linux/utility.h" +#include "fsfw_hal/linux/UnixFileGuard.h" #include "fsfw/serviceinterface/ServiceInterface.h" diff --git a/hal/src/fsfw_hal/linux/i2c/I2cCookie.cpp b/hal/src/fsfw_hal/linux/i2c/I2cCookie.cpp index c3297f1e..aebffedb 100644 --- a/hal/src/fsfw_hal/linux/i2c/I2cCookie.cpp +++ b/hal/src/fsfw_hal/linux/i2c/I2cCookie.cpp @@ -1,4 +1,4 @@ -#include "fsfw-hal/linux/i2c/I2cCookie.h" +#include "fsfw_hal/linux/i2c/I2cCookie.h" I2cCookie::I2cCookie(address_t i2cAddress_, size_t maxReplyLen_, std::string deviceFile_) : diff --git a/hal/src/fsfw_hal/linux/rpi/GpioRPi.cpp b/hal/src/fsfw_hal/linux/rpi/GpioRPi.cpp index c4cc51ff..6a71f291 100644 --- a/hal/src/fsfw_hal/linux/rpi/GpioRPi.cpp +++ b/hal/src/fsfw_hal/linux/rpi/GpioRPi.cpp @@ -1,7 +1,7 @@ #include "fsfw/FSFW.h" -#include "fsfw-hal/linux/rpi/GpioRPi.h" -#include "fsfw-hal/common/gpio/GpioCookie.h" +#include "fsfw_hal/linux/rpi/GpioRPi.h" +#include "fsfw_hal/common/gpio/GpioCookie.h" #include diff --git a/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp b/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp index 35aa6c29..7273dfc2 100644 --- a/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp +++ b/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp @@ -1,8 +1,8 @@ #include "fsfw/FSFW.h" -#include "fsfw-hal/linux/spi/SpiComIF.h" -#include "fsfw-hal/linux/spi/SpiCookie.h" -#include "fsfw-hal/linux/utility.h" -#include "fsfw-hal/linux/UnixFileGuard.h" +#include "fsfw_hal/linux/spi/SpiComIF.h" +#include "fsfw_hal/linux/spi/SpiCookie.h" +#include "fsfw_hal/linux/utility.h" +#include "fsfw_hal/linux/UnixFileGuard.h" #include #include diff --git a/hal/src/fsfw_hal/linux/spi/SpiComIF.h b/hal/src/fsfw_hal/linux/spi/SpiComIF.h index daabf6be..d43e2505 100644 --- a/hal/src/fsfw_hal/linux/spi/SpiComIF.h +++ b/hal/src/fsfw_hal/linux/spi/SpiComIF.h @@ -3,7 +3,7 @@ #include "spiDefinitions.h" #include "returnvalues/classIds.h" -#include "fsfw-hal/common/gpio/GpioIF.h" +#include "fsfw_hal/common/gpio/GpioIF.h" #include "fsfw/devicehandlers/DeviceCommunicationIF.h" #include "fsfw/objectmanager/SystemObject.h" diff --git a/hal/src/fsfw_hal/linux/spi/SpiCookie.cpp b/hal/src/fsfw_hal/linux/spi/SpiCookie.cpp index 1f1806c2..54d8aa16 100644 --- a/hal/src/fsfw_hal/linux/spi/SpiCookie.cpp +++ b/hal/src/fsfw_hal/linux/spi/SpiCookie.cpp @@ -1,4 +1,4 @@ -#include "fsfw-hal/linux/spi/SpiCookie.h" +#include "fsfw_hal/linux/spi/SpiCookie.h" SpiCookie::SpiCookie(address_t spiAddress, gpioId_t chipSelect, std::string spiDev, const size_t maxSize, spi::SpiModes spiMode, uint32_t spiSpeed): diff --git a/hal/src/fsfw_hal/linux/uart/UartComIF.cpp b/hal/src/fsfw_hal/linux/uart/UartComIF.cpp index c6e192c5..2b1da314 100644 --- a/hal/src/fsfw_hal/linux/uart/UartComIF.cpp +++ b/hal/src/fsfw_hal/linux/uart/UartComIF.cpp @@ -1,4 +1,4 @@ -#include "fsfw-hal/linux/uart/UartComIF.h" +#include "fsfw_hal/linux/uart/UartComIF.h" #include "OBSWConfig.h" #include "fsfw/serviceinterface/ServiceInterface.h" diff --git a/hal/src/fsfw_hal/linux/uart/UartCookie.cpp b/hal/src/fsfw_hal/linux/uart/UartCookie.cpp index 5156d9b8..339c7451 100644 --- a/hal/src/fsfw_hal/linux/uart/UartCookie.cpp +++ b/hal/src/fsfw_hal/linux/uart/UartCookie.cpp @@ -1,4 +1,4 @@ -#include "fsfw-hal/linux/uart/UartCookie.h" +#include "fsfw_hal/linux/uart/UartCookie.h" #include diff --git a/hal/src/fsfw_hal/linux/utility.cpp b/hal/src/fsfw_hal/linux/utility.cpp index 6120f983..99489e3f 100644 --- a/hal/src/fsfw_hal/linux/utility.cpp +++ b/hal/src/fsfw_hal/linux/utility.cpp @@ -1,6 +1,6 @@ #include "fsfw/FSFW.h" #include "fsfw/serviceinterface/ServiceInterface.h" -#include "fsfw-hal/linux/utility.h" +#include "fsfw_hal/linux/utility.h" #include #include diff --git a/hal/src/fsfw_hal/stm32h7/devicetest/GyroL3GD20H.cpp b/hal/src/fsfw_hal/stm32h7/devicetest/GyroL3GD20H.cpp index 7e5d0d51..051be344 100644 --- a/hal/src/fsfw_hal/stm32h7/devicetest/GyroL3GD20H.cpp +++ b/hal/src/fsfw_hal/stm32h7/devicetest/GyroL3GD20H.cpp @@ -1,10 +1,10 @@ -#include "fsfw-hal/stm32h7/devicetest/GyroL3GD20H.h" +#include "fsfw_hal/stm32h7/devicetest/GyroL3GD20H.h" -#include "fsfw-hal/stm32h7/spi/mspInit.h" -#include "fsfw-hal/stm32h7/spi/spiDefinitions.h" -#include "fsfw-hal/stm32h7/spi/spiCore.h" -#include "fsfw-hal/stm32h7/spi/spiInterrupts.h" -#include "fsfw-hal/stm32h7/spi/stm32h743ziSpi.h" +#include "fsfw_hal/stm32h7/spi/mspInit.h" +#include "fsfw_hal/stm32h7/spi/spiDefinitions.h" +#include "fsfw_hal/stm32h7/spi/spiCore.h" +#include "fsfw_hal/stm32h7/spi/spiInterrupts.h" +#include "fsfw_hal/stm32h7/spi/stm32h743ziSpi.h" #include "fsfw/tasks/TaskFactory.h" #include "fsfw/serviceinterface/ServiceInterface.h" diff --git a/hal/src/fsfw_hal/stm32h7/dma.cpp b/hal/src/fsfw_hal/stm32h7/dma.cpp index 97cd93a2..bedf4aa4 100644 --- a/hal/src/fsfw_hal/stm32h7/dma.cpp +++ b/hal/src/fsfw_hal/stm32h7/dma.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/hal/src/fsfw_hal/stm32h7/gpio/gpio.cpp b/hal/src/fsfw_hal/stm32h7/gpio/gpio.cpp index d8b24270..5a890d7f 100644 --- a/hal/src/fsfw_hal/stm32h7/gpio/gpio.cpp +++ b/hal/src/fsfw_hal/stm32h7/gpio/gpio.cpp @@ -1,4 +1,4 @@ -#include "fsfw-hal/stm32h7/gpio/gpio.h" +#include "fsfw_hal/stm32h7/gpio/gpio.h" #include "stm32h7xx_hal_rcc.h" diff --git a/hal/src/fsfw_hal/stm32h7/spi/SpiComIF.cpp b/hal/src/fsfw_hal/stm32h7/spi/SpiComIF.cpp index f91602f9..1813aac0 100644 --- a/hal/src/fsfw_hal/stm32h7/spi/SpiComIF.cpp +++ b/hal/src/fsfw_hal/stm32h7/spi/SpiComIF.cpp @@ -1,11 +1,11 @@ -#include "fsfw-hal/stm32h7/spi/SpiComIF.h" -#include "fsfw-hal/stm32h7/spi/SpiCookie.h" +#include "fsfw_hal/stm32h7/spi/SpiComIF.h" +#include "fsfw_hal/stm32h7/spi/SpiCookie.h" #include "fsfw/tasks/SemaphoreFactory.h" -#include "fsfw-hal/stm32h7/spi/spiCore.h" -#include "fsfw-hal/stm32h7/spi/spiInterrupts.h" -#include "fsfw-hal/stm32h7/spi/mspInit.h" -#include "fsfw-hal/stm32h7/gpio/gpio.h" +#include "fsfw_hal/stm32h7/spi/spiCore.h" +#include "fsfw_hal/stm32h7/spi/spiInterrupts.h" +#include "fsfw_hal/stm32h7/spi/mspInit.h" +#include "fsfw_hal/stm32h7/gpio/gpio.h" // FreeRTOS required special Semaphore handling from an ISR. Therefore, we use the concrete // instance here, because RTEMS and FreeRTOS are the only relevant OSALs currently diff --git a/hal/src/fsfw_hal/stm32h7/spi/SpiComIF.h b/hal/src/fsfw_hal/stm32h7/spi/SpiComIF.h index e97aebe7..9548e102 100644 --- a/hal/src/fsfw_hal/stm32h7/spi/SpiComIF.h +++ b/hal/src/fsfw_hal/stm32h7/spi/SpiComIF.h @@ -5,7 +5,7 @@ #include "fsfw/devicehandlers/DeviceCommunicationIF.h" #include "fsfw/objectmanager/SystemObject.h" -#include "fsfw-hal/stm32h7/spi/spiDefinitions.h" +#include "fsfw_hal/stm32h7/spi/spiDefinitions.h" #include "stm32h7xx_hal_spi.h" #include "stm32h743xx.h" diff --git a/hal/src/fsfw_hal/stm32h7/spi/SpiCookie.cpp b/hal/src/fsfw_hal/stm32h7/spi/SpiCookie.cpp index b37d3ae9..88f1e1f1 100644 --- a/hal/src/fsfw_hal/stm32h7/spi/SpiCookie.cpp +++ b/hal/src/fsfw_hal/stm32h7/spi/SpiCookie.cpp @@ -1,4 +1,4 @@ -#include "fsfw-hal/stm32h7/spi/SpiCookie.h" +#include "fsfw_hal/stm32h7/spi/SpiCookie.h" SpiCookie::SpiCookie(address_t deviceAddress, spi::SpiBus spiIdx, spi::TransferModes transferMode, diff --git a/hal/src/fsfw_hal/stm32h7/spi/mspInit.cpp b/hal/src/fsfw_hal/stm32h7/spi/mspInit.cpp index 17ff45f9..4df61f9b 100644 --- a/hal/src/fsfw_hal/stm32h7/spi/mspInit.cpp +++ b/hal/src/fsfw_hal/stm32h7/spi/mspInit.cpp @@ -1,7 +1,7 @@ -#include "fsfw-hal/stm32h7/dma.h" -#include "fsfw-hal/stm32h7/spi/mspInit.h" -#include "fsfw-hal/stm32h7/spi/spiCore.h" -#include "fsfw-hal/stm32h7/spi/spiInterrupts.h" +#include "fsfw_hal/stm32h7/dma.h" +#include "fsfw_hal/stm32h7/spi/mspInit.h" +#include "fsfw_hal/stm32h7/spi/spiCore.h" +#include "fsfw_hal/stm32h7/spi/spiInterrupts.h" #include "stm32h743xx.h" #include "stm32h7xx_hal_spi.h" diff --git a/hal/src/fsfw_hal/stm32h7/spi/spiCore.cpp b/hal/src/fsfw_hal/stm32h7/spi/spiCore.cpp index aa3c32ce..e569c9f4 100644 --- a/hal/src/fsfw_hal/stm32h7/spi/spiCore.cpp +++ b/hal/src/fsfw_hal/stm32h7/spi/spiCore.cpp @@ -1,5 +1,5 @@ -#include "fsfw-hal/stm32h7/spi/spiCore.h" -#include "fsfw-hal/stm32h7/spi/spiDefinitions.h" +#include "fsfw_hal/stm32h7/spi/spiCore.h" +#include "fsfw_hal/stm32h7/spi/spiDefinitions.h" #include diff --git a/hal/src/fsfw_hal/stm32h7/spi/spiCore.h b/hal/src/fsfw_hal/stm32h7/spi/spiCore.h index ba4e1430..1ad5c693 100644 --- a/hal/src/fsfw_hal/stm32h7/spi/spiCore.h +++ b/hal/src/fsfw_hal/stm32h7/spi/spiCore.h @@ -1,8 +1,8 @@ #ifndef FSFW_HAL_STM32H7_SPI_SPICORE_H_ #define FSFW_HAL_STM32H7_SPI_SPICORE_H_ -#include "fsfw-hal/stm32h7/dma.h" -#include "fsfw-hal/stm32h7/spi/spiDefinitions.h" +#include "fsfw_hal/stm32h7/dma.h" +#include "fsfw_hal/stm32h7/spi/spiDefinitions.h" #include "stm32h7xx_hal.h" #include "stm32h7xx_hal_dma.h" diff --git a/hal/src/fsfw_hal/stm32h7/spi/spiDefinitions.cpp b/hal/src/fsfw_hal/stm32h7/spi/spiDefinitions.cpp index 7573640c..11655f5e 100644 --- a/hal/src/fsfw_hal/stm32h7/spi/spiDefinitions.cpp +++ b/hal/src/fsfw_hal/stm32h7/spi/spiDefinitions.cpp @@ -1,4 +1,4 @@ -#include "fsfw-hal/stm32h7/spi/spiDefinitions.h" +#include "fsfw_hal/stm32h7/spi/spiDefinitions.h" void spi::assignSpiMode(SpiModes spiMode, SPI_HandleTypeDef& spiHandle) { switch(spiMode) { diff --git a/hal/src/fsfw_hal/stm32h7/spi/spiInterrupts.cpp b/hal/src/fsfw_hal/stm32h7/spi/spiInterrupts.cpp index c3ca6603..5d84208d 100644 --- a/hal/src/fsfw_hal/stm32h7/spi/spiInterrupts.cpp +++ b/hal/src/fsfw_hal/stm32h7/spi/spiInterrupts.cpp @@ -1,5 +1,5 @@ -#include "fsfw-hal/stm32h7/spi/spiInterrupts.h" -#include "fsfw-hal/stm32h7/spi/spiCore.h" +#include "fsfw_hal/stm32h7/spi/spiInterrupts.h" +#include "fsfw_hal/stm32h7/spi/spiCore.h" #include "stm32h7xx_hal.h" #include "stm32h7xx_hal_dma.h" diff --git a/hal/src/fsfw_hal/stm32h7/spi/stm32h743ziSpi.cpp b/hal/src/fsfw_hal/stm32h7/spi/stm32h743ziSpi.cpp index c6be862f..43194704 100644 --- a/hal/src/fsfw_hal/stm32h7/spi/stm32h743ziSpi.cpp +++ b/hal/src/fsfw_hal/stm32h7/spi/stm32h743ziSpi.cpp @@ -1,6 +1,6 @@ -#include "fsfw-hal/stm32h7/spi/stm32h743ziSpi.h" -#include "fsfw-hal/stm32h7/spi/spiCore.h" -#include "fsfw-hal/stm32h7/spi/spiInterrupts.h" +#include "fsfw_hal/stm32h7/spi/stm32h743ziSpi.h" +#include "fsfw_hal/stm32h7/spi/spiCore.h" +#include "fsfw_hal/stm32h7/spi/spiInterrupts.h" #include "stm32h7xx_hal.h" #include "stm32h7xx_hal_rcc.h" diff --git a/tests/src/fsfw_tests/internal/InternalUnitTester.cpp b/tests/src/fsfw_tests/internal/InternalUnitTester.cpp index 8fc7cb68..f9fc1932 100644 --- a/tests/src/fsfw_tests/internal/InternalUnitTester.cpp +++ b/tests/src/fsfw_tests/internal/InternalUnitTester.cpp @@ -1,11 +1,11 @@ -#include "fsfw-tests/internal/InternalUnitTester.h" -#include "fsfw-tests/internal/UnittDefinitions.h" +#include "fsfw_tests/internal/InternalUnitTester.h" +#include "fsfw_tests/internal/UnittDefinitions.h" -#include "fsfw-tests/internal/osal/IntTestMq.h" -#include "fsfw-tests/internal/osal/IntTestSemaphore.h" -#include "fsfw-tests/internal/osal/IntTestMutex.h" -#include "fsfw-tests/internal/serialize/IntTestSerialization.h" -#include "fsfw-tests/internal/globalfunctions/TestArrayPrinter.h" +#include "fsfw_tests/internal/osal/IntTestMq.h" +#include "fsfw_tests/internal/osal/IntTestSemaphore.h" +#include "fsfw_tests/internal/osal/IntTestMutex.h" +#include "fsfw_tests/internal/serialize/IntTestSerialization.h" +#include "fsfw_tests/internal/globalfunctions/TestArrayPrinter.h" #include diff --git a/tests/src/fsfw_tests/internal/UnittDefinitions.cpp b/tests/src/fsfw_tests/internal/UnittDefinitions.cpp index eaef0bfe..7f754a0a 100644 --- a/tests/src/fsfw_tests/internal/UnittDefinitions.cpp +++ b/tests/src/fsfw_tests/internal/UnittDefinitions.cpp @@ -1,4 +1,4 @@ -#include "fsfw-tests/internal/UnittDefinitions.h" +#include "fsfw_tests/internal/UnittDefinitions.h" ReturnValue_t unitt::put_error(std::string errorId) { #if FSFW_CPP_OSTREAM_ENABLED == 1 diff --git a/tests/src/fsfw_tests/internal/globalfunctions/TestArrayPrinter.cpp b/tests/src/fsfw_tests/internal/globalfunctions/TestArrayPrinter.cpp index f1a0378e..b4311343 100644 --- a/tests/src/fsfw_tests/internal/globalfunctions/TestArrayPrinter.cpp +++ b/tests/src/fsfw_tests/internal/globalfunctions/TestArrayPrinter.cpp @@ -1,4 +1,4 @@ -#include "fsfw-tests/internal/globalfunctions/TestArrayPrinter.h" +#include "fsfw_tests/internal/globalfunctions/TestArrayPrinter.h" void arrayprinter::testArrayPrinter() { { diff --git a/tests/src/fsfw_tests/internal/osal/IntTestMq.cpp b/tests/src/fsfw_tests/internal/osal/IntTestMq.cpp index 5ea3ec34..6c31b354 100644 --- a/tests/src/fsfw_tests/internal/osal/IntTestMq.cpp +++ b/tests/src/fsfw_tests/internal/osal/IntTestMq.cpp @@ -1,5 +1,5 @@ -#include "fsfw-tests/internal/osal/IntTestMq.h" -#include "fsfw-tests/internal/UnittDefinitions.h" +#include "fsfw_tests/internal/osal/IntTestMq.h" +#include "fsfw_tests/internal/UnittDefinitions.h" #include #include diff --git a/tests/src/fsfw_tests/internal/osal/IntTestMutex.cpp b/tests/src/fsfw_tests/internal/osal/IntTestMutex.cpp index 2d8a50c2..b1699a46 100644 --- a/tests/src/fsfw_tests/internal/osal/IntTestMutex.cpp +++ b/tests/src/fsfw_tests/internal/osal/IntTestMutex.cpp @@ -1,5 +1,5 @@ -#include "fsfw-tests/internal/osal/IntTestMutex.h" -#include "fsfw-tests/internal/UnittDefinitions.h" +#include "fsfw_tests/internal/osal/IntTestMutex.h" +#include "fsfw_tests/internal/UnittDefinitions.h" #include diff --git a/tests/src/fsfw_tests/internal/osal/IntTestSemaphore.cpp b/tests/src/fsfw_tests/internal/osal/IntTestSemaphore.cpp index 8a848d92..8b79f33b 100644 --- a/tests/src/fsfw_tests/internal/osal/IntTestSemaphore.cpp +++ b/tests/src/fsfw_tests/internal/osal/IntTestSemaphore.cpp @@ -1,5 +1,5 @@ -#include "fsfw-tests/internal/osal/IntTestSemaphore.h" -#include "fsfw-tests/internal/UnittDefinitions.h" +#include "fsfw_tests/internal/osal/IntTestSemaphore.h" +#include "fsfw_tests/internal/UnittDefinitions.h" #include #include diff --git a/tests/src/fsfw_tests/internal/serialize/IntTestSerialization.cpp b/tests/src/fsfw_tests/internal/serialize/IntTestSerialization.cpp index 42b4861f..4720f706 100644 --- a/tests/src/fsfw_tests/internal/serialize/IntTestSerialization.cpp +++ b/tests/src/fsfw_tests/internal/serialize/IntTestSerialization.cpp @@ -1,5 +1,5 @@ -#include "fsfw-tests/internal/serialize/IntTestSerialization.h" -#include "fsfw-tests/internal/UnittDefinitions.h" +#include "fsfw_tests/internal/serialize/IntTestSerialization.h" +#include "fsfw_tests/internal/UnittDefinitions.h" #include #include From 4d9c07a1ecaff8a570c98201de2bf57a41545347 Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Mon, 2 Aug 2021 21:22:56 +0200 Subject: [PATCH 225/389] wrong path for sgp4 include --- src/fsfw/coordinates/Sgp4Propagator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsfw/coordinates/Sgp4Propagator.h b/src/fsfw/coordinates/Sgp4Propagator.h index aa1e821f..7c7a0a8c 100644 --- a/src/fsfw/coordinates/Sgp4Propagator.h +++ b/src/fsfw/coordinates/Sgp4Propagator.h @@ -7,7 +7,7 @@ #ifndef PLATFORM_WIN #include #endif -#include "fsfw-contrib/sgp4/sgp4unit.h" +#include "fsfw_contrib/sgp4/sgp4unit.h" #include "fsfw/returnvalues/HasReturnvaluesIF.h" class Sgp4Propagator { From ec00a84b294621bded139fa76446dc7cfad8f761 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 3 Aug 2021 18:46:50 +0200 Subject: [PATCH 226/389] update README for moved logo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 484d65c0..48d2b8e7 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![FSFW Logo](logo/FSFW_Logo_V3_bw.png) +![FSFW Logo](misc/logo/FSFW_Logo_V3_bw.png) # Flight Software Framework (FSFW) From 2706b8fa248f9ac2516aa4a0975f629727888003 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 6 Aug 2021 11:06:33 +0200 Subject: [PATCH 227/389] Printer updates 1. Only prefix is colored now 2. Minor formatting change --- .../serviceinterface/ServiceInterfaceBuffer.cpp | 4 ++-- .../serviceinterface/ServiceInterfacePrinter.cpp | 14 +++++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/fsfw/serviceinterface/ServiceInterfaceBuffer.cpp b/src/fsfw/serviceinterface/ServiceInterfaceBuffer.cpp index 25828fe3..0411e674 100644 --- a/src/fsfw/serviceinterface/ServiceInterfaceBuffer.cpp +++ b/src/fsfw/serviceinterface/ServiceInterfaceBuffer.cpp @@ -146,8 +146,8 @@ std::string* ServiceInterfaceBuffer::getPreamble(size_t * preambleSize) { #endif int32_t charCount = sprintf(parsePosition, - "%s: | %02" SCNu32 ":%02" SCNu32 ":%02" SCNu32 ".%03" SCNu32 " | ", - this->logMessage.c_str(), loggerTime.hour, + "%s%s | %02" SCNu32 ":%02" SCNu32 ":%02" SCNu32 ".%03" SCNu32 " | ", + this->logMessage.c_str(), sif::ANSI_COLOR_RESET, loggerTime.hour, loggerTime.minute, loggerTime.second, loggerTime.usecond /1000); diff --git a/src/fsfw/serviceinterface/ServiceInterfacePrinter.cpp b/src/fsfw/serviceinterface/ServiceInterfacePrinter.cpp index 9b62e91d..e42e515d 100644 --- a/src/fsfw/serviceinterface/ServiceInterfacePrinter.cpp +++ b/src/fsfw/serviceinterface/ServiceInterfacePrinter.cpp @@ -56,25 +56,29 @@ void fsfwPrint(sif::PrintLevel printType, const char* fmt, va_list arg) { #endif if (printType == sif::PrintLevel::INFO_LEVEL) { - len += sprintf(bufferPosition + len, "INFO: "); + len += sprintf(bufferPosition + len, "INFO"); } if(printType == sif::PrintLevel::DEBUG_LEVEL) { - len += sprintf(bufferPosition + len, "DEBUG: "); + len += sprintf(bufferPosition + len, "DEBUG"); } if(printType == sif::PrintLevel::WARNING_LEVEL) { - len += sprintf(bufferPosition + len, "WARNING: "); + len += sprintf(bufferPosition + len, "WARNING"); } if(printType == sif::PrintLevel::ERROR_LEVEL) { - len += sprintf(bufferPosition + len, "ERROR: "); + len += sprintf(bufferPosition + len, "ERROR"); } +#if FSFW_COLORED_OUTPUT == 1 + len += sprintf(bufferPosition + len, sif::ANSI_COLOR_RESET); +#endif + Clock::TimeOfDay_t now; Clock::getDateAndTime(&now); /* * Log current time to terminal if desired. */ - len += sprintf(bufferPosition + len, "| %lu:%02lu:%02lu.%03lu | ", + len += sprintf(bufferPosition + len, " | %lu:%02lu:%02lu.%03lu | ", (unsigned long) now.hour, (unsigned long) now.minute, (unsigned long) now.second, From 90a1571707b4d75244ca641f0a70e2bfe9f7c764 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 6 Aug 2021 11:23:31 +0200 Subject: [PATCH 228/389] Linux HAL updates 1. The type correction was merged as part of https://egit.irs.uni-stuttgart.de/eive/fsfw/pulls/7 in the EIVE project. Quotation of PR definition of getSpiParameters is `void getSpiParameters(spi::SpiModes& spiMode, uint32_t& spiSpeed, UncommonParameters* parameters = nullptr) const;`. Here, size_t spiSpeed is passed, which implicitely gets converted to a temporary, which can not be bound to uint32_t& and, at least in gcc 9.3.0, leads to a compiler error. 2. Allow flushing the UART buffers --- hal/src/fsfw_hal/linux/spi/SpiComIF.cpp | 2 +- hal/src/fsfw_hal/linux/uart/UartComIF.cpp | 45 +++++++++++++++++++++++ hal/src/fsfw_hal/linux/uart/UartComIF.h | 15 ++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) diff --git a/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp b/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp index 7273dfc2..fafe67be 100644 --- a/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp +++ b/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp @@ -82,7 +82,7 @@ ReturnValue_t SpiComIF::initializeInterface(CookieIF *cookie) { gpioComIF->pullHigh(gpioId); } - size_t spiSpeed = 0; + uint32_t spiSpeed = 0; spi::SpiModes spiMode = spi::SpiModes::MODE_0; SpiCookie::UncommonParameters params; diff --git a/hal/src/fsfw_hal/linux/uart/UartComIF.cpp b/hal/src/fsfw_hal/linux/uart/UartComIF.cpp index 2b1da314..3c975735 100644 --- a/hal/src/fsfw_hal/linux/uart/UartComIF.cpp +++ b/hal/src/fsfw_hal/linux/uart/UartComIF.cpp @@ -443,6 +443,51 @@ ReturnValue_t UartComIF::readReceivedMessage(CookieIF *cookie, return RETURN_OK; } +ReturnValue_t UartComIF::flushUartRxBuffer(CookieIF *cookie) { + std::string deviceFile; + UartDeviceMapIter uartDeviceMapIter; + UartCookie* uartCookie = dynamic_cast(cookie); + if(uartCookie == nullptr) { + sif::warning << "UartComIF::flushUartRxBuffer: Invalid uart cookie!" << std::endl; + return NULLPOINTER; + } + deviceFile = uartCookie->getDeviceFile(); + uartDeviceMapIter = uartDeviceMap.find(deviceFile); + int fd = uartDeviceMapIter->second.fileDescriptor; + tcflush(fd, TCIFLUSH); + return RETURN_OK; +} + +ReturnValue_t UartComIF::flushUartTxBuffer(CookieIF *cookie) { + std::string deviceFile; + UartDeviceMapIter uartDeviceMapIter; + UartCookie* uartCookie = dynamic_cast(cookie); + if(uartCookie == nullptr) { + sif::warning << "UartComIF::flushUartTxBuffer: Invalid uart cookie!" << std::endl; + return NULLPOINTER; + } + deviceFile = uartCookie->getDeviceFile(); + uartDeviceMapIter = uartDeviceMap.find(deviceFile); + int fd = uartDeviceMapIter->second.fileDescriptor; + tcflush(fd, TCOFLUSH); + return RETURN_OK; +} + +ReturnValue_t UartComIF::flushUartTxAndRxBuf(CookieIF *cookie) { + std::string deviceFile; + UartDeviceMapIter uartDeviceMapIter; + UartCookie* uartCookie = dynamic_cast(cookie); + if(uartCookie == nullptr) { + sif::warning << "UartComIF::flushUartTxAndRxBuf: Invalid uart cookie!" << std::endl; + return NULLPOINTER; + } + deviceFile = uartCookie->getDeviceFile(); + uartDeviceMapIter = uartDeviceMap.find(deviceFile); + int fd = uartDeviceMapIter->second.fileDescriptor; + tcflush(fd, TCIOFLUSH); + return RETURN_OK; +} + void UartComIF::setUartMode(struct termios *options, UartCookie &uartCookie) { UartModes uartMode = uartCookie.getUartMode(); if(uartMode == UartModes::NON_CANONICAL) { diff --git a/hal/src/fsfw_hal/linux/uart/UartComIF.h b/hal/src/fsfw_hal/linux/uart/UartComIF.h index e513aa86..68d2b9f5 100644 --- a/hal/src/fsfw_hal/linux/uart/UartComIF.h +++ b/hal/src/fsfw_hal/linux/uart/UartComIF.h @@ -41,6 +41,21 @@ public: ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) override; + /** + * @brief This function discards all data received but not read in the UART buffer. + */ + ReturnValue_t flushUartRxBuffer(CookieIF *cookie); + + /** + * @brief This function discards all data in the transmit buffer of the UART driver. + */ + ReturnValue_t flushUartTxBuffer(CookieIF *cookie); + + /** + * @brief This function discards both data in the transmit and receive buffer of the UART. + */ + ReturnValue_t flushUartTxAndRxBuf(CookieIF *cookie); + private: using UartDeviceFile_t = std::string; From 20adc1c9813697744a37c375027114370131695c Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" <–meierj@irs.uni-stuttgart.de> Date: Sat, 7 Aug 2021 14:28:12 +0200 Subject: [PATCH 229/389] queue nullptr check in action helper --- action/ActionHelper.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/action/ActionHelper.cpp b/action/ActionHelper.cpp index 73007ea3..aaa19ac4 100644 --- a/action/ActionHelper.cpp +++ b/action/ActionHelper.cpp @@ -33,6 +33,17 @@ ReturnValue_t ActionHelper::initialize(MessageQueueIF* queueToUse_) { setQueueToUse(queueToUse_); } + if(queueToUse == nullptr) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "ActionHelper::initialize: No queue set" << std::endl; +#else + sif::printWarning("ActionHelper::initialize: No queue set\n"); +#endif +#endif /* FSFW_VERBOSE_LEVEL >= 1 */ + return HasReturnvaluesIF::RETURN_FAILED; + } + return HasReturnvaluesIF::RETURN_OK; } From 62873c31188e38ac28df369de36bb3684a371e95 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 9 Aug 2021 15:37:12 +0200 Subject: [PATCH 230/389] UartComIF check iter validity --- hal/src/fsfw_hal/linux/uart/UartComIF.cpp | 27 +++++++++++++++-------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/hal/src/fsfw_hal/linux/uart/UartComIF.cpp b/hal/src/fsfw_hal/linux/uart/UartComIF.cpp index 3c975735..f52b6b1e 100644 --- a/hal/src/fsfw_hal/linux/uart/UartComIF.cpp +++ b/hal/src/fsfw_hal/linux/uart/UartComIF.cpp @@ -453,9 +453,12 @@ ReturnValue_t UartComIF::flushUartRxBuffer(CookieIF *cookie) { } deviceFile = uartCookie->getDeviceFile(); uartDeviceMapIter = uartDeviceMap.find(deviceFile); - int fd = uartDeviceMapIter->second.fileDescriptor; - tcflush(fd, TCIFLUSH); - return RETURN_OK; + if(uartDeviceMapIter != uartDeviceMap.end()) { + int fd = uartDeviceMapIter->second.fileDescriptor; + tcflush(fd, TCIFLUSH); + return RETURN_OK; + } + return RETURN_FAILED; } ReturnValue_t UartComIF::flushUartTxBuffer(CookieIF *cookie) { @@ -468,9 +471,12 @@ ReturnValue_t UartComIF::flushUartTxBuffer(CookieIF *cookie) { } deviceFile = uartCookie->getDeviceFile(); uartDeviceMapIter = uartDeviceMap.find(deviceFile); - int fd = uartDeviceMapIter->second.fileDescriptor; - tcflush(fd, TCOFLUSH); - return RETURN_OK; + if(uartDeviceMapIter != uartDeviceMap.end()) { + int fd = uartDeviceMapIter->second.fileDescriptor; + tcflush(fd, TCOFLUSH); + return RETURN_OK; + } + return RETURN_FAILED; } ReturnValue_t UartComIF::flushUartTxAndRxBuf(CookieIF *cookie) { @@ -483,9 +489,12 @@ ReturnValue_t UartComIF::flushUartTxAndRxBuf(CookieIF *cookie) { } deviceFile = uartCookie->getDeviceFile(); uartDeviceMapIter = uartDeviceMap.find(deviceFile); - int fd = uartDeviceMapIter->second.fileDescriptor; - tcflush(fd, TCIOFLUSH); - return RETURN_OK; + if(uartDeviceMapIter != uartDeviceMap.end()) { + int fd = uartDeviceMapIter->second.fileDescriptor; + tcflush(fd, TCIOFLUSH); + return RETURN_OK; + } + return RETURN_FAILED; } void UartComIF::setUartMode(struct termios *options, UartCookie &uartCookie) { From ccaa0aa24f75ff26b59ae75f4a57d476aaa22d18 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 9 Aug 2021 16:57:24 +0200 Subject: [PATCH 231/389] Cleaning up TCP and UDP code Same port number used as before, but some inconsistencies fixed --- src/fsfw/osal/common/TcpTmTcBridge.cpp | 2 +- src/fsfw/osal/common/TcpTmTcBridge.h | 2 +- src/fsfw/osal/common/TcpTmTcServer.cpp | 4 ++-- src/fsfw/osal/common/TcpTmTcServer.h | 3 +-- src/fsfw/osal/common/UdpTmTcBridge.cpp | 4 ++-- src/fsfw/osal/common/UdpTmTcBridge.h | 2 +- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/fsfw/osal/common/TcpTmTcBridge.cpp b/src/fsfw/osal/common/TcpTmTcBridge.cpp index 24f1a281..f873d5c7 100644 --- a/src/fsfw/osal/common/TcpTmTcBridge.cpp +++ b/src/fsfw/osal/common/TcpTmTcBridge.cpp @@ -17,7 +17,7 @@ #endif -const std::string TcpTmTcBridge::DEFAULT_UDP_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT; +const std::string TcpTmTcBridge::DEFAULT_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT; TcpTmTcBridge::TcpTmTcBridge(object_id_t objectId, object_id_t tcDestination, object_id_t tmStoreId, object_id_t tcStoreId): diff --git a/src/fsfw/osal/common/TcpTmTcBridge.h b/src/fsfw/osal/common/TcpTmTcBridge.h index 6cfacb9f..be0d0d52 100644 --- a/src/fsfw/osal/common/TcpTmTcBridge.h +++ b/src/fsfw/osal/common/TcpTmTcBridge.h @@ -30,7 +30,7 @@ class TcpTmTcBridge: friend class TcpTmTcServer; public: /* The ports chosen here should not be used by any other process. */ - static const std::string DEFAULT_UDP_SERVER_PORT; + static const std::string DEFAULT_SERVER_PORT; /** * Constructor diff --git a/src/fsfw/osal/common/TcpTmTcServer.cpp b/src/fsfw/osal/common/TcpTmTcServer.cpp index f94449bb..057cd538 100644 --- a/src/fsfw/osal/common/TcpTmTcServer.cpp +++ b/src/fsfw/osal/common/TcpTmTcServer.cpp @@ -22,14 +22,14 @@ #define FSFW_TCP_RECV_WIRETAPPING_ENABLED 0 #endif -const std::string TcpTmTcServer::DEFAULT_TCP_SERVER_PORT = "7303"; +const std::string TcpTmTcServer::DEFAULT_SERVER_PORT = TcpTmTcBridge::DEFAULT_SERVER_PORT; TcpTmTcServer::TcpTmTcServer(object_id_t objectId, object_id_t tmtcTcpBridge, size_t receptionBufferSize, std::string customTcpServerPort): SystemObject(objectId), tmtcBridgeId(tmtcTcpBridge), tcpPort(customTcpServerPort), receptionBuffer(receptionBufferSize) { if(tcpPort == "") { - tcpPort = DEFAULT_TCP_SERVER_PORT; + tcpPort = DEFAULT_SERVER_PORT; } } diff --git a/src/fsfw/osal/common/TcpTmTcServer.h b/src/fsfw/osal/common/TcpTmTcServer.h index f7c36d69..6588f111 100644 --- a/src/fsfw/osal/common/TcpTmTcServer.h +++ b/src/fsfw/osal/common/TcpTmTcServer.h @@ -41,8 +41,7 @@ class TcpTmTcServer: public TcpIpBase, public ExecutableObjectIF { public: - /* The ports chosen here should not be used by any other process. */ - static const std::string DEFAULT_TCP_SERVER_PORT; + static const std::string DEFAULT_SERVER_PORT; static constexpr size_t ETHERNET_MTU_SIZE = 1500; diff --git a/src/fsfw/osal/common/UdpTmTcBridge.cpp b/src/fsfw/osal/common/UdpTmTcBridge.cpp index 7015cf4a..db2546cd 100644 --- a/src/fsfw/osal/common/UdpTmTcBridge.cpp +++ b/src/fsfw/osal/common/UdpTmTcBridge.cpp @@ -17,13 +17,13 @@ #define FSFW_UDP_SEND_WIRETAPPING_ENABLED 0 #endif -const std::string UdpTmTcBridge::DEFAULT_UDP_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT; +const std::string UdpTmTcBridge::DEFAULT_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT; UdpTmTcBridge::UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination, std::string udpServerPort, object_id_t tmStoreId, object_id_t tcStoreId): TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) { if(udpServerPort == "") { - this->udpServerPort = DEFAULT_UDP_SERVER_PORT; + this->udpServerPort = DEFAULT_SERVER_PORT; } else { this->udpServerPort = udpServerPort; diff --git a/src/fsfw/osal/common/UdpTmTcBridge.h b/src/fsfw/osal/common/UdpTmTcBridge.h index 7a346de5..93c7511e 100644 --- a/src/fsfw/osal/common/UdpTmTcBridge.h +++ b/src/fsfw/osal/common/UdpTmTcBridge.h @@ -28,7 +28,7 @@ class UdpTmTcBridge: friend class UdpTcPollingTask; public: /* The ports chosen here should not be used by any other process. */ - static const std::string DEFAULT_UDP_SERVER_PORT; + static const std::string DEFAULT_SERVER_PORT; UdpTmTcBridge(object_id_t objectId, object_id_t tcDestination, std::string udpServerPort = "", object_id_t tmStoreId = objects::TM_STORE, From 14a30f30db15805cca98c984d238a3bccd32882b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 9 Aug 2021 18:12:25 +0200 Subject: [PATCH 232/389] More improvements for TCP/UDP port definition --- src/fsfw/osal/common/TcpTmTcBridge.cpp | 3 --- src/fsfw/osal/common/TcpTmTcBridge.h | 4 +--- src/fsfw/osal/common/TcpTmTcServer.cpp | 6 +++++- src/fsfw/osal/common/TcpTmTcServer.h | 19 +++++++++++-------- src/fsfw/osal/common/UdpTmTcBridge.h | 4 ++-- src/fsfw/osal/common/tcpipCommon.h | 4 ++-- 6 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/fsfw/osal/common/TcpTmTcBridge.cpp b/src/fsfw/osal/common/TcpTmTcBridge.cpp index f873d5c7..3cd03c36 100644 --- a/src/fsfw/osal/common/TcpTmTcBridge.cpp +++ b/src/fsfw/osal/common/TcpTmTcBridge.cpp @@ -1,6 +1,5 @@ #include "fsfw/platform.h" #include "fsfw/osal/common/TcpTmTcBridge.h" -#include "fsfw/osal/common/tcpipHelpers.h" #include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/ipc/MutexGuard.h" @@ -17,8 +16,6 @@ #endif -const std::string TcpTmTcBridge::DEFAULT_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT; - TcpTmTcBridge::TcpTmTcBridge(object_id_t objectId, object_id_t tcDestination, object_id_t tmStoreId, object_id_t tcStoreId): TmTcBridge(objectId, tcDestination, tmStoreId, tcStoreId) { diff --git a/src/fsfw/osal/common/TcpTmTcBridge.h b/src/fsfw/osal/common/TcpTmTcBridge.h index be0d0d52..dc46f1f0 100644 --- a/src/fsfw/osal/common/TcpTmTcBridge.h +++ b/src/fsfw/osal/common/TcpTmTcBridge.h @@ -2,7 +2,7 @@ #define FSFW_OSAL_COMMON_TCPTMTCBRIDGE_H_ #include "TcpIpBase.h" -#include "../../tmtcservices/TmTcBridge.h" +#include "fsfw/tmtcservices/TmTcBridge.h" #ifdef _WIN32 @@ -29,8 +29,6 @@ class TcpTmTcBridge: public TmTcBridge { friend class TcpTmTcServer; public: - /* The ports chosen here should not be used by any other process. */ - static const std::string DEFAULT_SERVER_PORT; /** * Constructor diff --git a/src/fsfw/osal/common/TcpTmTcServer.cpp b/src/fsfw/osal/common/TcpTmTcServer.cpp index 057cd538..11ab71af 100644 --- a/src/fsfw/osal/common/TcpTmTcServer.cpp +++ b/src/fsfw/osal/common/TcpTmTcServer.cpp @@ -22,7 +22,7 @@ #define FSFW_TCP_RECV_WIRETAPPING_ENABLED 0 #endif -const std::string TcpTmTcServer::DEFAULT_SERVER_PORT = TcpTmTcBridge::DEFAULT_SERVER_PORT; +const std::string TcpTmTcServer::DEFAULT_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT; TcpTmTcServer::TcpTmTcServer(object_id_t objectId, object_id_t tmtcTcpBridge, size_t receptionBufferSize, std::string customTcpServerPort): @@ -200,6 +200,10 @@ void TcpTmTcServer::setTcpBacklog(uint8_t tcpBacklog) { this->tcpBacklog = tcpBacklog; } +std::string TcpTmTcServer::getTcpPort() const { + return tcpPort; +} + ReturnValue_t TcpTmTcServer::handleTmSending(socket_t connSocket) { // Access to the FIFO is mutex protected because it is filled by the bridge MutexGuard(tmtcBridge->mutex, tmtcBridge->timeoutType, tmtcBridge->mutexTimeoutMs); diff --git a/src/fsfw/osal/common/TcpTmTcServer.h b/src/fsfw/osal/common/TcpTmTcServer.h index 6588f111..c6916080 100644 --- a/src/fsfw/osal/common/TcpTmTcServer.h +++ b/src/fsfw/osal/common/TcpTmTcServer.h @@ -3,13 +3,14 @@ #include "TcpIpBase.h" -#include "../../platform.h" -#include "../../ipc/messageQueueDefinitions.h" -#include "../../ipc/MessageQueueIF.h" -#include "../../objectmanager/frameworkObjects.h" -#include "../../objectmanager/SystemObject.h" -#include "../../storagemanager/StorageManagerIF.h" -#include "../../tasks/ExecutableObjectIF.h" +#include "fsfw/platform.h" +#include "fsfw/osal/common/tcpipHelpers.h" +#include "fsfw/ipc/messageQueueDefinitions.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/objectmanager/frameworkObjects.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/tasks/ExecutableObjectIF.h" #ifdef PLATFORM_UNIX #include @@ -43,7 +44,7 @@ class TcpTmTcServer: public: static const std::string DEFAULT_SERVER_PORT; - static constexpr size_t ETHERNET_MTU_SIZE = 1500; + static constexpr size_t ETHERNET_MTU_SIZE = 1500; /** * TCP Server Constructor @@ -64,6 +65,8 @@ public: ReturnValue_t performOperation(uint8_t opCode) override; ReturnValue_t initializeAfterTaskCreation() override; + std::string getTcpPort() const; + protected: StorageManagerIF* tcStore = nullptr; StorageManagerIF* tmStore = nullptr; diff --git a/src/fsfw/osal/common/UdpTmTcBridge.h b/src/fsfw/osal/common/UdpTmTcBridge.h index 93c7511e..dc695c81 100644 --- a/src/fsfw/osal/common/UdpTmTcBridge.h +++ b/src/fsfw/osal/common/UdpTmTcBridge.h @@ -2,8 +2,8 @@ #define FSFW_OSAL_COMMON_TMTCUDPBRIDGE_H_ #include "TcpIpBase.h" -#include "../../platform.h" -#include "../../tmtcservices/TmTcBridge.h" +#include "fsfw/platform.h" +#include "fsfw/tmtcservices/TmTcBridge.h" #ifdef PLATFORM_WIN #include diff --git a/src/fsfw/osal/common/tcpipCommon.h b/src/fsfw/osal/common/tcpipCommon.h index ce7a90cd..5a04144e 100644 --- a/src/fsfw/osal/common/tcpipCommon.h +++ b/src/fsfw/osal/common/tcpipCommon.h @@ -1,7 +1,7 @@ #ifndef FSFW_OSAL_COMMON_TCPIPCOMMON_H_ #define FSFW_OSAL_COMMON_TCPIPCOMMON_H_ -#include "../../timemanager/clockDefinitions.h" +#include "fsfw/timemanager/clockDefinitions.h" #include #ifdef _WIN32 @@ -13,7 +13,7 @@ namespace tcpip { -const char* const DEFAULT_SERVER_PORT = "7301"; +static constexpr char DEFAULT_SERVER_PORT[] = "7301"; enum class Protocol { UDP, From eecb69d230399b2e05c0729cfad9d8cdf00e25b4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 9 Aug 2021 18:22:22 +0200 Subject: [PATCH 233/389] getter function for UDP port --- src/fsfw/osal/common/UdpTmTcBridge.cpp | 4 ++++ src/fsfw/osal/common/UdpTmTcBridge.h | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/fsfw/osal/common/UdpTmTcBridge.cpp b/src/fsfw/osal/common/UdpTmTcBridge.cpp index db2546cd..734a2b15 100644 --- a/src/fsfw/osal/common/UdpTmTcBridge.cpp +++ b/src/fsfw/osal/common/UdpTmTcBridge.cpp @@ -108,6 +108,10 @@ UdpTmTcBridge::~UdpTmTcBridge() { } } +std::string UdpTmTcBridge::getUdpPort() const { + return udpServerPort; +} + ReturnValue_t UdpTmTcBridge::sendTm(const uint8_t *data, size_t dataLen) { int flags = 0; diff --git a/src/fsfw/osal/common/UdpTmTcBridge.h b/src/fsfw/osal/common/UdpTmTcBridge.h index dc695c81..4d634e64 100644 --- a/src/fsfw/osal/common/UdpTmTcBridge.h +++ b/src/fsfw/osal/common/UdpTmTcBridge.h @@ -44,6 +44,8 @@ public: void checkAndSetClientAddress(sockaddr& clientAddress); + std::string getUdpPort() const; + protected: virtual ReturnValue_t sendTm(const uint8_t * data, size_t dataLen) override; From a18706ec5351db0ae638380ba806cbce44c8ece3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 16 Aug 2021 10:49:07 +0200 Subject: [PATCH 234/389] Make FSFW tests accessible from outside 1. Further reduces the amount of code the user needs to copy and paste 2. Makes FSFW tests more accessible. This can be used to simplify moving mission unit tests to the FSFW 3. A lot of include improvements --- CMakeLists.txt | 3 ++- tests/src/fsfw_tests/unit/CMakeLists.txt | 13 ++++++++++ .../fsfw_tests/unit}/CatchDefinitions.cpp | 0 .../fsfw_tests/unit}/CatchDefinitions.h | 0 .../fsfw_tests/unit}/CatchFactory.cpp | 16 +++++++------ tests/src/fsfw_tests/unit/CatchFactory.h | 24 +++++++++++++++++++ .../fsfw_tests/unit}/CatchRunner.cpp | 6 ++--- tests/src/fsfw_tests/unit/CatchRunner.h | 14 +++++++++++ .../fsfw_tests/unit}/CatchSetup.cpp | 15 +++++------- .../unit/action/TestActionHelper.cpp | 5 +--- .../fsfw_tests/unit/action/TestActionHelper.h | 3 +-- .../unit/container/RingBufferTest.cpp | 2 +- .../unit/container/TestArrayList.cpp | 3 ++- .../unit/container/TestDynamicFifo.cpp | 3 ++- .../fsfw_tests/unit/container/TestFifo.cpp | 3 ++- .../unit/container/TestFixedArrayList.cpp | 3 ++- .../unit/container/TestFixedMap.cpp | 3 ++- .../container/TestFixedOrderedMultimap.cpp | 3 ++- .../unit/container/TestPlacementFactory.cpp | 3 ++- .../unit/datapoollocal/DataSetTest.cpp | 7 +++--- .../datapoollocal/LocalPoolManagerTest.cpp | 9 +++---- .../unit/datapoollocal/LocalPoolOwnerBase.h | 2 +- .../datapoollocal/LocalPoolVariableTest.cpp | 4 ++-- .../datapoollocal/LocalPoolVectorTest.cpp | 3 ++- .../unit/mocks/MessageQueueMockBase.h | 9 ++++--- .../fsfw_tests/unit/osal/TestMessageQueue.cpp | 3 ++- .../fsfw_tests/unit}/printChar.cpp | 0 .../core => src/fsfw_tests/unit}/printChar.h | 0 .../serialize/TestSerialBufferAdapter.cpp | 4 +++- .../unit/serialize/TestSerialLinkedPacket.cpp | 3 +-- .../unit/serialize/TestSerialization.cpp | 2 +- .../unit/storagemanager/TestNewAccessor.cpp | 5 +++- .../unit/storagemanager/TestPool.cpp | 3 ++- tests/user/CMakeLists.txt | 4 ++-- tests/user/testcfg/TestsConfig.h.in | 2 ++ tests/user/unittest/CMakeLists.txt | 1 - tests/user/unittest/core/CMakeLists.txt | 13 ---------- tests/user/unittest/core/CatchFactory.h | 16 ------------- tests/user/unittest/core/core.mk | 3 --- 39 files changed, 124 insertions(+), 91 deletions(-) rename tests/{user/unittest/core => src/fsfw_tests/unit}/CatchDefinitions.cpp (100%) rename tests/{user/unittest/core => src/fsfw_tests/unit}/CatchDefinitions.h (100%) rename tests/{user/unittest/core => src/fsfw_tests/unit}/CatchFactory.cpp (91%) create mode 100644 tests/src/fsfw_tests/unit/CatchFactory.h rename tests/{user/unittest/core => src/fsfw_tests/unit}/CatchRunner.cpp (78%) create mode 100644 tests/src/fsfw_tests/unit/CatchRunner.h rename tests/{user/unittest/core => src/fsfw_tests/unit}/CatchSetup.cpp (57%) rename tests/{user/unittest/core => src/fsfw_tests/unit}/printChar.cpp (100%) rename tests/{user/unittest/core => src/fsfw_tests/unit}/printChar.h (100%) delete mode 100644 tests/user/unittest/CMakeLists.txt delete mode 100644 tests/user/unittest/core/CMakeLists.txt delete mode 100644 tests/user/unittest/core/CatchFactory.h delete mode 100644 tests/user/unittest/core/core.mk diff --git a/CMakeLists.txt b/CMakeLists.txt index b7865300..feaa4b81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ endif() option(FSFW_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON) # Options to exclude parts of the FSFW from compilation. option(FSFW_ADD_INTERNAL_TESTS "Add internal unit tests" ON) +option(FSFW_ADD_UNITTESTS "Add regular unittests. Requires Catch2" OFF) option(FSFW_ADD_HAL "Add Hardware Abstraction Layer" ON) # Optional sources @@ -38,7 +39,7 @@ elseif(${CMAKE_CXX_STANDARD} LESS 11) endif() # Backwards comptability -if(OS_FSFW) +if(OS_FSFW AND NOT FSFW_OSAL) message(WARNING "Please pass the FSFW OSAL as FSFW_OSAL instead of OS_FSFW") set(FSFW_OSAL OS_FSFW) endif() diff --git a/tests/src/fsfw_tests/unit/CMakeLists.txt b/tests/src/fsfw_tests/unit/CMakeLists.txt index 255063f3..01e4d19c 100644 --- a/tests/src/fsfw_tests/unit/CMakeLists.txt +++ b/tests/src/fsfw_tests/unit/CMakeLists.txt @@ -1,3 +1,16 @@ +target_sources(${TARGET_NAME} PRIVATE + CatchDefinitions.cpp + CatchFactory.cpp + printChar.cpp +) + +if(FSFW_CUSTOM_UNITTEST_RUNNER) + target_sources(${TARGET_NAME} PRIVATE + CatchRunner.cpp + CatchSetup.cpp + ) +endif() + add_subdirectory(action) add_subdirectory(container) add_subdirectory(osal) diff --git a/tests/user/unittest/core/CatchDefinitions.cpp b/tests/src/fsfw_tests/unit/CatchDefinitions.cpp similarity index 100% rename from tests/user/unittest/core/CatchDefinitions.cpp rename to tests/src/fsfw_tests/unit/CatchDefinitions.cpp diff --git a/tests/user/unittest/core/CatchDefinitions.h b/tests/src/fsfw_tests/unit/CatchDefinitions.h similarity index 100% rename from tests/user/unittest/core/CatchDefinitions.h rename to tests/src/fsfw_tests/unit/CatchDefinitions.h diff --git a/tests/user/unittest/core/CatchFactory.cpp b/tests/src/fsfw_tests/unit/CatchFactory.cpp similarity index 91% rename from tests/user/unittest/core/CatchFactory.cpp rename to tests/src/fsfw_tests/unit/CatchFactory.cpp index ff591b8e..010ab5dd 100644 --- a/tests/user/unittest/core/CatchFactory.cpp +++ b/tests/src/fsfw_tests/unit/CatchFactory.cpp @@ -1,17 +1,21 @@ #include "CatchFactory.h" +#include "datapoollocal/LocalPoolOwnerBase.h" +#include "mocks/HkReceiverMock.h" + #include #include #include #include -#include +#include #include #include #include #include #include -#include -#include + + +#if FSFW_ADD_DEFAULT_FACTORY_FUNCTIONS == 1 /** * @brief Produces system objects. @@ -26,7 +30,7 @@ * * @ingroup init */ -void Factory::produce(void) { +void Factory::produceFrameworkObjects(void* args) { setStaticFrameworkObjectIds(); new EventManager(objects::EVENT_MANAGER); new HealthTable(objects::HEALTH_TABLE); @@ -55,7 +59,6 @@ void Factory::produce(void) { }; new PoolManager(objects::IPC_STORE, poolCfg); } - } void Factory::setStaticFrameworkObjectIds() { @@ -77,5 +80,4 @@ void Factory::setStaticFrameworkObjectIds() { TmPacketBase::timeStamperId = objects::NO_OBJECT; } - - +#endif diff --git a/tests/src/fsfw_tests/unit/CatchFactory.h b/tests/src/fsfw_tests/unit/CatchFactory.h new file mode 100644 index 00000000..ae0629e5 --- /dev/null +++ b/tests/src/fsfw_tests/unit/CatchFactory.h @@ -0,0 +1,24 @@ +#ifndef FSFW_CATCHFACTORY_H_ +#define FSFW_CATCHFACTORY_H_ + +#include "TestConfig.h" +#include "fsfw/objectmanager/SystemObjectIF.h" +#include "fsfw/objectmanager/ObjectManager.h" + +// TODO: It is possible to solve this more cleanly using a special class which +// is allowed to set the object IDs and has virtual functions. +#if FSFW_ADD_DEFAULT_FACTORY_FUNCTIONS == 1 + +namespace Factory { + /** + * @brief Creates all SystemObject elements which are persistent + * during execution. + */ + void produceFrameworkObjects(void* args); + void setStaticFrameworkObjectIds(); + +} + +#endif /* FSFW_ADD_DEFAULT_FSFW_FACTORY == 1 */ + +#endif /* FSFW_CATCHFACTORY_H_ */ diff --git a/tests/user/unittest/core/CatchRunner.cpp b/tests/src/fsfw_tests/unit/CatchRunner.cpp similarity index 78% rename from tests/user/unittest/core/CatchRunner.cpp rename to tests/src/fsfw_tests/unit/CatchRunner.cpp index 886d641f..c96db7f4 100644 --- a/tests/user/unittest/core/CatchRunner.cpp +++ b/tests/src/fsfw_tests/unit/CatchRunner.cpp @@ -6,7 +6,7 @@ * from the eclipse market place to get colored characters. */ -#include +#include "CatchRunner.h" #define CATCH_CONFIG_COLOUR_WINDOWS @@ -14,11 +14,11 @@ extern int customSetup(); -int main( int argc, char* argv[] ) { +int fsfwtest::customMain(int argc, char* argv[]) { customSetup(); // Catch internal function call - int result = Catch::Session().run( argc, argv ); + int result = Catch::Session().run(argc, argv); // global clean-up return result; diff --git a/tests/src/fsfw_tests/unit/CatchRunner.h b/tests/src/fsfw_tests/unit/CatchRunner.h new file mode 100644 index 00000000..720625c6 --- /dev/null +++ b/tests/src/fsfw_tests/unit/CatchRunner.h @@ -0,0 +1,14 @@ +#ifndef FSFW_TESTS_USER_UNITTEST_CORE_CATCHRUNNER_H_ +#define FSFW_TESTS_USER_UNITTEST_CORE_CATCHRUNNER_H_ + +namespace fsfwtest { + +/** + * Can be called by upper level main() if default Catch2 main is overriden + * @return + */ +int customMain(int argc, char* argv[]); + +} + +#endif /* FSFW_TESTS_USER_UNITTEST_CORE_CATCHRUNNER_H_ */ diff --git a/tests/user/unittest/core/CatchSetup.cpp b/tests/src/fsfw_tests/unit/CatchSetup.cpp similarity index 57% rename from tests/user/unittest/core/CatchSetup.cpp rename to tests/src/fsfw_tests/unit/CatchSetup.cpp index bda31400..a0791bc9 100644 --- a/tests/user/unittest/core/CatchSetup.cpp +++ b/tests/src/fsfw_tests/unit/CatchSetup.cpp @@ -5,10 +5,9 @@ #include #endif -#include -#include -#include -#include +#include "fsfw/objectmanager/ObjectManager.h" +#include "fsfw/storagemanager/StorageManagerIF.h" +#include "fsfw/serviceinterface/ServiceInterface.h" /* Global instantiations normally done in main.cpp */ @@ -24,13 +23,11 @@ ServiceInterfaceStream warning("WARNING"); } #endif -/* Global object manager */ -ObjectManagerIF *objectManager; - int customSetup() { // global setup - objectManager = new ObjectManager(Factory::produce); - objectManager -> initialize(); + ObjectManager* objMan = ObjectManager::instance(); + objMan->setObjectFactoryFunction(Factory::produceFrameworkObjects, nullptr); + objMan->initialize(); return 0; } diff --git a/tests/src/fsfw_tests/unit/action/TestActionHelper.cpp b/tests/src/fsfw_tests/unit/action/TestActionHelper.cpp index 126979f6..3129b001 100644 --- a/tests/src/fsfw_tests/unit/action/TestActionHelper.cpp +++ b/tests/src/fsfw_tests/unit/action/TestActionHelper.cpp @@ -1,13 +1,10 @@ #include "TestActionHelper.h" - -#include +#include "fsfw_tests/unit/mocks/MessageQueueMockBase.h" #include #include -#include #include - #include diff --git a/tests/src/fsfw_tests/unit/action/TestActionHelper.h b/tests/src/fsfw_tests/unit/action/TestActionHelper.h index 641ea2c6..34b228c0 100644 --- a/tests/src/fsfw_tests/unit/action/TestActionHelper.h +++ b/tests/src/fsfw_tests/unit/action/TestActionHelper.h @@ -1,12 +1,11 @@ #ifndef UNITTEST_HOSTED_TESTACTIONHELPER_H_ #define UNITTEST_HOSTED_TESTACTIONHELPER_H_ +#include "fsfw_tests/unit/CatchDefinitions.h" #include #include -#include #include - class ActionHelperOwnerMockBase: public HasActionsIF { public: bool getCommandQueueCalled = false; diff --git a/tests/src/fsfw_tests/unit/container/RingBufferTest.cpp b/tests/src/fsfw_tests/unit/container/RingBufferTest.cpp index 32a2502d..819401ab 100644 --- a/tests/src/fsfw_tests/unit/container/RingBufferTest.cpp +++ b/tests/src/fsfw_tests/unit/container/RingBufferTest.cpp @@ -1,4 +1,4 @@ -#include +#include "fsfw_tests/unit/CatchDefinitions.h" #include #include diff --git a/tests/src/fsfw_tests/unit/container/TestArrayList.cpp b/tests/src/fsfw_tests/unit/container/TestArrayList.cpp index 1fd330b6..9417144c 100644 --- a/tests/src/fsfw_tests/unit/container/TestArrayList.cpp +++ b/tests/src/fsfw_tests/unit/container/TestArrayList.cpp @@ -1,8 +1,9 @@ +#include "fsfw_tests/unit/CatchDefinitions.h" + #include #include #include -#include /** * @brief Array List test diff --git a/tests/src/fsfw_tests/unit/container/TestDynamicFifo.cpp b/tests/src/fsfw_tests/unit/container/TestDynamicFifo.cpp index 2b572d52..a1bab3ba 100644 --- a/tests/src/fsfw_tests/unit/container/TestDynamicFifo.cpp +++ b/tests/src/fsfw_tests/unit/container/TestDynamicFifo.cpp @@ -1,9 +1,10 @@ +#include "fsfw_tests/unit/CatchDefinitions.h" + #include #include #include #include -#include TEST_CASE( "Dynamic Fifo Tests", "[TestDynamicFifo]") { INFO("Dynamic Fifo Tests"); diff --git a/tests/src/fsfw_tests/unit/container/TestFifo.cpp b/tests/src/fsfw_tests/unit/container/TestFifo.cpp index fbcd40cc..311dd8fd 100644 --- a/tests/src/fsfw_tests/unit/container/TestFifo.cpp +++ b/tests/src/fsfw_tests/unit/container/TestFifo.cpp @@ -1,9 +1,10 @@ +#include "fsfw_tests/unit/CatchDefinitions.h" + #include #include #include #include -#include TEST_CASE( "Static Fifo Tests", "[TestFifo]") { INFO("Fifo Tests"); diff --git a/tests/src/fsfw_tests/unit/container/TestFixedArrayList.cpp b/tests/src/fsfw_tests/unit/container/TestFixedArrayList.cpp index 1a85f30d..ed597f73 100644 --- a/tests/src/fsfw_tests/unit/container/TestFixedArrayList.cpp +++ b/tests/src/fsfw_tests/unit/container/TestFixedArrayList.cpp @@ -1,8 +1,9 @@ +#include "fsfw_tests/unit/CatchDefinitions.h" + #include #include #include -#include TEST_CASE( "FixedArrayList Tests", "[TestFixedArrayList]") { diff --git a/tests/src/fsfw_tests/unit/container/TestFixedMap.cpp b/tests/src/fsfw_tests/unit/container/TestFixedMap.cpp index 297171ca..488418b9 100644 --- a/tests/src/fsfw_tests/unit/container/TestFixedMap.cpp +++ b/tests/src/fsfw_tests/unit/container/TestFixedMap.cpp @@ -1,8 +1,9 @@ +#include "fsfw_tests/unit/CatchDefinitions.h" + #include #include #include -#include template class FixedMap; diff --git a/tests/src/fsfw_tests/unit/container/TestFixedOrderedMultimap.cpp b/tests/src/fsfw_tests/unit/container/TestFixedOrderedMultimap.cpp index a47d6efb..23d91744 100644 --- a/tests/src/fsfw_tests/unit/container/TestFixedOrderedMultimap.cpp +++ b/tests/src/fsfw_tests/unit/container/TestFixedOrderedMultimap.cpp @@ -1,8 +1,9 @@ +#include "fsfw_tests/unit/CatchDefinitions.h" + #include #include #include -#include TEST_CASE( "FixedOrderedMultimap Tests", "[TestFixedOrderedMultimap]") { INFO("FixedOrderedMultimap Tests"); diff --git a/tests/src/fsfw_tests/unit/container/TestPlacementFactory.cpp b/tests/src/fsfw_tests/unit/container/TestPlacementFactory.cpp index 14cf8eb4..1e328fc7 100644 --- a/tests/src/fsfw_tests/unit/container/TestPlacementFactory.cpp +++ b/tests/src/fsfw_tests/unit/container/TestPlacementFactory.cpp @@ -1,10 +1,11 @@ +#include "fsfw_tests/unit/CatchDefinitions.h" + #include #include #include #include #include -#include TEST_CASE( "PlacementFactory Tests", "[TestPlacementFactory]") { INFO("PlacementFactory Tests"); diff --git a/tests/src/fsfw_tests/unit/datapoollocal/DataSetTest.cpp b/tests/src/fsfw_tests/unit/datapoollocal/DataSetTest.cpp index b8748eb4..94b13f2f 100644 --- a/tests/src/fsfw_tests/unit/datapoollocal/DataSetTest.cpp +++ b/tests/src/fsfw_tests/unit/datapoollocal/DataSetTest.cpp @@ -1,7 +1,5 @@ #include "LocalPoolOwnerBase.h" - -#include -#include +#include "fsfw_tests/unit/CatchDefinitions.h" #include #include @@ -10,7 +8,8 @@ #include #include -#include +#include +#include TEST_CASE("DataSetTest" , "[DataSetTest]") { LocalPoolOwnerBase* poolOwner = ObjectManager::instance()-> diff --git a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolManagerTest.cpp b/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolManagerTest.cpp index 4a4d08fb..7b2f9412 100644 --- a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolManagerTest.cpp +++ b/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolManagerTest.cpp @@ -1,7 +1,5 @@ #include "LocalPoolOwnerBase.h" - -#include -#include +#include "fsfw_tests/unit/CatchDefinitions.h" #include #include @@ -10,7 +8,10 @@ #include #include #include -#include + +#include +#include + #include diff --git a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.h b/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.h index c0e41ddf..ea5bb7e0 100644 --- a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.h +++ b/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.h @@ -2,6 +2,7 @@ #define FSFW_UNITTEST_TESTS_DATAPOOLLOCAL_LOCALPOOLOWNERBASE_H_ #include "objects/systemObjectList.h" +#include "../mocks/MessageQueueMockBase.h" #include #include @@ -10,7 +11,6 @@ #include #include #include -#include #include namespace lpool { diff --git a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVariableTest.cpp b/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVariableTest.cpp index 514d8125..648a76e2 100644 --- a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVariableTest.cpp +++ b/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVariableTest.cpp @@ -1,10 +1,10 @@ #include "LocalPoolOwnerBase.h" +#include "fsfw_tests/unit/CatchDefinitions.h" -#include #include #include -#include +#include TEST_CASE("LocalPoolVariable" , "[LocPoolVarTest]") { LocalPoolOwnerBase* poolOwner = ObjectManager::instance()-> diff --git a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVectorTest.cpp b/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVectorTest.cpp index 5b3dd105..3f846dec 100644 --- a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVectorTest.cpp +++ b/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVectorTest.cpp @@ -1,9 +1,10 @@ #include "LocalPoolOwnerBase.h" +#include "fsfw_tests/unit/CatchDefinitions.h" #include #include #include -#include + TEST_CASE("LocalPoolVector" , "[LocPoolVecTest]") { LocalPoolOwnerBase* poolOwner = ObjectManager::instance()-> diff --git a/tests/src/fsfw_tests/unit/mocks/MessageQueueMockBase.h b/tests/src/fsfw_tests/unit/mocks/MessageQueueMockBase.h index 3000f7fb..93a00b7a 100644 --- a/tests/src/fsfw_tests/unit/mocks/MessageQueueMockBase.h +++ b/tests/src/fsfw_tests/unit/mocks/MessageQueueMockBase.h @@ -1,9 +1,12 @@ #ifndef FSFW_UNITTEST_TESTS_MOCKS_MESSAGEQUEUEMOCKBASE_H_ #define FSFW_UNITTEST_TESTS_MOCKS_MESSAGEQUEUEMOCKBASE_H_ -#include -#include -#include +#include "fsfw_tests/unit/CatchDefinitions.h" + +#include "fsfw/ipc/CommandMessage.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/ipc/MessageQueueMessage.h" + #include #include diff --git a/tests/src/fsfw_tests/unit/osal/TestMessageQueue.cpp b/tests/src/fsfw_tests/unit/osal/TestMessageQueue.cpp index e33b7240..07197bf7 100644 --- a/tests/src/fsfw_tests/unit/osal/TestMessageQueue.cpp +++ b/tests/src/fsfw_tests/unit/osal/TestMessageQueue.cpp @@ -1,8 +1,9 @@ +#include "fsfw_tests/unit/CatchDefinitions.h" + #include #include #include -#include #include diff --git a/tests/user/unittest/core/printChar.cpp b/tests/src/fsfw_tests/unit/printChar.cpp similarity index 100% rename from tests/user/unittest/core/printChar.cpp rename to tests/src/fsfw_tests/unit/printChar.cpp diff --git a/tests/user/unittest/core/printChar.h b/tests/src/fsfw_tests/unit/printChar.h similarity index 100% rename from tests/user/unittest/core/printChar.h rename to tests/src/fsfw_tests/unit/printChar.h diff --git a/tests/src/fsfw_tests/unit/serialize/TestSerialBufferAdapter.cpp b/tests/src/fsfw_tests/unit/serialize/TestSerialBufferAdapter.cpp index 1938746d..01d75881 100644 --- a/tests/src/fsfw_tests/unit/serialize/TestSerialBufferAdapter.cpp +++ b/tests/src/fsfw_tests/unit/serialize/TestSerialBufferAdapter.cpp @@ -1,7 +1,9 @@ +#include "fsfw_tests/unit/CatchDefinitions.h" + #include #include -#include + #include diff --git a/tests/src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.cpp b/tests/src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.cpp index b90ae9f8..b6bb214d 100644 --- a/tests/src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.cpp +++ b/tests/src/fsfw_tests/unit/serialize/TestSerialLinkedPacket.cpp @@ -1,10 +1,9 @@ #include "TestSerialLinkedPacket.h" -#include +#include "fsfw_tests/unit/CatchDefinitions.h" #include #include -#include #include diff --git a/tests/src/fsfw_tests/unit/serialize/TestSerialization.cpp b/tests/src/fsfw_tests/unit/serialize/TestSerialization.cpp index 3de581ec..64deae3b 100644 --- a/tests/src/fsfw_tests/unit/serialize/TestSerialization.cpp +++ b/tests/src/fsfw_tests/unit/serialize/TestSerialization.cpp @@ -1,8 +1,8 @@ +#include "fsfw_tests/unit/CatchDefinitions.h" #include #include #include -#include #include diff --git a/tests/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp b/tests/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp index 10d05c6b..bd1634b7 100644 --- a/tests/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp +++ b/tests/src/fsfw_tests/unit/storagemanager/TestNewAccessor.cpp @@ -1,6 +1,9 @@ +#include "fsfw_tests/unit/CatchDefinitions.h" + #include + #include -#include + #include #include diff --git a/tests/src/fsfw_tests/unit/storagemanager/TestPool.cpp b/tests/src/fsfw_tests/unit/storagemanager/TestPool.cpp index d05a3dd6..013ecf86 100644 --- a/tests/src/fsfw_tests/unit/storagemanager/TestPool.cpp +++ b/tests/src/fsfw_tests/unit/storagemanager/TestPool.cpp @@ -1,8 +1,9 @@ +#include "fsfw_tests/unit/CatchDefinitions.h" + #include #include #include -#include #include diff --git a/tests/user/CMakeLists.txt b/tests/user/CMakeLists.txt index df16c756..2e1fdee3 100644 --- a/tests/user/CMakeLists.txt +++ b/tests/user/CMakeLists.txt @@ -32,7 +32,7 @@ if(NOT FSFW_OSAL) set(FSFW_OSAL host CACHE STRING "OS for the FSFW.") endif() -option(CUSTOM_UNITTEST_RUNNER +option(FSFW_CUSTOM_UNITTEST_RUNNER "Specify whether custom main or Catch2 main is used" TRUE ) @@ -49,7 +49,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED True) # Set names and variables set(TARGET_NAME ${CMAKE_PROJECT_NAME}) -if(CUSTOM_UNITTEST_RUNNER) +if(FSFW_CUSTOM_UNITTEST_RUNNER) set(CATCH2_TARGET Catch2) else() set(CATCH2_TARGET Catch2WithMain) diff --git a/tests/user/testcfg/TestsConfig.h.in b/tests/user/testcfg/TestsConfig.h.in index 0341583d..7d950070 100644 --- a/tests/user/testcfg/TestsConfig.h.in +++ b/tests/user/testcfg/TestsConfig.h.in @@ -1,6 +1,8 @@ #ifndef FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_ #define FSFW_UNITTEST_CONFIG_TESTSCONFIG_H_ +#define FSFW_ADD_DEFAULT_FACTORY_FUNCTIONS 1 + #ifdef __cplusplus #include "objects/systemObjectList.h" diff --git a/tests/user/unittest/CMakeLists.txt b/tests/user/unittest/CMakeLists.txt deleted file mode 100644 index ad6d4787..00000000 --- a/tests/user/unittest/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(core) diff --git a/tests/user/unittest/core/CMakeLists.txt b/tests/user/unittest/core/CMakeLists.txt deleted file mode 100644 index 0989926c..00000000 --- a/tests/user/unittest/core/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -target_sources(${TARGET_NAME} PRIVATE - CatchDefinitions.cpp - CatchFactory.cpp - CatchRunner.cpp - CatchSetup.cpp - printChar.cpp -) - -if(CUSTOM_UNITTEST_RUNNER) - target_sources(${TARGET_NAME} PRIVATE - CatchRunner.cpp - ) -endif() \ No newline at end of file diff --git a/tests/user/unittest/core/CatchFactory.h b/tests/user/unittest/core/CatchFactory.h deleted file mode 100644 index 024f762e..00000000 --- a/tests/user/unittest/core/CatchFactory.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef FSFW_CATCHFACTORY_H_ -#define FSFW_CATCHFACTORY_H_ - -#include - -namespace Factory { - /** - * @brief Creates all SystemObject elements which are persistent - * during execution. - */ - void produce(void* args); - void setStaticFrameworkObjectIds(); - -} - -#endif /* FSFW_CATCHFACTORY_H_ */ diff --git a/tests/user/unittest/core/core.mk b/tests/user/unittest/core/core.mk deleted file mode 100644 index 3e5626d3..00000000 --- a/tests/user/unittest/core/core.mk +++ /dev/null @@ -1,3 +0,0 @@ -CXXSRC += $(wildcard $(CURRENTPATH)/*.cpp) - -INCLUDES += $(CURRENTPATH) \ No newline at end of file From cfb8bc5dfdb146f66187e38eafe9af8b18a0d031 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 16 Aug 2021 11:20:15 +0200 Subject: [PATCH 235/389] fsfw version update --- src/fsfw/FSFWVersion.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/fsfw/FSFWVersion.h b/src/fsfw/FSFWVersion.h index df2d49a5..1d0da280 100644 --- a/src/fsfw/FSFWVersion.h +++ b/src/fsfw/FSFWVersion.h @@ -1,12 +1,10 @@ -#ifndef FSFW_DEFAULTCFG_VERSION_H_ -#define FSFW_DEFAULTCFG_VERSION_H_ +#ifndef FSFW_VERSION_H_ +#define FSFW_VERSION_H_ const char* const FSFW_VERSION_NAME = "ASTP"; #define FSFW_VERSION 1 -#define FSFW_SUBVERSION 0 -#define FSFW_REVISION 0 +#define FSFW_SUBVERSION 3 +#define FSFW_REVISION 0 - - -#endif /* FSFW_DEFAULTCFG_VERSION_H_ */ +#endif /* FSFW_VERSION_H_ */ From 6e9a0ddcf46d8988e96a6aa6de97178625462993 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 16 Aug 2021 11:23:44 +0200 Subject: [PATCH 236/389] cmakedefine for OSAL type --- CMakeLists.txt | 37 +++++++++++++++---------------------- src/fsfw/FSFW.h.in | 5 +++++ 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7865300..9a1f7d1a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,35 +62,28 @@ endif() set(FSFW_OSAL_DEFINITION FSFW_OSAL_HOST) if(FSFW_OSAL MATCHES host) - set(OS_FSFW_NAME "Host") + set(OS_FSFW_NAME "Host") + set(FSFW_OSAL_HOST ON) elseif(FSFW_OSAL MATCHES linux) - set(OS_FSFW_NAME "Linux") - set(FSFW_OSAL_DEFINITION FSFW_OSAL_LINUX) + set(OS_FSFW_NAME "Linux") + set(FSFW_OSAL_LINUX ON) elseif(FSFW_OSAL MATCHES freertos) - set(OS_FSFW_NAME "FreeRTOS") - set(FSFW_OSAL_DEFINITION FSFW_OSAL_FREERTOS) - target_link_libraries(${LIB_FSFW_NAME} PRIVATE + set(OS_FSFW_NAME "FreeRTOS") + set(FSFW_OSAL_FREERTOS ON) + target_link_libraries(${LIB_FSFW_NAME} PRIVATE ${LIB_OS_NAME} - ) + ) elseif(FSFW_OSAL STREQUAL rtems) - set(OS_FSFW_NAME "RTEMS") - set(FSFW_OSAL_DEFINITION FSFW_OSAL_RTEMS) + set(OS_FSFW_NAME "RTEMS") + set(FSFW_OSAL_RTEMS ON) else() - message(WARNING - "Invalid operating system for FSFW specified! Setting to host.." - ) - set(OS_FSFW_NAME "Host") - set(OS_FSFW "host") + message(WARNING + "Invalid operating system for FSFW specified! Setting to host.." + ) + set(OS_FSFW_NAME "Host") + set(OS_FSFW "host") endif() -target_compile_definitions(${LIB_FSFW_NAME} PRIVATE - ${FSFW_OSAL_DEFINITION} -) - -target_compile_definitions(${LIB_FSFW_NAME} INTERFACE - ${FSFW_OSAL_DEFINITION} -) - message(STATUS "Compiling FSFW for the ${OS_FSFW_NAME} operating system.") add_subdirectory(src) diff --git a/src/fsfw/FSFW.h.in b/src/fsfw/FSFW.h.in index 4d4b8aee..f0eb9365 100644 --- a/src/fsfw/FSFW.h.in +++ b/src/fsfw/FSFW.h.in @@ -3,6 +3,11 @@ #include "FSFWConfig.h" +#cmakedefine FSFW_OSAL_RTEMS +#cmakedefine FSFW_OSAL_FREERTOS +#cmakedefine FSFW_OSAL_LINUX +#cmakedefine FSFW_OSAL_HOST + #cmakedefine FSFW_ADD_RMAP #cmakedefine FSFW_ADD_DATALINKLAYER #cmakedefine FSFW_ADD_TMSTORAGE From 517d52f55df804ef22fab9c7be6708e2560b180d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 16 Aug 2021 11:27:46 +0200 Subject: [PATCH 237/389] using better defines --- .../src/fsfw_tests/internal/InternalUnitTester.cpp | 9 ++++++--- tests/src/fsfw_tests/internal/InternalUnitTester.h | 1 + tests/src/fsfw_tests/internal/osal/IntTestMutex.cpp | 11 ++++++----- .../fsfw_tests/internal/osal/IntTestSemaphore.cpp | 13 +++++++------ 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/tests/src/fsfw_tests/internal/InternalUnitTester.cpp b/tests/src/fsfw_tests/internal/InternalUnitTester.cpp index f9fc1932..20998d64 100644 --- a/tests/src/fsfw_tests/internal/InternalUnitTester.cpp +++ b/tests/src/fsfw_tests/internal/InternalUnitTester.cpp @@ -16,15 +16,18 @@ InternalUnitTester::~InternalUnitTester() {} ReturnValue_t InternalUnitTester::performTests( const struct InternalUnitTester::TestConfig& testConfig) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::info << "Running internal unit tests.." << std::endl; + sif::info << "Running internal unit tests.. Error messages might follow" << + std::endl; #else sif::printInfo("Running internal unit tests..\n"); #endif testserialize::test_serialization(); testmq::testMq(); - testsemaph::testBinSemaph(); - testsemaph::testCountingSemaph(); + if(testConfig.testSemaphores) { + testsemaph::testBinSemaph(); + testsemaph::testCountingSemaph(); + } testmutex::testMutex(); if(testConfig.testArrayPrinter) { arrayprinter::testArrayPrinter(); diff --git a/tests/src/fsfw_tests/internal/InternalUnitTester.h b/tests/src/fsfw_tests/internal/InternalUnitTester.h index 50c89d77..433a0f1f 100644 --- a/tests/src/fsfw_tests/internal/InternalUnitTester.h +++ b/tests/src/fsfw_tests/internal/InternalUnitTester.h @@ -18,6 +18,7 @@ class InternalUnitTester: public HasReturnvaluesIF { public: struct TestConfig { bool testArrayPrinter = false; + bool testSemaphores = true; }; InternalUnitTester(); diff --git a/tests/src/fsfw_tests/internal/osal/IntTestMutex.cpp b/tests/src/fsfw_tests/internal/osal/IntTestMutex.cpp index b1699a46..d9184cd8 100644 --- a/tests/src/fsfw_tests/internal/osal/IntTestMutex.cpp +++ b/tests/src/fsfw_tests/internal/osal/IntTestMutex.cpp @@ -1,10 +1,12 @@ #include "fsfw_tests/internal/osal/IntTestMutex.h" #include "fsfw_tests/internal/UnittDefinitions.h" +#include "fsfw/platform.h" #include -#if defined(WIN32) || defined(UNIX) -#include +#if defined PLATFORM_WIN || defined PLATFORM_UNIX +#include "fsfw/osal/host/Mutex.h" + #include #include #endif @@ -20,7 +22,7 @@ void testmutex::testMutex() { // timed_mutex from the C++ library specifies undefined behaviour if // the timed mutex is locked twice from the same thread. // TODO: we should pass a define like FSFW_OSAL_HOST to the build. -#if defined(WIN32) || defined(UNIX) +#if defined PLATFORM_WIN || defined PLATFORM_UNIX // This calls the function from // another thread and stores the returnvalue in a future. auto future = std::async(&MutexIF::lockMutex, mutex, MutexIF::TimeoutType::WAITING, 1); @@ -37,8 +39,7 @@ void testmutex::testMutex() { unitt::put_error(id); } - // TODO: we should pass a define like FSFW_OSAL_HOST to the build. -#if !defined(WIN32) && !defined(UNIX) +#if !defined PLATFORM_WIN && !defined PLATFORM_UNIX result = mutex->unlockMutex(); if(result != MutexIF::CURR_THREAD_DOES_NOT_OWN_MUTEX) { unitt::put_error(id); diff --git a/tests/src/fsfw_tests/internal/osal/IntTestSemaphore.cpp b/tests/src/fsfw_tests/internal/osal/IntTestSemaphore.cpp index 8b79f33b..4b28f961 100644 --- a/tests/src/fsfw_tests/internal/osal/IntTestSemaphore.cpp +++ b/tests/src/fsfw_tests/internal/osal/IntTestSemaphore.cpp @@ -1,9 +1,10 @@ +#include "fsfw/FSFW.h" #include "fsfw_tests/internal/osal/IntTestSemaphore.h" #include "fsfw_tests/internal/UnittDefinitions.h" -#include -#include -#include +#include "fsfw/tasks/SemaphoreFactory.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/timemanager/Stopwatch.h" #include @@ -16,7 +17,7 @@ void testsemaph::testBinSemaph() { } testBinSemaphoreImplementation(binSemaph, id); SemaphoreFactory::instance()->deleteSemaphore(binSemaph); -#if defined(freeRTOS) +#if defined FSFW_OSAL_FREERTOS SemaphoreIF* binSemaphUsingTask = SemaphoreFactory::instance()->createBinarySemaphore(1); testBinSemaphoreImplementation(binSemaphUsingTask, id); @@ -36,7 +37,7 @@ void testsemaph::testCountingSemaph() { } testBinSemaphoreImplementation(countingSemaph, id); SemaphoreFactory::instance()->deleteSemaphore(countingSemaph); -#if defined(freeRTOS) +#if defined FSFW_OSAL_FREERTOS countingSemaph = SemaphoreFactory::instance()-> createCountingSemaphore(1, 1, 1); testBinSemaphoreImplementation(countingSemaph, id); @@ -50,7 +51,7 @@ void testsemaph::testCountingSemaph() { createCountingSemaphore(3,3); testCountingSemaphImplementation(countingSemaph, id); SemaphoreFactory::instance()->deleteSemaphore(countingSemaph); -#if defined(freeRTOS) +#if defined FSFW_OSAL_FREERTOS countingSemaph = SemaphoreFactory::instance()-> createCountingSemaphore(3, 0, 1); uint8_t semaphCount = countingSemaph->getSemaphoreCounter(); From db3284c2b8cc6492a50476025a93cab509e02d77 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 16 Aug 2021 14:52:11 +0200 Subject: [PATCH 238/389] subversion update --- src/fsfw/FSFWVersion.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsfw/FSFWVersion.h b/src/fsfw/FSFWVersion.h index 1d0da280..f8e89694 100644 --- a/src/fsfw/FSFWVersion.h +++ b/src/fsfw/FSFWVersion.h @@ -4,7 +4,7 @@ const char* const FSFW_VERSION_NAME = "ASTP"; #define FSFW_VERSION 1 -#define FSFW_SUBVERSION 3 +#define FSFW_SUBVERSION 2 #define FSFW_REVISION 0 #endif /* FSFW_VERSION_H_ */ From fa14ebbe1f0aa5f8888e53d3476b93acf1a82cdb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 16 Aug 2021 15:19:03 +0200 Subject: [PATCH 239/389] additional check --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9a1f7d1a..4a1ec8c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,7 +38,7 @@ elseif(${CMAKE_CXX_STANDARD} LESS 11) endif() # Backwards comptability -if(OS_FSFW) +if(OS_FSFW AND NOT FSFW_OSAL) message(WARNING "Please pass the FSFW OSAL as FSFW_OSAL instead of OS_FSFW") set(FSFW_OSAL OS_FSFW) endif() From 92d3f0743b3b765e8da028b4aba712f751eda201 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 16 Aug 2021 15:26:28 +0200 Subject: [PATCH 240/389] moved change to another PR --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index feaa4b81..4882db54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,7 @@ elseif(${CMAKE_CXX_STANDARD} LESS 11) endif() # Backwards comptability -if(OS_FSFW AND NOT FSFW_OSAL) +if(OS_FSFW) message(WARNING "Please pass the FSFW OSAL as FSFW_OSAL instead of OS_FSFW") set(FSFW_OSAL OS_FSFW) endif() From 4b72e246c36bab632d9efd92ff1d8e6cd533b6a9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 17 Aug 2021 15:05:29 +0200 Subject: [PATCH 241/389] improved DLE encoder --- src/fsfw/globalfunctions/DleEncoder.cpp | 67 ++++++++++++++----------- src/fsfw/globalfunctions/DleEncoder.h | 66 +++++++++++++++--------- 2 files changed, 79 insertions(+), 54 deletions(-) diff --git a/src/fsfw/globalfunctions/DleEncoder.cpp b/src/fsfw/globalfunctions/DleEncoder.cpp index 11df8ad7..d6f3cc87 100644 --- a/src/fsfw/globalfunctions/DleEncoder.cpp +++ b/src/fsfw/globalfunctions/DleEncoder.cpp @@ -1,6 +1,7 @@ #include "fsfw/globalfunctions/DleEncoder.h" -DleEncoder::DleEncoder() {} +DleEncoder::DleEncoder(bool escapeStxEtx, bool escapeCr): escapeStxEtx(escapeStxEtx), + escapeCr(escapeCr) {} DleEncoder::~DleEncoder() {} @@ -17,26 +18,28 @@ ReturnValue_t DleEncoder::encode(const uint8_t* sourceStream, ++encodedIndex; } - while (encodedIndex < maxDestLen and sourceIndex < sourceLen) - { + while (encodedIndex < maxDestLen and sourceIndex < sourceLen) { nextByte = sourceStream[sourceIndex]; // STX, ETX and CR characters in the stream need to be escaped with DLE - if (nextByte == STX_CHAR or nextByte == ETX_CHAR or nextByte == CARRIAGE_RETURN) { - if (encodedIndex + 1 >= maxDestLen) { - return STREAM_TOO_SHORT; - } - else { - destStream[encodedIndex] = DLE_CHAR; - ++encodedIndex; - /* Escaped byte will be actual byte + 0x40. This prevents - * STX, ETX, and carriage return characters from appearing - * in the encoded data stream at all, so when polling an - * encoded stream, the transmission can be stopped at ETX. - * 0x40 was chosen at random with special requirements: - * - Prevent going from one control char to another - * - Prevent overflow for common characters */ - destStream[encodedIndex] = nextByte + 0x40; - } + if ((nextByte == STX_CHAR or nextByte == ETX_CHAR) or + (this->escapeCr and nextByte == CARRIAGE_RETURN)) { + if(this->escapeStxEtx) { + if (encodedIndex + 1 >= maxDestLen) { + return STREAM_TOO_SHORT; + } + else { + destStream[encodedIndex] = DLE_CHAR; + ++encodedIndex; + /* Escaped byte will be actual byte + 0x40. This prevents + * STX, ETX, and carriage return characters from appearing + * in the encoded data stream at all, so when polling an + * encoded stream, the transmission can be stopped at ETX. + * 0x40 was chosen at random with special requirements: + * - Prevent going from one control char to another + * - Prevent overflow for common characters */ + destStream[encodedIndex] = nextByte + 0x40; + } + } } // DLE characters are simply escaped with DLE. else if (nextByte == DLE_CHAR) { @@ -90,16 +93,22 @@ ReturnValue_t DleEncoder::decode(const uint8_t *sourceStream, destStream[decodedIndex] = nextByte; } else { - /* The next byte is a STX, DTX or 0x0D character which - * was escaped by a DLE character. The actual byte was - * also encoded by adding + 0x40 to prevent having control chars, - * in the stream at all, so we convert it back. */ - if (nextByte == 0x42 or nextByte == 0x43 or nextByte == 0x4D) { - destStream[decodedIndex] = nextByte - 0x40; - } - else { - return DECODING_ERROR; - } + if(this->escapeStxEtx) { + /* The next byte is a STX, DTX or 0x0D character which + * was escaped by a DLE character. The actual byte was + * also encoded by adding + 0x40 to prevent having control chars, + * in the stream at all, so we convert it back. */ + if ((nextByte == STX_CHAR + 0x40 or nextByte == ETX_CHAR + 0x40) or + (this->escapeCr and nextByte == CARRIAGE_RETURN + 0x40)) { + destStream[decodedIndex] = nextByte - 0x40; + } + else { + return DECODING_ERROR; + } + } + else { + return DECODING_ERROR; + } } ++encodedIndex; } diff --git a/src/fsfw/globalfunctions/DleEncoder.h b/src/fsfw/globalfunctions/DleEncoder.h index 6d073f9a..38d4dc75 100644 --- a/src/fsfw/globalfunctions/DleEncoder.h +++ b/src/fsfw/globalfunctions/DleEncoder.h @@ -1,7 +1,7 @@ #ifndef FRAMEWORK_GLOBALFUNCTIONS_DLEENCODER_H_ #define FRAMEWORK_GLOBALFUNCTIONS_DLEENCODER_H_ -#include "../returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" #include /** @@ -13,9 +13,9 @@ * * This encoder can be used to achieve a basic transport layer when using * char based transmission systems. - * The passed source strean is converted into a encoded stream by adding + * The passed source stream is converted into a encoded stream by adding * a STX marker at the start of the stream and an ETX marker at the end of - * the stream. Any STX, ETX, DLE and CR occurrences in the source stream are + * the stream. Any STX, ETX, DLE and CR occurrences in the source stream can be * escaped by a DLE character. The encoder also replaces escaped control chars * by another char, so STX, ETX and CR should not appear anywhere in the actual * encoded data stream. @@ -26,38 +26,45 @@ */ class DleEncoder: public HasReturnvaluesIF { private: - DleEncoder(); - virtual ~DleEncoder(); + DleEncoder(bool escapeStxEtx = true, bool escapeCr = false); + virtual ~DleEncoder(); public: - static constexpr uint8_t INTERFACE_ID = CLASS_ID::DLE_ENCODER; - static constexpr ReturnValue_t STREAM_TOO_SHORT = MAKE_RETURN_CODE(0x01); - static constexpr ReturnValue_t DECODING_ERROR = MAKE_RETURN_CODE(0x02); + static constexpr uint8_t INTERFACE_ID = CLASS_ID::DLE_ENCODER; + static constexpr ReturnValue_t STREAM_TOO_SHORT = MAKE_RETURN_CODE(0x01); + static constexpr ReturnValue_t DECODING_ERROR = MAKE_RETURN_CODE(0x02); - //! Start Of Text character. First character is encoded stream - static constexpr uint8_t STX_CHAR = 0x02; - //! End Of Text character. Last character in encoded stream - static constexpr uint8_t ETX_CHAR = 0x03; - //! Data Link Escape character. Used to escape STX, ETX and DLE occurrences - //! in the source stream. - static constexpr uint8_t DLE_CHAR = 0x10; - static constexpr uint8_t CARRIAGE_RETURN = 0x0D; + //! Start Of Text character. First character is encoded stream + static constexpr uint8_t STX_CHAR = 0x02; + //! End Of Text character. Last character in encoded stream + static constexpr uint8_t ETX_CHAR = 0x03; + //! Data Link Escape character. Used to escape STX, ETX and DLE occurrences + //! in the source stream. + static constexpr uint8_t DLE_CHAR = 0x10; + static constexpr uint8_t CARRIAGE_RETURN = 0x0D; /** * Encodes the give data stream by preceding it with the STX marker - * and ending it with an ETX marker. STX, ETX and DLE characters inside - * the stream are escaped by DLE characters and also replaced by adding - * 0x40 (which is reverted in the decoding process). + * and ending it with an ETX marker. DLE characters inside + * the stream are escaped by DLE characters. STX, ETX and CR characters can be escaped with a + * DLE character as well. The escaped characters are also encoded by adding + * 0x40 (which is reverted in the decoding process). This is performed so the source stream + * does not have STX/ETX/CR occurrences anymore, so the receiving side can simply parse for + * start and end markers * @param sourceStream * @param sourceLen * @param destStream * @param maxDestLen * @param encodedLen - * @param addStxEtx - * Adding STX and ETX can be omitted, if they are added manually. + * @param addStxEtx Adding STX start marker and ETX end marker can be omitted, + * if they are added manually + * @param escapeStxEtx STX and ETX occurrences in the given source stream will be escaped and + * encoded by adding 0x40 + * @param escapeCr CR characters in the given source stream will be escaped and encoded + * by adding 0x40 * @return */ - static ReturnValue_t encode(const uint8_t *sourceStream, size_t sourceLen, + ReturnValue_t encode(const uint8_t *sourceStream, size_t sourceLen, uint8_t *destStream, size_t maxDestLen, size_t *encodedLen, bool addStxEtx = true); @@ -69,11 +76,20 @@ public: * @param destStream * @param maxDestStreamlen * @param decodedLen + * @param escapeStxEtx STX and ETX characters were escaped in the encoded stream and need to + * be decoded back as well + * @param escapeCr CR characters were escaped in the encoded stream and need to + * be decoded back as well by subtracting 0x40 * @return */ - static ReturnValue_t decode(const uint8_t *sourceStream, - size_t sourceStreamLen, size_t *readLen, uint8_t *destStream, - size_t maxDestStreamlen, size_t *decodedLen); + ReturnValue_t decode(const uint8_t *sourceStream, + size_t sourceStreamLen, size_t *readLen, uint8_t *destStream, + size_t maxDestStreamlen, size_t *decodedLen); + +private: + + bool escapeStxEtx; + bool escapeCr; }; #endif /* FRAMEWORK_GLOBALFUNCTIONS_DLEENCODER_H_ */ From ece7dce6f7ee33b04473a41f698ff15414520a02 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 17 Aug 2021 15:13:58 +0200 Subject: [PATCH 242/389] ctor and dtor public now --- src/fsfw/globalfunctions/DleEncoder.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/fsfw/globalfunctions/DleEncoder.h b/src/fsfw/globalfunctions/DleEncoder.h index 38d4dc75..c78fe197 100644 --- a/src/fsfw/globalfunctions/DleEncoder.h +++ b/src/fsfw/globalfunctions/DleEncoder.h @@ -25,11 +25,15 @@ * while ETX can be used to notify the reader that the data has ended. */ class DleEncoder: public HasReturnvaluesIF { -private: +public: + /** + * Create an encoder instance with the given configuration. + * @param escapeStxEtx + * @param escapeCr + */ DleEncoder(bool escapeStxEtx = true, bool escapeCr = false); virtual ~DleEncoder(); -public: static constexpr uint8_t INTERFACE_ID = CLASS_ID::DLE_ENCODER; static constexpr ReturnValue_t STREAM_TOO_SHORT = MAKE_RETURN_CODE(0x01); static constexpr ReturnValue_t DECODING_ERROR = MAKE_RETURN_CODE(0x02); From 5fcac4d85b5eba9f28f9f7fae8dedb8f1f39928a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 17 Aug 2021 15:39:24 +0200 Subject: [PATCH 243/389] added proper non-escaped variant --- src/fsfw/globalfunctions/DleEncoder.cpp | 159 +++++++++++++++++------- src/fsfw/globalfunctions/DleEncoder.h | 8 ++ 2 files changed, 121 insertions(+), 46 deletions(-) diff --git a/src/fsfw/globalfunctions/DleEncoder.cpp b/src/fsfw/globalfunctions/DleEncoder.cpp index d6f3cc87..0cc3ad2a 100644 --- a/src/fsfw/globalfunctions/DleEncoder.cpp +++ b/src/fsfw/globalfunctions/DleEncoder.cpp @@ -14,6 +14,10 @@ ReturnValue_t DleEncoder::encode(const uint8_t* sourceStream, size_t encodedIndex = 0, sourceIndex = 0; uint8_t nextByte; if (addStxEtx) { + if(not escapeStxEtx) { + destStream[0] = DLE_CHAR; + ++encodedIndex; + } destStream[0] = STX_CHAR; ++encodedIndex; } @@ -61,6 +65,10 @@ ReturnValue_t DleEncoder::encode(const uint8_t* sourceStream, if (sourceIndex == sourceLen and encodedIndex < maxDestLen) { if (addStxEtx) { + if(not escapeStxEtx) { + destStream[encodedIndex] = DLE_CHAR; + ++encodedIndex; + } destStream[encodedIndex] = ETX_CHAR; ++encodedIndex; } @@ -72,62 +80,121 @@ ReturnValue_t DleEncoder::encode(const uint8_t* sourceStream, } } +ReturnValue_t DleEncoder::encodeEscaped(const uint8_t *sourceStream, size_t sourceLen, + uint8_t *destStream, size_t maxDestLen, size_t *encodedLen, bool addStxEtx) { +} + +ReturnValue_t DleEncoder::encodeNonEscaped(const uint8_t *sourceStream, size_t sourceLen, + uint8_t *destStream, size_t maxDestLen, size_t *encodedLen, bool addStxEtx) { +} + ReturnValue_t DleEncoder::decode(const uint8_t *sourceStream, size_t sourceStreamLen, size_t *readLen, uint8_t *destStream, size_t maxDestStreamlen, size_t *decodedLen) { size_t encodedIndex = 0, decodedIndex = 0; uint8_t nextByte; - if (*sourceStream != STX_CHAR) { - return DECODING_ERROR; + if(not escapeStxEtx) { + if (*sourceStream != DLE_CHAR) { + return DECODING_ERROR; + } + ++encodedIndex; } + if (sourceStream[encodedIndex] != STX_CHAR) { + return DECODING_ERROR; + } + ++encodedIndex; - while ((encodedIndex < sourceStreamLen) && (decodedIndex < maxDestStreamlen) - && (sourceStream[encodedIndex] != ETX_CHAR) - && (sourceStream[encodedIndex] != STX_CHAR)) { - if (sourceStream[encodedIndex] == DLE_CHAR) { - nextByte = sourceStream[encodedIndex + 1]; - // The next byte is a DLE character that was escaped by another - // DLE character, so we can write it to the destination stream. - if (nextByte == DLE_CHAR) { - destStream[decodedIndex] = nextByte; - } - else { - if(this->escapeStxEtx) { - /* The next byte is a STX, DTX or 0x0D character which - * was escaped by a DLE character. The actual byte was - * also encoded by adding + 0x40 to prevent having control chars, - * in the stream at all, so we convert it back. */ - if ((nextByte == STX_CHAR + 0x40 or nextByte == ETX_CHAR + 0x40) or - (this->escapeCr and nextByte == CARRIAGE_RETURN + 0x40)) { - destStream[decodedIndex] = nextByte - 0x40; - } - else { - return DECODING_ERROR; - } - } - else { - return DECODING_ERROR; - } - } - ++encodedIndex; - } - else { - destStream[decodedIndex] = sourceStream[encodedIndex]; - } - - ++encodedIndex; - ++decodedIndex; - } - - if (sourceStream[encodedIndex] != ETX_CHAR) { - *readLen = ++encodedIndex; - return DECODING_ERROR; + if(escapeStxEtx) { + return decodeStreamEscaped(encodedIndex, decodedIndex, sourceStream, sourceStreamLen, + readLen, destStream, maxDestStreamlen, decodedLen); } else { - *readLen = ++encodedIndex; - *decodedLen = decodedIndex; - return RETURN_OK; + return decodeStreamNonEscaped(encodedIndex, decodedIndex, sourceStream, sourceStreamLen, + readLen, destStream, maxDestStreamlen, decodedLen); } } +ReturnValue_t DleEncoder::decodeStreamEscaped(size_t encodedIndex, size_t decodedIndex, + const uint8_t *sourceStream, size_t sourceStreamLen, size_t *readLen, uint8_t *destStream, + size_t maxDestStreamlen, size_t *decodedLen) { + uint8_t nextByte; + while ((encodedIndex < sourceStreamLen) && (decodedIndex < maxDestStreamlen) + && (sourceStream[encodedIndex] != ETX_CHAR) + && (sourceStream[encodedIndex] != STX_CHAR)) { + if (sourceStream[encodedIndex] == DLE_CHAR) { + nextByte = sourceStream[encodedIndex + 1]; + // The next byte is a DLE character that was escaped by another + // DLE character, so we can write it to the destination stream. + if (nextByte == DLE_CHAR) { + destStream[decodedIndex] = nextByte; + } + else { + if(this->escapeStxEtx) { + /* The next byte is a STX, DTX or 0x0D character which + * was escaped by a DLE character. The actual byte was + * also encoded by adding + 0x40 to prevent having control chars, + * in the stream at all, so we convert it back. */ + if ((nextByte == STX_CHAR + 0x40 or nextByte == ETX_CHAR + 0x40) or + (this->escapeCr and nextByte == CARRIAGE_RETURN + 0x40)) { + destStream[decodedIndex] = nextByte - 0x40; + } + else { + return DECODING_ERROR; + } + } + else { + return DECODING_ERROR; + } + } + ++encodedIndex; + } + else { + destStream[decodedIndex] = sourceStream[encodedIndex]; + } + + ++encodedIndex; + ++decodedIndex; + } + if (sourceStream[encodedIndex] != ETX_CHAR) { + *readLen = ++encodedIndex; + return DECODING_ERROR; + } + else { + *readLen = ++encodedIndex; + *decodedLen = decodedIndex; + return RETURN_OK; + } +} + +ReturnValue_t DleEncoder::decodeStreamNonEscaped(size_t encodedIndex, size_t decodedIndex, + const uint8_t *sourceStream, size_t sourceStreamLen, size_t *readLen, uint8_t *destStream, + size_t maxDestStreamlen, size_t *decodedLen) { + uint8_t nextByte; + while ((encodedIndex < sourceStreamLen) && (decodedIndex < maxDestStreamlen)) { + if (sourceStream[encodedIndex] == DLE_CHAR) { + nextByte = sourceStream[encodedIndex + 1]; + if(nextByte == STX_CHAR) { + *readLen = ++encodedIndex; + return DECODING_ERROR; + } + else if(nextByte == DLE_CHAR) { + // The next byte is a DLE character that was escaped by another + // DLE character, so we can write it to the destination stream. + destStream[decodedIndex] = nextByte; + ++encodedIndex; + } + else if(nextByte == ETX_CHAR) { + // End of stream reached + return RETURN_OK; + } + } + else { + destStream[decodedIndex] = sourceStream[encodedIndex]; + } + ++encodedIndex; + ++decodedIndex; + } + return DECODING_ERROR; +} + diff --git a/src/fsfw/globalfunctions/DleEncoder.h b/src/fsfw/globalfunctions/DleEncoder.h index c78fe197..47bb2a69 100644 --- a/src/fsfw/globalfunctions/DleEncoder.h +++ b/src/fsfw/globalfunctions/DleEncoder.h @@ -90,6 +90,14 @@ public: size_t sourceStreamLen, size_t *readLen, uint8_t *destStream, size_t maxDestStreamlen, size_t *decodedLen); + ReturnValue_t decodeStreamEscaped(size_t encodedIndex, size_t decodedIndex, + const uint8_t *sourceStream, size_t sourceStreamLen, size_t *readLen, + uint8_t *destStream, size_t maxDestStreamlen, size_t *decodedLen); + + ReturnValue_t decodeStreamNonEscaped(size_t encodedIndex, size_t decodedIndex, + const uint8_t *sourceStream, size_t sourceStreamLen, size_t *readLen, + uint8_t *destStream, size_t maxDestStreamlen, size_t *decodedLen); + private: bool escapeStxEtx; From 28f2db2c113bb2e34b641c9fbed8dd3568ca83c4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 17 Aug 2021 15:40:51 +0200 Subject: [PATCH 244/389] some fixes --- src/fsfw/globalfunctions/DleEncoder.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/fsfw/globalfunctions/DleEncoder.cpp b/src/fsfw/globalfunctions/DleEncoder.cpp index 0cc3ad2a..81131910 100644 --- a/src/fsfw/globalfunctions/DleEncoder.cpp +++ b/src/fsfw/globalfunctions/DleEncoder.cpp @@ -80,19 +80,10 @@ ReturnValue_t DleEncoder::encode(const uint8_t* sourceStream, } } -ReturnValue_t DleEncoder::encodeEscaped(const uint8_t *sourceStream, size_t sourceLen, - uint8_t *destStream, size_t maxDestLen, size_t *encodedLen, bool addStxEtx) { -} - -ReturnValue_t DleEncoder::encodeNonEscaped(const uint8_t *sourceStream, size_t sourceLen, - uint8_t *destStream, size_t maxDestLen, size_t *encodedLen, bool addStxEtx) { -} - ReturnValue_t DleEncoder::decode(const uint8_t *sourceStream, size_t sourceStreamLen, size_t *readLen, uint8_t *destStream, size_t maxDestStreamlen, size_t *decodedLen) { size_t encodedIndex = 0, decodedIndex = 0; - uint8_t nextByte; if(not escapeStxEtx) { if (*sourceStream != DLE_CHAR) { return DECODING_ERROR; From 654b23869f607c6c89b78dc3bebdab8a2b7be291 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 17 Aug 2021 16:00:39 +0200 Subject: [PATCH 245/389] several imporovements --- src/fsfw/globalfunctions/DleEncoder.cpp | 24 ++++++++------ src/fsfw/globalfunctions/DleEncoder.h | 43 +++++++++++-------------- 2 files changed, 34 insertions(+), 33 deletions(-) diff --git a/src/fsfw/globalfunctions/DleEncoder.cpp b/src/fsfw/globalfunctions/DleEncoder.cpp index 81131910..6ad5e5fa 100644 --- a/src/fsfw/globalfunctions/DleEncoder.cpp +++ b/src/fsfw/globalfunctions/DleEncoder.cpp @@ -83,7 +83,7 @@ ReturnValue_t DleEncoder::encode(const uint8_t* sourceStream, ReturnValue_t DleEncoder::decode(const uint8_t *sourceStream, size_t sourceStreamLen, size_t *readLen, uint8_t *destStream, size_t maxDestStreamlen, size_t *decodedLen) { - size_t encodedIndex = 0, decodedIndex = 0; + size_t encodedIndex = 0; if(not escapeStxEtx) { if (*sourceStream != DLE_CHAR) { return DECODING_ERROR; @@ -94,21 +94,22 @@ ReturnValue_t DleEncoder::decode(const uint8_t *sourceStream, return DECODING_ERROR; } - ++encodedIndex; - if(escapeStxEtx) { - return decodeStreamEscaped(encodedIndex, decodedIndex, sourceStream, sourceStreamLen, + return decodeStreamEscaped(sourceStream, sourceStreamLen, readLen, destStream, maxDestStreamlen, decodedLen); } else { - return decodeStreamNonEscaped(encodedIndex, decodedIndex, sourceStream, sourceStreamLen, + return decodeStreamNonEscaped(sourceStream, sourceStreamLen, readLen, destStream, maxDestStreamlen, decodedLen); } } -ReturnValue_t DleEncoder::decodeStreamEscaped(size_t encodedIndex, size_t decodedIndex, - const uint8_t *sourceStream, size_t sourceStreamLen, size_t *readLen, uint8_t *destStream, +ReturnValue_t DleEncoder::decodeStreamEscaped(const uint8_t *sourceStream, size_t sourceStreamLen, + size_t *readLen, uint8_t *destStream, size_t maxDestStreamlen, size_t *decodedLen) { + // Skip start marker, was already checked + size_t encodedIndex = 1; + size_t decodedIndex = 0; uint8_t nextByte; while ((encodedIndex < sourceStreamLen) && (decodedIndex < maxDestStreamlen) && (sourceStream[encodedIndex] != ETX_CHAR) @@ -158,9 +159,12 @@ ReturnValue_t DleEncoder::decodeStreamEscaped(size_t encodedIndex, size_t decode } } -ReturnValue_t DleEncoder::decodeStreamNonEscaped(size_t encodedIndex, size_t decodedIndex, - const uint8_t *sourceStream, size_t sourceStreamLen, size_t *readLen, uint8_t *destStream, +ReturnValue_t DleEncoder::decodeStreamNonEscaped(const uint8_t *sourceStream, + size_t sourceStreamLen, size_t *readLen, uint8_t *destStream, size_t maxDestStreamlen, size_t *decodedLen) { + // Skip start marker, was already checked + size_t encodedIndex = 2; + size_t decodedIndex = 0; uint8_t nextByte; while ((encodedIndex < sourceStreamLen) && (decodedIndex < maxDestStreamlen)) { if (sourceStream[encodedIndex] == DLE_CHAR) { @@ -177,6 +181,8 @@ ReturnValue_t DleEncoder::decodeStreamNonEscaped(size_t encodedIndex, size_t dec } else if(nextByte == ETX_CHAR) { // End of stream reached + *readLen = encodedIndex + 2; + *decodedLen = decodedIndex; return RETURN_OK; } } diff --git a/src/fsfw/globalfunctions/DleEncoder.h b/src/fsfw/globalfunctions/DleEncoder.h index 47bb2a69..cc7dbc22 100644 --- a/src/fsfw/globalfunctions/DleEncoder.h +++ b/src/fsfw/globalfunctions/DleEncoder.h @@ -12,24 +12,29 @@ * https://en.wikipedia.org/wiki/C0_and_C1_control_codes * * This encoder can be used to achieve a basic transport layer when using - * char based transmission systems. - * The passed source stream is converted into a encoded stream by adding - * a STX marker at the start of the stream and an ETX marker at the end of - * the stream. Any STX, ETX, DLE and CR occurrences in the source stream can be - * escaped by a DLE character. The encoder also replaces escaped control chars - * by another char, so STX, ETX and CR should not appear anywhere in the actual - * encoded data stream. + * char based transmission systems. There are two implemented variants: * - * When using a strictly char based reception of packets encoded with DLE, + * 1. Escaped variant + * + * The encoded stream starts with a STX marker and ends with an ETX marker. + * STX and ETX occurrences in the stream are escaped and internally encoded as well so the + * receiver side can simply check for STX and ETX markers as frame delimiters. When using a + * strictly char based reception of packets encoded with DLE, * STX can be used to notify a reader that actual data will start to arrive * while ETX can be used to notify the reader that the data has ended. + * + * 2. Non-escaped variant + * + * The encoded stream starts with DLE STX and ends with DLE ETX. All DLE occurrences in the stream + * are escaped with DLE. If the received detects a DLE char, it needs to read the next char + * and to determine whether a start (STX) or end (ETX) of a frame has been detected. */ class DleEncoder: public HasReturnvaluesIF { public: /** * Create an encoder instance with the given configuration. - * @param escapeStxEtx - * @param escapeCr + * @param escapeStxEtx Determines whether the algorithm works in escaped or non-escaped mode + * @param escapeCr In escaped mode, escape all CR occurrences as well */ DleEncoder(bool escapeStxEtx = true, bool escapeCr = false); virtual ~DleEncoder(); @@ -62,10 +67,6 @@ public: * @param encodedLen * @param addStxEtx Adding STX start marker and ETX end marker can be omitted, * if they are added manually - * @param escapeStxEtx STX and ETX occurrences in the given source stream will be escaped and - * encoded by adding 0x40 - * @param escapeCr CR characters in the given source stream will be escaped and encoded - * by adding 0x40 * @return */ ReturnValue_t encode(const uint8_t *sourceStream, size_t sourceLen, @@ -80,23 +81,17 @@ public: * @param destStream * @param maxDestStreamlen * @param decodedLen - * @param escapeStxEtx STX and ETX characters were escaped in the encoded stream and need to - * be decoded back as well - * @param escapeCr CR characters were escaped in the encoded stream and need to - * be decoded back as well by subtracting 0x40 * @return */ ReturnValue_t decode(const uint8_t *sourceStream, size_t sourceStreamLen, size_t *readLen, uint8_t *destStream, size_t maxDestStreamlen, size_t *decodedLen); - ReturnValue_t decodeStreamEscaped(size_t encodedIndex, size_t decodedIndex, - const uint8_t *sourceStream, size_t sourceStreamLen, size_t *readLen, - uint8_t *destStream, size_t maxDestStreamlen, size_t *decodedLen); + ReturnValue_t decodeStreamEscaped(const uint8_t *sourceStream, size_t sourceStreamLen, + size_t *readLen, uint8_t *destStream, size_t maxDestStreamlen, size_t *decodedLen); - ReturnValue_t decodeStreamNonEscaped(size_t encodedIndex, size_t decodedIndex, - const uint8_t *sourceStream, size_t sourceStreamLen, size_t *readLen, - uint8_t *destStream, size_t maxDestStreamlen, size_t *decodedLen); + ReturnValue_t decodeStreamNonEscaped(const uint8_t *sourceStream, size_t sourceStreamLen, + size_t *readLen, uint8_t *destStream, size_t maxDestStreamlen, size_t *decodedLen); private: From 8780c5ddcdb055052ab27ddae55c498d59455d24 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 17 Aug 2021 16:02:54 +0200 Subject: [PATCH 246/389] comment typos --- src/fsfw/globalfunctions/DleEncoder.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fsfw/globalfunctions/DleEncoder.h b/src/fsfw/globalfunctions/DleEncoder.h index cc7dbc22..cd2164f8 100644 --- a/src/fsfw/globalfunctions/DleEncoder.h +++ b/src/fsfw/globalfunctions/DleEncoder.h @@ -26,8 +26,8 @@ * 2. Non-escaped variant * * The encoded stream starts with DLE STX and ends with DLE ETX. All DLE occurrences in the stream - * are escaped with DLE. If the received detects a DLE char, it needs to read the next char - * and to determine whether a start (STX) or end (ETX) of a frame has been detected. + * are escaped with DLE. If the receiver detects a DLE char, it needs to read the next char + * to determine whether a start (STX) or end (ETX) of a frame has been detected. */ class DleEncoder: public HasReturnvaluesIF { public: From 845c00044ecbb36683c7dbc1c662d24e49bad380 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 18 Aug 2021 11:27:39 +0200 Subject: [PATCH 247/389] printout fixes for UnixFileGuard --- hal/src/fsfw_hal/linux/UnixFileGuard.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/hal/src/fsfw_hal/linux/UnixFileGuard.cpp b/hal/src/fsfw_hal/linux/UnixFileGuard.cpp index f7901018..ad875623 100644 --- a/hal/src/fsfw_hal/linux/UnixFileGuard.cpp +++ b/hal/src/fsfw_hal/linux/UnixFileGuard.cpp @@ -1,5 +1,10 @@ +#include "fsfw/FSFW.h" +#include "fsfw/serviceinterface.h" #include "fsfw_hal/linux/UnixFileGuard.h" +#include +#include + UnixFileGuard::UnixFileGuard(std::string device, int* fileDescriptor, int flags, std::string diagnosticPrefix): fileDescriptor(fileDescriptor) { @@ -10,12 +15,11 @@ UnixFileGuard::UnixFileGuard(std::string device, int* fileDescriptor, int flags, if (*fileDescriptor < 0) { #if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << diagnosticPrefix <<"Opening device failed with error code " << errno << - "." << std::endl; - sif::warning << "Error description: " << strerror(errno) << std::endl; + sif::warning << diagnosticPrefix << "Opening device failed with error code " << + errno << ": " << strerror(errno) << std::endl; #else - sif::printError("%sOpening device failed with error code %d.\n", diagnosticPrefix); - sif::printWarning("Error description: %s\n", strerror(errno)); + sif::printWarning("%sOpening device failed with error code %d: %s\n", + diagnosticPrefix, errno, strerror(errno)); #endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ #endif /* FSFW_VERBOSE_LEVEL >= 1 */ openStatus = OPEN_FILE_FAILED; From 3cec9f5f8054e2003c66affc39f45ed73cba2398 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 18 Aug 2021 13:18:42 +0200 Subject: [PATCH 248/389] Made two functions private, small tweak --- src/fsfw/globalfunctions/DleEncoder.cpp | 19 +++++++------------ src/fsfw/globalfunctions/DleEncoder.h | 4 ++-- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/fsfw/globalfunctions/DleEncoder.cpp b/src/fsfw/globalfunctions/DleEncoder.cpp index 6ad5e5fa..e30eee22 100644 --- a/src/fsfw/globalfunctions/DleEncoder.cpp +++ b/src/fsfw/globalfunctions/DleEncoder.cpp @@ -122,18 +122,13 @@ ReturnValue_t DleEncoder::decodeStreamEscaped(const uint8_t *sourceStream, size_ destStream[decodedIndex] = nextByte; } else { - if(this->escapeStxEtx) { - /* The next byte is a STX, DTX or 0x0D character which - * was escaped by a DLE character. The actual byte was - * also encoded by adding + 0x40 to prevent having control chars, - * in the stream at all, so we convert it back. */ - if ((nextByte == STX_CHAR + 0x40 or nextByte == ETX_CHAR + 0x40) or - (this->escapeCr and nextByte == CARRIAGE_RETURN + 0x40)) { - destStream[decodedIndex] = nextByte - 0x40; - } - else { - return DECODING_ERROR; - } + /* The next byte is a STX, DTX or 0x0D character which + * was escaped by a DLE character. The actual byte was + * also encoded by adding + 0x40 to prevent having control chars, + * in the stream at all, so we convert it back. */ + if ((nextByte == STX_CHAR + 0x40 or nextByte == ETX_CHAR + 0x40) or + (this->escapeCr and nextByte == CARRIAGE_RETURN + 0x40)) { + destStream[decodedIndex] = nextByte - 0x40; } else { return DECODING_ERROR; diff --git a/src/fsfw/globalfunctions/DleEncoder.h b/src/fsfw/globalfunctions/DleEncoder.h index cd2164f8..292e00f8 100644 --- a/src/fsfw/globalfunctions/DleEncoder.h +++ b/src/fsfw/globalfunctions/DleEncoder.h @@ -87,14 +87,14 @@ public: size_t sourceStreamLen, size_t *readLen, uint8_t *destStream, size_t maxDestStreamlen, size_t *decodedLen); +private: + ReturnValue_t decodeStreamEscaped(const uint8_t *sourceStream, size_t sourceStreamLen, size_t *readLen, uint8_t *destStream, size_t maxDestStreamlen, size_t *decodedLen); ReturnValue_t decodeStreamNonEscaped(const uint8_t *sourceStream, size_t sourceStreamLen, size_t *readLen, uint8_t *destStream, size_t maxDestStreamlen, size_t *decodedLen); -private: - bool escapeStxEtx; bool escapeCr; }; From 5dcf0e44b65f5d986b71881c731207f8bbc47029 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 18 Aug 2021 13:33:31 +0200 Subject: [PATCH 249/389] encoder functions split up --- src/fsfw/globalfunctions/DleEncoder.cpp | 179 ++++++++++++++++-------- src/fsfw/globalfunctions/DleEncoder.h | 8 ++ 2 files changed, 125 insertions(+), 62 deletions(-) diff --git a/src/fsfw/globalfunctions/DleEncoder.cpp b/src/fsfw/globalfunctions/DleEncoder.cpp index e30eee22..a043cbf7 100644 --- a/src/fsfw/globalfunctions/DleEncoder.cpp +++ b/src/fsfw/globalfunctions/DleEncoder.cpp @@ -8,76 +8,131 @@ DleEncoder::~DleEncoder() {} ReturnValue_t DleEncoder::encode(const uint8_t* sourceStream, size_t sourceLen, uint8_t* destStream, size_t maxDestLen, size_t* encodedLen, bool addStxEtx) { - if (maxDestLen < 2) { - return STREAM_TOO_SHORT; - } - size_t encodedIndex = 0, sourceIndex = 0; - uint8_t nextByte; + size_t minAllowedLen = 0; + if(escapeStxEtx) { + minAllowedLen = 2; + + } + else { + minAllowedLen = 1; + + } + if(maxDestLen < minAllowedLen) { + return STREAM_TOO_SHORT; + } if (addStxEtx) { if(not escapeStxEtx) { destStream[0] = DLE_CHAR; - ++encodedIndex; } destStream[0] = STX_CHAR; - ++encodedIndex; } - while (encodedIndex < maxDestLen and sourceIndex < sourceLen) { - nextByte = sourceStream[sourceIndex]; - // STX, ETX and CR characters in the stream need to be escaped with DLE - if ((nextByte == STX_CHAR or nextByte == ETX_CHAR) or - (this->escapeCr and nextByte == CARRIAGE_RETURN)) { - if(this->escapeStxEtx) { - if (encodedIndex + 1 >= maxDestLen) { - return STREAM_TOO_SHORT; - } - else { - destStream[encodedIndex] = DLE_CHAR; - ++encodedIndex; - /* Escaped byte will be actual byte + 0x40. This prevents - * STX, ETX, and carriage return characters from appearing - * in the encoded data stream at all, so when polling an - * encoded stream, the transmission can be stopped at ETX. - * 0x40 was chosen at random with special requirements: - * - Prevent going from one control char to another - * - Prevent overflow for common characters */ - destStream[encodedIndex] = nextByte + 0x40; - } - } - } - // DLE characters are simply escaped with DLE. - else if (nextByte == DLE_CHAR) { - if (encodedIndex + 1 >= maxDestLen) { - return STREAM_TOO_SHORT; - } - else { - destStream[encodedIndex] = DLE_CHAR; - ++encodedIndex; - destStream[encodedIndex] = DLE_CHAR; - } - } - else { - destStream[encodedIndex] = nextByte; - } - ++encodedIndex; - ++sourceIndex; - } + if(escapeStxEtx) { + return encodeStreamEscaped(sourceStream, sourceLen, + destStream, maxDestLen, encodedLen, addStxEtx); + } + else { + return encodeStreamNonEscaped(sourceStream, sourceLen, + destStream, maxDestLen, encodedLen, addStxEtx); + } - if (sourceIndex == sourceLen and encodedIndex < maxDestLen) { - if (addStxEtx) { - if(not escapeStxEtx) { - destStream[encodedIndex] = DLE_CHAR; - ++encodedIndex; - } - destStream[encodedIndex] = ETX_CHAR; - ++encodedIndex; - } - *encodedLen = encodedIndex; - return RETURN_OK; - } - else { - return STREAM_TOO_SHORT; - } +} + +ReturnValue_t DleEncoder::encodeStreamEscaped(const uint8_t *sourceStream, size_t sourceLen, + uint8_t *destStream, size_t maxDestLen, size_t *encodedLen, + bool addStxEtx) { + size_t encodedIndex = 2; + size_t sourceIndex = 0; + uint8_t nextByte = 0; + while (encodedIndex < maxDestLen and sourceIndex < sourceLen) { + nextByte = sourceStream[sourceIndex]; + // STX, ETX and CR characters in the stream need to be escaped with DLE + if ((nextByte == STX_CHAR or nextByte == ETX_CHAR) or + (this->escapeCr and nextByte == CARRIAGE_RETURN)) { + if (encodedIndex + 1 >= maxDestLen) { + return STREAM_TOO_SHORT; + } + else { + destStream[encodedIndex] = DLE_CHAR; + ++encodedIndex; + /* Escaped byte will be actual byte + 0x40. This prevents + * STX, ETX, and carriage return characters from appearing + * in the encoded data stream at all, so when polling an + * encoded stream, the transmission can be stopped at ETX. + * 0x40 was chosen at random with special requirements: + * - Prevent going from one control char to another + * - Prevent overflow for common characters */ + destStream[encodedIndex] = nextByte + 0x40; + } + } + // DLE characters are simply escaped with DLE. + else if (nextByte == DLE_CHAR) { + if (encodedIndex + 1 >= maxDestLen) { + return STREAM_TOO_SHORT; + } + else { + destStream[encodedIndex] = DLE_CHAR; + ++encodedIndex; + destStream[encodedIndex] = DLE_CHAR; + } + } + else { + destStream[encodedIndex] = nextByte; + } + ++encodedIndex; + ++sourceIndex; + } + + if (sourceIndex == sourceLen and encodedIndex < maxDestLen) { + if (addStxEtx) { + destStream[encodedIndex] = ETX_CHAR; + ++encodedIndex; + } + *encodedLen = encodedIndex; + return RETURN_OK; + } + else { + return STREAM_TOO_SHORT; + } +} + +ReturnValue_t DleEncoder::encodeStreamNonEscaped(const uint8_t *sourceStream, size_t sourceLen, + uint8_t *destStream, size_t maxDestLen, size_t *encodedLen, + bool addStxEtx) { + size_t encodedIndex = 1; + size_t sourceIndex = 0; + uint8_t nextByte = 0; + while (encodedIndex < maxDestLen and sourceIndex < sourceLen) { + nextByte = sourceStream[sourceIndex]; + // DLE characters are simply escaped with DLE. + if (nextByte == DLE_CHAR) { + if (encodedIndex + 1 >= maxDestLen) { + return STREAM_TOO_SHORT; + } + else { + destStream[encodedIndex] = DLE_CHAR; + ++encodedIndex; + destStream[encodedIndex] = DLE_CHAR; + } + } + else { + destStream[encodedIndex] = nextByte; + } + ++encodedIndex; + ++sourceIndex; + } + + if (sourceIndex == sourceLen and encodedIndex < maxDestLen) { + if (addStxEtx) { + destStream[encodedIndex] = ETX_CHAR; + ++encodedIndex; + } + *encodedLen = encodedIndex; + return RETURN_OK; + } + else { + return STREAM_TOO_SHORT; + } } ReturnValue_t DleEncoder::decode(const uint8_t *sourceStream, diff --git a/src/fsfw/globalfunctions/DleEncoder.h b/src/fsfw/globalfunctions/DleEncoder.h index 292e00f8..dc178a0e 100644 --- a/src/fsfw/globalfunctions/DleEncoder.h +++ b/src/fsfw/globalfunctions/DleEncoder.h @@ -89,6 +89,14 @@ public: private: + ReturnValue_t encodeStreamEscaped(const uint8_t *sourceStream, size_t sourceLen, + uint8_t *destStream, size_t maxDestLen, size_t *encodedLen, + bool addStxEtx = true); + + ReturnValue_t encodeStreamNonEscaped(const uint8_t *sourceStream, size_t sourceLen, + uint8_t *destStream, size_t maxDestLen, size_t *encodedLen, + bool addStxEtx = true); + ReturnValue_t decodeStreamEscaped(const uint8_t *sourceStream, size_t sourceStreamLen, size_t *readLen, uint8_t *destStream, size_t maxDestStreamlen, size_t *decodedLen); From b6aebb3061a8417ffe09111eced07b8f17dddd3d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 19 Aug 2021 17:08:35 +0200 Subject: [PATCH 250/389] format adapted --- hal/src/fsfw_hal/linux/UnixFileGuard.cpp | 4 ++-- hal/src/fsfw_hal/linux/spi/SpiComIF.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hal/src/fsfw_hal/linux/UnixFileGuard.cpp b/hal/src/fsfw_hal/linux/UnixFileGuard.cpp index ad875623..5019343e 100644 --- a/hal/src/fsfw_hal/linux/UnixFileGuard.cpp +++ b/hal/src/fsfw_hal/linux/UnixFileGuard.cpp @@ -15,10 +15,10 @@ UnixFileGuard::UnixFileGuard(std::string device, int* fileDescriptor, int flags, if (*fileDescriptor < 0) { #if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << diagnosticPrefix << "Opening device failed with error code " << + sif::warning << diagnosticPrefix << ": Opening device failed with error code " << errno << ": " << strerror(errno) << std::endl; #else - sif::printWarning("%sOpening device failed with error code %d: %s\n", + sif::printWarning("%s: Opening device failed with error code %d: %s\n", diagnosticPrefix, errno, strerror(errno)); #endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ #endif /* FSFW_VERBOSE_LEVEL >= 1 */ diff --git a/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp b/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp index fafe67be..6697bc92 100644 --- a/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp +++ b/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp @@ -184,7 +184,7 @@ ReturnValue_t SpiComIF::performRegularSendOperation(SpiCookie *spiCookie, const /* Prepare transfer */ int fileDescriptor = 0; std::string device = spiCookie->getSpiDevice(); - UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, "SpiComIF::sendMessage: "); + UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, "SpiComIF::sendMessage"); if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) { return OPENING_FILE_FAILED; } @@ -273,7 +273,7 @@ ReturnValue_t SpiComIF::performHalfDuplexReception(SpiCookie* spiCookie) { std::string device = spiCookie->getSpiDevice(); int fileDescriptor = 0; UnixFileGuard fileHelper(device, &fileDescriptor, O_RDWR, - "SpiComIF::requestReceiveMessage: "); + "SpiComIF::requestReceiveMessage"); if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) { return OPENING_FILE_FAILED; } From 98e3ed897c9f81837cffa24da41d4cbb50cea72d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 19 Aug 2021 17:17:19 +0200 Subject: [PATCH 251/389] small tweak --- hal/src/fsfw_hal/linux/spi/SpiComIF.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp b/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp index 6697bc92..48bf7449 100644 --- a/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp +++ b/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp @@ -90,7 +90,7 @@ ReturnValue_t SpiComIF::initializeInterface(CookieIF *cookie) { int fileDescriptor = 0; UnixFileGuard fileHelper(spiCookie->getSpiDevice(), &fileDescriptor, O_RDWR, - "SpiComIF::initializeInterface: "); + "SpiComIF::initializeInterface"); if(fileHelper.getOpenResult() != HasReturnvaluesIF::RETURN_OK) { return fileHelper.getOpenResult(); } From a6d744c9c8df4e2cd69c170a4bd6806f54b835f9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Sep 2021 12:05:30 +0200 Subject: [PATCH 252/389] Possible bugfix in DHB The delayCycles variables needs to be initialized differently for periodic replies. It is initialized to the maxDelayCycles value now --- devicehandlers/DeviceHandlerBase.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/devicehandlers/DeviceHandlerBase.cpp b/devicehandlers/DeviceHandlerBase.cpp index 5665b101..733701b2 100644 --- a/devicehandlers/DeviceHandlerBase.cpp +++ b/devicehandlers/DeviceHandlerBase.cpp @@ -430,7 +430,12 @@ ReturnValue_t DeviceHandlerBase::insertInReplyMap(DeviceCommandId_t replyId, DeviceReplyInfo info; info.maxDelayCycles = maxDelayCycles; info.periodic = periodic; - info.delayCycles = 0; + if(info.periodic) { + info.delayCycles = info.maxDelayCycles; + } + else { + info.delayCycles = 0; + } info.replyLen = replyLen; info.dataSet = dataSet; info.command = deviceCommandMap.end(); From c42eb59d2e6947c51dcc6e952e7e626e5a1531ea Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 8 Sep 2021 16:10:18 +0200 Subject: [PATCH 253/389] UART bugfixes and improvements --- hal/src/fsfw_hal/linux/uart/UartComIF.cpp | 42 ++++++++++++++++------ hal/src/fsfw_hal/linux/uart/UartCookie.cpp | 4 +-- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/hal/src/fsfw_hal/linux/uart/UartComIF.cpp b/hal/src/fsfw_hal/linux/uart/UartComIF.cpp index f52b6b1e..f5754c6e 100644 --- a/hal/src/fsfw_hal/linux/uart/UartComIF.cpp +++ b/hal/src/fsfw_hal/linux/uart/UartComIF.cpp @@ -1,6 +1,7 @@ -#include "fsfw_hal/linux/uart/UartComIF.h" +#include "UartComIF.h" #include "OBSWConfig.h" +#include "fsfw_hal/linux/utility.h" #include "fsfw/serviceinterface/ServiceInterface.h" #include @@ -60,7 +61,13 @@ int UartComIF::configureUartPort(UartCookie* uartCookie) { struct termios options = {}; std::string deviceFile = uartCookie->getDeviceFile(); - int fd = open(deviceFile.c_str(), O_RDWR); + int flags = O_RDWR; + if(uartCookie->getUartMode() == UartModes::CANONICAL) { + // In non-canonical mode, don't specify O_NONBLOCK because these properties will be + // controlled by the VTIME and VMIN parameters and O_NONBLOCK would override this + flags |= O_NONBLOCK; + } + int fd = open(deviceFile.c_str(), flags); if (fd < 0) { sif::warning << "UartComIF::configureUartPort: Failed to open uart " << deviceFile << @@ -259,23 +266,22 @@ void UartComIF::configureBaudrate(struct termios* options, UartCookie* uartCooki ReturnValue_t UartComIF::sendMessage(CookieIF *cookie, const uint8_t *sendData, size_t sendLen) { - int fd = 0; std::string deviceFile; UartDeviceMapIter uartDeviceMapIter; - if(sendData == nullptr) { - sif::debug << "UartComIF::sendMessage: Send Data is nullptr" << std::endl; - return RETURN_FAILED; - } - if(sendLen == 0) { return RETURN_OK; } + if(sendData == nullptr) { + sif::warning << "UartComIF::sendMessage: Send data is nullptr" << std::endl; + return RETURN_FAILED; + } + UartCookie* uartCookie = dynamic_cast(cookie); if(uartCookie == nullptr) { - sif::debug << "UartComIF::sendMessasge: Invalid UART Cookie!" << std::endl; + sif::warning << "UartComIF::sendMessasge: Invalid UART Cookie!" << std::endl; return NULLPOINTER; } @@ -347,12 +353,13 @@ ReturnValue_t UartComIF::handleCanonicalRead(UartCookie& uartCookie, UartDeviceM size_t maxReplySize = uartCookie.getMaxReplyLen(); int fd = iter->second.fileDescriptor; auto bufferPtr = iter->second.replyBuffer.data(); + iter->second.replyLen = 0; do { size_t allowedReadSize = 0; if(currentBytesRead >= maxReplySize) { // Overflow risk. Emit warning, trigger event and break. If this happens, // the reception buffer is not large enough or data is not polled often enough. -#if OBSW_VERBOSE_LEVEL >= 1 +#if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::warning << "UartComIF::requestReceiveMessage: Next read would cause overflow!" << std::endl; @@ -370,7 +377,20 @@ ReturnValue_t UartComIF::handleCanonicalRead(UartCookie& uartCookie, UartDeviceM bytesRead = read(fd, bufferPtr, allowedReadSize); if (bytesRead < 0) { - return RETURN_FAILED; + // EAGAIN: No data available in non-blocking mode + if(errno != EAGAIN) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "UartComIF::handleCanonicalRead: read failed with code" << + errno << ": " << strerror(errno) << std::endl; +#else + sif::printWarning("UartComIF::handleCanonicalRead: read failed with code %d: %s\n", + errno, strerror(errno)); +#endif +#endif + return RETURN_FAILED; + } + } else if(bytesRead > 0) { iter->second.replyLen += bytesRead; diff --git a/hal/src/fsfw_hal/linux/uart/UartCookie.cpp b/hal/src/fsfw_hal/linux/uart/UartCookie.cpp index 339c7451..1c52e9cd 100644 --- a/hal/src/fsfw_hal/linux/uart/UartCookie.cpp +++ b/hal/src/fsfw_hal/linux/uart/UartCookie.cpp @@ -4,8 +4,8 @@ UartCookie::UartCookie(object_id_t handlerId, std::string deviceFile, UartModes uartMode, uint32_t baudrate, size_t maxReplyLen): - handlerId(handlerId), deviceFile(deviceFile), uartMode(uartMode), baudrate(baudrate), - maxReplyLen(maxReplyLen) { + handlerId(handlerId), deviceFile(deviceFile), uartMode(uartMode), + baudrate(baudrate), maxReplyLen(maxReplyLen) { } UartCookie::~UartCookie() {} From dfc44fce071a29ce1de05eaecd76e795b09ea8fc Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 8 Sep 2021 23:33:10 +0200 Subject: [PATCH 254/389] added DLE encoder test files --- .../unit/globalfunctions/CMakeLists.txt | 1 + .../unit/globalfunctions/testDleEncoder.cpp | 69 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp diff --git a/tests/src/fsfw_tests/unit/globalfunctions/CMakeLists.txt b/tests/src/fsfw_tests/unit/globalfunctions/CMakeLists.txt index 8e57e01b..617c7f5a 100644 --- a/tests/src/fsfw_tests/unit/globalfunctions/CMakeLists.txt +++ b/tests/src/fsfw_tests/unit/globalfunctions/CMakeLists.txt @@ -1,2 +1,3 @@ target_sources(${TARGET_NAME} PRIVATE + testDleEncoder.cpp ) diff --git a/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp b/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp new file mode 100644 index 00000000..01ac3568 --- /dev/null +++ b/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp @@ -0,0 +1,69 @@ +#include "fsfw/globalfunctions/DleEncoder.h" +#include "fsfw_tests/unit/CatchDefinitions.h" +#include "catch2/catch_test_macros.hpp" + +#include + +const std::array TEST_ARRAY_0 = { 0 }; +const std::array TEST_ARRAY_1 = { 0, DleEncoder::DLE_CHAR, 5}; +const std::array TEST_ARRAY_2 = { 0, DleEncoder::STX_CHAR, 5}; +const std::array TEST_ARRAY_3 = { 0, DleEncoder::CARRIAGE_RETURN, DleEncoder::ETX_CHAR}; + +TEST_CASE("DleEncoder" , "[DleEncoder]") { + + DleEncoder dleEncoder; + std::array buffer; + SECTION("Encoding") { + size_t encodedLen = 0; + ReturnValue_t result = dleEncoder.encode(TEST_ARRAY_0.data(), TEST_ARRAY_0.size(), + buffer.data(), buffer.size(), &encodedLen); + REQUIRE(result == retval::CATCH_OK); + std::vector expected = {DleEncoder::STX_CHAR, 0, 0, 0, 0, 0, + DleEncoder::ETX_CHAR}; + for(size_t idx = 0; idx < expected.size(); idx++) { + REQUIRE(buffer[idx] == expected[idx]); + } + REQUIRE(encodedLen == 7); + + result = dleEncoder.encode(TEST_ARRAY_1.data(), TEST_ARRAY_1.size(), + buffer.data(), buffer.size(), &encodedLen); + REQUIRE(result == retval::CATCH_OK); + expected = std::vector{DleEncoder::STX_CHAR, 0, DleEncoder::DLE_CHAR, + DleEncoder::DLE_CHAR, 5, DleEncoder::ETX_CHAR}; + for(size_t idx = 0; idx < expected.size(); idx++) { + REQUIRE(buffer[idx] == expected[idx]); + } + REQUIRE(encodedLen == expected.size()); + + result = dleEncoder.encode(TEST_ARRAY_2.data(), TEST_ARRAY_2.size(), + buffer.data(), buffer.size(), &encodedLen); + REQUIRE(result == retval::CATCH_OK); + expected = std::vector{DleEncoder::STX_CHAR, 0, DleEncoder::DLE_CHAR, + DleEncoder::STX_CHAR + 0x40, 5, DleEncoder::ETX_CHAR}; + for(size_t idx = 0; idx < expected.size(); idx++) { + REQUIRE(buffer[idx] == expected[idx]); + } + REQUIRE(encodedLen == expected.size()); + + result = dleEncoder.encode(TEST_ARRAY_3.data(), TEST_ARRAY_3.size(), + buffer.data(), buffer.size(), &encodedLen); + REQUIRE(result == retval::CATCH_OK); + expected = std::vector{DleEncoder::STX_CHAR, 0, DleEncoder::CARRIAGE_RETURN, + DleEncoder::DLE_CHAR, DleEncoder::ETX_CHAR + 0x40, DleEncoder::ETX_CHAR}; + for(size_t idx = 0; idx < expected.size(); idx++) { + REQUIRE(buffer[idx] == expected[idx]); + } + REQUIRE(encodedLen == expected.size()); + + result = dleEncoder.encode(TEST_ARRAY_3.data(), TEST_ARRAY_3.size(), + buffer.data(), 0, &encodedLen); + REQUIRE(result == DleEncoder::STREAM_TOO_SHORT); + result = dleEncoder.encode(TEST_ARRAY_1.data(), TEST_ARRAY_1.size(), + buffer.data(), 4, &encodedLen); + REQUIRE(result == DleEncoder::STREAM_TOO_SHORT); + } + + SECTION("Decoding") { + + } +} From b5063117f62393be273dbbcdf10532055a848ec3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 9 Sep 2021 00:02:17 +0200 Subject: [PATCH 255/389] added check to avoid seg fault --- src/fsfw/globalfunctions/DleEncoder.cpp | 20 +++++++++++--------- tests/src/fsfw_tests/unit/CatchFactory.h | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/fsfw/globalfunctions/DleEncoder.cpp b/src/fsfw/globalfunctions/DleEncoder.cpp index a043cbf7..5ab9fae6 100644 --- a/src/fsfw/globalfunctions/DleEncoder.cpp +++ b/src/fsfw/globalfunctions/DleEncoder.cpp @@ -10,12 +10,10 @@ ReturnValue_t DleEncoder::encode(const uint8_t* sourceStream, size_t* encodedLen, bool addStxEtx) { size_t minAllowedLen = 0; if(escapeStxEtx) { - minAllowedLen = 2; - + minAllowedLen = 1; } else { - minAllowedLen = 1; - + minAllowedLen = 2; } if(maxDestLen < minAllowedLen) { return STREAM_TOO_SHORT; @@ -41,7 +39,7 @@ ReturnValue_t DleEncoder::encode(const uint8_t* sourceStream, ReturnValue_t DleEncoder::encodeStreamEscaped(const uint8_t *sourceStream, size_t sourceLen, uint8_t *destStream, size_t maxDestLen, size_t *encodedLen, bool addStxEtx) { - size_t encodedIndex = 2; + size_t encodedIndex = 1; size_t sourceIndex = 0; uint8_t nextByte = 0; while (encodedIndex < maxDestLen and sourceIndex < sourceLen) { @@ -99,7 +97,7 @@ ReturnValue_t DleEncoder::encodeStreamEscaped(const uint8_t *sourceStream, size_ ReturnValue_t DleEncoder::encodeStreamNonEscaped(const uint8_t *sourceStream, size_t sourceLen, uint8_t *destStream, size_t maxDestLen, size_t *encodedLen, bool addStxEtx) { - size_t encodedIndex = 1; + size_t encodedIndex = 2; size_t sourceIndex = 0; uint8_t nextByte = 0; while (encodedIndex < maxDestLen and sourceIndex < sourceLen) { @@ -166,10 +164,14 @@ ReturnValue_t DleEncoder::decodeStreamEscaped(const uint8_t *sourceStream, size_ size_t encodedIndex = 1; size_t decodedIndex = 0; uint8_t nextByte; - while ((encodedIndex < sourceStreamLen) && (decodedIndex < maxDestStreamlen) - && (sourceStream[encodedIndex] != ETX_CHAR) - && (sourceStream[encodedIndex] != STX_CHAR)) { + while ((encodedIndex < sourceStreamLen) + and (decodedIndex < maxDestStreamlen) + and (sourceStream[encodedIndex] != ETX_CHAR) + and (sourceStream[encodedIndex] != STX_CHAR)) { if (sourceStream[encodedIndex] == DLE_CHAR) { + if(encodedIndex + 1 >= sourceStreamLen) { + return DECODING_ERROR; + } nextByte = sourceStream[encodedIndex + 1]; // The next byte is a DLE character that was escaped by another // DLE character, so we can write it to the destination stream. diff --git a/tests/src/fsfw_tests/unit/CatchFactory.h b/tests/src/fsfw_tests/unit/CatchFactory.h index ae0629e5..38ec46bd 100644 --- a/tests/src/fsfw_tests/unit/CatchFactory.h +++ b/tests/src/fsfw_tests/unit/CatchFactory.h @@ -1,7 +1,7 @@ #ifndef FSFW_CATCHFACTORY_H_ #define FSFW_CATCHFACTORY_H_ -#include "TestConfig.h" +#include "TestsConfig.h" #include "fsfw/objectmanager/SystemObjectIF.h" #include "fsfw/objectmanager/ObjectManager.h" From 35b53e9a1707dd4502f1d58ac912564be23557aa Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 9 Sep 2021 01:06:54 +0200 Subject: [PATCH 256/389] continuing tests --- src/fsfw/globalfunctions/DleEncoder.cpp | 8 +- src/fsfw/globalfunctions/DleEncoder.h | 3 + .../unit/globalfunctions/testDleEncoder.cpp | 120 +++++++++++------- 3 files changed, 84 insertions(+), 47 deletions(-) diff --git a/src/fsfw/globalfunctions/DleEncoder.cpp b/src/fsfw/globalfunctions/DleEncoder.cpp index 5ab9fae6..02e4aba4 100644 --- a/src/fsfw/globalfunctions/DleEncoder.cpp +++ b/src/fsfw/globalfunctions/DleEncoder.cpp @@ -22,7 +22,7 @@ ReturnValue_t DleEncoder::encode(const uint8_t* sourceStream, if(not escapeStxEtx) { destStream[0] = DLE_CHAR; } - destStream[0] = STX_CHAR; + destStream[1] = STX_CHAR; } if(escapeStxEtx) { @@ -220,6 +220,9 @@ ReturnValue_t DleEncoder::decodeStreamNonEscaped(const uint8_t *sourceStream, uint8_t nextByte; while ((encodedIndex < sourceStreamLen) && (decodedIndex < maxDestStreamlen)) { if (sourceStream[encodedIndex] == DLE_CHAR) { + if(encodedIndex + 1 >= sourceStreamLen) { + return DECODING_ERROR; + } nextByte = sourceStream[encodedIndex + 1]; if(nextByte == STX_CHAR) { *readLen = ++encodedIndex; @@ -247,3 +250,6 @@ ReturnValue_t DleEncoder::decodeStreamNonEscaped(const uint8_t *sourceStream, return DECODING_ERROR; } +void DleEncoder::setEscapeMode(bool escapeStxEtx) { + this->escapeStxEtx = escapeStxEtx; +} diff --git a/src/fsfw/globalfunctions/DleEncoder.h b/src/fsfw/globalfunctions/DleEncoder.h index dc178a0e..e4871bf0 100644 --- a/src/fsfw/globalfunctions/DleEncoder.h +++ b/src/fsfw/globalfunctions/DleEncoder.h @@ -37,6 +37,9 @@ public: * @param escapeCr In escaped mode, escape all CR occurrences as well */ DleEncoder(bool escapeStxEtx = true, bool escapeCr = false); + + void setEscapeMode(bool escapeStxEtx); + virtual ~DleEncoder(); static constexpr uint8_t INTERFACE_ID = CLASS_ID::DLE_ENCODER; diff --git a/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp b/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp index 01ac3568..91eb9052 100644 --- a/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp +++ b/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp @@ -4,58 +4,82 @@ #include -const std::array TEST_ARRAY_0 = { 0 }; -const std::array TEST_ARRAY_1 = { 0, DleEncoder::DLE_CHAR, 5}; -const std::array TEST_ARRAY_2 = { 0, DleEncoder::STX_CHAR, 5}; -const std::array TEST_ARRAY_3 = { 0, DleEncoder::CARRIAGE_RETURN, DleEncoder::ETX_CHAR}; +const std::vector TEST_ARRAY_0 = { 0, 0, 0, 0, 0 }; +const std::vector TEST_ARRAY_1 = { 0, DleEncoder::DLE_CHAR, 5}; +const std::vector TEST_ARRAY_2 = { 0, DleEncoder::STX_CHAR, 5}; +const std::vector TEST_ARRAY_3 = { 0, DleEncoder::CARRIAGE_RETURN, DleEncoder::ETX_CHAR}; +const std::vector TEST_ARRAY_4 = { DleEncoder::DLE_CHAR, DleEncoder::ETX_CHAR, + DleEncoder::STX_CHAR }; + +const std::vector TEST_ARRAY_0_ENCODED_ESCAPED = { + DleEncoder::STX_CHAR, 0, 0, 0, 0, 0, DleEncoder::ETX_CHAR +}; +const std::vector TEST_ARRAY_0_ENCODED_NON_ESCAPED = { + DleEncoder::DLE_CHAR, DleEncoder::STX_CHAR, 0, 0, 0, 0, 0, + DleEncoder::DLE_CHAR, DleEncoder::ETX_CHAR +}; + +const std::vector TEST_ARRAY_1_ENCODED_ESCAPED = { + DleEncoder::STX_CHAR, 0, DleEncoder::DLE_CHAR, DleEncoder::DLE_CHAR, 5, DleEncoder::ETX_CHAR +}; +const std::vector TEST_ARRAY_2_ENCODED_ESCAPED = { + DleEncoder::STX_CHAR, 0, DleEncoder::DLE_CHAR, DleEncoder::STX_CHAR + 0x40, + 5, DleEncoder::ETX_CHAR +}; +const std::vector TEST_ARRAY_3_ENCODED_ESCAPED = { + DleEncoder::STX_CHAR, 0, DleEncoder::CARRIAGE_RETURN, + DleEncoder::DLE_CHAR, DleEncoder::ETX_CHAR + 0x40, DleEncoder::ETX_CHAR +}; +const std::vector TEST_ARRAY_4_ENCODED_ESCAPED = { + DleEncoder::STX_CHAR, DleEncoder::DLE_CHAR, DleEncoder::DLE_CHAR, + DleEncoder::DLE_CHAR, DleEncoder::ETX_CHAR + 0x40, DleEncoder::DLE_CHAR, + DleEncoder::STX_CHAR + 0x40, DleEncoder::ETX_CHAR +}; + TEST_CASE("DleEncoder" , "[DleEncoder]") { - DleEncoder dleEncoder; std::array buffer; + + size_t encodedLen = 0; + size_t readLen = 0; + size_t decodedLen = 0; + + auto testLambdaEncode = [&](DleEncoder& encoder, const std::vector& vecToEncode, + const std::vector& expectedVec) { + ReturnValue_t result = encoder.encode(vecToEncode.data(), vecToEncode.size(), + buffer.data(), buffer.size(), &encodedLen); + REQUIRE(result == retval::CATCH_OK); + for(size_t idx = 0; idx < expectedVec.size(); idx++) { + REQUIRE(buffer[idx] == expectedVec[idx]); + } + REQUIRE(encodedLen == expectedVec.size()); + }; + + auto testLambdaDecode = [&](DleEncoder& encoder, const std::vector& testVecEncoded, + const std::vector& expectedVec) { + ReturnValue_t result = encoder.decode(testVecEncoded.data(), + testVecEncoded.size(), + &readLen, buffer.data(), buffer.size(), &decodedLen); + REQUIRE(result == retval::CATCH_OK); + REQUIRE(readLen == testVecEncoded.size()); + REQUIRE(decodedLen == expectedVec.size()); + for(size_t idx = 0; idx < decodedLen; idx++) { + REQUIRE(buffer[idx] == expectedVec[idx]); + } + }; + SECTION("Encoding") { - size_t encodedLen = 0; - ReturnValue_t result = dleEncoder.encode(TEST_ARRAY_0.data(), TEST_ARRAY_0.size(), - buffer.data(), buffer.size(), &encodedLen); - REQUIRE(result == retval::CATCH_OK); - std::vector expected = {DleEncoder::STX_CHAR, 0, 0, 0, 0, 0, - DleEncoder::ETX_CHAR}; - for(size_t idx = 0; idx < expected.size(); idx++) { - REQUIRE(buffer[idx] == expected[idx]); - } - REQUIRE(encodedLen == 7); + testLambdaEncode(dleEncoder, TEST_ARRAY_0, TEST_ARRAY_0_ENCODED_ESCAPED); + testLambdaEncode(dleEncoder, TEST_ARRAY_1, TEST_ARRAY_1_ENCODED_ESCAPED); + testLambdaEncode(dleEncoder, TEST_ARRAY_2, TEST_ARRAY_2_ENCODED_ESCAPED); + testLambdaEncode(dleEncoder, TEST_ARRAY_3, TEST_ARRAY_3_ENCODED_ESCAPED); + testLambdaEncode(dleEncoder, TEST_ARRAY_4, TEST_ARRAY_4_ENCODED_ESCAPED); - result = dleEncoder.encode(TEST_ARRAY_1.data(), TEST_ARRAY_1.size(), - buffer.data(), buffer.size(), &encodedLen); - REQUIRE(result == retval::CATCH_OK); - expected = std::vector{DleEncoder::STX_CHAR, 0, DleEncoder::DLE_CHAR, - DleEncoder::DLE_CHAR, 5, DleEncoder::ETX_CHAR}; - for(size_t idx = 0; idx < expected.size(); idx++) { - REQUIRE(buffer[idx] == expected[idx]); - } - REQUIRE(encodedLen == expected.size()); + dleEncoder.setEscapeMode(false); + testLambdaEncode(dleEncoder, TEST_ARRAY_0, TEST_ARRAY_0_ENCODED_NON_ESCAPED); - result = dleEncoder.encode(TEST_ARRAY_2.data(), TEST_ARRAY_2.size(), - buffer.data(), buffer.size(), &encodedLen); - REQUIRE(result == retval::CATCH_OK); - expected = std::vector{DleEncoder::STX_CHAR, 0, DleEncoder::DLE_CHAR, - DleEncoder::STX_CHAR + 0x40, 5, DleEncoder::ETX_CHAR}; - for(size_t idx = 0; idx < expected.size(); idx++) { - REQUIRE(buffer[idx] == expected[idx]); - } - REQUIRE(encodedLen == expected.size()); - - result = dleEncoder.encode(TEST_ARRAY_3.data(), TEST_ARRAY_3.size(), - buffer.data(), buffer.size(), &encodedLen); - REQUIRE(result == retval::CATCH_OK); - expected = std::vector{DleEncoder::STX_CHAR, 0, DleEncoder::CARRIAGE_RETURN, - DleEncoder::DLE_CHAR, DleEncoder::ETX_CHAR + 0x40, DleEncoder::ETX_CHAR}; - for(size_t idx = 0; idx < expected.size(); idx++) { - REQUIRE(buffer[idx] == expected[idx]); - } - REQUIRE(encodedLen == expected.size()); - - result = dleEncoder.encode(TEST_ARRAY_3.data(), TEST_ARRAY_3.size(), + ReturnValue_t result = dleEncoder.encode(TEST_ARRAY_3.data(), TEST_ARRAY_3.size(), buffer.data(), 0, &encodedLen); REQUIRE(result == DleEncoder::STREAM_TOO_SHORT); result = dleEncoder.encode(TEST_ARRAY_1.data(), TEST_ARRAY_1.size(), @@ -64,6 +88,10 @@ TEST_CASE("DleEncoder" , "[DleEncoder]") { } SECTION("Decoding") { - + testLambdaDecode(dleEncoder, TEST_ARRAY_0_ENCODED_ESCAPED, TEST_ARRAY_0); + testLambdaDecode(dleEncoder, TEST_ARRAY_1_ENCODED_ESCAPED, TEST_ARRAY_1); + testLambdaDecode(dleEncoder, TEST_ARRAY_2_ENCODED_ESCAPED, TEST_ARRAY_2); + testLambdaDecode(dleEncoder, TEST_ARRAY_3_ENCODED_ESCAPED, TEST_ARRAY_3); + testLambdaDecode(dleEncoder, TEST_ARRAY_4_ENCODED_ESCAPED, TEST_ARRAY_4); } } From d05eb23ea73499f37b9dc3d7c6b5389c43a53c2c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 9 Sep 2021 01:28:21 +0200 Subject: [PATCH 257/389] debugged and tested non-escaped encoder --- src/fsfw/globalfunctions/DleEncoder.cpp | 9 ++--- .../unit/globalfunctions/testDleEncoder.cpp | 34 ++++++++++++++++--- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/fsfw/globalfunctions/DleEncoder.cpp b/src/fsfw/globalfunctions/DleEncoder.cpp index 02e4aba4..f17df055 100644 --- a/src/fsfw/globalfunctions/DleEncoder.cpp +++ b/src/fsfw/globalfunctions/DleEncoder.cpp @@ -19,10 +19,11 @@ ReturnValue_t DleEncoder::encode(const uint8_t* sourceStream, return STREAM_TOO_SHORT; } if (addStxEtx) { + size_t currentIdx = 0; if(not escapeStxEtx) { - destStream[0] = DLE_CHAR; + destStream[currentIdx++] = DLE_CHAR; } - destStream[1] = STX_CHAR; + destStream[currentIdx] = STX_CHAR; } if(escapeStxEtx) { @@ -122,8 +123,8 @@ ReturnValue_t DleEncoder::encodeStreamNonEscaped(const uint8_t *sourceStream, si if (sourceIndex == sourceLen and encodedIndex < maxDestLen) { if (addStxEtx) { - destStream[encodedIndex] = ETX_CHAR; - ++encodedIndex; + destStream[encodedIndex++] = DLE_CHAR; + destStream[encodedIndex++] = ETX_CHAR; } *encodedLen = encodedIndex; return RETURN_OK; diff --git a/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp b/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp index 91eb9052..bb8ee40f 100644 --- a/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp +++ b/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp @@ -22,19 +22,39 @@ const std::vector TEST_ARRAY_0_ENCODED_NON_ESCAPED = { const std::vector TEST_ARRAY_1_ENCODED_ESCAPED = { DleEncoder::STX_CHAR, 0, DleEncoder::DLE_CHAR, DleEncoder::DLE_CHAR, 5, DleEncoder::ETX_CHAR }; +const std::vector TEST_ARRAY_1_ENCODED_NON_ESCAPED = { + DleEncoder::DLE_CHAR, DleEncoder::STX_CHAR, 0, DleEncoder::DLE_CHAR, DleEncoder::DLE_CHAR, + 5, DleEncoder::DLE_CHAR, DleEncoder::ETX_CHAR +}; + const std::vector TEST_ARRAY_2_ENCODED_ESCAPED = { DleEncoder::STX_CHAR, 0, DleEncoder::DLE_CHAR, DleEncoder::STX_CHAR + 0x40, 5, DleEncoder::ETX_CHAR }; +const std::vector TEST_ARRAY_2_ENCODED_NON_ESCAPED = { + DleEncoder::DLE_CHAR, DleEncoder::STX_CHAR, 0, + DleEncoder::STX_CHAR, 5, DleEncoder::DLE_CHAR, DleEncoder::ETX_CHAR +}; + const std::vector TEST_ARRAY_3_ENCODED_ESCAPED = { DleEncoder::STX_CHAR, 0, DleEncoder::CARRIAGE_RETURN, - DleEncoder::DLE_CHAR, DleEncoder::ETX_CHAR + 0x40, DleEncoder::ETX_CHAR + DleEncoder::DLE_CHAR, DleEncoder::ETX_CHAR + 0x40, DleEncoder::ETX_CHAR }; +const std::vector TEST_ARRAY_3_ENCODED_NON_ESCAPED = { + DleEncoder::DLE_CHAR, DleEncoder::STX_CHAR, 0, + DleEncoder::CARRIAGE_RETURN, DleEncoder::ETX_CHAR, DleEncoder::DLE_CHAR, + DleEncoder::ETX_CHAR +}; + const std::vector TEST_ARRAY_4_ENCODED_ESCAPED = { DleEncoder::STX_CHAR, DleEncoder::DLE_CHAR, DleEncoder::DLE_CHAR, DleEncoder::DLE_CHAR, DleEncoder::ETX_CHAR + 0x40, DleEncoder::DLE_CHAR, DleEncoder::STX_CHAR + 0x40, DleEncoder::ETX_CHAR }; +const std::vector TEST_ARRAY_4_ENCODED_NON_ESCAPED = { + DleEncoder::DLE_CHAR, DleEncoder::STX_CHAR, DleEncoder::DLE_CHAR, DleEncoder::DLE_CHAR, + DleEncoder::ETX_CHAR, DleEncoder::STX_CHAR, DleEncoder::DLE_CHAR, DleEncoder::ETX_CHAR +}; TEST_CASE("DleEncoder" , "[DleEncoder]") { @@ -75,16 +95,20 @@ TEST_CASE("DleEncoder" , "[DleEncoder]") { testLambdaEncode(dleEncoder, TEST_ARRAY_2, TEST_ARRAY_2_ENCODED_ESCAPED); testLambdaEncode(dleEncoder, TEST_ARRAY_3, TEST_ARRAY_3_ENCODED_ESCAPED); testLambdaEncode(dleEncoder, TEST_ARRAY_4, TEST_ARRAY_4_ENCODED_ESCAPED); - - dleEncoder.setEscapeMode(false); - testLambdaEncode(dleEncoder, TEST_ARRAY_0, TEST_ARRAY_0_ENCODED_NON_ESCAPED); - ReturnValue_t result = dleEncoder.encode(TEST_ARRAY_3.data(), TEST_ARRAY_3.size(), buffer.data(), 0, &encodedLen); REQUIRE(result == DleEncoder::STREAM_TOO_SHORT); result = dleEncoder.encode(TEST_ARRAY_1.data(), TEST_ARRAY_1.size(), buffer.data(), 4, &encodedLen); REQUIRE(result == DleEncoder::STREAM_TOO_SHORT); + + dleEncoder.setEscapeMode(false); + testLambdaEncode(dleEncoder, TEST_ARRAY_0, TEST_ARRAY_0_ENCODED_NON_ESCAPED); + testLambdaEncode(dleEncoder, TEST_ARRAY_1, TEST_ARRAY_1_ENCODED_NON_ESCAPED); + testLambdaEncode(dleEncoder, TEST_ARRAY_2, TEST_ARRAY_2_ENCODED_NON_ESCAPED); + testLambdaEncode(dleEncoder, TEST_ARRAY_3, TEST_ARRAY_3_ENCODED_NON_ESCAPED); + testLambdaEncode(dleEncoder, TEST_ARRAY_4, TEST_ARRAY_4_ENCODED_NON_ESCAPED); + dleEncoder.setEscapeMode(true); } SECTION("Decoding") { From 3d336c08f20cbae3703660787c1169bc8d31bcb8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 9 Sep 2021 10:47:54 +0200 Subject: [PATCH 258/389] tests almost complete --- src/fsfw/globalfunctions/DleEncoder.cpp | 5 +- .../unit/globalfunctions/testDleEncoder.cpp | 69 ++++++++++++++++--- 2 files changed, 65 insertions(+), 9 deletions(-) diff --git a/src/fsfw/globalfunctions/DleEncoder.cpp b/src/fsfw/globalfunctions/DleEncoder.cpp index f17df055..e9e5e856 100644 --- a/src/fsfw/globalfunctions/DleEncoder.cpp +++ b/src/fsfw/globalfunctions/DleEncoder.cpp @@ -15,7 +15,7 @@ ReturnValue_t DleEncoder::encode(const uint8_t* sourceStream, else { minAllowedLen = 2; } - if(maxDestLen < minAllowedLen) { + if(minAllowedLen > maxDestLen) { return STREAM_TOO_SHORT; } if (addStxEtx) { @@ -123,6 +123,9 @@ ReturnValue_t DleEncoder::encodeStreamNonEscaped(const uint8_t *sourceStream, si if (sourceIndex == sourceLen and encodedIndex < maxDestLen) { if (addStxEtx) { + if(encodedIndex + 2 >= maxDestLen) { + return STREAM_TOO_SHORT; + } destStream[encodedIndex++] = DLE_CHAR; destStream[encodedIndex++] = ETX_CHAR; } diff --git a/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp b/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp index bb8ee40f..42701377 100644 --- a/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp +++ b/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp @@ -59,6 +59,7 @@ const std::vector TEST_ARRAY_4_ENCODED_NON_ESCAPED = { TEST_CASE("DleEncoder" , "[DleEncoder]") { DleEncoder dleEncoder; + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; std::array buffer; size_t encodedLen = 0; @@ -67,7 +68,7 @@ TEST_CASE("DleEncoder" , "[DleEncoder]") { auto testLambdaEncode = [&](DleEncoder& encoder, const std::vector& vecToEncode, const std::vector& expectedVec) { - ReturnValue_t result = encoder.encode(vecToEncode.data(), vecToEncode.size(), + result = encoder.encode(vecToEncode.data(), vecToEncode.size(), buffer.data(), buffer.size(), &encodedLen); REQUIRE(result == retval::CATCH_OK); for(size_t idx = 0; idx < expectedVec.size(); idx++) { @@ -78,7 +79,7 @@ TEST_CASE("DleEncoder" , "[DleEncoder]") { auto testLambdaDecode = [&](DleEncoder& encoder, const std::vector& testVecEncoded, const std::vector& expectedVec) { - ReturnValue_t result = encoder.decode(testVecEncoded.data(), + result = encoder.decode(testVecEncoded.data(), testVecEncoded.size(), &readLen, buffer.data(), buffer.size(), &decodedLen); REQUIRE(result == retval::CATCH_OK); @@ -95,12 +96,25 @@ TEST_CASE("DleEncoder" , "[DleEncoder]") { testLambdaEncode(dleEncoder, TEST_ARRAY_2, TEST_ARRAY_2_ENCODED_ESCAPED); testLambdaEncode(dleEncoder, TEST_ARRAY_3, TEST_ARRAY_3_ENCODED_ESCAPED); testLambdaEncode(dleEncoder, TEST_ARRAY_4, TEST_ARRAY_4_ENCODED_ESCAPED); - ReturnValue_t result = dleEncoder.encode(TEST_ARRAY_3.data(), TEST_ARRAY_3.size(), - buffer.data(), 0, &encodedLen); - REQUIRE(result == DleEncoder::STREAM_TOO_SHORT); - result = dleEncoder.encode(TEST_ARRAY_1.data(), TEST_ARRAY_1.size(), - buffer.data(), 4, &encodedLen); - REQUIRE(result == DleEncoder::STREAM_TOO_SHORT); + + auto testFaultyEncoding = [&](const std::vector& vecToEncode, + const std::vector& expectedVec) { + + for(size_t faultyDestSize = 0; faultyDestSize < expectedVec.size(); faultyDestSize ++) { + if(faultyDestSize == 8) { + + } + result = dleEncoder.encode(vecToEncode.data(), vecToEncode.size(), + buffer.data(), faultyDestSize, &encodedLen); + REQUIRE(result == DleEncoder::STREAM_TOO_SHORT); + } + }; + + testFaultyEncoding(TEST_ARRAY_0, TEST_ARRAY_0_ENCODED_ESCAPED); + testFaultyEncoding(TEST_ARRAY_1, TEST_ARRAY_1_ENCODED_ESCAPED); + testFaultyEncoding(TEST_ARRAY_2, TEST_ARRAY_2_ENCODED_ESCAPED); + testFaultyEncoding(TEST_ARRAY_3, TEST_ARRAY_3_ENCODED_ESCAPED); + testFaultyEncoding(TEST_ARRAY_4, TEST_ARRAY_4_ENCODED_ESCAPED); dleEncoder.setEscapeMode(false); testLambdaEncode(dleEncoder, TEST_ARRAY_0, TEST_ARRAY_0_ENCODED_NON_ESCAPED); @@ -108,6 +122,12 @@ TEST_CASE("DleEncoder" , "[DleEncoder]") { testLambdaEncode(dleEncoder, TEST_ARRAY_2, TEST_ARRAY_2_ENCODED_NON_ESCAPED); testLambdaEncode(dleEncoder, TEST_ARRAY_3, TEST_ARRAY_3_ENCODED_NON_ESCAPED); testLambdaEncode(dleEncoder, TEST_ARRAY_4, TEST_ARRAY_4_ENCODED_NON_ESCAPED); + + testFaultyEncoding(TEST_ARRAY_0, TEST_ARRAY_0_ENCODED_NON_ESCAPED); + testFaultyEncoding(TEST_ARRAY_1, TEST_ARRAY_1_ENCODED_NON_ESCAPED); + testFaultyEncoding(TEST_ARRAY_2, TEST_ARRAY_2_ENCODED_NON_ESCAPED); + testFaultyEncoding(TEST_ARRAY_3, TEST_ARRAY_3_ENCODED_NON_ESCAPED); + testFaultyEncoding(TEST_ARRAY_4, TEST_ARRAY_4_ENCODED_NON_ESCAPED); dleEncoder.setEscapeMode(true); } @@ -117,5 +137,38 @@ TEST_CASE("DleEncoder" , "[DleEncoder]") { testLambdaDecode(dleEncoder, TEST_ARRAY_2_ENCODED_ESCAPED, TEST_ARRAY_2); testLambdaDecode(dleEncoder, TEST_ARRAY_3_ENCODED_ESCAPED, TEST_ARRAY_3); testLambdaDecode(dleEncoder, TEST_ARRAY_4_ENCODED_ESCAPED, TEST_ARRAY_4); + + auto testFaultyDecoding = [&](const std::vector& vecToDecode, + const std::vector& expectedVec) { + for(size_t faultyDestSizes = 0; + faultyDestSizes < expectedVec.size(); + faultyDestSizes ++) { + result = dleEncoder.decode(vecToDecode.data(), + vecToDecode.size(), &readLen, + buffer.data(), faultyDestSizes, &decodedLen); + REQUIRE(result == static_cast(DleEncoder::DECODING_ERROR)); + } + }; + + testFaultyDecoding(TEST_ARRAY_0_ENCODED_ESCAPED, TEST_ARRAY_0); + testFaultyDecoding(TEST_ARRAY_1_ENCODED_ESCAPED, TEST_ARRAY_1); + testFaultyDecoding(TEST_ARRAY_2_ENCODED_ESCAPED, TEST_ARRAY_2); + testFaultyDecoding(TEST_ARRAY_3_ENCODED_ESCAPED, TEST_ARRAY_3); + testFaultyDecoding(TEST_ARRAY_4_ENCODED_ESCAPED, TEST_ARRAY_4); + + dleEncoder.setEscapeMode(false); + testLambdaDecode(dleEncoder, TEST_ARRAY_0_ENCODED_NON_ESCAPED, TEST_ARRAY_0); + testLambdaDecode(dleEncoder, TEST_ARRAY_1_ENCODED_NON_ESCAPED, TEST_ARRAY_1); + testLambdaDecode(dleEncoder, TEST_ARRAY_2_ENCODED_NON_ESCAPED, TEST_ARRAY_2); + testLambdaDecode(dleEncoder, TEST_ARRAY_3_ENCODED_NON_ESCAPED, TEST_ARRAY_3); + testLambdaDecode(dleEncoder, TEST_ARRAY_4_ENCODED_NON_ESCAPED, TEST_ARRAY_4); + + testFaultyDecoding(TEST_ARRAY_0_ENCODED_NON_ESCAPED, TEST_ARRAY_0); + testFaultyDecoding(TEST_ARRAY_1_ENCODED_NON_ESCAPED, TEST_ARRAY_1); + testFaultyDecoding(TEST_ARRAY_2_ENCODED_NON_ESCAPED, TEST_ARRAY_2); + testFaultyDecoding(TEST_ARRAY_3_ENCODED_NON_ESCAPED, TEST_ARRAY_3); + testFaultyDecoding(TEST_ARRAY_4_ENCODED_NON_ESCAPED, TEST_ARRAY_4); + + dleEncoder.setEscapeMode(true); } } From ea573b0523ea205ef36c8f4c91c61d948bab29c7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 9 Sep 2021 11:12:42 +0200 Subject: [PATCH 259/389] a few more tests with faulty source data --- src/fsfw/globalfunctions/DleEncoder.cpp | 3 ++ .../unit/globalfunctions/testDleEncoder.cpp | 54 +++++++++++++++++-- 2 files changed, 54 insertions(+), 3 deletions(-) diff --git a/src/fsfw/globalfunctions/DleEncoder.cpp b/src/fsfw/globalfunctions/DleEncoder.cpp index e9e5e856..0db557b6 100644 --- a/src/fsfw/globalfunctions/DleEncoder.cpp +++ b/src/fsfw/globalfunctions/DleEncoder.cpp @@ -244,6 +244,9 @@ ReturnValue_t DleEncoder::decodeStreamNonEscaped(const uint8_t *sourceStream, *decodedLen = decodedIndex; return RETURN_OK; } + else { + return DECODING_ERROR; + } } else { destStream[decodedIndex] = sourceStream[encodedIndex]; diff --git a/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp b/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp index 42701377..4cc3326e 100644 --- a/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp +++ b/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp @@ -101,9 +101,6 @@ TEST_CASE("DleEncoder" , "[DleEncoder]") { const std::vector& expectedVec) { for(size_t faultyDestSize = 0; faultyDestSize < expectedVec.size(); faultyDestSize ++) { - if(faultyDestSize == 8) { - - } result = dleEncoder.encode(vecToEncode.data(), vecToEncode.size(), buffer.data(), faultyDestSize, &encodedLen); REQUIRE(result == DleEncoder::STREAM_TOO_SHORT); @@ -138,6 +135,28 @@ TEST_CASE("DleEncoder" , "[DleEncoder]") { testLambdaDecode(dleEncoder, TEST_ARRAY_3_ENCODED_ESCAPED, TEST_ARRAY_3); testLambdaDecode(dleEncoder, TEST_ARRAY_4_ENCODED_ESCAPED, TEST_ARRAY_4); + // Faulty source data + auto testArray1EncodedFaulty = TEST_ARRAY_1_ENCODED_ESCAPED; + testArray1EncodedFaulty[3] = 0; + result = dleEncoder.decode(testArray1EncodedFaulty.data(), testArray1EncodedFaulty.size(), + &readLen, buffer.data(), buffer.size(), &encodedLen); + REQUIRE(result == static_cast(DleEncoder::DECODING_ERROR)); + auto testArray2EncodedFaulty = TEST_ARRAY_2_ENCODED_ESCAPED; + testArray2EncodedFaulty[5] = 0; + result = dleEncoder.decode(testArray2EncodedFaulty.data(), testArray2EncodedFaulty.size(), + &readLen, buffer.data(), buffer.size(), &encodedLen); + REQUIRE(result == static_cast(DleEncoder::DECODING_ERROR)); + auto testArray4EncodedFaulty = TEST_ARRAY_4_ENCODED_ESCAPED; + testArray4EncodedFaulty[2] = 0; + result = dleEncoder.decode(testArray4EncodedFaulty.data(), testArray4EncodedFaulty.size(), + &readLen, buffer.data(), buffer.size(), &encodedLen); + REQUIRE(result == static_cast(DleEncoder::DECODING_ERROR)); + auto testArray4EncodedFaulty2 = TEST_ARRAY_4_ENCODED_ESCAPED; + testArray4EncodedFaulty2[4] = 0; + result = dleEncoder.decode(testArray4EncodedFaulty2.data(), testArray4EncodedFaulty2.size(), + &readLen, buffer.data(), buffer.size(), &encodedLen); + REQUIRE(result == static_cast(DleEncoder::DECODING_ERROR)); + auto testFaultyDecoding = [&](const std::vector& vecToDecode, const std::vector& expectedVec) { for(size_t faultyDestSizes = 0; @@ -169,6 +188,35 @@ TEST_CASE("DleEncoder" , "[DleEncoder]") { testFaultyDecoding(TEST_ARRAY_3_ENCODED_NON_ESCAPED, TEST_ARRAY_3); testFaultyDecoding(TEST_ARRAY_4_ENCODED_NON_ESCAPED, TEST_ARRAY_4); + // Faulty source data + testArray1EncodedFaulty = TEST_ARRAY_1_ENCODED_NON_ESCAPED; + auto prevVal = testArray1EncodedFaulty[0]; + testArray1EncodedFaulty[0] = 0; + result = dleEncoder.decode(testArray1EncodedFaulty.data(), testArray1EncodedFaulty.size(), + &readLen, buffer.data(), buffer.size(), &encodedLen); + REQUIRE(result == static_cast(DleEncoder::DECODING_ERROR)); + testArray1EncodedFaulty[0] = prevVal; + testArray1EncodedFaulty[1] = 0; + result = dleEncoder.decode(testArray1EncodedFaulty.data(), testArray1EncodedFaulty.size(), + &readLen, buffer.data(), buffer.size(), &encodedLen); + REQUIRE(result == static_cast(DleEncoder::DECODING_ERROR)); + + testArray1EncodedFaulty = TEST_ARRAY_1_ENCODED_NON_ESCAPED; + testArray1EncodedFaulty[6] = 0; + result = dleEncoder.decode(testArray1EncodedFaulty.data(), testArray1EncodedFaulty.size(), + &readLen, buffer.data(), buffer.size(), &encodedLen); + REQUIRE(result == static_cast(DleEncoder::DECODING_ERROR)); + testArray1EncodedFaulty = TEST_ARRAY_1_ENCODED_NON_ESCAPED; + testArray1EncodedFaulty[7] = 0; + result = dleEncoder.decode(testArray1EncodedFaulty.data(), testArray1EncodedFaulty.size(), + &readLen, buffer.data(), buffer.size(), &encodedLen); + REQUIRE(result == static_cast(DleEncoder::DECODING_ERROR)); + testArray4EncodedFaulty = TEST_ARRAY_4_ENCODED_NON_ESCAPED; + testArray4EncodedFaulty[3] = 0; + result = dleEncoder.decode(testArray4EncodedFaulty.data(), testArray4EncodedFaulty.size(), + &readLen, buffer.data(), buffer.size(), &encodedLen); + REQUIRE(result == static_cast(DleEncoder::DECODING_ERROR)); + dleEncoder.setEscapeMode(true); } } From c9bfc8464aede0f79c167e18c5c0c79ded2444ce Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 11 Sep 2021 17:39:42 +0200 Subject: [PATCH 260/389] added function to enable periodic reply --- src/fsfw/devicehandlers/DeviceHandlerBase.cpp | 23 +++++++++++------ src/fsfw/devicehandlers/DeviceHandlerBase.h | 25 +++++++++++++------ 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp index 1a7fbc91..95e25b74 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp @@ -430,12 +430,7 @@ ReturnValue_t DeviceHandlerBase::insertInReplyMap(DeviceCommandId_t replyId, DeviceReplyInfo info; info.maxDelayCycles = maxDelayCycles; info.periodic = periodic; - if(info.periodic) { - info.delayCycles = info.maxDelayCycles; - } - else { - info.delayCycles = 0; - } + info.delayCycles = 0; info.replyLen = replyLen; info.dataSet = dataSet; info.command = deviceCommandMap.end(); @@ -474,7 +469,7 @@ ReturnValue_t DeviceHandlerBase::updateReplyMapEntry(DeviceCommandId_t deviceRep auto replyIter = deviceReplyMap.find(deviceReply); if (replyIter == deviceReplyMap.end()) { triggerEvent(INVALID_DEVICE_COMMAND, deviceReply); - return RETURN_FAILED; + return COMMAND_NOT_SUPPORTED; } else { DeviceReplyInfo *info = &(replyIter->second); if (maxDelayCycles != 0) { @@ -486,6 +481,20 @@ ReturnValue_t DeviceHandlerBase::updateReplyMapEntry(DeviceCommandId_t deviceRep } } +ReturnValue_t DeviceHandlerBase::enablePeriodicReply(DeviceCommandId_t deviceReply) { + auto replyIter = deviceReplyMap.find(deviceReply); + if (replyIter == deviceReplyMap.end()) { + triggerEvent(INVALID_DEVICE_COMMAND, deviceReply); + return COMMAND_NOT_SUPPORTED; + } else { + DeviceReplyInfo *info = &(replyIter->second); + if(not info->periodic) { + return COMMAND_NOT_SUPPORTED; + } + info->delayCycles = info->maxDelayCycles; + } + return HasReturnvaluesIF::RETURN_OK; +} ReturnValue_t DeviceHandlerBase::setReplyDataset(DeviceCommandId_t replyId, LocalPoolDataSetBase *dataSet) { diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.h b/src/fsfw/devicehandlers/DeviceHandlerBase.h index 53bd1e65..d478b0fa 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.h +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.h @@ -449,7 +449,9 @@ protected: * @param replyLen Will be supplied to the requestReceiveMessage call of * the communication interface. * @param periodic Indicates if the command is periodic (i.e. it is sent - * by the device repeatedly without request) or not. Default is aperiodic (0) + * by the device repeatedly without request) or not. Default is aperiodic (0). + * Please note that periodic replies are disabled by default. You can enable them with + * #enablePeriodicReplies * @return - @c RETURN_OK when the command was successfully inserted, * - @c RETURN_FAILED else. */ @@ -464,7 +466,9 @@ protected: * @param maxDelayCycles The maximum number of delay cycles the reply waits * until it times out. * @param periodic Indicates if the command is periodic (i.e. it is sent - * by the device repeatedly without request) or not. Default is aperiodic (0) + * by the device repeatedly without request) or not. Default is aperiodic (0). + * Please note that periodic replies are disabled by default. You can enable them with + * #enablePeriodicReplies * @return - @c RETURN_OK when the command was successfully inserted, * - @c RETURN_FAILED else. */ @@ -480,6 +484,13 @@ protected: */ ReturnValue_t insertInCommandMap(DeviceCommandId_t deviceCommand); + /** + * Enables a periodic reply for a given command. It sets to delay cycles to the specified + * maximum delay cycles for a given reply ID. + * @return + */ + ReturnValue_t enablePeriodicReply(DeviceCommandId_t deviceReply); + /** * @brief This function returns the reply length of the next reply to read. * @@ -493,16 +504,14 @@ protected: virtual size_t getNextReplyLength(DeviceCommandId_t deviceCommand); /** - * @brief This is a helper method to facilitate updating entries - * in the reply map. + * @brief This is a helper method to facilitate updating entries in the reply map. * @param deviceCommand Identifier of the reply to update. - * @param delayCycles The current number of delay cycles to wait. - * As stated in #fillCommandAndCookieMap, to disable periodic commands, - * this is set to zero. + * @param delayCycles The current number of delay cycles to wait. As stated in + * #fillCommandAndReplyMap, to disable periodic commands, this is set to zero. * @param maxDelayCycles The maximum number of delay cycles the reply waits * until it times out. By passing 0 the entry remains untouched. * @param periodic Indicates if the command is periodic (i.e. it is sent - * by the device repeatedly without request) or not.Default is aperiodic (0). + * by the device repeatedly without request) or not. Default is aperiodic (0). * Warning: The setting always overrides the value that was entered in the map. * @return - @c RETURN_OK when the command was successfully inserted, * - @c RETURN_FAILED else. From 11a3c8c21f8a80d5c0872e99e39bd655f18acfa7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 11 Sep 2021 17:42:29 +0200 Subject: [PATCH 261/389] added option to disable it as well --- src/fsfw/devicehandlers/DeviceHandlerBase.cpp | 9 +++++++-- src/fsfw/devicehandlers/DeviceHandlerBase.h | 5 +++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp index 95e25b74..aab3aa16 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp @@ -481,7 +481,7 @@ ReturnValue_t DeviceHandlerBase::updateReplyMapEntry(DeviceCommandId_t deviceRep } } -ReturnValue_t DeviceHandlerBase::enablePeriodicReply(DeviceCommandId_t deviceReply) { +ReturnValue_t DeviceHandlerBase::enablePeriodicReply(bool enable, DeviceCommandId_t deviceReply) { auto replyIter = deviceReplyMap.find(deviceReply); if (replyIter == deviceReplyMap.end()) { triggerEvent(INVALID_DEVICE_COMMAND, deviceReply); @@ -491,7 +491,12 @@ ReturnValue_t DeviceHandlerBase::enablePeriodicReply(DeviceCommandId_t deviceRep if(not info->periodic) { return COMMAND_NOT_SUPPORTED; } - info->delayCycles = info->maxDelayCycles; + if(enable) { + info->delayCycles = info->maxDelayCycles; + } + else { + info->delayCycles = 0; + } } return HasReturnvaluesIF::RETURN_OK; } diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.h b/src/fsfw/devicehandlers/DeviceHandlerBase.h index d478b0fa..138b429e 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.h +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.h @@ -486,10 +486,11 @@ protected: /** * Enables a periodic reply for a given command. It sets to delay cycles to the specified - * maximum delay cycles for a given reply ID. + * maximum delay cycles for a given reply ID if enabled or to 0 if disabled. + * @param enable Specify whether to enable or disable a given periodic reply * @return */ - ReturnValue_t enablePeriodicReply(DeviceCommandId_t deviceReply); + ReturnValue_t enablePeriodicReply(bool enable, DeviceCommandId_t deviceReply); /** * @brief This function returns the reply length of the next reply to read. From 134deb3f433988513617a0d510fbbf8629b34fbc Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 11 Sep 2021 17:43:58 +0200 Subject: [PATCH 262/389] renamed function --- src/fsfw/devicehandlers/DeviceHandlerBase.cpp | 2 +- src/fsfw/devicehandlers/DeviceHandlerBase.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp index aab3aa16..c3fc023e 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp @@ -481,7 +481,7 @@ ReturnValue_t DeviceHandlerBase::updateReplyMapEntry(DeviceCommandId_t deviceRep } } -ReturnValue_t DeviceHandlerBase::enablePeriodicReply(bool enable, DeviceCommandId_t deviceReply) { +ReturnValue_t DeviceHandlerBase::updatePeriodicReply(bool enable, DeviceCommandId_t deviceReply) { auto replyIter = deviceReplyMap.find(deviceReply); if (replyIter == deviceReplyMap.end()) { triggerEvent(INVALID_DEVICE_COMMAND, deviceReply); diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.h b/src/fsfw/devicehandlers/DeviceHandlerBase.h index 138b429e..30d36ef0 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.h +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.h @@ -451,7 +451,7 @@ protected: * @param periodic Indicates if the command is periodic (i.e. it is sent * by the device repeatedly without request) or not. Default is aperiodic (0). * Please note that periodic replies are disabled by default. You can enable them with - * #enablePeriodicReplies + * #updatePeriodicReply * @return - @c RETURN_OK when the command was successfully inserted, * - @c RETURN_FAILED else. */ @@ -468,7 +468,7 @@ protected: * @param periodic Indicates if the command is periodic (i.e. it is sent * by the device repeatedly without request) or not. Default is aperiodic (0). * Please note that periodic replies are disabled by default. You can enable them with - * #enablePeriodicReplies + * #updatePeriodicReply * @return - @c RETURN_OK when the command was successfully inserted, * - @c RETURN_FAILED else. */ @@ -490,7 +490,7 @@ protected: * @param enable Specify whether to enable or disable a given periodic reply * @return */ - ReturnValue_t enablePeriodicReply(bool enable, DeviceCommandId_t deviceReply); + ReturnValue_t updatePeriodicReply(bool enable, DeviceCommandId_t deviceReply); /** * @brief This function returns the reply length of the next reply to read. From 7c7a8a5df7510e9a35f6bd6f88d21cad54454548 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 11 Sep 2021 19:18:18 +0200 Subject: [PATCH 263/389] added improvements from code review --- src/fsfw/globalfunctions/DleEncoder.cpp | 93 ++++++++++++------- src/fsfw/globalfunctions/DleEncoder.h | 5 + .../unit/globalfunctions/testDleEncoder.cpp | 2 +- 3 files changed, 65 insertions(+), 35 deletions(-) diff --git a/src/fsfw/globalfunctions/DleEncoder.cpp b/src/fsfw/globalfunctions/DleEncoder.cpp index 0db557b6..35ba84d5 100644 --- a/src/fsfw/globalfunctions/DleEncoder.cpp +++ b/src/fsfw/globalfunctions/DleEncoder.cpp @@ -8,22 +8,12 @@ DleEncoder::~DleEncoder() {} ReturnValue_t DleEncoder::encode(const uint8_t* sourceStream, size_t sourceLen, uint8_t* destStream, size_t maxDestLen, size_t* encodedLen, bool addStxEtx) { - size_t minAllowedLen = 0; - if(escapeStxEtx) { - minAllowedLen = 1; - } - else { - minAllowedLen = 2; - } - if(minAllowedLen > maxDestLen) { - return STREAM_TOO_SHORT; - } if (addStxEtx) { size_t currentIdx = 0; if(not escapeStxEtx) { destStream[currentIdx++] = DLE_CHAR; } - destStream[currentIdx] = STX_CHAR; + } if(escapeStxEtx) { @@ -40,9 +30,15 @@ ReturnValue_t DleEncoder::encode(const uint8_t* sourceStream, ReturnValue_t DleEncoder::encodeStreamEscaped(const uint8_t *sourceStream, size_t sourceLen, uint8_t *destStream, size_t maxDestLen, size_t *encodedLen, bool addStxEtx) { - size_t encodedIndex = 1; + size_t encodedIndex = 0; size_t sourceIndex = 0; uint8_t nextByte = 0; + if(addStxEtx) { + if(maxDestLen < 1) { + return STREAM_TOO_SHORT; + } + destStream[encodedIndex++] = STX_CHAR; + } while (encodedIndex < maxDestLen and sourceIndex < sourceLen) { nextByte = sourceStream[sourceIndex]; // STX, ETX and CR characters in the stream need to be escaped with DLE @@ -82,8 +78,11 @@ ReturnValue_t DleEncoder::encodeStreamEscaped(const uint8_t *sourceStream, size_ ++sourceIndex; } - if (sourceIndex == sourceLen and encodedIndex < maxDestLen) { + if (sourceIndex == sourceLen) { if (addStxEtx) { + if(encodedIndex + 1 >= maxDestLen) { + return STREAM_TOO_SHORT; + } destStream[encodedIndex] = ETX_CHAR; ++encodedIndex; } @@ -98,9 +97,16 @@ ReturnValue_t DleEncoder::encodeStreamEscaped(const uint8_t *sourceStream, size_ ReturnValue_t DleEncoder::encodeStreamNonEscaped(const uint8_t *sourceStream, size_t sourceLen, uint8_t *destStream, size_t maxDestLen, size_t *encodedLen, bool addStxEtx) { - size_t encodedIndex = 2; + size_t encodedIndex = 0; size_t sourceIndex = 0; uint8_t nextByte = 0; + if(addStxEtx) { + if(maxDestLen < 2) { + return STREAM_TOO_SHORT; + } + destStream[encodedIndex++] = DLE_CHAR; + destStream[encodedIndex++] = STX_CHAR; + } while (encodedIndex < maxDestLen and sourceIndex < sourceLen) { nextByte = sourceStream[sourceIndex]; // DLE characters are simply escaped with DLE. @@ -121,7 +127,7 @@ ReturnValue_t DleEncoder::encodeStreamNonEscaped(const uint8_t *sourceStream, si ++sourceIndex; } - if (sourceIndex == sourceLen and encodedIndex < maxDestLen) { + if (sourceIndex == sourceLen) { if (addStxEtx) { if(encodedIndex + 2 >= maxDestLen) { return STREAM_TOO_SHORT; @@ -140,17 +146,6 @@ ReturnValue_t DleEncoder::encodeStreamNonEscaped(const uint8_t *sourceStream, si ReturnValue_t DleEncoder::decode(const uint8_t *sourceStream, size_t sourceStreamLen, size_t *readLen, uint8_t *destStream, size_t maxDestStreamlen, size_t *decodedLen) { - size_t encodedIndex = 0; - if(not escapeStxEtx) { - if (*sourceStream != DLE_CHAR) { - return DECODING_ERROR; - } - ++encodedIndex; - } - if (sourceStream[encodedIndex] != STX_CHAR) { - return DECODING_ERROR; - } - if(escapeStxEtx) { return decodeStreamEscaped(sourceStream, sourceStreamLen, readLen, destStream, maxDestStreamlen, decodedLen); @@ -164,10 +159,15 @@ ReturnValue_t DleEncoder::decode(const uint8_t *sourceStream, ReturnValue_t DleEncoder::decodeStreamEscaped(const uint8_t *sourceStream, size_t sourceStreamLen, size_t *readLen, uint8_t *destStream, size_t maxDestStreamlen, size_t *decodedLen) { - // Skip start marker, was already checked - size_t encodedIndex = 1; + size_t encodedIndex = 0; size_t decodedIndex = 0; uint8_t nextByte; + if(maxDestStreamlen < 1) { + return STREAM_TOO_SHORT; + } + if (sourceStream[encodedIndex++] != STX_CHAR) { + return DECODING_ERROR; + } while ((encodedIndex < sourceStreamLen) and (decodedIndex < maxDestStreamlen) and (sourceStream[encodedIndex] != ETX_CHAR) @@ -192,6 +192,8 @@ ReturnValue_t DleEncoder::decodeStreamEscaped(const uint8_t *sourceStream, size_ destStream[decodedIndex] = nextByte - 0x40; } else { + // Set readLen so user can resume parsing after incorrect data + *readLen = encodedIndex + 2; return DECODING_ERROR; } } @@ -205,8 +207,13 @@ ReturnValue_t DleEncoder::decodeStreamEscaped(const uint8_t *sourceStream, size_ ++decodedIndex; } if (sourceStream[encodedIndex] != ETX_CHAR) { - *readLen = ++encodedIndex; - return DECODING_ERROR; + if(decodedIndex == maxDestStreamlen) { + return STREAM_TOO_SHORT; + } + else { + *readLen = ++encodedIndex; + return DECODING_ERROR; + } } else { *readLen = ++encodedIndex; @@ -218,18 +225,29 @@ ReturnValue_t DleEncoder::decodeStreamEscaped(const uint8_t *sourceStream, size_ ReturnValue_t DleEncoder::decodeStreamNonEscaped(const uint8_t *sourceStream, size_t sourceStreamLen, size_t *readLen, uint8_t *destStream, size_t maxDestStreamlen, size_t *decodedLen) { - // Skip start marker, was already checked - size_t encodedIndex = 2; + size_t encodedIndex = 0; size_t decodedIndex = 0; uint8_t nextByte; + if(maxDestStreamlen < 2) { + return STREAM_TOO_SHORT; + } + if (sourceStream[encodedIndex++] != DLE_CHAR) { + return DECODING_ERROR; + } + if (sourceStream[encodedIndex++] != STX_CHAR) { + return DECODING_ERROR; + } while ((encodedIndex < sourceStreamLen) && (decodedIndex < maxDestStreamlen)) { if (sourceStream[encodedIndex] == DLE_CHAR) { if(encodedIndex + 1 >= sourceStreamLen) { + *readLen = encodedIndex; return DECODING_ERROR; } nextByte = sourceStream[encodedIndex + 1]; if(nextByte == STX_CHAR) { - *readLen = ++encodedIndex; + // Set readLen so the DLE/STX char combination is preserved. Could be start of + // another frame + *readLen = encodedIndex; return DECODING_ERROR; } else if(nextByte == DLE_CHAR) { @@ -245,6 +263,7 @@ ReturnValue_t DleEncoder::decodeStreamNonEscaped(const uint8_t *sourceStream, return RETURN_OK; } else { + *readLen = encodedIndex; return DECODING_ERROR; } } @@ -254,7 +273,13 @@ ReturnValue_t DleEncoder::decodeStreamNonEscaped(const uint8_t *sourceStream, ++encodedIndex; ++decodedIndex; } - return DECODING_ERROR; + *readLen = encodedIndex; + if(decodedIndex == maxDestStreamlen) { + return STREAM_TOO_SHORT; + } + else { + return DECODING_ERROR; + } } void DleEncoder::setEscapeMode(bool escapeStxEtx) { diff --git a/src/fsfw/globalfunctions/DleEncoder.h b/src/fsfw/globalfunctions/DleEncoder.h index e4871bf0..09fa2726 100644 --- a/src/fsfw/globalfunctions/DleEncoder.h +++ b/src/fsfw/globalfunctions/DleEncoder.h @@ -71,6 +71,8 @@ public: * @param addStxEtx Adding STX start marker and ETX end marker can be omitted, * if they are added manually * @return + * - RETURN_OK for successful encoding operation + * - STREAM_TOO_SHORT if the destination stream is too short */ ReturnValue_t encode(const uint8_t *sourceStream, size_t sourceLen, uint8_t *destStream, size_t maxDestLen, size_t *encodedLen, @@ -85,6 +87,9 @@ public: * @param maxDestStreamlen * @param decodedLen * @return + * - RETURN_OK for successful decode operation + * - DECODE_ERROR if the source stream is invalid + * - STREAM_TOO_SHORT if the destination stream is too short */ ReturnValue_t decode(const uint8_t *sourceStream, size_t sourceStreamLen, size_t *readLen, uint8_t *destStream, diff --git a/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp b/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp index 4cc3326e..a82ac73a 100644 --- a/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp +++ b/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp @@ -165,7 +165,7 @@ TEST_CASE("DleEncoder" , "[DleEncoder]") { result = dleEncoder.decode(vecToDecode.data(), vecToDecode.size(), &readLen, buffer.data(), faultyDestSizes, &decodedLen); - REQUIRE(result == static_cast(DleEncoder::DECODING_ERROR)); + REQUIRE(result == static_cast(DleEncoder::STREAM_TOO_SHORT)); } }; From d36d849e6994356c045e17924a60a00b13ae75e3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 11 Sep 2021 19:21:21 +0200 Subject: [PATCH 264/389] removed part which is now not necessary anymore --- src/fsfw/globalfunctions/DleEncoder.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/fsfw/globalfunctions/DleEncoder.cpp b/src/fsfw/globalfunctions/DleEncoder.cpp index 35ba84d5..04e4985c 100644 --- a/src/fsfw/globalfunctions/DleEncoder.cpp +++ b/src/fsfw/globalfunctions/DleEncoder.cpp @@ -8,14 +8,6 @@ DleEncoder::~DleEncoder() {} ReturnValue_t DleEncoder::encode(const uint8_t* sourceStream, size_t sourceLen, uint8_t* destStream, size_t maxDestLen, size_t* encodedLen, bool addStxEtx) { - if (addStxEtx) { - size_t currentIdx = 0; - if(not escapeStxEtx) { - destStream[currentIdx++] = DLE_CHAR; - } - - } - if(escapeStxEtx) { return encodeStreamEscaped(sourceStream, sourceLen, destStream, maxDestLen, encodedLen, addStxEtx); From dae27a8e105a5d0e9c0f8bd5bda6b6d2826441b3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 11 Sep 2021 19:22:51 +0200 Subject: [PATCH 265/389] indentation --- src/fsfw/globalfunctions/DleEncoder.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/fsfw/globalfunctions/DleEncoder.cpp b/src/fsfw/globalfunctions/DleEncoder.cpp index 04e4985c..df9a909e 100644 --- a/src/fsfw/globalfunctions/DleEncoder.cpp +++ b/src/fsfw/globalfunctions/DleEncoder.cpp @@ -1,13 +1,13 @@ #include "fsfw/globalfunctions/DleEncoder.h" -DleEncoder::DleEncoder(bool escapeStxEtx, bool escapeCr): escapeStxEtx(escapeStxEtx), - escapeCr(escapeCr) {} +DleEncoder::DleEncoder(bool escapeStxEtx, bool escapeCr): + escapeStxEtx(escapeStxEtx), escapeCr(escapeCr) {} DleEncoder::~DleEncoder() {} ReturnValue_t DleEncoder::encode(const uint8_t* sourceStream, - size_t sourceLen, uint8_t* destStream, size_t maxDestLen, - size_t* encodedLen, bool addStxEtx) { + size_t sourceLen, uint8_t* destStream, size_t maxDestLen, + size_t* encodedLen, bool addStxEtx) { if(escapeStxEtx) { return encodeStreamEscaped(sourceStream, sourceLen, destStream, maxDestLen, encodedLen, addStxEtx); @@ -136,16 +136,16 @@ ReturnValue_t DleEncoder::encodeStreamNonEscaped(const uint8_t *sourceStream, si } ReturnValue_t DleEncoder::decode(const uint8_t *sourceStream, - size_t sourceStreamLen, size_t *readLen, uint8_t *destStream, - size_t maxDestStreamlen, size_t *decodedLen) { - if(escapeStxEtx) { - return decodeStreamEscaped(sourceStream, sourceStreamLen, - readLen, destStream, maxDestStreamlen, decodedLen); - } - else { + size_t sourceStreamLen, size_t *readLen, uint8_t *destStream, + size_t maxDestStreamlen, size_t *decodedLen) { + if(escapeStxEtx) { + return decodeStreamEscaped(sourceStream, sourceStreamLen, + readLen, destStream, maxDestStreamlen, decodedLen); + } + else { return decodeStreamNonEscaped(sourceStream, sourceStreamLen, readLen, destStream, maxDestStreamlen, decodedLen); - } + } } ReturnValue_t DleEncoder::decodeStreamEscaped(const uint8_t *sourceStream, size_t sourceStreamLen, From abacfbf2d5550c189e5c0b48f3eb794eb8525f02 Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Mon, 13 Sep 2021 10:38:36 +0200 Subject: [PATCH 266/389] added setting of readLen according to review --- src/fsfw/globalfunctions/DleEncoder.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/fsfw/globalfunctions/DleEncoder.cpp b/src/fsfw/globalfunctions/DleEncoder.cpp index df9a909e..47ea5c4e 100644 --- a/src/fsfw/globalfunctions/DleEncoder.cpp +++ b/src/fsfw/globalfunctions/DleEncoder.cpp @@ -154,6 +154,11 @@ ReturnValue_t DleEncoder::decodeStreamEscaped(const uint8_t *sourceStream, size_ size_t encodedIndex = 0; size_t decodedIndex = 0; uint8_t nextByte; + + //init to 0 so that we can just return in the first checks (which do not consume anything from + //the source stream) + *readLen = 0; + if(maxDestStreamlen < 1) { return STREAM_TOO_SHORT; } @@ -166,6 +171,8 @@ ReturnValue_t DleEncoder::decodeStreamEscaped(const uint8_t *sourceStream, size_ and (sourceStream[encodedIndex] != STX_CHAR)) { if (sourceStream[encodedIndex] == DLE_CHAR) { if(encodedIndex + 1 >= sourceStreamLen) { + //reached the end of the sourceStream + *readLen = sourceStreamLen; return DECODING_ERROR; } nextByte = sourceStream[encodedIndex + 1]; @@ -200,6 +207,8 @@ ReturnValue_t DleEncoder::decodeStreamEscaped(const uint8_t *sourceStream, size_ } if (sourceStream[encodedIndex] != ETX_CHAR) { if(decodedIndex == maxDestStreamlen) { + //so far we did not find anything wrong here, so let user try again + *readLen = 0; return STREAM_TOO_SHORT; } else { @@ -220,6 +229,11 @@ ReturnValue_t DleEncoder::decodeStreamNonEscaped(const uint8_t *sourceStream, size_t encodedIndex = 0; size_t decodedIndex = 0; uint8_t nextByte; + + //init to 0 so that we can just return in the first checks (which do not consume anything from + //the source stream) + *readLen = 0; + if(maxDestStreamlen < 2) { return STREAM_TOO_SHORT; } @@ -227,6 +241,7 @@ ReturnValue_t DleEncoder::decodeStreamNonEscaped(const uint8_t *sourceStream, return DECODING_ERROR; } if (sourceStream[encodedIndex++] != STX_CHAR) { + *readLen = 1; return DECODING_ERROR; } while ((encodedIndex < sourceStreamLen) && (decodedIndex < maxDestStreamlen)) { @@ -265,11 +280,13 @@ ReturnValue_t DleEncoder::decodeStreamNonEscaped(const uint8_t *sourceStream, ++encodedIndex; ++decodedIndex; } - *readLen = encodedIndex; + if(decodedIndex == maxDestStreamlen) { + //so far we did not find anything wrong here, so let user try again + *readLen = 0; return STREAM_TOO_SHORT; - } - else { + } else { + *readLen = encodedIndex; return DECODING_ERROR; } } From 21b5eaa891c58f3e52de3acbf138c3ec128a1789 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 15 Sep 2021 17:09:42 +0200 Subject: [PATCH 267/389] Some changes and improvements for DHB 1. Renamed getCommanderId to getCommanderQueueId. 2. Some indentation 3. Correct preprocessor define for warning printout used now --- src/fsfw/devicehandlers/DeviceHandlerBase.cpp | 28 ++++++++++----- src/fsfw/devicehandlers/DeviceHandlerBase.h | 34 +++++++++---------- 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp index c3fc023e..535113fd 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.cpp +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.cpp @@ -461,7 +461,7 @@ size_t DeviceHandlerBase::getNextReplyLength(DeviceCommandId_t commandId){ return iter->second.replyLen; }else{ return 0; - } + } } ReturnValue_t DeviceHandlerBase::updateReplyMapEntry(DeviceCommandId_t deviceReply, @@ -612,15 +612,15 @@ void DeviceHandlerBase::replyToReply(const DeviceCommandId_t command, DeviceRepl } DeviceCommandInfo* info = &replyInfo.command->second; if (info == nullptr){ - printWarningOrError(sif::OutputTypes::OUT_ERROR, - "replyToReply", HasReturnvaluesIF::RETURN_FAILED, - "Command pointer not found"); - return; + printWarningOrError(sif::OutputTypes::OUT_ERROR, + "replyToReply", HasReturnvaluesIF::RETURN_FAILED, + "Command pointer not found"); + return; } if (info->expectedReplies > 0){ - // Check before to avoid underflow - info->expectedReplies--; + // Check before to avoid underflow + info->expectedReplies--; } // Check if more replies are expected. If so, do nothing. if (info->expectedReplies == 0) { @@ -1355,10 +1355,20 @@ void DeviceHandlerBase::buildInternalCommand(void) { DeviceCommandMap::iterator iter = deviceCommandMap.find( deviceCommandId); if (iter == deviceCommandMap.end()) { +#if FSFW_VERBOSE_LEVEL >= 1 + char output[36]; + sprintf(output, "Command 0x%08x unknown", + static_cast(deviceCommandId)); + // so we can track misconfigurations + printWarningOrError(sif::OutputTypes::OUT_WARNING, + "buildInternalCommand", + COMMAND_NOT_SUPPORTED, + output); +#endif result = COMMAND_NOT_SUPPORTED; } else if (iter->second.isExecuting) { -#if FSFW_DISABLE_PRINTOUT == 0 +#if FSFW_VERBOSE_LEVEL >= 1 char output[36]; sprintf(output, "Command 0x%08x is executing", static_cast(deviceCommandId)); @@ -1569,7 +1579,7 @@ LocalDataPoolManager* DeviceHandlerBase::getHkManagerHandle() { return &poolManager; } -MessageQueueId_t DeviceHandlerBase::getCommanderId(DeviceCommandId_t replyId) const { +MessageQueueId_t DeviceHandlerBase::getCommanderQueueId(DeviceCommandId_t replyId) const { auto commandIter = deviceCommandMap.find(replyId); if(commandIter == deviceCommandMap.end()) { return MessageQueueIF::NO_QUEUE; diff --git a/src/fsfw/devicehandlers/DeviceHandlerBase.h b/src/fsfw/devicehandlers/DeviceHandlerBase.h index 30d36ef0..b182b611 100644 --- a/src/fsfw/devicehandlers/DeviceHandlerBase.h +++ b/src/fsfw/devicehandlers/DeviceHandlerBase.h @@ -6,22 +6,22 @@ #include "DeviceHandlerFailureIsolation.h" #include "DeviceHandlerThermalSet.h" -#include "../serviceinterface/ServiceInterface.h" -#include "../serviceinterface/serviceInterfaceDefintions.h" -#include "../objectmanager/SystemObject.h" -#include "../tasks/ExecutableObjectIF.h" -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../action/HasActionsIF.h" -#include "../datapool/PoolVariableIF.h" -#include "../modes/HasModesIF.h" -#include "../power/PowerSwitchIF.h" -#include "../ipc/MessageQueueIF.h" -#include "../tasks/PeriodicTaskIF.h" -#include "../action/ActionHelper.h" -#include "../health/HealthHelper.h" -#include "../parameters/ParameterHelper.h" -#include "../datapoollocal/HasLocalDataPoolIF.h" -#include "../datapoollocal/LocalDataPoolManager.h" +#include "fsfw/serviceinterface/ServiceInterface.h" +#include "fsfw/serviceinterface/serviceInterfaceDefintions.h" +#include "fsfw/objectmanager/SystemObject.h" +#include "fsfw/tasks/ExecutableObjectIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/action/HasActionsIF.h" +#include "fsfw/datapool/PoolVariableIF.h" +#include "fsfw/modes/HasModesIF.h" +#include "fsfw/power/PowerSwitchIF.h" +#include "fsfw/ipc/MessageQueueIF.h" +#include "fsfw/tasks/PeriodicTaskIF.h" +#include "fsfw/action/ActionHelper.h" +#include "fsfw/health/HealthHelper.h" +#include "fsfw/parameters/ParameterHelper.h" +#include "fsfw/datapoollocal/HasLocalDataPoolIF.h" +#include "fsfw/datapoollocal/LocalDataPoolManager.h" #include @@ -399,7 +399,7 @@ protected: */ virtual ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) = 0; - MessageQueueId_t getCommanderId(DeviceCommandId_t replyId) const; + MessageQueueId_t getCommanderQueueId(DeviceCommandId_t replyId) const; /** * Helper function to get pending command. This is useful for devices * like SPI sensors to identify the last sent command. From e5db64cbb91bc72c63f0f3963bba9d89df9e1e6c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 15 Sep 2021 17:15:18 +0200 Subject: [PATCH 268/389] set transfer size to 0, better name --- hal/src/fsfw_hal/linux/spi/SpiComIF.cpp | 8 ++------ hal/src/fsfw_hal/linux/spi/SpiComIF.h | 1 + hal/src/fsfw_hal/linux/spi/SpiCookie.cpp | 2 +- hal/src/fsfw_hal/linux/spi/SpiCookie.h | 6 ++---- 4 files changed, 6 insertions(+), 11 deletions(-) diff --git a/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp b/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp index 48bf7449..6cf6675f 100644 --- a/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp +++ b/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp @@ -15,11 +15,6 @@ #include #include -/* Can be used for low-level debugging of the SPI bus */ -#ifndef FSFW_HAL_LINUX_SPI_WIRETAPPING -#define FSFW_HAL_LINUX_SPI_WIRETAPPING 0 -#endif - SpiComIF::SpiComIF(object_id_t objectId, GpioIF* gpioComIF): SystemObject(objectId), gpioComIF(gpioComIF) { if(gpioComIF == nullptr) { @@ -193,7 +188,7 @@ ReturnValue_t SpiComIF::performRegularSendOperation(SpiCookie *spiCookie, const spiCookie->getSpiParameters(spiMode, spiSpeed, nullptr); setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed); spiCookie->assignWriteBuffer(sendData); - spiCookie->assignTransferSize(sendLen); + spiCookie->setTransferSize(sendLen); bool fullDuplex = spiCookie->isFullDuplex(); gpioId_t gpioId = spiCookie->getChipSelectPin(); @@ -335,6 +330,7 @@ ReturnValue_t SpiComIF::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, *buffer = rxBuf; *size = spiCookie->getCurrentTransferSize(); + spiCookie->setTransferSize(0); return HasReturnvaluesIF::RETURN_OK; } diff --git a/hal/src/fsfw_hal/linux/spi/SpiComIF.h b/hal/src/fsfw_hal/linux/spi/SpiComIF.h index d43e2505..bcca7462 100644 --- a/hal/src/fsfw_hal/linux/spi/SpiComIF.h +++ b/hal/src/fsfw_hal/linux/spi/SpiComIF.h @@ -1,6 +1,7 @@ #ifndef LINUX_SPI_SPICOMIF_H_ #define LINUX_SPI_SPICOMIF_H_ +#include "fsfw/FSFW.h" #include "spiDefinitions.h" #include "returnvalues/classIds.h" #include "fsfw_hal/common/gpio/GpioIF.h" diff --git a/hal/src/fsfw_hal/linux/spi/SpiCookie.cpp b/hal/src/fsfw_hal/linux/spi/SpiCookie.cpp index 54d8aa16..f07954e9 100644 --- a/hal/src/fsfw_hal/linux/spi/SpiCookie.cpp +++ b/hal/src/fsfw_hal/linux/spi/SpiCookie.cpp @@ -121,7 +121,7 @@ bool SpiCookie::isFullDuplex() const { return not this->halfDuplex; } -void SpiCookie::assignTransferSize(size_t transferSize) { +void SpiCookie::setTransferSize(size_t transferSize) { spiTransferStruct.len = transferSize; } diff --git a/hal/src/fsfw_hal/linux/spi/SpiCookie.h b/hal/src/fsfw_hal/linux/spi/SpiCookie.h index acf7c77c..844fd421 100644 --- a/hal/src/fsfw_hal/linux/spi/SpiCookie.h +++ b/hal/src/fsfw_hal/linux/spi/SpiCookie.h @@ -103,10 +103,10 @@ public: void assignReadBuffer(uint8_t* rx); void assignWriteBuffer(const uint8_t* tx); /** - * Assign size for the next transfer. + * Set size for the next transfer. Set to 0 for no transfer * @param transferSize */ - void assignTransferSize(size_t transferSize); + void setTransferSize(size_t transferSize); size_t getCurrentTransferSize() const; struct UncommonParameters { @@ -158,8 +158,6 @@ private: std::string spiDev, const size_t maxSize, spi::SpiModes spiMode, uint32_t spiSpeed, spi::send_callback_function_t callback, void* args); - size_t currentTransferSize = 0; - address_t spiAddress; gpioId_t chipSelectPin; std::string spiDevice; From a6e4eb9ad4f9c2367c09d72182176d43b67260a8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 15 Sep 2021 17:18:47 +0200 Subject: [PATCH 269/389] improvements for L3GD20H device handler --- .../devicehandlers/GyroL3GD20Handler.cpp | 42 +++++++++---------- .../devicehandlers/GyroL3GD20Handler.h | 11 ++--- 2 files changed, 25 insertions(+), 28 deletions(-) diff --git a/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.cpp b/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.cpp index 96d284e1..4a492e5d 100644 --- a/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.cpp +++ b/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.cpp @@ -3,9 +3,9 @@ #include "fsfw/datapool/PoolReadGuard.h" GyroHandlerL3GD20H::GyroHandlerL3GD20H(object_id_t objectId, object_id_t deviceCommunication, - CookieIF *comCookie): + CookieIF *comCookie, uint8_t switchId, uint32_t transitionDelayMs): DeviceHandlerBase(objectId, deviceCommunication, comCookie), - dataset(this) { + switchId(switchId), transitionDelayMs(transitionDelayMs), dataset(this) { #if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 debugDivider = new PeriodicOperationDivider(5); #endif @@ -47,7 +47,7 @@ ReturnValue_t GyroHandlerL3GD20H::buildTransitionDeviceCommand(DeviceCommandId_t switch(internalState) { case(InternalState::NONE): case(InternalState::NORMAL): { - return HasReturnvaluesIF::RETURN_OK; + return NOTHING_TO_SEND; } case(InternalState::CONFIGURE): { *id = L3GD20H::CONFIGURE_CTRL_REGS; @@ -66,10 +66,11 @@ ReturnValue_t GyroHandlerL3GD20H::buildTransitionDeviceCommand(DeviceCommandId_t default: #if FSFW_CPP_OSTREAM_ENABLED == 1 /* Might be a configuration error. */ - sif::debug << "GyroHandler::buildTransitionDeviceCommand: Unknown internal state!" << - std::endl; + sif::warning << "GyroL3GD20Handler::buildTransitionDeviceCommand: " + "Unknown internal state!" << std::endl; #else - sif::printDebug("GyroHandler::buildTransitionDeviceCommand: Unknown internal state!\n"); + sif::printDebug("GyroL3GD20Handler::buildTransitionDeviceCommand: " + "Unknown internal state!\n"); #endif return HasReturnvaluesIF::RETURN_OK; } @@ -144,7 +145,7 @@ ReturnValue_t GyroHandlerL3GD20H::buildCommandFromCommand( ReturnValue_t GyroHandlerL3GD20H::scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId, size_t *foundLen) { - /* For SPI, the ID will always be the one of the last sent command. */ + // For SPI, the ID will always be the one of the last sent command *foundId = this->getPendingCommand(); *foundLen = this->rawPacketLen; @@ -166,7 +167,7 @@ ReturnValue_t GyroHandlerL3GD20H::interpretDeviceReply(DeviceCommandId_t id, commandExecuted = true; } else { - /* Attempt reconfiguration. */ + // Attempt reconfiguration internalState = InternalState::CONFIGURE; return DeviceHandlerIF::DEVICE_REPLY_INVALID; } @@ -199,13 +200,12 @@ ReturnValue_t GyroHandlerL3GD20H::interpretDeviceReply(DeviceCommandId_t id, if(debugDivider->checkAndIncrement()) { /* Set terminal to utf-8 if there is an issue with micro printout. */ #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::info << "GyroHandlerL3GD20H: Angular velocities in degrees per second:" << - std::endl; - sif::info << "X: " << angVelocX << " \xC2\xB0" << std::endl; - sif::info << "Y: " << angVelocY << " \xC2\xB0" << std::endl; - sif::info << "Z: " << angVelocZ << " \xC2\xB0" << std::endl; + sif::info << "GyroHandlerL3GD20H: Angular velocities (deg/s):" << std::endl; + sif::info << "X: " << angVelocX << std::endl; + sif::info << "Y: " << angVelocY << std::endl; + sif::info << "Z: " << angVelocZ << std::endl; #else - sif::printInfo("GyroHandlerL3GD20H: Angular velocities in degrees per second:\n"); + sif::printInfo("GyroHandlerL3GD20H: Angular velocities (deg/s):\n"); sif::printInfo("X: %f\n", angVelocX); sif::printInfo("Y: %f\n", angVelocY); sif::printInfo("Z: %f\n", angVelocZ); @@ -231,7 +231,7 @@ ReturnValue_t GyroHandlerL3GD20H::interpretDeviceReply(DeviceCommandId_t id, uint32_t GyroHandlerL3GD20H::getTransitionDelayMs(Mode_t from, Mode_t to) { - return 10000; + return this->transitionDelayMs; } void GyroHandlerL3GD20H::setGoNormalModeAtStartup() { @@ -240,14 +240,10 @@ void GyroHandlerL3GD20H::setGoNormalModeAtStartup() { ReturnValue_t GyroHandlerL3GD20H::initializeLocalDataPool( localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { - localDataPoolMap.emplace(L3GD20H::ANG_VELOC_X, - new PoolEntry({0.0})); - localDataPoolMap.emplace(L3GD20H::ANG_VELOC_Y, - new PoolEntry({0.0})); - localDataPoolMap.emplace(L3GD20H::ANG_VELOC_Z, - new PoolEntry({0.0})); - localDataPoolMap.emplace(L3GD20H::TEMPERATURE, - new PoolEntry({0.0})); + localDataPoolMap.emplace(L3GD20H::ANG_VELOC_X, new PoolEntry({0.0})); + localDataPoolMap.emplace(L3GD20H::ANG_VELOC_Y, new PoolEntry({0.0})); + localDataPoolMap.emplace(L3GD20H::ANG_VELOC_Z, new PoolEntry({0.0})); + localDataPoolMap.emplace(L3GD20H::TEMPERATURE, new PoolEntry({0.0})); return HasReturnvaluesIF::RETURN_OK; } diff --git a/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.h b/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.h index 020c5a32..bc1d9c1c 100644 --- a/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.h +++ b/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.h @@ -7,10 +7,6 @@ #include #include -#ifndef FSFW_HAL_L3GD20_GYRO_DEBUG -#define FSFW_HAL_L3GD20_GYRO_DEBUG 0 -#endif /* FSFW_HAL_L3GD20_GYRO_DEBUG */ - /** * @brief Device Handler for the L3GD20H gyroscope sensor * (https://www.st.com/en/mems-and-sensors/l3gd20h.html) @@ -23,9 +19,12 @@ class GyroHandlerL3GD20H: public DeviceHandlerBase { public: GyroHandlerL3GD20H(object_id_t objectId, object_id_t deviceCommunication, - CookieIF* comCookie); + CookieIF* comCookie, uint8_t switchId, uint32_t transitionDelayMs = 10000); virtual ~GyroHandlerL3GD20H(); + /** + * @brief Configure device handler to go to normal mode immediately + */ void setGoNormalModeAtStartup(); protected: @@ -51,6 +50,8 @@ protected: LocalDataPoolManager &poolManager) override; private: + uint8_t switchId = 0; + uint32_t transitionDelayMs = 0; GyroPrimaryDataset dataset; enum class InternalState { From 1732359f72766216acd7f8a719a51606cac66c33 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 15 Sep 2021 17:23:26 +0200 Subject: [PATCH 270/389] doc was wrong --- src/fsfw/pus/servicepackets/Service1Packets.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/fsfw/pus/servicepackets/Service1Packets.h b/src/fsfw/pus/servicepackets/Service1Packets.h index 2249b4b0..02ae339f 100644 --- a/src/fsfw/pus/servicepackets/Service1Packets.h +++ b/src/fsfw/pus/servicepackets/Service1Packets.h @@ -13,10 +13,10 @@ /** * @brief FailureReport class to serialize a failure report - * @brief Subservice 1, 3, 5, 7 + * @brief Subservice 2, 4, 6, 8 * @ingroup spacepackets */ -class FailureReport: public SerializeIF { //!< [EXPORT] : [SUBSERVICE] 1, 3, 5, 7 +class FailureReport: public SerializeIF { //!< [EXPORT] : [SUBSERVICE] 2, 4, 6, 8 public: FailureReport(uint8_t failureSubtype_, uint16_t packetId_, uint16_t packetSequenceControl_, uint8_t stepNumber_, @@ -108,10 +108,10 @@ private: }; /** - * @brief Subservices 2, 4, 6, 8 + * @brief Subservices 1, 3, 5, 7 * @ingroup spacepackets */ -class SuccessReport: public SerializeIF { //!< [EXPORT] : [SUBSERVICE] 2, 4, 6, 8 +class SuccessReport: public SerializeIF { //!< [EXPORT] : [SUBSERVICE] 1, 3, 5, 7 public: SuccessReport(uint8_t subtype_, uint16_t packetId_, uint16_t packetSequenceControl_,uint8_t stepNumber_) : From f40f783cb43ca11388ac557848980fcde5a1ac15 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 23 Sep 2021 17:58:44 +0200 Subject: [PATCH 271/389] GPIO code update Adds capability to define GPIO by label and by chip for Linux systems --- .../fsfw_hal/common/gpio/gpioDefinitions.h | 64 ++++++--- .../fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp | 127 ++++++++++++------ hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h | 11 +- hal/src/fsfw_hal/linux/rpi/GpioRPi.cpp | 2 +- 4 files changed, 139 insertions(+), 65 deletions(-) diff --git a/hal/src/fsfw_hal/common/gpio/gpioDefinitions.h b/hal/src/fsfw_hal/common/gpio/gpioDefinitions.h index 710b2e2c..688d9c9b 100644 --- a/hal/src/fsfw_hal/common/gpio/gpioDefinitions.h +++ b/hal/src/fsfw_hal/common/gpio/gpioDefinitions.h @@ -26,7 +26,8 @@ enum GpioOperation { enum GpioTypes { NONE, - GPIO_REGULAR, + GPIO_REGULAR_BY_CHIP, + GPIO_REGULAR_BY_LABEL, CALLBACK }; @@ -68,28 +69,57 @@ public: int initValue = 0; }; -class GpiodRegular: public GpioBase { +class GpiodRegularBase: public GpioBase { public: - GpiodRegular() : - GpioBase(gpio::GpioTypes::GPIO_REGULAR, std::string(), gpio::Direction::IN, 0) { + GpiodRegularBase(gpio::GpioTypes gpioType, std::string consumer, gpio::Direction direction, + int initValue, int lineNum): GpioBase(gpioType, consumer, direction, initValue), + lineNum(lineNum) { } - ; - - GpiodRegular(std::string chipname_, int lineNum_, std::string consumer_, - gpio::Direction direction_, int initValue_) : - GpioBase(gpio::GpioTypes::GPIO_REGULAR, consumer_, direction_, initValue_), - chipname(chipname_), lineNum(lineNum_) { - } - - GpiodRegular(std::string chipname_, int lineNum_, std::string consumer_) : - GpioBase(gpio::GpioTypes::GPIO_REGULAR, consumer_, gpio::Direction::IN, 0), - chipname(chipname_), lineNum(lineNum_) { - } - std::string chipname; int lineNum = 0; struct gpiod_line* lineHandle = nullptr; }; +class GpiodRegularByChip: public GpiodRegularBase { +public: + GpiodRegularByChip() : + GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_CHIP, + std::string(), gpio::Direction::IN, gpio::LOW, 0) { + } + + GpiodRegularByChip(std::string chipname_, int lineNum_, std::string consumer_, + gpio::Direction direction_, int initValue_) : + GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_CHIP, + consumer_, direction_, initValue_, lineNum_), + chipname(chipname_){ + } + + GpiodRegularByChip(std::string chipname_, int lineNum_, std::string consumer_) : + GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_CHIP, consumer_, + gpio::Direction::IN, gpio::LOW, lineNum_), + chipname(chipname_) { + } + + std::string chipname; +}; + +class GpiodRegularByLabel: public GpiodRegularBase { +public: + GpiodRegularByLabel(std::string label_, int lineNum_, std::string consumer_, + gpio::Direction direction_, int initValue_) : + GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_LABEL, consumer_, + direction_, initValue_, lineNum_), + label(label_) { + } + + GpiodRegularByLabel(std::string label_, int lineNum_, std::string consumer_) : + GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_LABEL, consumer_, + gpio::Direction::IN, gpio::LOW, lineNum_), + label(label_) { + } + + std::string label; +}; + class GpioCallback: public GpioBase { public: GpioCallback(std::string consumer, gpio::Direction direction_, int initValue_, diff --git a/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp b/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp index eef61e58..15c3d118 100644 --- a/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp +++ b/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp @@ -20,7 +20,7 @@ LinuxLibgpioIF::~LinuxLibgpioIF() { ReturnValue_t LinuxLibgpioIF::addGpios(GpioCookie* gpioCookie) { ReturnValue_t result; if(gpioCookie == nullptr) { - sif::error << "LinuxLibgpioIF::initialize: Invalid cookie" << std::endl; + sif::error << "LinuxLibgpioIF::addGpios: Invalid cookie" << std::endl; return RETURN_FAILED; } @@ -45,16 +45,25 @@ ReturnValue_t LinuxLibgpioIF::addGpios(GpioCookie* gpioCookie) { ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap& mapToAdd) { for(auto& gpioConfig: mapToAdd) { - switch(gpioConfig.second->gpioType) { + auto& gpioType = gpioConfig.second->gpioType; + switch(gpioType) { case(gpio::GpioTypes::NONE): { return GPIO_INVALID_INSTANCE; } - case(gpio::GpioTypes::GPIO_REGULAR): { - GpiodRegular* regularGpio = dynamic_cast(gpioConfig.second); + case(gpio::GpioTypes::GPIO_REGULAR_BY_CHIP): { + auto regularGpio = dynamic_cast(gpioConfig.second); if(regularGpio == nullptr) { return GPIO_INVALID_INSTANCE; } - configureRegularGpio(gpioConfig.first, regularGpio); + configureGpioByChip(gpioConfig.first, *regularGpio); + break; + } + case(gpio::GpioTypes::GPIO_REGULAR_BY_LABEL):{ + auto regularGpio = dynamic_cast(gpioConfig.second); + if(regularGpio == nullptr) { + return GPIO_INVALID_INSTANCE; + } + configureGpioByLabel(gpioConfig.first, *regularGpio); break; } case(gpio::GpioTypes::CALLBACK): { @@ -70,41 +79,59 @@ ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap& mapToAdd) { return RETURN_OK; } -ReturnValue_t LinuxLibgpioIF::configureRegularGpio(gpioId_t gpioId, GpiodRegular *regularGpio) { - std::string chipname; +ReturnValue_t LinuxLibgpioIF::configureGpioByLabel(gpioId_t gpioId, + GpiodRegularByLabel &gpioByLabel) { + std::string& label = gpioByLabel.label; + struct gpiod_chip* chip = gpiod_chip_open_by_label(label.c_str()); + if (chip == nullptr) { + sif::warning << "LinuxLibgpioIF::configureRegularGpio: Failed to open gpio from gpio " + << "group with label " << label << ". Gpio ID: " << gpioId << std::endl; + return RETURN_FAILED; + + } + std::string failOutput = "label: " + label; + return configureRegularGpio(gpioId, gpioByLabel.gpioType, chip, gpioByLabel, failOutput); +} + +ReturnValue_t LinuxLibgpioIF::configureGpioByChip(gpioId_t gpioId, + GpiodRegularByChip &gpioByChip) { + std::string& chipname = gpioByChip.chipname; + struct gpiod_chip* chip = gpiod_chip_open_by_name(chipname.c_str()); + if (chip == nullptr) { + sif::warning << "LinuxLibgpioIF::configureRegularGpio: Failed to open chip " + << chipname << ". Gpio ID: " << gpioId << std::endl; + return RETURN_FAILED; + } + std::string failOutput = "chipname: " + chipname; + return configureRegularGpio(gpioId, gpioByChip.gpioType, chip, gpioByChip, failOutput); +} + +ReturnValue_t LinuxLibgpioIF::configureRegularGpio(gpioId_t gpioId, gpio::GpioTypes gpioType, + struct gpiod_chip* chip, GpiodRegularBase& regularGpio, std::string failOutput) { unsigned int lineNum; - struct gpiod_chip *chip; gpio::Direction direction; std::string consumer; struct gpiod_line *lineHandle; int result = 0; - chipname = regularGpio->chipname; - chip = gpiod_chip_open_by_name(chipname.c_str()); - if (!chip) { - sif::warning << "LinuxLibgpioIF::configureRegularGpio: Failed to open chip " - << chipname << ". Gpio ID: " << gpioId << std::endl; - return RETURN_FAILED; - } - - lineNum = regularGpio->lineNum; + lineNum = regularGpio.lineNum; lineHandle = gpiod_chip_get_line(chip, lineNum); if (!lineHandle) { - sif::debug << "LinuxLibgpioIF::configureRegularGpio: Failed to open line " << std::endl; - sif::debug << "GPIO ID: " << gpioId << ", line number: " << lineNum << - ", chipname: " << chipname << std::endl; - sif::debug << "Check if linux GPIO configuration has changed. " << std::endl; + sif::warning << "LinuxLibgpioIF::configureRegularGpio: Failed to open line " << std::endl; + sif::warning << "GPIO ID: " << gpioId << ", line number: " << lineNum << + ", " << failOutput << std::endl; + sif::warning << "Check if Linux GPIO configuration has changed. " << std::endl; gpiod_chip_close(chip); return RETURN_FAILED; } - direction = regularGpio->direction; - consumer = regularGpio->consumer; + direction = regularGpio.direction; + consumer = regularGpio.consumer; /* Configure direction and add a description to the GPIO */ switch (direction) { case(gpio::OUT): { result = gpiod_line_request_output(lineHandle, consumer.c_str(), - regularGpio->initValue); + regularGpio.initValue); if (result < 0) { sif::error << "LinuxLibgpioIF::configureRegularGpio: Failed to request line " << lineNum << " from GPIO instance with ID: " << gpioId << std::endl; @@ -134,7 +161,7 @@ ReturnValue_t LinuxLibgpioIF::configureRegularGpio(gpioId_t gpioId, GpiodRegular * Write line handle to GPIO configuration instance so it can later be used to set or * read states of GPIOs. */ - regularGpio->lineHandle = lineHandle; + regularGpio.lineHandle = lineHandle; return RETURN_OK; } @@ -145,8 +172,14 @@ ReturnValue_t LinuxLibgpioIF::pullHigh(gpioId_t gpioId) { return UNKNOWN_GPIO_ID; } - if(gpioMapIter->second->gpioType == gpio::GpioTypes::GPIO_REGULAR) { - return driveGpio(gpioId, dynamic_cast(gpioMapIter->second), 1); + auto gpioType = gpioMapIter->second->gpioType; + if(gpioType == gpio::GpioTypes::GPIO_REGULAR_BY_CHIP or + gpioType == gpio::GpioTypes::GPIO_REGULAR_BY_LABEL) { + auto regularGpio = dynamic_cast(gpioMapIter->second); + if(regularGpio == nullptr) { + return GPIO_TYPE_FAILURE; + } + return driveGpio(gpioId, *regularGpio, gpio::HIGH); } else { auto gpioCallback = dynamic_cast(gpioMapIter->second); @@ -167,8 +200,14 @@ ReturnValue_t LinuxLibgpioIF::pullLow(gpioId_t gpioId) { return UNKNOWN_GPIO_ID; } - if(gpioMapIter->second->gpioType == gpio::GpioTypes::GPIO_REGULAR) { - return driveGpio(gpioId, dynamic_cast(gpioMapIter->second), 0); + auto& gpioType = gpioMapIter->second->gpioType; + if(gpioType == gpio::GpioTypes::GPIO_REGULAR_BY_CHIP or + gpioType == gpio::GpioTypes::GPIO_REGULAR_BY_LABEL) { + auto regularGpio = dynamic_cast(gpioMapIter->second); + if(regularGpio == nullptr) { + return GPIO_TYPE_FAILURE; + } + return driveGpio(gpioId, *regularGpio, gpio::LOW); } else { auto gpioCallback = dynamic_cast(gpioMapIter->second); @@ -183,12 +222,8 @@ ReturnValue_t LinuxLibgpioIF::pullLow(gpioId_t gpioId) { } ReturnValue_t LinuxLibgpioIF::driveGpio(gpioId_t gpioId, - GpiodRegular* regularGpio, unsigned int logicLevel) { - if(regularGpio == nullptr) { - return GPIO_TYPE_FAILURE; - } - - int result = gpiod_line_set_value(regularGpio->lineHandle, logicLevel); + GpiodRegularBase& regularGpio, gpio::Levels logicLevel) { + int result = gpiod_line_set_value(regularGpio.lineHandle, logicLevel); if (result < 0) { sif::warning << "LinuxLibgpioIF::driveGpio: Failed to pull GPIO with ID " << gpioId << " to logic level " << logicLevel << std::endl; @@ -204,9 +239,10 @@ ReturnValue_t LinuxLibgpioIF::readGpio(gpioId_t gpioId, int* gpioState) { sif::warning << "LinuxLibgpioIF::readGpio: Unknown GPIOD ID " << gpioId << std::endl; return UNKNOWN_GPIO_ID; } - - if(gpioMapIter->second->gpioType == gpio::GpioTypes::GPIO_REGULAR) { - GpiodRegular* regularGpio = dynamic_cast(gpioMapIter->second); + auto gpioType = gpioMapIter->second->gpioType; + if(gpioType == gpio::GpioTypes::GPIO_REGULAR_BY_CHIP or + gpioType == gpio::GpioTypes::GPIO_REGULAR_BY_LABEL) { + auto regularGpio = dynamic_cast(gpioMapIter->second); if(regularGpio == nullptr) { return GPIO_TYPE_FAILURE; } @@ -225,13 +261,14 @@ ReturnValue_t LinuxLibgpioIF::checkForConflicts(GpioMap& mapToAdd){ ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; for(auto& gpioConfig: mapToAdd) { switch(gpioConfig.second->gpioType) { - case(gpio::GpioTypes::GPIO_REGULAR): { - auto regularGpio = dynamic_cast(gpioConfig.second); + case(gpio::GpioTypes::GPIO_REGULAR_BY_CHIP): + case(gpio::GpioTypes::GPIO_REGULAR_BY_LABEL): { + auto regularGpio = dynamic_cast(gpioConfig.second); if(regularGpio == nullptr) { return GPIO_TYPE_FAILURE; } /* Check for conflicts and remove duplicates if necessary */ - result = checkForConflictsRegularGpio(gpioConfig.first, regularGpio, mapToAdd); + result = checkForConflictsRegularGpio(gpioConfig.first, *regularGpio, mapToAdd); if(result != HasReturnvaluesIF::RETURN_OK) { status = result; } @@ -259,17 +296,19 @@ ReturnValue_t LinuxLibgpioIF::checkForConflicts(GpioMap& mapToAdd){ ReturnValue_t LinuxLibgpioIF::checkForConflictsRegularGpio(gpioId_t gpioIdToCheck, - GpiodRegular* gpioToCheck, GpioMap& mapToAdd) { + GpiodRegularBase& gpioToCheck, GpioMap& mapToAdd) { /* Cross check with private map */ gpioMapIter = gpioMap.find(gpioIdToCheck); if(gpioMapIter != gpioMap.end()) { - if(gpioMapIter->second->gpioType != gpio::GpioTypes::GPIO_REGULAR) { + auto& gpioType = gpioMapIter->second->gpioType; + if(gpioType != gpio::GpioTypes::GPIO_REGULAR_BY_CHIP and + gpioType != gpio::GpioTypes::GPIO_REGULAR_BY_LABEL) { sif::warning << "LinuxLibgpioIF::checkForConflicts: ID already exists for different " "GPIO type" << gpioIdToCheck << ". Removing duplicate." << std::endl; mapToAdd.erase(gpioIdToCheck); return HasReturnvaluesIF::RETURN_OK; } - auto ownRegularGpio = dynamic_cast(gpioMapIter->second); + auto ownRegularGpio = dynamic_cast(gpioMapIter->second); if(ownRegularGpio == nullptr) { return GPIO_TYPE_FAILURE; } diff --git a/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h b/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h index 00e1bdfe..31e4a7e8 100644 --- a/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h +++ b/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h @@ -6,6 +6,7 @@ #include class GpioCookie; +class GpiodRegularIF; /** * @brief This class implements the GpioIF for a linux based system. The @@ -47,9 +48,13 @@ private: * @param gpioId The GPIO ID of the GPIO to drive. * @param logiclevel The logic level to set. O or 1. */ - ReturnValue_t driveGpio(gpioId_t gpioId, GpiodRegular* regularGpio, unsigned int logiclevel); + ReturnValue_t driveGpio(gpioId_t gpioId, GpiodRegularBase& regularGpio, + gpio::Levels logicLevel); - ReturnValue_t configureRegularGpio(gpioId_t gpioId, GpiodRegular* regularGpio); + ReturnValue_t configureGpioByLabel(gpioId_t gpioId, GpiodRegularByLabel& gpioByLabel); + ReturnValue_t configureGpioByChip(gpioId_t gpioId, GpiodRegularByChip& gpioByChip); + ReturnValue_t configureRegularGpio(gpioId_t gpioId, gpio::GpioTypes gpioType, + struct gpiod_chip* chip, GpiodRegularBase& regularGpio, std::string failOutput); /** * @brief This function checks if GPIOs are already registered and whether @@ -62,7 +67,7 @@ private: */ ReturnValue_t checkForConflicts(GpioMap& mapToAdd); - ReturnValue_t checkForConflictsRegularGpio(gpioId_t gpiodId, GpiodRegular* regularGpio, + ReturnValue_t checkForConflictsRegularGpio(gpioId_t gpiodId, GpiodRegularBase& regularGpio, GpioMap& mapToAdd); ReturnValue_t checkForConflictsCallbackGpio(gpioId_t gpiodId, GpioCallback* regularGpio, GpioMap& mapToAdd); diff --git a/hal/src/fsfw_hal/linux/rpi/GpioRPi.cpp b/hal/src/fsfw_hal/linux/rpi/GpioRPi.cpp index 6a71f291..e1c274c0 100644 --- a/hal/src/fsfw_hal/linux/rpi/GpioRPi.cpp +++ b/hal/src/fsfw_hal/linux/rpi/GpioRPi.cpp @@ -12,7 +12,7 @@ ReturnValue_t gpio::createRpiGpioConfig(GpioCookie* cookie, gpioId_t gpioId, int return HasReturnvaluesIF::RETURN_FAILED; } - GpiodRegular* config = new GpiodRegular(); + auto config = new GpiodRegularByChip(); /* Default chipname for Raspberry Pi. There is still gpiochip1 for expansion, but most users will not need this */ config->chipname = "gpiochip0"; From bfae25ff2dc68362c639ea8080e9b42e0c1d4add Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 23 Sep 2021 18:06:04 +0200 Subject: [PATCH 272/389] Updates for SPI 1. Better names for functions 2. Reply size is set to 0 --- hal/src/fsfw_hal/linux/spi/SpiComIF.cpp | 34 +++++++++++++++--------- hal/src/fsfw_hal/linux/spi/SpiComIF.h | 1 + hal/src/fsfw_hal/linux/spi/SpiCookie.cpp | 2 +- hal/src/fsfw_hal/linux/spi/SpiCookie.h | 6 ++--- 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp b/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp index 48bf7449..9c4e66ae 100644 --- a/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp +++ b/hal/src/fsfw_hal/linux/spi/SpiComIF.cpp @@ -15,11 +15,6 @@ #include #include -/* Can be used for low-level debugging of the SPI bus */ -#ifndef FSFW_HAL_LINUX_SPI_WIRETAPPING -#define FSFW_HAL_LINUX_SPI_WIRETAPPING 0 -#endif - SpiComIF::SpiComIF(object_id_t objectId, GpioIF* gpioComIF): SystemObject(objectId), gpioComIF(gpioComIF) { if(gpioComIF == nullptr) { @@ -146,8 +141,8 @@ ReturnValue_t SpiComIF::sendMessage(CookieIF *cookie, const uint8_t *sendData, s if(sendLen > spiCookie->getMaxBufferSize()) { #if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "SpiComIF::sendMessage: Too much data sent, send length" << sendLen << - "larger than maximum buffer length" << spiCookie->getMaxBufferSize() << std::endl; + sif::warning << "SpiComIF::sendMessage: Too much data sent, send length " << sendLen << + "larger than maximum buffer length " << spiCookie->getMaxBufferSize() << std::endl; #else sif::printWarning("SpiComIF::sendMessage: Too much data sent, send length %lu larger " "than maximum buffer length %lu!\n", static_cast(sendLen), @@ -193,7 +188,7 @@ ReturnValue_t SpiComIF::performRegularSendOperation(SpiCookie *spiCookie, const spiCookie->getSpiParameters(spiMode, spiSpeed, nullptr); setSpiSpeedAndMode(fileDescriptor, spiMode, spiSpeed); spiCookie->assignWriteBuffer(sendData); - spiCookie->assignTransferSize(sendLen); + spiCookie->setTransferSize(sendLen); bool fullDuplex = spiCookie->isFullDuplex(); gpioId_t gpioId = spiCookie->getChipSelectPin(); @@ -202,12 +197,26 @@ ReturnValue_t SpiComIF::performRegularSendOperation(SpiCookie *spiCookie, const if(gpioId != gpio::NO_GPIO) { result = spiMutex->lockMutex(timeoutType, timeoutMs); if (result != RETURN_OK) { +#if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::error << "SpiComIF::sendMessage: Failed to lock mutex" << std::endl; +#else + sif::printError("SpiComIF::sendMessage: Failed to lock mutex\n"); +#endif +#endif + return result; + } + ReturnValue_t result = gpioComIF->pullLow(gpioId); + if(result != HasReturnvaluesIF::RETURN_OK) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "SpiComIF::sendMessage: Pulling low CS pin failed" << std::endl; +#else + sif::printWarning("SpiComIF::sendMessage: Pulling low CS pin failed"); +#endif #endif return result; } - gpioComIF->pullLow(gpioId); } /* Execute transfer */ @@ -218,7 +227,7 @@ ReturnValue_t SpiComIF::performRegularSendOperation(SpiCookie *spiCookie, const utility::handleIoctlError("SpiComIF::sendMessage: ioctl error."); result = FULL_DUPLEX_TRANSFER_FAILED; } -#if FSFW_HAL_LINUX_SPI_WIRETAPPING == 1 +#if FSFW_HAL_SPI_WIRETAPPING == 1 performSpiWiretapping(spiCookie); #endif /* FSFW_LINUX_SPI_WIRETAPPING == 1 */ } @@ -335,6 +344,7 @@ ReturnValue_t SpiComIF::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, *buffer = rxBuf; *size = spiCookie->getCurrentTransferSize(); + spiCookie->setTransferSize(0); return HasReturnvaluesIF::RETURN_OK; } @@ -388,11 +398,11 @@ GpioIF* SpiComIF::getGpioInterface() { void SpiComIF::setSpiSpeedAndMode(int spiFd, spi::SpiModes mode, uint32_t speed) { int retval = ioctl(spiFd, SPI_IOC_WR_MODE, reinterpret_cast(&mode)); if(retval != 0) { - utility::handleIoctlError("SpiTestClass::performRm3100Test: Setting SPI mode failed!"); + utility::handleIoctlError("SpiComIF::setSpiSpeedAndMode: Setting SPI mode failed"); } retval = ioctl(spiFd, SPI_IOC_WR_MAX_SPEED_HZ, &speed); if(retval != 0) { - utility::handleIoctlError("SpiTestClass::performRm3100Test: Setting SPI speed failed!"); + utility::handleIoctlError("SpiComIF::setSpiSpeedAndMode: Setting SPI speed failed"); } } diff --git a/hal/src/fsfw_hal/linux/spi/SpiComIF.h b/hal/src/fsfw_hal/linux/spi/SpiComIF.h index d43e2505..bcca7462 100644 --- a/hal/src/fsfw_hal/linux/spi/SpiComIF.h +++ b/hal/src/fsfw_hal/linux/spi/SpiComIF.h @@ -1,6 +1,7 @@ #ifndef LINUX_SPI_SPICOMIF_H_ #define LINUX_SPI_SPICOMIF_H_ +#include "fsfw/FSFW.h" #include "spiDefinitions.h" #include "returnvalues/classIds.h" #include "fsfw_hal/common/gpio/GpioIF.h" diff --git a/hal/src/fsfw_hal/linux/spi/SpiCookie.cpp b/hal/src/fsfw_hal/linux/spi/SpiCookie.cpp index 54d8aa16..f07954e9 100644 --- a/hal/src/fsfw_hal/linux/spi/SpiCookie.cpp +++ b/hal/src/fsfw_hal/linux/spi/SpiCookie.cpp @@ -121,7 +121,7 @@ bool SpiCookie::isFullDuplex() const { return not this->halfDuplex; } -void SpiCookie::assignTransferSize(size_t transferSize) { +void SpiCookie::setTransferSize(size_t transferSize) { spiTransferStruct.len = transferSize; } diff --git a/hal/src/fsfw_hal/linux/spi/SpiCookie.h b/hal/src/fsfw_hal/linux/spi/SpiCookie.h index acf7c77c..844fd421 100644 --- a/hal/src/fsfw_hal/linux/spi/SpiCookie.h +++ b/hal/src/fsfw_hal/linux/spi/SpiCookie.h @@ -103,10 +103,10 @@ public: void assignReadBuffer(uint8_t* rx); void assignWriteBuffer(const uint8_t* tx); /** - * Assign size for the next transfer. + * Set size for the next transfer. Set to 0 for no transfer * @param transferSize */ - void assignTransferSize(size_t transferSize); + void setTransferSize(size_t transferSize); size_t getCurrentTransferSize() const; struct UncommonParameters { @@ -158,8 +158,6 @@ private: std::string spiDev, const size_t maxSize, spi::SpiModes spiMode, uint32_t spiSpeed, spi::send_callback_function_t callback, void* args); - size_t currentTransferSize = 0; - address_t spiAddress; gpioId_t chipSelectPin; std::string spiDevice; From fc9b85d5db29079ec96031a160a98f5caab65a81 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 23 Sep 2021 18:06:54 +0200 Subject: [PATCH 273/389] update FSFW.h.in --- src/fsfw/FSFW.h.in | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/fsfw/FSFW.h.in b/src/fsfw/FSFW.h.in index f0eb9365..96460ae4 100644 --- a/src/fsfw/FSFW.h.in +++ b/src/fsfw/FSFW.h.in @@ -16,6 +16,11 @@ #cmakedefine FSFW_ADD_MONITORING #cmakedefine FSFW_ADD_SGP4_PROPAGATOR +// Can be used for low-level debugging of the SPI bus +#ifndef FSFW_HAL_SPI_WIRETAPPING +#define FSFW_HAL_SPI_WIRETAPPING 0 +#endif + #ifndef FSFW_HAL_L3GD20_GYRO_DEBUG #define FSFW_HAL_L3GD20_GYRO_DEBUG 0 #endif /* FSFW_HAL_L3GD20_GYRO_DEBUG */ From f2bc374f0ffd349c3c02552885433735eb632f92 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 23 Sep 2021 18:12:59 +0200 Subject: [PATCH 274/389] Device handler updates --- .../fsfw_hal/devicehandlers/CMakeLists.txt | 2 + .../devicehandlers/GyroL3GD20Handler.cpp | 43 ++++- .../devicehandlers/GyroL3GD20Handler.h | 21 ++- .../devicedefinitions/MgmLIS3HandlerDefs.h | 178 ++++++++++++++++++ .../devicedefinitions/MgmRM3100HandlerDefs.h | 132 +++++++++++++ 5 files changed, 364 insertions(+), 12 deletions(-) create mode 100644 hal/src/fsfw_hal/devicehandlers/devicedefinitions/MgmLIS3HandlerDefs.h create mode 100644 hal/src/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h diff --git a/hal/src/fsfw_hal/devicehandlers/CMakeLists.txt b/hal/src/fsfw_hal/devicehandlers/CMakeLists.txt index cf542d8d..94e67c72 100644 --- a/hal/src/fsfw_hal/devicehandlers/CMakeLists.txt +++ b/hal/src/fsfw_hal/devicehandlers/CMakeLists.txt @@ -1,3 +1,5 @@ target_sources(${LIB_FSFW_NAME} PRIVATE GyroL3GD20Handler.cpp + MgmRM3100Handler.cpp + MgmLIS3MDLHandler.cpp ) diff --git a/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.cpp b/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.cpp index 4a492e5d..70ba49eb 100644 --- a/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.cpp +++ b/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.cpp @@ -3,11 +3,11 @@ #include "fsfw/datapool/PoolReadGuard.h" GyroHandlerL3GD20H::GyroHandlerL3GD20H(object_id_t objectId, object_id_t deviceCommunication, - CookieIF *comCookie, uint8_t switchId, uint32_t transitionDelayMs): + CookieIF *comCookie, uint32_t transitionDelayMs): DeviceHandlerBase(objectId, deviceCommunication, comCookie), - switchId(switchId), transitionDelayMs(transitionDelayMs), dataset(this) { + transitionDelayMs(transitionDelayMs), dataset(this) { #if FSFW_HAL_L3GD20_GYRO_DEBUG == 1 - debugDivider = new PeriodicOperationDivider(5); + debugDivider = new PeriodicOperationDivider(3); #endif } @@ -215,11 +215,32 @@ ReturnValue_t GyroHandlerL3GD20H::interpretDeviceReply(DeviceCommandId_t id, PoolReadGuard readSet(&dataset); if(readSet.getReadResult() == HasReturnvaluesIF::RETURN_OK) { - dataset.angVelocX = angVelocX; - dataset.angVelocY = angVelocY; - dataset.angVelocZ = angVelocZ; + if(std::abs(angVelocX) < this->absLimitX) { + dataset.angVelocX = angVelocX; + dataset.angVelocX.setValid(true); + } + else { + dataset.angVelocX.setValid(false); + } + + if(std::abs(angVelocY) < this->absLimitY) { + dataset.angVelocY = angVelocY; + dataset.angVelocY.setValid(true); + } + else { + dataset.angVelocY.setValid(false); + } + + if(std::abs(angVelocZ) < this->absLimitZ) { + dataset.angVelocZ = angVelocZ; + dataset.angVelocZ.setValid(true); + } + else { + dataset.angVelocZ.setValid(false); + } + dataset.temperature = temperature; - dataset.setValidity(true, true); + dataset.temperature.setValid(true); } break; } @@ -234,7 +255,7 @@ uint32_t GyroHandlerL3GD20H::getTransitionDelayMs(Mode_t from, Mode_t to) { return this->transitionDelayMs; } -void GyroHandlerL3GD20H::setGoNormalModeAtStartup() { +void GyroHandlerL3GD20H::setToGoToNormalMode(bool enable) { this->goNormalModeImmediately = true; } @@ -256,3 +277,9 @@ void GyroHandlerL3GD20H::fillCommandAndReplyMap() { void GyroHandlerL3GD20H::modeChanged() { internalState = InternalState::NONE; } + +void GyroHandlerL3GD20H::setAbsoluteLimits(float limitX, float limitY, float limitZ) { + this->absLimitX = limitX; + this->absLimitY = limitY; + this->absLimitZ = limitZ; +} diff --git a/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.h b/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.h index bc1d9c1c..870f551d 100644 --- a/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.h +++ b/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.h @@ -19,13 +19,22 @@ class GyroHandlerL3GD20H: public DeviceHandlerBase { public: GyroHandlerL3GD20H(object_id_t objectId, object_id_t deviceCommunication, - CookieIF* comCookie, uint8_t switchId, uint32_t transitionDelayMs = 10000); + CookieIF* comCookie, uint32_t transitionDelayMs); virtual ~GyroHandlerL3GD20H(); + /** + * Set the absolute limit for the values on the axis in degrees per second. + * The dataset values will be marked as invalid if that limit is exceeded + * @param xLimit + * @param yLimit + * @param zLimit + */ + void setAbsoluteLimits(float limitX, float limitY, float limitZ); + /** * @brief Configure device handler to go to normal mode immediately */ - void setGoNormalModeAtStartup(); + void setToGoToNormalMode(bool enable); protected: /* DeviceHandlerBase overrides */ @@ -40,12 +49,12 @@ protected: size_t commandDataLen) override; ReturnValue_t scanForReply(const uint8_t *start, size_t len, DeviceCommandId_t *foundId, size_t *foundLen) override; - ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, + virtual ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override; void fillCommandAndReplyMap() override; void modeChanged() override; - uint32_t getTransitionDelayMs(Mode_t from, Mode_t to) override; + virtual uint32_t getTransitionDelayMs(Mode_t from, Mode_t to) override; ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) override; @@ -54,6 +63,10 @@ private: uint32_t transitionDelayMs = 0; GyroPrimaryDataset dataset; + float absLimitX = L3GD20H::RANGE_DPS_00; + float absLimitY = L3GD20H::RANGE_DPS_00; + float absLimitZ = L3GD20H::RANGE_DPS_00; + enum class InternalState { NONE, CONFIGURE, diff --git a/hal/src/fsfw_hal/devicehandlers/devicedefinitions/MgmLIS3HandlerDefs.h b/hal/src/fsfw_hal/devicehandlers/devicedefinitions/MgmLIS3HandlerDefs.h new file mode 100644 index 00000000..b6f3fd84 --- /dev/null +++ b/hal/src/fsfw_hal/devicehandlers/devicedefinitions/MgmLIS3HandlerDefs.h @@ -0,0 +1,178 @@ +#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_MGMLIS3HANDLERDEFS_H_ +#define MISSION_DEVICES_DEVICEDEFINITIONS_MGMLIS3HANDLERDEFS_H_ + +#include +#include +#include +#include + +namespace MGMLIS3MDL { + +enum Set { + ON, OFF +}; +enum OpMode { + LOW, MEDIUM, HIGH, ULTRA +}; + +enum Sensitivies: uint8_t { + GAUSS_4 = 4, + GAUSS_8 = 8, + GAUSS_12 = 12, + GAUSS_16 = 16 +}; + +/* Actually 15, we just round up a bit */ +static constexpr size_t MAX_BUFFER_SIZE = 16; + +/* Field data register scaling */ +static constexpr uint8_t GAUSS_TO_MICROTESLA_FACTOR = 100; +static constexpr float FIELD_LSB_PER_GAUSS_4_SENS = 1.0 / 6842.0; +static constexpr float FIELD_LSB_PER_GAUSS_8_SENS = 1.0 / 3421.0; +static constexpr float FIELD_LSB_PER_GAUSS_12_SENS = 1.0 / 2281.0; +static constexpr float FIELD_LSB_PER_GAUSS_16_SENS = 1.0 / 1711.0; + +static const DeviceCommandId_t READ_CONFIG_AND_DATA = 0x00; +static const DeviceCommandId_t SETUP_MGM = 0x01; +static const DeviceCommandId_t READ_TEMPERATURE = 0x02; +static const DeviceCommandId_t IDENTIFY_DEVICE = 0x03; +static const DeviceCommandId_t TEMP_SENSOR_ENABLE = 0x04; +static const DeviceCommandId_t ACCURACY_OP_MODE_SET = 0x05; + +/* Number of all control registers */ +static const uint8_t NR_OF_CTRL_REGISTERS = 5; +/* Number of registers in the MGM */ +static const uint8_t NR_OF_REGISTERS = 19; +/* Total number of adresses for all registers */ +static const uint8_t TOTAL_NR_OF_ADRESSES = 52; +static const uint8_t NR_OF_DATA_AND_CFG_REGISTERS = 14; +static const uint8_t TEMPERATURE_REPLY_LEN = 3; +static const uint8_t SETUP_REPLY_LEN = 6; + +/*------------------------------------------------------------------------*/ +/* Register adresses */ +/*------------------------------------------------------------------------*/ +/* Register adress returns identifier of device with default 0b00111101 */ +static const uint8_t IDENTIFY_DEVICE_REG_ADDR = 0b00001111; +static const uint8_t DEVICE_ID = 0b00111101; // Identifier for Device + +/* Register adress to access register 1 */ +static const uint8_t CTRL_REG1 = 0b00100000; +/* Register adress to access register 2 */ +static const uint8_t CTRL_REG2 = 0b00100001; +/* Register adress to access register 3 */ +static const uint8_t CTRL_REG3 = 0b00100010; +/* Register adress to access register 4 */ +static const uint8_t CTRL_REG4 = 0b00100011; +/* Register adress to access register 5 */ +static const uint8_t CTRL_REG5 = 0b00100100; + +/* Register adress to access status register */ +static const uint8_t STATUS_REG_IDX = 8; +static const uint8_t STATUS_REG = 0b00100111; + +/* Register adress to access low byte of x-axis */ +static const uint8_t X_LOWBYTE_IDX = 9; +static const uint8_t X_LOWBYTE = 0b00101000; +/* Register adress to access high byte of x-axis */ +static const uint8_t X_HIGHBYTE_IDX = 10; +static const uint8_t X_HIGHBYTE = 0b00101001; +/* Register adress to access low byte of y-axis */ +static const uint8_t Y_LOWBYTE_IDX = 11; +static const uint8_t Y_LOWBYTE = 0b00101010; +/* Register adress to access high byte of y-axis */ +static const uint8_t Y_HIGHBYTE_IDX = 12; +static const uint8_t Y_HIGHBYTE = 0b00101011; +/* Register adress to access low byte of z-axis */ +static const uint8_t Z_LOWBYTE_IDX = 13; +static const uint8_t Z_LOWBYTE = 0b00101100; +/* Register adress to access high byte of z-axis */ +static const uint8_t Z_HIGHBYTE_IDX = 14; +static const uint8_t Z_HIGHBYTE = 0b00101101; + +/* Register adress to access low byte of temperature sensor */ +static const uint8_t TEMP_LOWBYTE = 0b00101110; +/* Register adress to access high byte of temperature sensor */ +static const uint8_t TEMP_HIGHBYTE = 0b00101111; + +/*------------------------------------------------------------------------*/ +/* Initialize Setup Register set bits */ +/*------------------------------------------------------------------------*/ +/* General transfer bits */ +// Read=1 / Write=0 Bit +static const uint8_t RW_BIT = 7; +// Continous Read/Write Bit, increment adress +static const uint8_t MS_BIT = 6; + +/* CTRL_REG1 bits */ +static const uint8_t ST = 0; // Self test enable bit, enabled = 1 +// Enable rates higher than 80 Hz enabled = 1 +static const uint8_t FAST_ODR = 1; +static const uint8_t DO0 = 2; // Output data rate bit 2 +static const uint8_t DO1 = 3; // Output data rate bit 3 +static const uint8_t DO2 = 4; // Output data rate bit 4 +static const uint8_t OM0 = 5; // XY operating mode bit 5 +static const uint8_t OM1 = 6; // XY operating mode bit 6 +static const uint8_t TEMP_EN = 7; // Temperature sensor enable enabled = 1 +static const uint8_t CTRL_REG1_DEFAULT = (1 << TEMP_EN) | (1 << OM1) | + (1 << DO0) | (1 << DO1) | (1 << DO2); + +/* CTRL_REG2 bits */ +//reset configuration registers and user registers +static const uint8_t SOFT_RST = 2; +static const uint8_t REBOOT = 3; //reboot memory content +static const uint8_t FSO = 5; //full-scale selection bit 5 +static const uint8_t FS1 = 6; //full-scale selection bit 6 +static const uint8_t CTRL_REG2_DEFAULT = 0; + +/* CTRL_REG3 bits */ +static const uint8_t MD0 = 0; //Operating mode bit 0 +static const uint8_t MD1 = 1; //Operating mode bit 1 +//SPI serial interface mode selection enabled = 3-wire-mode +static const uint8_t SIM = 2; +static const uint8_t LP = 5; //low-power mode +static const uint8_t CTRL_REG3_DEFAULT = 0; + +/* CTRL_REG4 bits */ +//big/little endian data selection enabled = MSb at lower adress +static const uint8_t BLE = 1; +static const uint8_t OMZ0 = 2; //Z operating mode bit 2 +static const uint8_t OMZ1 = 3; //Z operating mode bit 3 +static const uint8_t CTRL_REG4_DEFAULT = (1 << OMZ1); + +/* CTRL_REG5 bits */ +static const uint8_t BDU = 6; //Block data update +static const uint8_t FAST_READ = 7; //Fast read enabled = 1 +static const uint8_t CTRL_REG5_DEFAULT = 0; + +static const uint32_t MGM_DATA_SET_ID = READ_CONFIG_AND_DATA; + +enum MgmPoolIds: lp_id_t { + FIELD_STRENGTH_X, + FIELD_STRENGTH_Y, + FIELD_STRENGTH_Z, + TEMPERATURE_CELCIUS +}; + +class MgmPrimaryDataset: public StaticLocalDataSet<5> { +public: + MgmPrimaryDataset(HasLocalDataPoolIF* hkOwner): + StaticLocalDataSet(hkOwner, MGM_DATA_SET_ID) {} + + MgmPrimaryDataset(object_id_t mgmId): + StaticLocalDataSet(sid_t(mgmId, MGM_DATA_SET_ID)) {} + + lp_var_t fieldStrengthX = lp_var_t(sid.objectId, + FIELD_STRENGTH_X, this); + lp_var_t fieldStrengthY = lp_var_t(sid.objectId, + FIELD_STRENGTH_Y, this); + lp_var_t fieldStrengthZ = lp_var_t(sid.objectId, + FIELD_STRENGTH_Z, this); + lp_var_t temperature = lp_var_t(sid.objectId, + TEMPERATURE_CELCIUS, this); +}; + +} + + +#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_MGMLIS3HANDLERDEFS_H_ */ diff --git a/hal/src/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h b/hal/src/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h new file mode 100644 index 00000000..08f80dd9 --- /dev/null +++ b/hal/src/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h @@ -0,0 +1,132 @@ +#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_MGMHANDLERRM3100DEFINITIONS_H_ +#define MISSION_DEVICES_DEVICEDEFINITIONS_MGMHANDLERRM3100DEFINITIONS_H_ + +#include +#include +#include +#include +#include + +namespace RM3100 { + +/* Actually 10, we round up a little bit */ +static constexpr size_t MAX_BUFFER_SIZE = 12; + +static constexpr uint8_t READ_MASK = 0x80; + +/*----------------------------------------------------------------------------*/ +/* CMM Register */ +/*----------------------------------------------------------------------------*/ +static constexpr uint8_t SET_CMM_CMZ = 1 << 6; +static constexpr uint8_t SET_CMM_CMY = 1 << 5; +static constexpr uint8_t SET_CMM_CMX = 1 << 4; +static constexpr uint8_t SET_CMM_DRDM = 1 << 2; +static constexpr uint8_t SET_CMM_START = 1; +static constexpr uint8_t CMM_REGISTER = 0x01; + +static constexpr uint8_t CMM_VALUE = SET_CMM_CMZ | SET_CMM_CMY | SET_CMM_CMX | + SET_CMM_DRDM | SET_CMM_START; + +/*----------------------------------------------------------------------------*/ +/* Cycle count register */ +/*----------------------------------------------------------------------------*/ +// Default value (200) +static constexpr uint8_t CYCLE_COUNT_VALUE = 0xC8; + +static constexpr float DEFAULT_GAIN = static_cast(CYCLE_COUNT_VALUE) / + 100 * 38; +static constexpr uint8_t CYCLE_COUNT_START_REGISTER = 0x04; + +/*----------------------------------------------------------------------------*/ +/* TMRC register */ +/*----------------------------------------------------------------------------*/ +static constexpr uint8_t TMRC_150HZ_VALUE = 0x94; +static constexpr uint8_t TMRC_75HZ_VALUE = 0x95; +static constexpr uint8_t TMRC_DEFAULT_37HZ_VALUE = 0x96; + +static constexpr uint8_t TMRC_REGISTER = 0x0B; +static constexpr uint8_t TMRC_DEFAULT_VALUE = TMRC_DEFAULT_37HZ_VALUE; + +static constexpr uint8_t MEASUREMENT_REG_START = 0x24; +static constexpr uint8_t BIST_REGISTER = 0x33; +static constexpr uint8_t DATA_READY_VAL = 0b1000'0000; +static constexpr uint8_t STATUS_REGISTER = 0x34; +static constexpr uint8_t REVID_REGISTER = 0x36; + +// Range in Microtesla. 1 T equals 10000 Gauss (for comparison with LIS3 MGM) +static constexpr uint16_t RANGE = 800; + +static constexpr DeviceCommandId_t READ_DATA = 0; + +static constexpr DeviceCommandId_t CONFIGURE_CMM = 1; +static constexpr DeviceCommandId_t READ_CMM = 2; + +static constexpr DeviceCommandId_t CONFIGURE_TMRC = 3; +static constexpr DeviceCommandId_t READ_TMRC = 4; + +static constexpr DeviceCommandId_t CONFIGURE_CYCLE_COUNT = 5; +static constexpr DeviceCommandId_t READ_CYCLE_COUNT = 6; + +class CycleCountCommand: public SerialLinkedListAdapter { +public: + CycleCountCommand(bool oneCycleCount = true): oneCycleCount(oneCycleCount) { + setLinks(oneCycleCount); + } + + ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size, + Endianness streamEndianness) override { + ReturnValue_t result = SerialLinkedListAdapter::deSerialize(buffer, + size, streamEndianness); + if(oneCycleCount) { + cycleCountY = cycleCountX; + cycleCountZ = cycleCountX; + } + return result; + } + + SerializeElement cycleCountX; + SerializeElement cycleCountY; + SerializeElement cycleCountZ; + +private: + void setLinks(bool oneCycleCount) { + setStart(&cycleCountX); + if(not oneCycleCount) { + cycleCountX.setNext(&cycleCountY); + cycleCountY.setNext(&cycleCountZ); + } + } + + bool oneCycleCount; +}; + +static constexpr uint32_t MGM_DATASET_ID = READ_DATA; + +enum MgmPoolIds: lp_id_t { + FIELD_STRENGTH_X, + FIELD_STRENGTH_Y, + FIELD_STRENGTH_Z, +}; + +class Rm3100PrimaryDataset: public StaticLocalDataSet<3 * sizeof(float)> { +public: + Rm3100PrimaryDataset(HasLocalDataPoolIF* hkOwner): + StaticLocalDataSet(hkOwner, MGM_DATASET_ID) {} + + Rm3100PrimaryDataset(object_id_t mgmId): + StaticLocalDataSet(sid_t(mgmId, MGM_DATASET_ID)) {} + + // Field strengths in micro Tesla. + lp_var_t fieldStrengthX = lp_var_t(sid.objectId, + FIELD_STRENGTH_X, this); + lp_var_t fieldStrengthY = lp_var_t(sid.objectId, + FIELD_STRENGTH_Y, this); + lp_var_t fieldStrengthZ = lp_var_t(sid.objectId, + FIELD_STRENGTH_Z, this); +}; + +} + + + +#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_MGMHANDLERRM3100DEFINITIONS_H_ */ From a6bd7c0d6ea035c5acb38139ed9bac78228ab1ac Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 23 Sep 2021 18:13:51 +0200 Subject: [PATCH 275/389] added missing defines for debug output --- src/fsfw/FSFW.h.in | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/fsfw/FSFW.h.in b/src/fsfw/FSFW.h.in index f0eb9365..f124e647 100644 --- a/src/fsfw/FSFW.h.in +++ b/src/fsfw/FSFW.h.in @@ -17,7 +17,15 @@ #cmakedefine FSFW_ADD_SGP4_PROPAGATOR #ifndef FSFW_HAL_L3GD20_GYRO_DEBUG -#define FSFW_HAL_L3GD20_GYRO_DEBUG 0 +#define FSFW_HAL_L3GD20_GYRO_DEBUG 0 #endif /* FSFW_HAL_L3GD20_GYRO_DEBUG */ +#ifndef FSFW_HAL_RM3100_MGM_DEBUG +#define FSFW_HAL_RM3100_MGM_DEBUG 0 +#endif /* FSFW_HAL_RM3100_MGM_DEBUG */ + +#ifndef FSFW_HAL_LIS3MDL_MGM_DEBUG +#define FSFW_HAL_LIS3MDL_MGM_DEBUG 0 +#endif /* FSFW_HAL_LIS3MDL_MGM_DEBUG */ + #endif /* FSFW_FSFW_H_ */ From f6b03dee6ab7755df53d415fe75802a30fd2c435 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Fri, 24 Sep 2021 12:11:12 +0200 Subject: [PATCH 276/389] removed unused variable switchId from GyroL3GD20Handler class --- hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.h | 1 - 1 file changed, 1 deletion(-) diff --git a/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.h b/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.h index 870f551d..e73d2fbb 100644 --- a/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.h +++ b/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.h @@ -59,7 +59,6 @@ protected: LocalDataPoolManager &poolManager) override; private: - uint8_t switchId = 0; uint32_t transitionDelayMs = 0; GyroPrimaryDataset dataset; From a37b6184fcddf7792aaa5b70b5882a6d838a65ab Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sat, 25 Sep 2021 16:40:22 +0200 Subject: [PATCH 277/389] fix dataset sizes --- .../devicehandlers/devicedefinitions/MgmLIS3HandlerDefs.h | 2 +- .../devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hal/src/fsfw_hal/devicehandlers/devicedefinitions/MgmLIS3HandlerDefs.h b/hal/src/fsfw_hal/devicehandlers/devicedefinitions/MgmLIS3HandlerDefs.h index b6f3fd84..9d65aae2 100644 --- a/hal/src/fsfw_hal/devicehandlers/devicedefinitions/MgmLIS3HandlerDefs.h +++ b/hal/src/fsfw_hal/devicehandlers/devicedefinitions/MgmLIS3HandlerDefs.h @@ -154,7 +154,7 @@ enum MgmPoolIds: lp_id_t { TEMPERATURE_CELCIUS }; -class MgmPrimaryDataset: public StaticLocalDataSet<5> { +class MgmPrimaryDataset: public StaticLocalDataSet<4> { public: MgmPrimaryDataset(HasLocalDataPoolIF* hkOwner): StaticLocalDataSet(hkOwner, MGM_DATA_SET_ID) {} diff --git a/hal/src/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h b/hal/src/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h index 08f80dd9..0ee2c7f6 100644 --- a/hal/src/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h +++ b/hal/src/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h @@ -108,7 +108,7 @@ enum MgmPoolIds: lp_id_t { FIELD_STRENGTH_Z, }; -class Rm3100PrimaryDataset: public StaticLocalDataSet<3 * sizeof(float)> { +class Rm3100PrimaryDataset: public StaticLocalDataSet<3> { public: Rm3100PrimaryDataset(HasLocalDataPoolIF* hkOwner): StaticLocalDataSet(hkOwner, MGM_DATASET_ID) {} From a84e60a37a6fef4147837bd6732d74722d4708c1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 26 Sep 2021 22:22:55 +0200 Subject: [PATCH 278/389] Added missing devicehandlers These devicehandlers were missing from the last PR --- .../devicehandlers/MgmLIS3MDLHandler.cpp | 518 ++++++++++++++++++ .../devicehandlers/MgmLIS3MDLHandler.h | 186 +++++++ .../devicehandlers/MgmRM3100Handler.cpp | 363 ++++++++++++ .../devicehandlers/MgmRM3100Handler.h | 111 ++++ 4 files changed, 1178 insertions(+) create mode 100644 hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp create mode 100644 hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h create mode 100644 hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp create mode 100644 hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.h diff --git a/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp b/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp new file mode 100644 index 00000000..891d6fdc --- /dev/null +++ b/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp @@ -0,0 +1,518 @@ +#include "MgmLIS3MDLHandler.h" + +#include "fsfw/datapool/PoolReadGuard.h" +#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1 +#include "fsfw/globalfunctions/PeriodicOperationDivider.h" +#endif + +MgmLIS3MDLHandler::MgmLIS3MDLHandler(object_id_t objectId, object_id_t deviceCommunication, + CookieIF* comCookie, uint32_t transitionDelay): + DeviceHandlerBase(objectId, deviceCommunication, comCookie), + dataset(this), transitionDelay(transitionDelay) { +#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1 + debugDivider = new PeriodicOperationDivider(3); +#endif + // Set to default values right away + registers[0] = MGMLIS3MDL::CTRL_REG1_DEFAULT; + registers[1] = MGMLIS3MDL::CTRL_REG2_DEFAULT; + registers[2] = MGMLIS3MDL::CTRL_REG3_DEFAULT; + registers[3] = MGMLIS3MDL::CTRL_REG4_DEFAULT; + registers[4] = MGMLIS3MDL::CTRL_REG5_DEFAULT; + +} + +MgmLIS3MDLHandler::~MgmLIS3MDLHandler() { +} + + +void MgmLIS3MDLHandler::doStartUp() { + switch (internalState) { + case(InternalState::STATE_NONE): { + internalState = InternalState::STATE_FIRST_CONTACT; + break; + } + case(InternalState::STATE_FIRST_CONTACT): { + /* Will be set by checking device ID (WHO AM I register) */ + if(commandExecuted) { + commandExecuted = false; + internalState = InternalState::STATE_SETUP; + } + break; + } + case(InternalState::STATE_SETUP): { + internalState = InternalState::STATE_CHECK_REGISTERS; + break; + } + case(InternalState::STATE_CHECK_REGISTERS): { + /* Set up cached registers which will be used to configure the MGM. */ + if(commandExecuted) { + commandExecuted = false; + if(goToNormalMode) { + setMode(MODE_NORMAL); + } + else { + setMode(_MODE_TO_ON); + } + } + break; + } + default: + break; + } + +} + +void MgmLIS3MDLHandler::doShutDown() { + setMode(_MODE_POWER_DOWN); +} + +ReturnValue_t MgmLIS3MDLHandler::buildTransitionDeviceCommand( + DeviceCommandId_t *id) { + switch (internalState) { + case(InternalState::STATE_NONE): + case(InternalState::STATE_NORMAL): { + return HasReturnvaluesIF::RETURN_OK; + } + case(InternalState::STATE_FIRST_CONTACT): { + *id = MGMLIS3MDL::IDENTIFY_DEVICE; + break; + } + case(InternalState::STATE_SETUP): { + *id = MGMLIS3MDL::SETUP_MGM; + break; + } + case(InternalState::STATE_CHECK_REGISTERS): { + *id = MGMLIS3MDL::READ_CONFIG_AND_DATA; + break; + } + default: { + /* might be a configuration error. */ +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "GyroHandler::buildTransitionDeviceCommand: Unknown internal state!" << + std::endl; +#else + sif::printWarning("GyroHandler::buildTransitionDeviceCommand: Unknown internal state!\n"); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ + return HasReturnvaluesIF::RETURN_OK; + } + + } + return buildCommandFromCommand(*id, NULL, 0); +} + +uint8_t MgmLIS3MDLHandler::readCommand(uint8_t command, bool continuousCom) { + command |= (1 << MGMLIS3MDL::RW_BIT); + if (continuousCom == true) { + command |= (1 << MGMLIS3MDL::MS_BIT); + } + return command; +} + +uint8_t MgmLIS3MDLHandler::writeCommand(uint8_t command, bool continuousCom) { + command &= ~(1 << MGMLIS3MDL::RW_BIT); + if (continuousCom == true) { + command |= (1 << MGMLIS3MDL::MS_BIT); + } + return command; +} + +void MgmLIS3MDLHandler::setupMgm() { + + registers[0] = MGMLIS3MDL::CTRL_REG1_DEFAULT; + registers[1] = MGMLIS3MDL::CTRL_REG2_DEFAULT; + registers[2] = MGMLIS3MDL::CTRL_REG3_DEFAULT; + registers[3] = MGMLIS3MDL::CTRL_REG4_DEFAULT; + registers[4] = MGMLIS3MDL::CTRL_REG5_DEFAULT; + + prepareCtrlRegisterWrite(); +} + +ReturnValue_t MgmLIS3MDLHandler::buildNormalDeviceCommand( + DeviceCommandId_t *id) { + // Data/config register will be read in an alternating manner. + if(communicationStep == CommunicationStep::DATA) { + *id = MGMLIS3MDL::READ_CONFIG_AND_DATA; + communicationStep = CommunicationStep::TEMPERATURE; + return buildCommandFromCommand(*id, NULL, 0); + } + else { + *id = MGMLIS3MDL::READ_TEMPERATURE; + communicationStep = CommunicationStep::DATA; + return buildCommandFromCommand(*id, NULL, 0); + } + +} + +ReturnValue_t MgmLIS3MDLHandler::buildCommandFromCommand( + DeviceCommandId_t deviceCommand, const uint8_t *commandData, + size_t commandDataLen) { + switch(deviceCommand) { + case(MGMLIS3MDL::READ_CONFIG_AND_DATA): { + std::memset(commandBuffer, 0, sizeof(commandBuffer)); + commandBuffer[0] = readCommand(MGMLIS3MDL::CTRL_REG1, true); + + rawPacket = commandBuffer; + rawPacketLen = MGMLIS3MDL::NR_OF_DATA_AND_CFG_REGISTERS + 1; + return RETURN_OK; + } + case(MGMLIS3MDL::READ_TEMPERATURE): { + std::memset(commandBuffer, 0, 3); + commandBuffer[0] = readCommand(MGMLIS3MDL::TEMP_LOWBYTE, true); + + rawPacket = commandBuffer; + rawPacketLen = 3; + return RETURN_OK; + } + case(MGMLIS3MDL::IDENTIFY_DEVICE): { + return identifyDevice(); + } + case(MGMLIS3MDL::TEMP_SENSOR_ENABLE): { + return enableTemperatureSensor(commandData, commandDataLen); + } + case(MGMLIS3MDL::SETUP_MGM): { + setupMgm(); + return HasReturnvaluesIF::RETURN_OK; + } + case(MGMLIS3MDL::ACCURACY_OP_MODE_SET): { + return setOperatingMode(commandData, commandDataLen); + } + default: + return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; + } + return HasReturnvaluesIF::RETURN_FAILED; +} + +ReturnValue_t MgmLIS3MDLHandler::identifyDevice() { + uint32_t size = 2; + commandBuffer[0] = readCommand(MGMLIS3MDL::IDENTIFY_DEVICE_REG_ADDR); + commandBuffer[1] = 0x00; + + rawPacket = commandBuffer; + rawPacketLen = size; + + return RETURN_OK; +} + +ReturnValue_t MgmLIS3MDLHandler::scanForReply(const uint8_t *start, + size_t len, DeviceCommandId_t *foundId, size_t *foundLen) { + *foundLen = len; + if (len == MGMLIS3MDL::NR_OF_DATA_AND_CFG_REGISTERS + 1) { + *foundLen = len; + *foundId = MGMLIS3MDL::READ_CONFIG_AND_DATA; + // Check validity by checking config registers + if (start[1] != registers[0] or start[2] != registers[1] or + start[3] != registers[2] or start[4] != registers[3] or + start[5] != registers[4]) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "MGMHandlerLIS3MDL::scanForReply: Invalid registers!" << std::endl; +#else + sif::printWarning("MGMHandlerLIS3MDL::scanForReply: Invalid registers!\n"); +#endif +#endif + return DeviceHandlerIF::INVALID_DATA; + } + if(mode == _MODE_START_UP) { + commandExecuted = true; + } + + } + else if(len == MGMLIS3MDL::TEMPERATURE_REPLY_LEN) { + *foundLen = len; + *foundId = MGMLIS3MDL::READ_TEMPERATURE; + } + else if (len == MGMLIS3MDL::SETUP_REPLY_LEN) { + *foundLen = len; + *foundId = MGMLIS3MDL::SETUP_MGM; + } + else if (len == SINGLE_COMMAND_ANSWER_LEN) { + *foundLen = len; + *foundId = getPendingCommand(); + if(*foundId == MGMLIS3MDL::IDENTIFY_DEVICE) { + if(start[1] != MGMLIS3MDL::DEVICE_ID) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "MGMHandlerLIS3MDL::scanForReply: " + "Device identification failed!" << std::endl; +#else + sif::printWarning("MGMHandlerLIS3MDL::scanForReply: " + "Device identification failed!\n"); +#endif +#endif + return DeviceHandlerIF::INVALID_DATA; + } + + if(mode == _MODE_START_UP) { + commandExecuted = true; + } + } + } + else { + return DeviceHandlerIF::INVALID_DATA; + } + + /* Data with SPI Interface always has this answer */ + if (start[0] == 0b11111111) { + return RETURN_OK; + } + else { + return DeviceHandlerIF::INVALID_DATA; + } + +} +ReturnValue_t MgmLIS3MDLHandler::interpretDeviceReply(DeviceCommandId_t id, + const uint8_t *packet) { + + switch (id) { + case MGMLIS3MDL::IDENTIFY_DEVICE: { + break; + } + case MGMLIS3MDL::SETUP_MGM: { + break; + } + case MGMLIS3MDL::READ_CONFIG_AND_DATA: { + // TODO: Store configuration in new local datasets. + float sensitivityFactor = getSensitivityFactor(getSensitivity(registers[2])); + + int16_t mgmMeasurementRawX = packet[MGMLIS3MDL::X_HIGHBYTE_IDX] << 8 + | packet[MGMLIS3MDL::X_LOWBYTE_IDX] ; + int16_t mgmMeasurementRawY = packet[MGMLIS3MDL::Y_HIGHBYTE_IDX] << 8 + | packet[MGMLIS3MDL::Y_LOWBYTE_IDX] ; + int16_t mgmMeasurementRawZ = packet[MGMLIS3MDL::Z_HIGHBYTE_IDX] << 8 + | packet[MGMLIS3MDL::Z_LOWBYTE_IDX] ; + + /* Target value in microtesla */ + float mgmX = static_cast(mgmMeasurementRawX) * sensitivityFactor + * MGMLIS3MDL::GAUSS_TO_MICROTESLA_FACTOR; + float mgmY = static_cast(mgmMeasurementRawY) * sensitivityFactor + * MGMLIS3MDL::GAUSS_TO_MICROTESLA_FACTOR; + float mgmZ = static_cast(mgmMeasurementRawZ) * sensitivityFactor + * MGMLIS3MDL::GAUSS_TO_MICROTESLA_FACTOR; + +#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1 + if(debugDivider->checkAndIncrement()) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "MGMHandlerLIS3: Magnetic field strength in" + " microtesla:" << std::endl; + sif::info << "X: " << mgmX << " uT" << std::endl; + sif::info << "Y: " << mgmY << " uT" << std::endl; + sif::info << "Z: " << mgmZ << " uT" << std::endl; +#else + sif::printInfo("MGMHandlerLIS3: Magnetic field strength in microtesla:\n"); + sif::printInfo("X: %f uT\n", mgmX); + sif::printInfo("Y: %f uT\n", mgmY); + sif::printInfo("Z: %f uT\n", mgmZ); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 0 */ + } +#endif /* OBSW_VERBOSE_LEVEL >= 1 */ + PoolReadGuard readHelper(&dataset); + if(readHelper.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if(std::abs(mgmX) < absLimitX) { + dataset.fieldStrengthX = mgmX; + dataset.fieldStrengthX.setValid(true); + } + else { + dataset.fieldStrengthX.setValid(false); + } + + if(std::abs(mgmY) < absLimitY) { + dataset.fieldStrengthY = mgmY; + dataset.fieldStrengthY.setValid(true); + } + else { + dataset.fieldStrengthY.setValid(false); + } + + if(std::abs(mgmZ) < absLimitZ) { + dataset.fieldStrengthZ = mgmZ; + dataset.fieldStrengthZ.setValid(true); + } + else { + dataset.fieldStrengthZ.setValid(false); + } + } + break; + } + + case MGMLIS3MDL::READ_TEMPERATURE: { + int16_t tempValueRaw = packet[2] << 8 | packet[1]; + float tempValue = 25.0 + ((static_cast(tempValueRaw)) / 8.0); + #if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1 + if(debugDivider->check()) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "MGMHandlerLIS3: Temperature: " << tempValue << " C" << + std::endl; +#else + sif::printInfo("MGMHandlerLIS3: Temperature: %f C\n"); +#endif + } +#endif + ReturnValue_t result = dataset.read(); + if(result == HasReturnvaluesIF::RETURN_OK) { + dataset.temperature = tempValue; + dataset.commit(); + } + break; + } + + default: { + return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY; + } + + } + return RETURN_OK; +} + +MGMLIS3MDL::Sensitivies MgmLIS3MDLHandler::getSensitivity(uint8_t ctrlRegister2) { + bool fs0Set = ctrlRegister2 & (1 << MGMLIS3MDL::FSO); // Checks if FS0 bit is set + bool fs1Set = ctrlRegister2 & (1 << MGMLIS3MDL::FS1); // Checks if FS1 bit is set + + if (fs0Set && fs1Set) + return MGMLIS3MDL::Sensitivies::GAUSS_16; + else if (!fs0Set && fs1Set) + return MGMLIS3MDL::Sensitivies::GAUSS_12; + else if (fs0Set && !fs1Set) + return MGMLIS3MDL::Sensitivies::GAUSS_8; + else + return MGMLIS3MDL::Sensitivies::GAUSS_4; +} + +float MgmLIS3MDLHandler::getSensitivityFactor(MGMLIS3MDL::Sensitivies sens) { + switch(sens) { + case(MGMLIS3MDL::GAUSS_4): { + return MGMLIS3MDL::FIELD_LSB_PER_GAUSS_4_SENS; + } + case(MGMLIS3MDL::GAUSS_8): { + return MGMLIS3MDL::FIELD_LSB_PER_GAUSS_8_SENS; + } + case(MGMLIS3MDL::GAUSS_12): { + return MGMLIS3MDL::FIELD_LSB_PER_GAUSS_12_SENS; + } + case(MGMLIS3MDL::GAUSS_16): { + return MGMLIS3MDL::FIELD_LSB_PER_GAUSS_16_SENS; + } + default: { + // Should never happen + return MGMLIS3MDL::FIELD_LSB_PER_GAUSS_4_SENS; + } + } +} + + +ReturnValue_t MgmLIS3MDLHandler::enableTemperatureSensor( + const uint8_t *commandData, size_t commandDataLen) { + triggerEvent(CHANGE_OF_SETUP_PARAMETER); + uint32_t size = 2; + commandBuffer[0] = writeCommand(MGMLIS3MDL::CTRL_REG1); + if (commandDataLen > 1) { + return INVALID_NUMBER_OR_LENGTH_OF_PARAMETERS; + } + switch (*commandData) { + case (MGMLIS3MDL::ON): { + commandBuffer[1] = registers[0] | (1 << 7); + break; + } + case (MGMLIS3MDL::OFF): { + commandBuffer[1] = registers[0] & ~(1 << 7); + break; + } + default: + return INVALID_COMMAND_PARAMETER; + } + registers[0] = commandBuffer[1]; + + rawPacket = commandBuffer; + rawPacketLen = size; + + return RETURN_OK; +} + +ReturnValue_t MgmLIS3MDLHandler::setOperatingMode(const uint8_t *commandData, + size_t commandDataLen) { + triggerEvent(CHANGE_OF_SETUP_PARAMETER); + if (commandDataLen != 1) { + return INVALID_NUMBER_OR_LENGTH_OF_PARAMETERS; + } + + switch (commandData[0]) { + case MGMLIS3MDL::LOW: + registers[0] = (registers[0] & (~(1 << MGMLIS3MDL::OM1))) & (~(1 << MGMLIS3MDL::OM0)); + registers[3] = (registers[3] & (~(1 << MGMLIS3MDL::OMZ1))) & (~(1 << MGMLIS3MDL::OMZ0)); + break; + case MGMLIS3MDL::MEDIUM: + registers[0] = (registers[0] & (~(1 << MGMLIS3MDL::OM1))) | (1 << MGMLIS3MDL::OM0); + registers[3] = (registers[3] & (~(1 << MGMLIS3MDL::OMZ1))) | (1 << MGMLIS3MDL::OMZ0); + break; + + case MGMLIS3MDL::HIGH: + registers[0] = (registers[0] | (1 << MGMLIS3MDL::OM1)) & (~(1 << MGMLIS3MDL::OM0)); + registers[3] = (registers[3] | (1 << MGMLIS3MDL::OMZ1)) & (~(1 << MGMLIS3MDL::OMZ0)); + break; + + case MGMLIS3MDL::ULTRA: + registers[0] = (registers[0] | (1 << MGMLIS3MDL::OM1)) | (1 << MGMLIS3MDL::OM0); + registers[3] = (registers[3] | (1 << MGMLIS3MDL::OMZ1)) | (1 << MGMLIS3MDL::OMZ0); + break; + default: + break; + } + + return prepareCtrlRegisterWrite(); +} + +void MgmLIS3MDLHandler::fillCommandAndReplyMap() { + insertInCommandAndReplyMap(MGMLIS3MDL::READ_CONFIG_AND_DATA, 1, &dataset); + insertInCommandAndReplyMap(MGMLIS3MDL::READ_TEMPERATURE, 1); + insertInCommandAndReplyMap(MGMLIS3MDL::SETUP_MGM, 1); + insertInCommandAndReplyMap(MGMLIS3MDL::IDENTIFY_DEVICE, 1); + insertInCommandAndReplyMap(MGMLIS3MDL::TEMP_SENSOR_ENABLE, 1); + insertInCommandAndReplyMap(MGMLIS3MDL::ACCURACY_OP_MODE_SET, 1); +} + +void MgmLIS3MDLHandler::setToGoToNormalMode(bool enable) { + this->goToNormalMode = enable; +} + +ReturnValue_t MgmLIS3MDLHandler::prepareCtrlRegisterWrite() { + commandBuffer[0] = writeCommand(MGMLIS3MDL::CTRL_REG1, true); + + for (size_t i = 0; i < MGMLIS3MDL::NR_OF_CTRL_REGISTERS; i++) { + commandBuffer[i + 1] = registers[i]; + } + rawPacket = commandBuffer; + rawPacketLen = MGMLIS3MDL::NR_OF_CTRL_REGISTERS + 1; + + // We dont have to check if this is working because we just did i + return RETURN_OK; +} + +void MgmLIS3MDLHandler::doTransition(Mode_t modeFrom, Submode_t subModeFrom) { + +} + +uint32_t MgmLIS3MDLHandler::getTransitionDelayMs(Mode_t from, Mode_t to) { + return transitionDelay; +} + +void MgmLIS3MDLHandler::modeChanged(void) { + internalState = InternalState::STATE_NONE; +} + +ReturnValue_t MgmLIS3MDLHandler::initializeLocalDataPool( + localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { + localDataPoolMap.emplace(MGMLIS3MDL::FIELD_STRENGTH_X, + new PoolEntry({0.0})); + localDataPoolMap.emplace(MGMLIS3MDL::FIELD_STRENGTH_Y, + new PoolEntry({0.0})); + localDataPoolMap.emplace(MGMLIS3MDL::FIELD_STRENGTH_Z, + new PoolEntry({0.0})); + localDataPoolMap.emplace(MGMLIS3MDL::TEMPERATURE_CELCIUS, + new PoolEntry({0.0})); + return HasReturnvaluesIF::RETURN_OK; +} + +void MgmLIS3MDLHandler::setAbsoluteLimits(float xLimit, float yLimit, float zLimit) { + this->absLimitX = xLimit; + this->absLimitY = yLimit; + this->absLimitZ = zLimit; +} diff --git a/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h b/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h new file mode 100644 index 00000000..6bf89a49 --- /dev/null +++ b/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.h @@ -0,0 +1,186 @@ +#ifndef MISSION_DEVICES_MGMLIS3MDLHANDLER_H_ +#define MISSION_DEVICES_MGMLIS3MDLHANDLER_H_ + +#include "fsfw/FSFW.h" +#include "events/subsystemIdRanges.h" +#include "devicedefinitions/MgmLIS3HandlerDefs.h" + +#include "fsfw/devicehandlers/DeviceHandlerBase.h" + +class PeriodicOperationDivider; + +/** + * @brief Device handler object for the LIS3MDL 3-axis magnetometer + * by STMicroeletronics + * @details + * Datasheet can be found online by googling LIS3MDL. + * Flight manual: + * https://egit.irs.uni-stuttgart.de/redmine/projects/eive-flight-manual/wiki/LIS3MDL_MGM + * @author L. Loidold, R. Mueller + */ +class MgmLIS3MDLHandler: public DeviceHandlerBase { +public: + enum class CommunicationStep { + DATA, + TEMPERATURE + }; + + static const uint8_t INTERFACE_ID = CLASS_ID::MGM_LIS3MDL; + static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::MGM_LIS3MDL; + //Notifies a command to change the setup parameters + static const Event CHANGE_OF_SETUP_PARAMETER = MAKE_EVENT(0, severity::LOW); + + MgmLIS3MDLHandler(uint32_t objectId, object_id_t deviceCommunication, CookieIF* comCookie, + uint32_t transitionDelay); + virtual ~MgmLIS3MDLHandler(); + + /** + * Set the absolute limit for the values on the axis in microtesla. The dataset values will + * be marked as invalid if that limit is exceeded + * @param xLimit + * @param yLimit + * @param zLimit + */ + void setAbsoluteLimits(float xLimit, float yLimit, float zLimit); + void setToGoToNormalMode(bool enable); + +protected: + + /** DeviceHandlerBase overrides */ + void doShutDown() override; + void doStartUp() override; + void doTransition(Mode_t modeFrom, Submode_t subModeFrom) override; + virtual uint32_t getTransitionDelayMs(Mode_t from, Mode_t to) override; + ReturnValue_t buildCommandFromCommand( + DeviceCommandId_t deviceCommand, const uint8_t *commandData, + size_t commandDataLen) override; + ReturnValue_t buildTransitionDeviceCommand( + DeviceCommandId_t *id) override; + ReturnValue_t buildNormalDeviceCommand( + DeviceCommandId_t *id) override; + ReturnValue_t scanForReply(const uint8_t *start, size_t len, + DeviceCommandId_t *foundId, size_t *foundLen) override; + /** + * This implementation is tailored towards space applications and will flag values larger + * than 100 microtesla on X,Y and 150 microtesla on Z as invalid + * @param id + * @param packet + * @return + */ + virtual ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, + const uint8_t *packet) override; + void fillCommandAndReplyMap() override; + void modeChanged(void) override; + ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, + LocalDataPoolManager &poolManager) override; + +private: + MGMLIS3MDL::MgmPrimaryDataset dataset; + //Length a single command SPI answer + static const uint8_t SINGLE_COMMAND_ANSWER_LEN = 2; + + uint32_t transitionDelay; + // Single SPI command has 2 bytes, first for adress, second for content + size_t singleComandSize = 2; + // Has the size for all adresses of the lis3mdl + the continous write bit + uint8_t commandBuffer[MGMLIS3MDL::NR_OF_DATA_AND_CFG_REGISTERS + 1]; + + float absLimitX = 100; + float absLimitY = 100; + float absLimitZ = 150; + + /** + * We want to save the registers we set, so we dont have to read the + * registers when we want to change something. + * --> everytime we change set a register we have to save it + */ + uint8_t registers[MGMLIS3MDL::NR_OF_CTRL_REGISTERS]; + + uint8_t statusRegister = 0; + bool goToNormalMode = false; + + enum class InternalState { + STATE_NONE, + STATE_FIRST_CONTACT, + STATE_SETUP, + STATE_CHECK_REGISTERS, + STATE_NORMAL + }; + + InternalState internalState = InternalState::STATE_NONE; + CommunicationStep communicationStep = CommunicationStep::DATA; + bool commandExecuted = false; + + /*------------------------------------------------------------------------*/ + /* Device specific commands and variables */ + /*------------------------------------------------------------------------*/ + /** + * Sets the read bit for the command + * @param single command to set the read-bit at + * @param boolean to select a continuous read bit, default = false + */ + uint8_t readCommand(uint8_t command, bool continuousCom = false); + + /** + * Sets the write bit for the command + * @param single command to set the write-bit at + * @param boolean to select a continuous write bit, default = false + */ + uint8_t writeCommand(uint8_t command, bool continuousCom = false); + + /** + * This Method gets the full scale for the measurement range + * e.g.: +- 4 gauss. See p.25 datasheet. + * @return The ReturnValue does not contain the sign of the value + */ + MGMLIS3MDL::Sensitivies getSensitivity(uint8_t ctrlReg2); + + /** + * The 16 bit value needs to be multiplied with a sensitivity factor + * which depends on the sensitivity configuration + * + * @param sens Configured sensitivity of the LIS3 device + * @return Multiplication factor to get the sensor value from raw data. + */ + float getSensitivityFactor(MGMLIS3MDL::Sensitivies sens); + + /** + * This Command detects the device ID + */ + ReturnValue_t identifyDevice(); + + virtual void setupMgm(); + + /*------------------------------------------------------------------------*/ + /* Non normal commands */ + /*------------------------------------------------------------------------*/ + /** + * Enables/Disables the integrated Temperaturesensor + * @param commandData On or Off + * @param length of the commandData: has to be 1 + */ + virtual ReturnValue_t enableTemperatureSensor(const uint8_t *commandData, + size_t commandDataLen); + + /** + * Sets the accuracy of the measurement of the axis. The noise is changing. + * @param commandData LOW, MEDIUM, HIGH, ULTRA + * @param length of the command, has to be 1 + */ + virtual ReturnValue_t setOperatingMode(const uint8_t *commandData, + size_t commandDataLen); + + /** + * We always update all registers together, so this method updates + * the rawpacket and rawpacketLen, so we just manipulate the local + * saved register + * + */ + ReturnValue_t prepareCtrlRegisterWrite(); + +#if FSFW_HAL_LIS3MDL_MGM_DEBUG == 1 + PeriodicOperationDivider* debugDivider; +#endif +}; + +#endif /* MISSION_DEVICES_MGMLIS3MDLHANDLER_H_ */ diff --git a/hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp b/hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp new file mode 100644 index 00000000..20cf95d2 --- /dev/null +++ b/hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp @@ -0,0 +1,363 @@ +#include "MgmRM3100Handler.h" + +#include "fsfw/datapool/PoolReadGuard.h" +#include "fsfw/globalfunctions/bitutility.h" +#include "fsfw/devicehandlers/DeviceHandlerMessage.h" +#include "fsfw/objectmanager/SystemObjectIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" + + +MgmRM3100Handler::MgmRM3100Handler(object_id_t objectId, + object_id_t deviceCommunication, CookieIF* comCookie, uint32_t transitionDelay): + DeviceHandlerBase(objectId, deviceCommunication, comCookie), + primaryDataset(this), transitionDelay(transitionDelay) { +#if FSFW_HAL_RM3100_MGM_DEBUG == 1 + debugDivider = new PeriodicOperationDivider(3); +#endif +} + +MgmRM3100Handler::~MgmRM3100Handler() {} + +void MgmRM3100Handler::doStartUp() { + switch(internalState) { + case(InternalState::NONE): { + internalState = InternalState::CONFIGURE_CMM; + break; + } + case(InternalState::CONFIGURE_CMM): { + internalState = InternalState::READ_CMM; + break; + } + case(InternalState::READ_CMM): { + if(commandExecuted) { + internalState = InternalState::STATE_CONFIGURE_TMRC; + } + break; + } + case(InternalState::STATE_CONFIGURE_TMRC): { + if(commandExecuted) { + internalState = InternalState::STATE_READ_TMRC; + } + break; + } + case(InternalState::STATE_READ_TMRC): { + if(commandExecuted) { + internalState = InternalState::NORMAL; + if(goToNormalModeAtStartup) { + setMode(MODE_NORMAL); + } + else { + setMode(_MODE_TO_ON); + } + } + break; + } + default: { + break; + } + } +} + +void MgmRM3100Handler::doShutDown() { + setMode(_MODE_POWER_DOWN); +} + +ReturnValue_t MgmRM3100Handler::buildTransitionDeviceCommand( + DeviceCommandId_t *id) { + size_t commandLen = 0; + switch(internalState) { + case(InternalState::NONE): + case(InternalState::NORMAL): { + return NOTHING_TO_SEND; + } + case(InternalState::CONFIGURE_CMM): { + *id = RM3100::CONFIGURE_CMM; + break; + } + case(InternalState::READ_CMM): { + *id = RM3100::READ_CMM; + break; + } + case(InternalState::STATE_CONFIGURE_TMRC): { + commandBuffer[0] = RM3100::TMRC_DEFAULT_VALUE; + commandLen = 1; + *id = RM3100::CONFIGURE_TMRC; + break; + } + case(InternalState::STATE_READ_TMRC): { + *id = RM3100::READ_TMRC; + break; + } + default: + // Might be a configuration error + sif::warning << "MgmRM3100Handler::buildTransitionDeviceCommand: Unknown internal state!" << + std::endl; + return HasReturnvaluesIF::RETURN_OK; + } + + return buildCommandFromCommand(*id, commandBuffer, commandLen); +} + +ReturnValue_t MgmRM3100Handler::buildCommandFromCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData, size_t commandDataLen) { + switch(deviceCommand) { + case(RM3100::CONFIGURE_CMM): { + commandBuffer[0] = RM3100::CMM_REGISTER; + commandBuffer[1] = RM3100::CMM_VALUE; + rawPacket = commandBuffer; + rawPacketLen = 2; + break; + } + case(RM3100::READ_CMM): { + commandBuffer[0] = RM3100::CMM_REGISTER | RM3100::READ_MASK; + commandBuffer[1] = 0; + rawPacket = commandBuffer; + rawPacketLen = 2; + break; + } + case(RM3100::CONFIGURE_TMRC): { + return handleTmrcConfigCommand(deviceCommand, commandData, commandDataLen); + } + case(RM3100::READ_TMRC): { + commandBuffer[0] = RM3100::TMRC_REGISTER | RM3100::READ_MASK; + commandBuffer[1] = 0; + rawPacket = commandBuffer; + rawPacketLen = 2; + break; + } + case(RM3100::CONFIGURE_CYCLE_COUNT): { + return handleCycleCountConfigCommand(deviceCommand, commandData, commandDataLen); + } + case(RM3100::READ_CYCLE_COUNT): { + commandBuffer[0] = RM3100::CYCLE_COUNT_START_REGISTER | RM3100::READ_MASK; + std::memset(commandBuffer + 1, 0, 6); + rawPacket = commandBuffer; + rawPacketLen = 7; + break; + } + case(RM3100::READ_DATA): { + commandBuffer[0] = RM3100::MEASUREMENT_REG_START | RM3100::READ_MASK; + std::memset(commandBuffer + 1, 0, 9); + rawPacketLen = 10; + break; + } + default: + return DeviceHandlerIF::COMMAND_NOT_IMPLEMENTED; + } + return RETURN_OK; +} + +ReturnValue_t MgmRM3100Handler::buildNormalDeviceCommand( + DeviceCommandId_t *id) { + *id = RM3100::READ_DATA; + return buildCommandFromCommand(*id, nullptr, 0); +} + +ReturnValue_t MgmRM3100Handler::scanForReply(const uint8_t *start, + size_t len, DeviceCommandId_t *foundId, + size_t *foundLen) { + + // For SPI, ID will always be the one of the last sent command + *foundId = this->getPendingCommand(); + *foundLen = len; + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t MgmRM3100Handler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) { + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + switch(id) { + case(RM3100::CONFIGURE_CMM): + case(RM3100::CONFIGURE_CYCLE_COUNT): + case(RM3100::CONFIGURE_TMRC): { + // We can only check whether write was successful with read operation + if(mode == _MODE_START_UP) { + commandExecuted = true; + } + break; + } + case(RM3100::READ_CMM): { + uint8_t cmmValue = packet[1]; + // We clear the seventh bit in any case + // because this one is zero sometimes for some reason + bitutil::bitClear(&cmmValue, 6); + if(cmmValue == cmmRegValue and internalState == InternalState::READ_CMM) { + commandExecuted = true; + } + else { + // Attempt reconfiguration + internalState = InternalState::CONFIGURE_CMM; + return DeviceHandlerIF::DEVICE_REPLY_INVALID; + } + break; + } + case(RM3100::READ_TMRC): { + if(packet[1] == tmrcRegValue) { + commandExecuted = true; + // Reading TMRC was commanded. Trigger event to inform ground + if(mode != _MODE_START_UP) { + triggerEvent(tmrcSet, tmrcRegValue, 0); + } + } + else { + // Attempt reconfiguration + internalState = InternalState::STATE_CONFIGURE_TMRC; + return DeviceHandlerIF::DEVICE_REPLY_INVALID; + } + break; + } + case(RM3100::READ_CYCLE_COUNT): { + uint16_t cycleCountX = packet[1] << 8 | packet[2]; + uint16_t cycleCountY = packet[3] << 8 | packet[4]; + uint16_t cycleCountZ = packet[5] << 8 | packet[6]; + if(cycleCountX != cycleCountRegValueX or cycleCountY != cycleCountRegValueY or + cycleCountZ != cycleCountRegValueZ) { + return DeviceHandlerIF::DEVICE_REPLY_INVALID; + } + // Reading TMRC was commanded. Trigger event to inform ground + if(mode != _MODE_START_UP) { + uint32_t eventParam1 = (cycleCountX << 16) | cycleCountY; + triggerEvent(cycleCountersSet, eventParam1, cycleCountZ); + } + break; + } + case(RM3100::READ_DATA): { + result = handleDataReadout(packet); + break; + } + default: + return DeviceHandlerIF::UNKNOWN_DEVICE_REPLY; + } + + return result; +} + +ReturnValue_t MgmRM3100Handler::handleCycleCountConfigCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData, size_t commandDataLen) { + if(commandData == nullptr) { + return DeviceHandlerIF::INVALID_COMMAND_PARAMETER; + } + + // Set cycle count + if(commandDataLen == 2) { + handleCycleCommand(true, commandData, commandDataLen); + } + else if(commandDataLen == 6) { + handleCycleCommand(false, commandData, commandDataLen); + } + else { + return DeviceHandlerIF::INVALID_COMMAND_PARAMETER; + } + + commandBuffer[0] = RM3100::CYCLE_COUNT_VALUE; + std::memcpy(commandBuffer + 1, &cycleCountRegValueX, 2); + std::memcpy(commandBuffer + 3, &cycleCountRegValueY, 2); + std::memcpy(commandBuffer + 5, &cycleCountRegValueZ, 2); + rawPacketLen = 7; + rawPacket = commandBuffer; + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t MgmRM3100Handler::handleCycleCommand(bool oneCycleValue, + const uint8_t *commandData, size_t commandDataLen) { + RM3100::CycleCountCommand command(oneCycleValue); + ReturnValue_t result = command.deSerialize(&commandData, &commandDataLen, + SerializeIF::Endianness::BIG); + if(result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + + // Data sheet p.30 "while noise limits the useful upper range to ~400 cycle counts." + if(command.cycleCountX > 450 ) { + return DeviceHandlerIF::INVALID_COMMAND_PARAMETER; + } + + if(not oneCycleValue and (command.cycleCountY > 450 or command.cycleCountZ > 450)) { + return DeviceHandlerIF::INVALID_COMMAND_PARAMETER; + } + + cycleCountRegValueX = command.cycleCountX; + cycleCountRegValueY = command.cycleCountY; + cycleCountRegValueZ = command.cycleCountZ; + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t MgmRM3100Handler::handleTmrcConfigCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData, size_t commandDataLen) { + if(commandData == nullptr or commandDataLen != 1) { + return DeviceHandlerIF::INVALID_COMMAND_PARAMETER; + } + + commandBuffer[0] = RM3100::TMRC_REGISTER; + commandBuffer[1] = commandData[0]; + tmrcRegValue = commandData[0]; + rawPacketLen = 2; + rawPacket = commandBuffer; + return HasReturnvaluesIF::RETURN_OK; +} + +void MgmRM3100Handler::fillCommandAndReplyMap() { + insertInCommandAndReplyMap(RM3100::CONFIGURE_CMM, 3); + insertInCommandAndReplyMap(RM3100::READ_CMM, 3); + + insertInCommandAndReplyMap(RM3100::CONFIGURE_TMRC, 3); + insertInCommandAndReplyMap(RM3100::READ_TMRC, 3); + + insertInCommandAndReplyMap(RM3100::CONFIGURE_CYCLE_COUNT, 3); + insertInCommandAndReplyMap(RM3100::READ_CYCLE_COUNT, 3); + + insertInCommandAndReplyMap(RM3100::READ_DATA, 3, &primaryDataset); +} + +void MgmRM3100Handler::modeChanged(void) { + internalState = InternalState::NONE; +} + +ReturnValue_t MgmRM3100Handler::initializeLocalDataPool( + localpool::DataPool &localDataPoolMap, LocalDataPoolManager &poolManager) { + localDataPoolMap.emplace(RM3100::FIELD_STRENGTH_X, new PoolEntry({0.0})); + localDataPoolMap.emplace(RM3100::FIELD_STRENGTH_Y, new PoolEntry({0.0})); + localDataPoolMap.emplace(RM3100::FIELD_STRENGTH_Z, new PoolEntry({0.0})); + return HasReturnvaluesIF::RETURN_OK; +} + +uint32_t MgmRM3100Handler::getTransitionDelayMs(Mode_t from, Mode_t to) { + return this->transitionDelay; +} + +void MgmRM3100Handler::setToGoToNormalMode(bool enable) { + goToNormalModeAtStartup = enable; +} + +ReturnValue_t MgmRM3100Handler::handleDataReadout(const uint8_t *packet) { + // Analyze data here. The sensor generates 24 bit signed values so we need to do some bitshift + // trickery here to calculate the raw values first + int32_t fieldStrengthRawX = ((packet[1] << 24) | (packet[2] << 16) | (packet[3] << 8)) >> 8; + int32_t fieldStrengthRawY = ((packet[4] << 24) | (packet[5] << 16) | (packet[6] << 8)) >> 8; + int32_t fieldStrengthRawZ = ((packet[7] << 24) | (packet[8] << 16) | (packet[3] << 8)) >> 8; + + // Now scale to physical value in microtesla + float fieldStrengthX = fieldStrengthRawX * scaleFactorX; + float fieldStrengthY = fieldStrengthRawY * scaleFactorX; + float fieldStrengthZ = fieldStrengthRawZ * scaleFactorX; + +#if FSFW_HAL_RM3100_MGM_DEBUG == 1 + if(debugDivider->checkAndIncrement()) { + sif::info << "MgmRM3100Handler: Magnetic field strength in" + " microtesla:" << std::endl; + /* Set terminal to utf-8 if there is an issue with micro printout. */ + sif::info << "X: " << fieldStrengthX << " uT" << std::endl; + sif::info << "Y: " << fieldStrengthY << " uT" << std::endl; + sif::info << "Z: " << fieldStrengthZ << " uT" << std::endl; + } +#endif + + // TODO: Sanity check on values? + PoolReadGuard readGuard(&primaryDataset); + if(readGuard.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + primaryDataset.fieldStrengthX = fieldStrengthX; + primaryDataset.fieldStrengthY = fieldStrengthY; + primaryDataset.fieldStrengthZ = fieldStrengthZ; + primaryDataset.setValidity(true, true); + } + return RETURN_OK; +} diff --git a/hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.h b/hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.h new file mode 100644 index 00000000..1ba680cb --- /dev/null +++ b/hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.h @@ -0,0 +1,111 @@ +#ifndef MISSION_DEVICES_MGMRM3100HANDLER_H_ +#define MISSION_DEVICES_MGMRM3100HANDLER_H_ + +#include "fsfw/FSFW.h" +#include "devices/powerSwitcherList.h" +#include "devicedefinitions/MgmRM3100HandlerDefs.h" +#include "fsfw/devicehandlers/DeviceHandlerBase.h" + +#if FSFW_HAL_RM3100_MGM_DEBUG == 1 +#include "fsfw/globalfunctions/PeriodicOperationDivider.h" +#endif + +/** + * @brief Device Handler for the RM3100 geomagnetic magnetometer sensor + * (https://www.pnicorp.com/rm3100/) + * @details + * Flight manual: + * https://egit.irs.uni-stuttgart.de/redmine/projects/eive-flight-manual/wiki/RM3100_MGM + */ +class MgmRM3100Handler: public DeviceHandlerBase { +public: + static const uint8_t INTERFACE_ID = CLASS_ID::MGM_RM3100; + + //! [EXPORT] : [COMMENT] P1: TMRC value which was set, P2: 0 + static constexpr Event tmrcSet = event::makeEvent(SUBSYSTEM_ID::MGM_RM3100, + 0x00, severity::INFO); + + //! [EXPORT] : [COMMENT] Cycle counter set. P1: First two bytes new Cycle Count X + //! P1: Second two bytes new Cycle Count Y + //! P2: New cycle count Z + static constexpr Event cycleCountersSet = event::makeEvent( + SUBSYSTEM_ID::MGM_RM3100, 0x01, severity::INFO); + + MgmRM3100Handler(object_id_t objectId, object_id_t deviceCommunication, + CookieIF* comCookie, uint32_t transitionDelay); + virtual ~MgmRM3100Handler(); + + /** + * Configure device handler to go to normal mode after startup immediately + * @param enable + */ + void setToGoToNormalMode(bool enable); + +protected: + + /* DeviceHandlerBase overrides */ + ReturnValue_t buildTransitionDeviceCommand( + DeviceCommandId_t *id) override; + void doStartUp() override; + void doShutDown() override; + ReturnValue_t buildNormalDeviceCommand(DeviceCommandId_t *id) override; + ReturnValue_t buildCommandFromCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData, size_t commandDataLen) override; + ReturnValue_t scanForReply(const uint8_t *start, size_t len, + DeviceCommandId_t *foundId, size_t *foundLen) override; + ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, const uint8_t *packet) override; + + void fillCommandAndReplyMap() override; + void modeChanged(void) override; + virtual uint32_t getTransitionDelayMs(Mode_t from, Mode_t to) override; + ReturnValue_t initializeLocalDataPool(localpool::DataPool &localDataPoolMap, + LocalDataPoolManager &poolManager) override; + +private: + + enum class InternalState { + NONE, + CONFIGURE_CMM, + READ_CMM, + // The cycle count states are propably not going to be used because + // the default cycle count will be used. + STATE_CONFIGURE_CYCLE_COUNT, + STATE_READ_CYCLE_COUNT, + STATE_CONFIGURE_TMRC, + STATE_READ_TMRC, + NORMAL + }; + InternalState internalState = InternalState::NONE; + bool commandExecuted = false; + RM3100::Rm3100PrimaryDataset primaryDataset; + + uint8_t commandBuffer[10]; + uint8_t commandBufferLen = 0; + + uint8_t cmmRegValue = RM3100::CMM_VALUE; + uint8_t tmrcRegValue = RM3100::TMRC_DEFAULT_VALUE; + uint16_t cycleCountRegValueX = RM3100::CYCLE_COUNT_VALUE; + uint16_t cycleCountRegValueY = RM3100::CYCLE_COUNT_VALUE; + uint16_t cycleCountRegValueZ = RM3100::CYCLE_COUNT_VALUE; + float scaleFactorX = 1.0 / RM3100::DEFAULT_GAIN; + float scaleFactorY = 1.0 / RM3100::DEFAULT_GAIN; + float scaleFactorZ = 1.0 / RM3100::DEFAULT_GAIN; + + bool goToNormalModeAtStartup = false; + uint32_t transitionDelay; + + ReturnValue_t handleCycleCountConfigCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData,size_t commandDataLen); + ReturnValue_t handleCycleCommand(bool oneCycleValue, + const uint8_t *commandData, size_t commandDataLen); + + ReturnValue_t handleTmrcConfigCommand(DeviceCommandId_t deviceCommand, + const uint8_t *commandData,size_t commandDataLen); + + ReturnValue_t handleDataReadout(const uint8_t* packet); +#if FSFW_HAL_RM3100_MGM_DEBUG == 1 + PeriodicOperationDivider* debugDivider; +#endif +}; + +#endif /* MISSION_DEVICEHANDLING_MGMRM3100HANDLER_H_ */ From 59feaa4b5c272899e07915accc4c3b46d3f4d45d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 26 Sep 2021 22:38:47 +0200 Subject: [PATCH 279/389] moved class id and subsystem ID --- src/fsfw/events/fwSubsystemIdRanges.h | 2 ++ src/fsfw/returnvalues/FwClassIds.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/fsfw/events/fwSubsystemIdRanges.h b/src/fsfw/events/fwSubsystemIdRanges.h index 88dee9b4..08fb878d 100644 --- a/src/fsfw/events/fwSubsystemIdRanges.h +++ b/src/fsfw/events/fwSubsystemIdRanges.h @@ -29,6 +29,8 @@ enum: uint8_t { PUS_SERVICE_9 = 89, PUS_SERVICE_17 = 97, PUS_SERVICE_23 = 103, + MGM_LIS3MDL = 106, + MGM_RM3100 = 107, FW_SUBSYSTEM_ID_RANGE }; diff --git a/src/fsfw/returnvalues/FwClassIds.h b/src/fsfw/returnvalues/FwClassIds.h index af32f9a7..cdbf5657 100644 --- a/src/fsfw/returnvalues/FwClassIds.h +++ b/src/fsfw/returnvalues/FwClassIds.h @@ -76,6 +76,8 @@ enum: uint8_t { HAL_UART, //HURT HAL_I2C, //HI2C HAL_GPIO, //HGIO + MGM_LIS3MDL, //MGMLIS3 + MGM_RM3100, //MGMRM3100 FW_CLASS_ID_COUNT // [EXPORT] : [END] }; From 423f7c828189701230fe7161a680590e37bf40fb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 26 Sep 2021 22:45:32 +0200 Subject: [PATCH 280/389] missing include and printer compatbility fixes --- .../devicehandlers/GyroL3GD20Handler.cpp | 4 +++- .../devicehandlers/MgmLIS3MDLHandler.cpp | 2 ++ .../devicehandlers/MgmRM3100Handler.cpp | 19 ++++++++++++++++--- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.cpp b/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.cpp index 70ba49eb..d27351d7 100644 --- a/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.cpp +++ b/hal/src/fsfw_hal/devicehandlers/GyroL3GD20Handler.cpp @@ -1,7 +1,9 @@ -#include "fsfw_hal/devicehandlers/GyroL3GD20Handler.h" +#include "GyroL3GD20Handler.h" #include "fsfw/datapool/PoolReadGuard.h" +#include + GyroHandlerL3GD20H::GyroHandlerL3GD20H(object_id_t objectId, object_id_t deviceCommunication, CookieIF *comCookie, uint32_t transitionDelayMs): DeviceHandlerBase(objectId, deviceCommunication, comCookie), diff --git a/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp b/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp index 891d6fdc..804e83f2 100644 --- a/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp +++ b/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp @@ -5,6 +5,8 @@ #include "fsfw/globalfunctions/PeriodicOperationDivider.h" #endif +#include + MgmLIS3MDLHandler::MgmLIS3MDLHandler(object_id_t objectId, object_id_t deviceCommunication, CookieIF* comCookie, uint32_t transitionDelay): DeviceHandlerBase(objectId, deviceCommunication, comCookie), diff --git a/hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp b/hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp index 20cf95d2..124eebbc 100644 --- a/hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp +++ b/hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp @@ -89,9 +89,16 @@ ReturnValue_t MgmRM3100Handler::buildTransitionDeviceCommand( break; } default: +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 // Might be a configuration error - sif::warning << "MgmRM3100Handler::buildTransitionDeviceCommand: Unknown internal state!" << - std::endl; + sif::warning << "MgmRM3100Handler::buildTransitionDeviceCommand: " + "Unknown internal state" << std::endl; +#else + sif::printWarning("MgmRM3100Handler::buildTransitionDeviceCommand: " + "Unknown internal state\n"); +#endif +#endif return HasReturnvaluesIF::RETURN_OK; } @@ -342,12 +349,18 @@ ReturnValue_t MgmRM3100Handler::handleDataReadout(const uint8_t *packet) { #if FSFW_HAL_RM3100_MGM_DEBUG == 1 if(debugDivider->checkAndIncrement()) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 sif::info << "MgmRM3100Handler: Magnetic field strength in" " microtesla:" << std::endl; - /* Set terminal to utf-8 if there is an issue with micro printout. */ sif::info << "X: " << fieldStrengthX << " uT" << std::endl; sif::info << "Y: " << fieldStrengthY << " uT" << std::endl; sif::info << "Z: " << fieldStrengthZ << " uT" << std::endl; +#else + sif::printInfo("MgmRM3100Handler: Magnetic field strength in microtesla:\n"); + sif::printInfo("X: %f uT\n", fieldStrengthX); + sif::printInfo("Y: %f uT\n", fieldStrengthY); + sif::printInfo("Z: %f uT\n", fieldStrengthZ); +#endif } #endif From 85c04dee2340da305684a347c01c391ef41dfcc7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 27 Sep 2021 11:12:38 +0200 Subject: [PATCH 281/389] increase limit of packets stored --- src/fsfw/tmtcservices/TmTcBridge.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsfw/tmtcservices/TmTcBridge.h b/src/fsfw/tmtcservices/TmTcBridge.h index d3689d19..4980caff 100644 --- a/src/fsfw/tmtcservices/TmTcBridge.h +++ b/src/fsfw/tmtcservices/TmTcBridge.h @@ -19,7 +19,7 @@ class TmTcBridge : public AcceptsTelemetryIF, public: static constexpr uint8_t TMTC_RECEPTION_QUEUE_DEPTH = 20; static constexpr uint8_t LIMIT_STORED_DATA_SENT_PER_CYCLE = 15; - static constexpr uint8_t LIMIT_DOWNLINK_PACKETS_STORED = 20; + static constexpr uint8_t LIMIT_DOWNLINK_PACKETS_STORED = 200; static constexpr uint8_t DEFAULT_STORED_DATA_SENT_PER_CYCLE = 5; static constexpr uint8_t DEFAULT_DOWNLINK_PACKETS_STORED = 10; From 42df77ff32a147a33c0c90ac154377dc414b7b6e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 27 Sep 2021 11:16:27 +0200 Subject: [PATCH 282/389] check for empty PST and return appropriate returnvalue --- src/fsfw/returnvalues/FwClassIds.h | 2 ++ src/fsfw/tasks/FixedSlotSequence.cpp | 6 +++--- src/fsfw/tasks/FixedSlotSequence.h | 4 +++- src/fsfw/tasks/FixedTimeslotTaskIF.h | 5 ++++- src/fsfw/tasks/Typedef.h | 9 ++++++--- 5 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/fsfw/returnvalues/FwClassIds.h b/src/fsfw/returnvalues/FwClassIds.h index af32f9a7..ce093b09 100644 --- a/src/fsfw/returnvalues/FwClassIds.h +++ b/src/fsfw/returnvalues/FwClassIds.h @@ -72,10 +72,12 @@ enum: uint8_t { PUS_SERVICE_3, //PUS3 PUS_SERVICE_9, //PUS9 FILE_SYSTEM, //FILS + LINUX_OSAL, //UXOS HAL_SPI, //HSPI HAL_UART, //HURT HAL_I2C, //HI2C HAL_GPIO, //HGIO + FIXED_SLOT_TASK_IF, //FTIF FW_CLASS_ID_COUNT // [EXPORT] : [END] }; diff --git a/src/fsfw/tasks/FixedSlotSequence.cpp b/src/fsfw/tasks/FixedSlotSequence.cpp index 2e5384b7..5e896af4 100644 --- a/src/fsfw/tasks/FixedSlotSequence.cpp +++ b/src/fsfw/tasks/FixedSlotSequence.cpp @@ -1,4 +1,5 @@ #include "fsfw/tasks/FixedSlotSequence.h" +#include "fsfw/tasks/FixedTimeslotTaskIF.h" #include "fsfw/serviceinterface/ServiceInterface.h" #include @@ -92,10 +93,9 @@ void FixedSlotSequence::addSlot(object_id_t componentId, uint32_t slotTimeMs, ReturnValue_t FixedSlotSequence::checkSequence() const { if(slotList.empty()) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "FixedSlotSequence::checkSequence:" - << " Slot list is empty!" << std::endl; + sif::warning << "FixedSlotSequence::checkSequence: Slot list is empty!" << std::endl; #endif - return HasReturnvaluesIF::RETURN_FAILED; + return FixedTimeslotTaskIF::SLOT_LIST_EMPTY; } if(customCheckFunction != nullptr) { diff --git a/src/fsfw/tasks/FixedSlotSequence.h b/src/fsfw/tasks/FixedSlotSequence.h index 077dd10b..7f49ea0c 100644 --- a/src/fsfw/tasks/FixedSlotSequence.h +++ b/src/fsfw/tasks/FixedSlotSequence.h @@ -2,7 +2,7 @@ #define FSFW_TASKS_FIXEDSLOTSEQUENCE_H_ #include "FixedSequenceSlot.h" -#include "../objectmanager/SystemObject.h" +#include "fsfw/objectmanager/SystemObject.h" #include @@ -136,6 +136,7 @@ public: * @details * Checks if timing is ok (must be ascending) and if all handlers were found. * @return + * - SLOT_LIST_EMPTY if the slot list is empty */ ReturnValue_t checkSequence() const; @@ -147,6 +148,7 @@ public: * The general check will be continued for now if the custom check function * fails but a diagnostic debug output will be given. * @param customCheckFunction + * */ void addCustomCheck(ReturnValue_t (*customCheckFunction)(const SlotList &)); diff --git a/src/fsfw/tasks/FixedTimeslotTaskIF.h b/src/fsfw/tasks/FixedTimeslotTaskIF.h index 2fc7e092..605239a4 100644 --- a/src/fsfw/tasks/FixedTimeslotTaskIF.h +++ b/src/fsfw/tasks/FixedTimeslotTaskIF.h @@ -2,7 +2,8 @@ #define FRAMEWORK_TASKS_FIXEDTIMESLOTTASKIF_H_ #include "PeriodicTaskIF.h" -#include "../objectmanager/ObjectManagerIF.h" +#include "fsfw/objectmanager/ObjectManagerIF.h" +#include "fsfw/returnvalues/FwClassIds.h" /** * @brief Following the same principle as the base class IF. @@ -12,6 +13,8 @@ class FixedTimeslotTaskIF : public PeriodicTaskIF { public: virtual ~FixedTimeslotTaskIF() {} + static constexpr ReturnValue_t SLOT_LIST_EMPTY = HasReturnvaluesIF::makeReturnCode( + CLASS_ID::FIXED_SLOT_TASK_IF, 0); /** * Add an object with a slot time and the execution step to the task. * The execution step will be passed to the object (e.g. as an operation diff --git a/src/fsfw/tasks/Typedef.h b/src/fsfw/tasks/Typedef.h index 55f6bda2..f2f9fe65 100644 --- a/src/fsfw/tasks/Typedef.h +++ b/src/fsfw/tasks/Typedef.h @@ -1,5 +1,8 @@ -#ifndef FRAMEWORK_TASKS_TYPEDEF_H_ -#define FRAMEWORK_TASKS_TYPEDEF_H_ +#ifndef FSFW_TASKS_TYPEDEF_H_ +#define FSFW_TASKS_TYPEDEF_H_ + +#include +#include typedef const char* TaskName; typedef uint32_t TaskPriority; @@ -7,4 +10,4 @@ typedef size_t TaskStackSize; typedef double TaskPeriod; typedef void (*TaskDeadlineMissedFunction)(); -#endif /* FRAMEWORK_TASKS_TYPEDEF_H_ */ +#endif /* FSFW_TASKS_TYPEDEF_H_ */ From 8ec35f158c0d445c72f4a5761dd1660c5725e7e0 Mon Sep 17 00:00:00 2001 From: Steffen Gaisser Date: Mon, 27 Sep 2021 19:57:42 +0200 Subject: [PATCH 283/389] Removed Timer and updated Countdown --- osal/linux/Timer.cpp | 45 ------------------------- osal/linux/Timer.h | 45 ------------------------- timemanager/Countdown.cpp | 36 ++++++++++++++------ timemanager/Countdown.h | 71 +++++++++++++++++++++++++++++++++------ 4 files changed, 86 insertions(+), 111 deletions(-) delete mode 100644 osal/linux/Timer.cpp delete mode 100644 osal/linux/Timer.h diff --git a/osal/linux/Timer.cpp b/osal/linux/Timer.cpp deleted file mode 100644 index fe0fbebb..00000000 --- a/osal/linux/Timer.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include "Timer.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" -#include - - -Timer::Timer() { - sigevent sigEvent; - sigEvent.sigev_notify = SIGEV_NONE; - sigEvent.sigev_signo = 0; - sigEvent.sigev_value.sival_ptr = &timerId; - int status = timer_create(CLOCK_MONOTONIC, &sigEvent, &timerId); - if(status!=0){ -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "Timer creation failed with: " << status << - " errno: " << errno << std::endl; -#endif - } -} - -Timer::~Timer() { - timer_delete(timerId); -} - -int Timer::setTimer(uint32_t intervalMs) { - itimerspec timer; - timer.it_value.tv_sec = intervalMs / 1000; - timer.it_value.tv_nsec = (intervalMs * 1000000) % (1000000000); - timer.it_interval.tv_sec = 0; - timer.it_interval.tv_nsec = 0; - return timer_settime(timerId, 0, &timer, NULL); -} - - -int Timer::getTimer(uint32_t* remainingTimeMs){ - itimerspec timer; - timer.it_value.tv_sec = 0; - timer.it_value.tv_nsec = 0; - timer.it_interval.tv_sec = 0; - timer.it_interval.tv_nsec = 0; - int status = timer_gettime(timerId, &timer); - - *remainingTimeMs = timer.it_value.tv_sec * 1000 + timer.it_value.tv_nsec / 1000000; - - return status; -} diff --git a/osal/linux/Timer.h b/osal/linux/Timer.h deleted file mode 100644 index f94bca59..00000000 --- a/osal/linux/Timer.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef FRAMEWORK_OSAL_LINUX_TIMER_H_ -#define FRAMEWORK_OSAL_LINUX_TIMER_H_ - -#include -#include -#include - -/** - * This class is a helper for the creation of a Clock Monotonic timer which does not trigger a signal - */ -class Timer { -public: - /** - * Creates the Timer sets the timerId Member - */ - Timer(); - /** - * Deletes the timer - * - * Careful! According to POSIX documentation: - * The treatment of any pending signal generated by the deleted timer is unspecified. - */ - virtual ~Timer(); - - /** - * Set the timer given in timerId to the given interval - * - * @param intervalMs Interval in ms to be set - * @return 0 on Success 1 else - */ - int setTimer(uint32_t intervalMs); - - /** - * Get the remaining time of the timer - * - * @param remainingTimeMs Pointer to integer value which is used to return the remaining time - * @return 0 on Success 1 else (see timer_getime documentation of posix function) - */ - int getTimer(uint32_t* remainingTimeMs); - -private: - timer_t timerId; -}; - -#endif /* FRAMEWORK_OSAL_LINUX_TIMER_H_ */ diff --git a/timemanager/Countdown.cpp b/timemanager/Countdown.cpp index 20b56189..7aa40e3e 100644 --- a/timemanager/Countdown.cpp +++ b/timemanager/Countdown.cpp @@ -1,4 +1,6 @@ #include "Countdown.h" +#include "fsfw/serviceinterface/ServiceInterfaceStream.h" + Countdown::Countdown(uint32_t initialTimeout): timeout(initialTimeout) { } @@ -6,16 +8,14 @@ Countdown::Countdown(uint32_t initialTimeout): timeout(initialTimeout) { Countdown::~Countdown() { } -ReturnValue_t Countdown::setTimeout(uint32_t miliseconds) { - ReturnValue_t return_value = Clock::getUptime( &startTime ); - timeout = miliseconds; - return return_value; +ReturnValue_t Countdown::setTimeout(uint32_t milliseconds) { + ReturnValue_t returnValue = Clock::getUptime( &startTime ); + timeout = milliseconds; + return returnValue; } bool Countdown::hasTimedOut() const { - uint32_t current_time; - Clock::getUptime( ¤t_time ); - if ( uint32_t(current_time - startTime) >= timeout) { + if ( uint32_t( this->getCurrentTime() - startTime) >= timeout) { return true; } else { return false; @@ -31,7 +31,23 @@ ReturnValue_t Countdown::resetTimer() { } void Countdown::timeOut() { - uint32_t current_time; - Clock::getUptime( ¤t_time ); - startTime= current_time - timeout; + startTime = this->getCurrentTime() - timeout; +} + +uint32_t Countdown::getRemainingMillis() const { + // We fetch the time before the if-statement + // to be sure that the return is in + // range 0 <= number <= timeout + uint32_t currentTime = this->getCurrentTime(); + if (this->hasTimedOut()){ + return 0; + }else{ + return (startTime + timeout) - currentTime; + } +} + +uint32_t Countdown::getCurrentTime() const { + uint32_t current_time; + Clock::getUptime( ¤t_time ); + return current_time; } diff --git a/timemanager/Countdown.h b/timemanager/Countdown.h index f6a41e73..c0afdf75 100644 --- a/timemanager/Countdown.h +++ b/timemanager/Countdown.h @@ -4,28 +4,77 @@ #include "Clock.h" /** - * @brief This file defines the Countdown class. - * @author baetz + * + * Countdown keeps track of a timespan. + * + * Countdown::resetTimer restarts the timer. + * Countdown::setTimeout sets a new countdown duration and resets. + * + * Can be checked with Countdown::hasTimedOut or + * Countdown::isBusy. + * + * Countdown::timeOut will force the timer to time out. + * */ class Countdown { public: - uint32_t timeout; + /** + * Constructor which sets the countdown duration in milliseconds + * + * It does not start the countdown! + * Call resetTimer or setTimeout before usage! + * Otherwise a call to hasTimedOut might return True. + * + * @param initialTimeout Countdown duration in milliseconds + */ Countdown(uint32_t initialTimeout = 0); ~Countdown(); - ReturnValue_t setTimeout(uint32_t miliseconds); - + /** + * Call to set a new countdown duration. + * + * Resets the countdown! + * + * @param milliseconds new countdown duration in milliseconds + * @return Returnvalue from Clock::getUptime + */ + ReturnValue_t setTimeout(uint32_t milliseconds); + /** + * Returns true if the countdown duration has passed. + * + * @return True if the countdown has passed + * False if it is still running + */ bool hasTimedOut() const; - + /** + * Complementary to hasTimedOut. + * + * @return True if the countdown is till running + * False if it is still running + */ bool isBusy() const; - - //!< Use last set timeout value and restart timer. + /** + * Uses last set timeout value and restarts timer. + */ ReturnValue_t resetTimer(); - - //!< Make hasTimedOut() return true + /** + * Returns the remaining milliseconds (0 if timeout) + */ + uint32_t getRemainingMillis() const; + /** + * Makes hasTimedOut() return true + */ void timeOut(); - + /** + * Internal countdown duration in milliseconds + */ + uint32_t timeout; private: + /** + * Last time the timer was started (uptime) + */ uint32_t startTime = 0; + + uint32_t getCurrentTime() const; }; #endif /* FSFW_TIMEMANAGER_COUNTDOWN_H_ */ From 5064d449992a921936211d7e2d8dbac99e4cf6cc Mon Sep 17 00:00:00 2001 From: Steffen Gaisser Date: Mon, 27 Sep 2021 20:45:44 +0200 Subject: [PATCH 284/389] Removed Timer.cpp from CMakeLists --- osal/linux/CMakeLists.txt | 1 - timemanager/Countdown.cpp | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/osal/linux/CMakeLists.txt b/osal/linux/CMakeLists.txt index 0fb66b3e..41800764 100644 --- a/osal/linux/CMakeLists.txt +++ b/osal/linux/CMakeLists.txt @@ -13,7 +13,6 @@ target_sources(${LIB_FSFW_NAME} QueueFactory.cpp SemaphoreFactory.cpp TaskFactory.cpp - Timer.cpp tcpipHelpers.cpp unixUtility.cpp ) diff --git a/timemanager/Countdown.cpp b/timemanager/Countdown.cpp index 7aa40e3e..81681beb 100644 --- a/timemanager/Countdown.cpp +++ b/timemanager/Countdown.cpp @@ -47,7 +47,7 @@ uint32_t Countdown::getRemainingMillis() const { } uint32_t Countdown::getCurrentTime() const { - uint32_t current_time; - Clock::getUptime( ¤t_time ); - return current_time; + uint32_t currentTime; + Clock::getUptime( ¤tTime ); + return currentTime; } From 4b62c8aa81abcf5490c6a3045e38d0acc9955f4b Mon Sep 17 00:00:00 2001 From: Steffen Gaisser Date: Mon, 27 Sep 2021 21:53:27 +0200 Subject: [PATCH 285/389] Added tests --- tests/src/fsfw_tests/unit/CMakeLists.txt | 1 + .../unit/timemanager/CMakeLists.txt | 3 +++ .../unit/timemanager/TestCountdown.cpp | 27 +++++++++++++++++++ 3 files changed, 31 insertions(+) create mode 100644 tests/src/fsfw_tests/unit/timemanager/CMakeLists.txt create mode 100644 tests/src/fsfw_tests/unit/timemanager/TestCountdown.cpp diff --git a/tests/src/fsfw_tests/unit/CMakeLists.txt b/tests/src/fsfw_tests/unit/CMakeLists.txt index 01e4d19c..f30e4b6b 100644 --- a/tests/src/fsfw_tests/unit/CMakeLists.txt +++ b/tests/src/fsfw_tests/unit/CMakeLists.txt @@ -18,4 +18,5 @@ add_subdirectory(serialize) add_subdirectory(datapoollocal) add_subdirectory(storagemanager) add_subdirectory(globalfunctions) +add_subdirectory(timemanager) add_subdirectory(tmtcpacket) diff --git a/tests/src/fsfw_tests/unit/timemanager/CMakeLists.txt b/tests/src/fsfw_tests/unit/timemanager/CMakeLists.txt new file mode 100644 index 00000000..2c635711 --- /dev/null +++ b/tests/src/fsfw_tests/unit/timemanager/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${TARGET_NAME} PRIVATE + TestCountdown.cpp +) diff --git a/tests/src/fsfw_tests/unit/timemanager/TestCountdown.cpp b/tests/src/fsfw_tests/unit/timemanager/TestCountdown.cpp new file mode 100644 index 00000000..b1b26679 --- /dev/null +++ b/tests/src/fsfw_tests/unit/timemanager/TestCountdown.cpp @@ -0,0 +1,27 @@ +#include "fsfw_tests/unit/CatchDefinitions.h" +#include +#include + + +TEST_CASE( "Countdown Tests", "[TestCountdown]") { + INFO("Countdown Tests"); + Countdown count(20); + REQUIRE(count.timeout == 20); + REQUIRE(count.setTimeout(100) == static_cast(HasReturnvaluesIF::RETURN_OK)); + REQUIRE(count.timeout == 100); + REQUIRE(count.setTimeout(150) == static_cast(HasReturnvaluesIF::RETURN_OK)); + REQUIRE(count.isBusy()); + REQUIRE(not count.hasTimedOut()); + uint32_t number = count.getRemainingMillis(); + REQUIRE(number > 0); + bool blocked = false; + while(not count.hasTimedOut()){ + blocked = true; + }; + REQUIRE(blocked); + number = count.getRemainingMillis(); + REQUIRE(number==0); + count.resetTimer(); + REQUIRE(not count.hasTimedOut()); + REQUIRE(count.isBusy()); +} From 09299802f0cc4456c510f6d6dac3260b96c08777 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 28 Sep 2021 15:01:01 +0200 Subject: [PATCH 286/389] TCP refactoring This refactoring keeps the TCP connection opened until the client closes it. It also increased the robustness of the TCP reception. Because TCP is stream based and usually applied to newline separated data, a special way to handle binary space packets is required. The new SpacePacketParser class takes care of this by taking TC packet IDs as as optional start markers to parse for space packets in a given buffer. The refactored TCP server uses a ring buffer, a reception buffer and the new parser to extract space packets from a stream in a safer way. --- src/fsfw/osal/common/TcpTmTcServer.cpp | 229 ++++++++++++++++---- src/fsfw/osal/common/TcpTmTcServer.h | 68 ++++-- src/fsfw/tmtcpacket/SpacePacket.h | 109 +++++----- src/fsfw/tmtcservices/SpacePacketParser.cpp | 77 +++++++ src/fsfw/tmtcservices/SpacePacketParser.h | 96 ++++++++ 5 files changed, 473 insertions(+), 106 deletions(-) create mode 100644 src/fsfw/tmtcservices/SpacePacketParser.cpp create mode 100644 src/fsfw/tmtcservices/SpacePacketParser.h diff --git a/src/fsfw/osal/common/TcpTmTcServer.cpp b/src/fsfw/osal/common/TcpTmTcServer.cpp index 11ab71af..e320b46b 100644 --- a/src/fsfw/osal/common/TcpTmTcServer.cpp +++ b/src/fsfw/osal/common/TcpTmTcServer.cpp @@ -1,8 +1,11 @@ -#include "fsfw/osal/common/TcpTmTcServer.h" -#include "fsfw/osal/common/TcpTmTcBridge.h" -#include "fsfw/osal/common/tcpipHelpers.h" - #include "fsfw/platform.h" +#include "fsfw/FSFW.h" + +#include "TcpTmTcServer.h" +#include "TcpTmTcBridge.h" +#include "tcpipHelpers.h" + +#include "fsfw/tasks/TaskFactory.h" #include "fsfw/container/SharedRingBuffer.h" #include "fsfw/ipc/MessageQueueSenderIF.h" #include "fsfw/ipc/MutexGuard.h" @@ -17,6 +20,7 @@ #elif defined(PLATFORM_UNIX) #include #endif +#include #ifndef FSFW_TCP_RECV_WIRETAPPING_ENABLED #define FSFW_TCP_RECV_WIRETAPPING_ENABLED 0 @@ -25,12 +29,11 @@ const std::string TcpTmTcServer::DEFAULT_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT; TcpTmTcServer::TcpTmTcServer(object_id_t objectId, object_id_t tmtcTcpBridge, - size_t receptionBufferSize, std::string customTcpServerPort): - SystemObject(objectId), tmtcBridgeId(tmtcTcpBridge), - tcpPort(customTcpServerPort), receptionBuffer(receptionBufferSize) { - if(tcpPort == "") { - tcpPort = DEFAULT_SERVER_PORT; - } + size_t receptionBufferSize, size_t ringBufferSize, std::string customTcpServerPort, + ReceptionModes receptionMode): + SystemObject(objectId), tmtcBridgeId(tmtcTcpBridge), receptionMode(receptionMode), + tcpConfig(customTcpServerPort), receptionBuffer(receptionBufferSize), + ringBuffer(ringBufferSize, true), validPacketIds() { } ReturnValue_t TcpTmTcServer::initialize() { @@ -41,6 +44,16 @@ ReturnValue_t TcpTmTcServer::initialize() { return result; } + switch(receptionMode) { + case(ReceptionModes::SPACE_PACKETS): { + spacePacketParser = new SpacePacketParser(validPacketIds); + if(spacePacketParser == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } + tcpConfig.tcpFlags |= MSG_DONTWAIT; + } + } + tcStore = ObjectManager::instance()->get(objects::TC_STORE); if (tcStore == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 @@ -63,7 +76,7 @@ ReturnValue_t TcpTmTcServer::initialize() { hints.ai_flags = AI_PASSIVE; // Listen to all addresses (0.0.0.0) by using AI_PASSIVE in the hint flags - retval = getaddrinfo(nullptr, tcpPort.c_str(), &hints, &addrResult); + retval = getaddrinfo(nullptr, tcpConfig.tcpPort.c_str(), &hints, &addrResult); if (retval != 0) { handleError(Protocol::TCP, ErrorSources::GETADDRINFO_CALL); return HasReturnvaluesIF::RETURN_FAILED; @@ -105,7 +118,7 @@ ReturnValue_t TcpTmTcServer::performOperation(uint8_t opCode) { // Listen for connection requests permanently for lifetime of program while(true) { - retval = listen(listenerTcpSocket, tcpBacklog); + retval = listen(listenerTcpSocket, tcpConfig.tcpBacklog); if(retval == SOCKET_ERROR) { handleError(Protocol::TCP, ErrorSources::LISTEN_CALL, 500); continue; @@ -123,11 +136,12 @@ ReturnValue_t TcpTmTcServer::performOperation(uint8_t opCode) { handleServerOperation(connSocket); // Done, shut down connection and go back to listening for client requests - retval = shutdown(connSocket, SHUT_SEND); + retval = shutdown(connSocket, SHUT_BOTH); if(retval != 0) { handleError(Protocol::TCP, ErrorSources::SHUTDOWN_CALL); } closeSocket(connSocket); + connSocket = 0; } return HasReturnvaluesIF::RETURN_OK; } @@ -144,51 +158,82 @@ ReturnValue_t TcpTmTcServer::initializeAfterTaskCreation() { return HasReturnvaluesIF::RETURN_OK; } -void TcpTmTcServer::handleServerOperation(socket_t connSocket) { - int retval = 0; - do { - // Read all telecommands sent by the client - retval = recv(connSocket, +void TcpTmTcServer::handleServerOperation(socket_t& connSocket) { + while (true) { + int retval = recv( + connSocket, reinterpret_cast(receptionBuffer.data()), receptionBuffer.capacity(), - tcpFlags); - if (retval > 0) { - handleTcReception(retval); + tcpConfig.tcpFlags + ); + if(retval == 0) { + // Client closed connection + return; } - else if(retval == 0) { - // Client has finished sending telecommands, send telemetry now - handleTmSending(connSocket); + else if(retval > 0) { + // The ring buffer was configured for overwrite, so the returnvalue does not need to + // be checked for now + ringBuffer.writeData(receptionBuffer.data(), retval); } - else { - // Should not happen - tcpip::handleError(tcpip::Protocol::TCP, tcpip::ErrorSources::RECV_CALL); + else if(retval < 0) { + if(errno == EAGAIN) { + // No data available. Check whether any packets have been read, then send back + // telemetry if available + bool tcAvailable = false; + bool tmSent = false; + size_t availableReadData = ringBuffer.getAvailableReadData(); + if(availableReadData > lastRingBufferSize) { + tcAvailable = true; + handleTcRingBufferData(availableReadData); + } + ReturnValue_t result = handleTmSending(connSocket, tmSent); + if(result == CONN_BROKEN) { + return; + } + if(not tcAvailable and not tmSent) { + TaskFactory::delayTask(DEFAULT_LOOP_DELAY_MS); + } + } + else { + tcpip::handleError(tcpip::Protocol::TCP, tcpip::ErrorSources::RECV_CALL); + } } - } while(retval > 0); + } } -ReturnValue_t TcpTmTcServer::handleTcReception(size_t bytesRecvd) { +ReturnValue_t TcpTmTcServer::handleTcReception(uint8_t* spacePacket, size_t packetSize) { #if FSFW_TCP_RECV_WIRETAPPING_ENABLED == 1 arrayprinter::print(receptionBuffer.data(), bytesRead); #endif + if(spacePacket == nullptr or packetSize == 0) { + return HasReturnvaluesIF::RETURN_FAILED; + } store_address_t storeId; - ReturnValue_t result = tcStore->addData(&storeId, receptionBuffer.data(), bytesRecvd); + ReturnValue_t result = tcStore->addData(&storeId, spacePacket, packetSize); if (result != HasReturnvaluesIF::RETURN_OK) { #if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning<< "TcpTmTcServer::handleServerOperation: Data storage failed." << std::endl; - sif::warning << "Packet size: " << bytesRecvd << std::endl; + sif::warning << "TcpTmTcServer::handleServerOperation: Data storage with packet size" << + packetSize << " failed" << std::endl; +#else + sif::printWarning("TcpTmTcServer::handleServerOperation: Data storage with packet size %d " + "failed\n", packetSize); #endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ #endif /* FSFW_VERBOSE_LEVEL >= 1 */ + return result; } TmTcMessage message(storeId); - result = MessageQueueSenderIF::sendMessage(targetTcDestination, &message); + result = MessageQueueSenderIF::sendMessage(targetTcDestination, &message); if (result != HasReturnvaluesIF::RETURN_OK) { #if FSFW_VERBOSE_LEVEL >= 1 #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "UdpTcPollingTask::handleSuccessfullTcRead: " + sif::warning << "TcpTmTcServer::handleServerOperation: " " Sending message to queue failed" << std::endl; +#else + sif::printWarning("TcpTmTcServer::handleServerOperation: " + " Sending message to queue failed\n"); #endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ #endif /* FSFW_VERBOSE_LEVEL >= 1 */ tcStore->deleteData(storeId); @@ -196,21 +241,26 @@ ReturnValue_t TcpTmTcServer::handleTcReception(size_t bytesRecvd) { return result; } -void TcpTmTcServer::setTcpBacklog(uint8_t tcpBacklog) { - this->tcpBacklog = tcpBacklog; -} - std::string TcpTmTcServer::getTcpPort() const { - return tcpPort; + return tcpConfig.tcpPort; } -ReturnValue_t TcpTmTcServer::handleTmSending(socket_t connSocket) { +void TcpTmTcServer::setSpacePacketParsingOptions(std::vector validPacketIds) { + this->validPacketIds = validPacketIds; +} + +TcpTmTcServer::TcpConfig& TcpTmTcServer::getTcpConfigStruct() { + return tcpConfig; +} + +ReturnValue_t TcpTmTcServer::handleTmSending(socket_t connSocket, bool& tmSent) { // Access to the FIFO is mutex protected because it is filled by the bridge MutexGuard(tmtcBridge->mutex, tmtcBridge->timeoutType, tmtcBridge->mutexTimeoutMs); store_address_t storeId; while((not tmtcBridge->tmFifo->empty()) and (tmtcBridge->packetSentCounter < tmtcBridge->sentPacketsPerCycle)) { - tmtcBridge->tmFifo->retrieve(&storeId); + // Send can fail, so only peek from the FIFO + tmtcBridge->tmFifo->peek(&storeId); // Using the store accessor will take care of deleting TM from the store automatically ConstStorageAccessor storeAccessor(storeId); @@ -221,10 +271,101 @@ ReturnValue_t TcpTmTcServer::handleTmSending(socket_t connSocket) { int retval = send(connSocket, reinterpret_cast(storeAccessor.data()), storeAccessor.size(), - tcpTmFlags); - if(retval != static_cast(storeAccessor.size())) { - tcpip::handleError(tcpip::Protocol::TCP, tcpip::ErrorSources::SEND_CALL); + tcpConfig.tcpTmFlags); + if(retval == static_cast(storeAccessor.size())) { + // Packet sent, clear FIFO entry + tmtcBridge->tmFifo->pop(); + tmSent = true; + + } + else if(retval <= 0) { + // Assume that the client has closed the connection here for now + handleSocketError(storeAccessor); + return CONN_BROKEN; } } return HasReturnvaluesIF::RETURN_OK; } + +ReturnValue_t TcpTmTcServer::handleTcRingBufferData(size_t availableReadData) { + ReturnValue_t status = HasReturnvaluesIF::RETURN_OK; + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + size_t readAmount = availableReadData; + lastRingBufferSize = availableReadData; + if(readAmount >= ringBuffer.getMaxSize()) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + // Possible configuration error, too much data or/and data coming in too fast, + // requiring larger buffers + sif::warning << "TcpTmTcServer::handleServerOperation: Ring buffer reached " << + "fill count" << std::endl; +#else + sif::printWarning("TcpTmTcServer::handleServerOperation: Ring buffer reached " + "fill count"); +#endif +#endif + } + if(readAmount >= receptionBuffer.size()) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + // Possible configuration error, too much data or/and data coming in too fast, + // requiring larger buffers + sif::warning << "TcpTmTcServer::handleServerOperation: " + "Reception buffer too small " << std::endl; +#else + sif::printWarning("TcpTmTcServer::handleServerOperation: Reception buffer too small\n"); +#endif +#endif + readAmount = receptionBuffer.size(); + } + ringBuffer.readData(receptionBuffer.data(), readAmount, true); + const uint8_t* bufPtr = receptionBuffer.data(); + const uint8_t** bufPtrPtr = &bufPtr; + size_t startIdx = 0; + size_t foundSize = 0; + size_t readLen = 0; + while(readLen < readAmount) { + result = spacePacketParser->parseSpacePackets(bufPtrPtr, readAmount, + startIdx, foundSize, readLen); + switch(result) { + case(SpacePacketParser::NO_PACKET_FOUND): + case(SpacePacketParser::SPLIT_PACKET): { + break; + } + case(HasReturnvaluesIF::RETURN_OK): { + result = handleTcReception(receptionBuffer.data() + startIdx, foundSize); + if(result != HasReturnvaluesIF::RETURN_OK) { + status = result; + } + } + } + ringBuffer.deleteData(foundSize); + lastRingBufferSize = ringBuffer.getAvailableReadData(); + std::memset(receptionBuffer.data() + startIdx, 0, foundSize); + } + return status; +} + +void TcpTmTcServer::handleSocketError(ConstStorageAccessor &accessor) { + // Don't delete data + accessor.release(); + auto socketError = getLastSocketError(); + switch(socketError) { +#if defined PLATFORM_WIN + case(WSAECONNRESET): { + // See https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send + // Remote client might have shut down connection + return; + } +#else + case(EPIPE): { + // See https://man7.org/linux/man-pages/man2/send.2.html + // Remote client might have shut down connection + return; + } +#endif + default: { + tcpip::handleError(tcpip::Protocol::TCP, tcpip::ErrorSources::SEND_CALL); + } + } +} diff --git a/src/fsfw/osal/common/TcpTmTcServer.h b/src/fsfw/osal/common/TcpTmTcServer.h index c6916080..a0a31655 100644 --- a/src/fsfw/osal/common/TcpTmTcServer.h +++ b/src/fsfw/osal/common/TcpTmTcServer.h @@ -1,11 +1,13 @@ #ifndef FSFW_OSAL_COMMON_TCP_TMTC_SERVER_H_ #define FSFW_OSAL_COMMON_TCP_TMTC_SERVER_H_ +#include #include "TcpIpBase.h" #include "fsfw/platform.h" #include "fsfw/osal/common/tcpipHelpers.h" #include "fsfw/ipc/messageQueueDefinitions.h" +#include "fsfw/container/SimpleRingBuffer.h" #include "fsfw/ipc/MessageQueueIF.h" #include "fsfw/objectmanager/frameworkObjects.h" #include "fsfw/objectmanager/SystemObject.h" @@ -42,9 +44,37 @@ class TcpTmTcServer: public TcpIpBase, public ExecutableObjectIF { public: + enum class ReceptionModes { + SPACE_PACKETS + }; + + struct TcpConfig { + public: + TcpConfig(std::string tcpPort): tcpPort(tcpPort) {} + + /** + * Passed to the recv call + */ + int tcpFlags = 0; + int tcpBacklog = 3; + + /** + * Passed to the select call which is used to ensure non-blocking TC reception + */ + //uint32_t selectTimeoutMs = DEFAULT_SELECT_TIMEOUT_MS; + /** + * Passed to the send call + */ + int tcpTmFlags = 0; + + const std::string tcpPort; + }; + static const std::string DEFAULT_SERVER_PORT; static constexpr size_t ETHERNET_MTU_SIZE = 1500; + static constexpr size_t RING_BUFFER_SIZE = ETHERNET_MTU_SIZE * 3; + static constexpr uint32_t DEFAULT_LOOP_DELAY_MS = 200; /** * TCP Server Constructor @@ -55,11 +85,19 @@ public: * @param customTcpServerPort The user can specify another port than the default (7301) here. */ TcpTmTcServer(object_id_t objectId, object_id_t tmtcTcpBridge, - size_t receptionBufferSize = ETHERNET_MTU_SIZE + 1, - std::string customTcpServerPort = ""); + size_t receptionBufferSize = RING_BUFFER_SIZE, + size_t ringBufferSize = RING_BUFFER_SIZE, + std::string customTcpServerPort = DEFAULT_SERVER_PORT, + ReceptionModes receptionMode = ReceptionModes::SPACE_PACKETS); virtual~ TcpTmTcServer(); - void setTcpBacklog(uint8_t tcpBacklog); + /** + * Get a handle to the TCP configuration struct, which can be used to configure TCP + * properties + * @return + */ + TcpConfig& getTcpConfigStruct(); + void setSpacePacketParsingOptions(std::vector validPacketIds); ReturnValue_t initialize() override; ReturnValue_t performOperation(uint8_t opCode) override; @@ -71,25 +109,29 @@ protected: StorageManagerIF* tcStore = nullptr; StorageManagerIF* tmStore = nullptr; private: + static constexpr ReturnValue_t CONN_BROKEN = HasReturnvaluesIF::makeReturnCode(1, 0); //! TMTC bridge is cached. object_id_t tmtcBridgeId = objects::NO_OBJECT; TcpTmTcBridge* tmtcBridge = nullptr; - std::string tcpPort; - int tcpFlags = 0; - socket_t listenerTcpSocket = 0; + ReceptionModes receptionMode; + TcpConfig tcpConfig; struct sockaddr tcpAddress; + socket_t listenerTcpSocket = 0; + MessageQueueId_t targetTcDestination = MessageQueueIF::NO_QUEUE; - int tcpAddrLen = sizeof(tcpAddress); - int tcpBacklog = 3; std::vector receptionBuffer; - int tcpSockOpt = 0; - int tcpTmFlags = 0; + SimpleRingBuffer ringBuffer; + std::vector validPacketIds; + SpacePacketParser* spacePacketParser = nullptr; + uint8_t lastRingBufferSize = 0; - void handleServerOperation(socket_t connSocket); - ReturnValue_t handleTcReception(size_t bytesRecvd); - ReturnValue_t handleTmSending(socket_t connSocket); + virtual void handleServerOperation(socket_t& connSocket); + ReturnValue_t handleTcReception(uint8_t* spacePacket, size_t packetSize); + ReturnValue_t handleTmSending(socket_t connSocket, bool& tmSent); + ReturnValue_t handleTcRingBufferData(size_t availableReadData); + void handleSocketError(ConstStorageAccessor& accessor); }; #endif /* FSFW_OSAL_COMMON_TCP_TMTC_SERVER_H_ */ diff --git a/src/fsfw/tmtcpacket/SpacePacket.h b/src/fsfw/tmtcpacket/SpacePacket.h index 49dd5ae5..9eec87a8 100644 --- a/src/fsfw/tmtcpacket/SpacePacket.h +++ b/src/fsfw/tmtcpacket/SpacePacket.h @@ -15,56 +15,67 @@ */ class SpacePacket: public SpacePacketBase { public: - static const uint16_t PACKET_MAX_SIZE = 1024; - /** - * The constructor initializes the packet and sets all header information - * according to the passed parameters. - * @param packetDataLength Sets the packet data length field and therefore specifies the size of the packet. - * @param isTelecommand Sets the packet type field to either TC (true) or TM (false). - * @param apid Sets the packet's APID field. The default value describes an idle packet. - * @param sequenceCount ets the packet's Source Sequence Count field. - */ - SpacePacket(uint16_t packetDataLength, bool isTelecommand = false, - uint16_t apid = APID_IDLE_PACKET, uint16_t sequenceCount = 0); - /** - * The class's default destructor. - */ - virtual ~SpacePacket(); - /** - * With this call, the complete data content (including the CCSDS Primary - * Header) is overwritten with the byte stream given. - * @param p_data Pointer to data to overwrite the content with - * @param packet_size Size of the data - * @return @li \c true if packet_size is smaller than \c MAX_PACKET_SIZE. - * @li \c false else. - */ - bool addWholeData(const uint8_t* p_data, uint32_t packet_size); + static const uint16_t PACKET_MAX_SIZE = 1024; + /** + * The constructor initializes the packet and sets all header information + * according to the passed parameters. + * @param packetDataLength Sets the packet data length field and therefore specifies + * the size of the packet. + * @param isTelecommand Sets the packet type field to either TC (true) or TM (false). + * @param apid Sets the packet's APID field. The default value describes an idle packet. + * @param sequenceCount ets the packet's Source Sequence Count field. + */ + SpacePacket(uint16_t packetDataLength, bool isTelecommand = false, + uint16_t apid = APID_IDLE_PACKET, uint16_t sequenceCount = 0); + /** + * The class's default destructor. + */ + virtual ~SpacePacket(); + + static constexpr uint16_t getTcSpacePacketIdFromApid(uint16_t apid) { + uint16_t tcPacketId = (0x18 << 8) | (((apid >> 8) & 0x07) << 8) | (apid & 0x00ff); + return tcPacketId; + } + static constexpr uint16_t getTmSpacePacketIdFromApid(uint16_t apid) { + uint16_t tmPacketId = (0x08 << 8) | (((apid >> 8) & 0x07) << 8) | (apid & 0x00ff); + return tmPacketId; + } + + /** + * With this call, the complete data content (including the CCSDS Primary + * Header) is overwritten with the byte stream given. + * @param p_data Pointer to data to overwrite the content with + * @param packet_size Size of the data + * @return @li \c true if packet_size is smaller than \c MAX_PACKET_SIZE. + * @li \c false else. + */ + bool addWholeData(const uint8_t* p_data, uint32_t packet_size); protected: - /** - * This structure defines the data structure of a Space Packet as local data. - * There's a buffer which corresponds to the Space Packet Data Field with a - * maximum size of \c PACKET_MAX_SIZE. - */ - struct PacketStructured { - CCSDSPrimaryHeader header; - uint8_t buffer[PACKET_MAX_SIZE]; - }; - /** - * This union simplifies accessing the full data content of the Space Packet. - * This is achieved by putting the \c PacketStructured struct in a union with - * a plain buffer. - */ - union SpacePacketData { - PacketStructured fields; - uint8_t byteStream[PACKET_MAX_SIZE + sizeof(CCSDSPrimaryHeader)]; - }; - /** - * This is the data representation of the class. - * It is a struct of CCSDS Primary Header and a data field, which again is - * packed in an union, so the data can be accessed as a byte stream without - * a cast. - */ - SpacePacketData localData; + /** + * This structure defines the data structure of a Space Packet as local data. + * There's a buffer which corresponds to the Space Packet Data Field with a + * maximum size of \c PACKET_MAX_SIZE. + */ + struct PacketStructured { + CCSDSPrimaryHeader header; + uint8_t buffer[PACKET_MAX_SIZE]; + }; + /** + * This union simplifies accessing the full data content of the Space Packet. + * This is achieved by putting the \c PacketStructured struct in a union with + * a plain buffer. + */ + union SpacePacketData { + PacketStructured fields; + uint8_t byteStream[PACKET_MAX_SIZE + sizeof(CCSDSPrimaryHeader)]; + }; + /** + * This is the data representation of the class. + * It is a struct of CCSDS Primary Header and a data field, which again is + * packed in an union, so the data can be accessed as a byte stream without + * a cast. + */ + SpacePacketData localData; }; #endif /* SPACEPACKET_H_ */ diff --git a/src/fsfw/tmtcservices/SpacePacketParser.cpp b/src/fsfw/tmtcservices/SpacePacketParser.cpp new file mode 100644 index 00000000..84f861cf --- /dev/null +++ b/src/fsfw/tmtcservices/SpacePacketParser.cpp @@ -0,0 +1,77 @@ +#include +#include +#include + +SpacePacketParser::SpacePacketParser(std::vector validPacketIds): + validPacketIds(validPacketIds) { +} + +ReturnValue_t SpacePacketParser::parseSpacePackets(const uint8_t *buffer, + const size_t maxSize, size_t& startIndex, size_t& foundSize) { + const uint8_t** tempPtr = &buffer; + size_t readLen = 0; + return parseSpacePackets(tempPtr, maxSize, startIndex, foundSize, readLen); +} + +ReturnValue_t SpacePacketParser::parseSpacePackets(const uint8_t **buffer, const size_t maxSize, + size_t &startIndex, size_t &foundSize, size_t& readLen) { + if(buffer == nullptr or maxSize < 5) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "SpacePacketParser::parseSpacePackets: Frame invalid" << std::endl; +#else + sif::printWarning("SpacePacketParser::parseSpacePackets: Frame invalid\n"); +#endif + return HasReturnvaluesIF::RETURN_FAILED; + } + const uint8_t* bufPtr = *buffer; + + auto verifyLengthField = [&](size_t idx) { + uint16_t lengthField = bufPtr[idx + 4] << 8 | bufPtr[idx + 5]; + size_t packetSize = lengthField + 7; + startIndex = idx; + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + if(lengthField == 0) { + // Skip whole header for now + foundSize = 6; + result = NO_PACKET_FOUND; + } + else if(packetSize + idx > maxSize) { + // Don't increment buffer and read length here, user has to decide what to do + foundSize = packetSize; + return SPLIT_PACKET; + } + else { + foundSize = packetSize; + } + *buffer += foundSize; + readLen += foundSize; + return result; + }; + + size_t idx = 0; + // Space packet ID as start marker + if(validPacketIds.size() > 0) { + while(idx < maxSize - 5) { + uint16_t currentPacketId = bufPtr[idx] << 8 | bufPtr[idx + 1]; + if(std::find(validPacketIds.begin(), validPacketIds.end(), currentPacketId) != + validPacketIds.end()) { + if(idx + 5 >= maxSize) { + return SPLIT_PACKET; + } + return verifyLengthField(idx); + } + else { + idx++; + } + } + startIndex = 0; + foundSize = maxSize; + *buffer += foundSize; + readLen += foundSize; + return NO_PACKET_FOUND; + } + // Assume that the user verified a valid start of a space packet + else { + return verifyLengthField(idx); + } +} diff --git a/src/fsfw/tmtcservices/SpacePacketParser.h b/src/fsfw/tmtcservices/SpacePacketParser.h new file mode 100644 index 00000000..16b53ea4 --- /dev/null +++ b/src/fsfw/tmtcservices/SpacePacketParser.h @@ -0,0 +1,96 @@ +#ifndef FRAMEWORK_TMTCSERVICES_PUSPARSER_H_ +#define FRAMEWORK_TMTCSERVICES_PUSPARSER_H_ + +#include "fsfw/container/DynamicFIFO.h" +#include "fsfw/returnvalues/FwClassIds.h" + +#include +#include + +/** + * @brief This small helper class scans a given buffer for PUS packets. + * Can be used if PUS packets are serialized in a tightly packed frame. + * @details + * The parser uses the length field field of the space packets to find + * the respective space packet sizes. + * + * The parser parses a buffer by taking a pointer and the maximum size to scan. + * If space packets are found, they are stored in a FIFO which stores pairs + * consisting of the index in the buffer and the respective packet sizes. + * + * If the parser detects split packets (which means that the size of the + * next packet is larger than the remaining size to scan), it can either + * store that split packet or throw away the packet. + * @author R. Mueller + */ +class SpacePacketParser { +public: + //! The first entry is the index inside the buffer while the second index + //! is the size of the PUS packet starting at that index. + using IndexSizePair = std::pair; + + static constexpr uint8_t INTERFACE_ID = CLASS_ID::PUS_PARSER; + static constexpr ReturnValue_t NO_PACKET_FOUND = MAKE_RETURN_CODE(0x00); + static constexpr ReturnValue_t SPLIT_PACKET = MAKE_RETURN_CODE(0x01); + + /** + * @brief Parser constructor. + * @param maxExpectedPusPackets + * Maximum expected number of PUS packets. A good estimate is to divide + * the frame size by the minimum size of a PUS packet (12 bytes) + * @param storeSplitPackets + * Specifies whether split packets are also stored inside the FIFO, + * with the size being the remaining frame size. + */ + SpacePacketParser(std::vector validPacketIds); + + /** + * Parse a given frame for PUS packets + * @param frame + * @param frameSize + * @param foundPackets The number of found packets will be stored here + * @return + * -@c NO_PACKET_FOUND if no packet was found + * -@c SPLIT_PACKET if splitting is enabled and a split packet was found + * -@c RETURN_OK if a packet was found. The index and sizes are stored in the internal FIFO + */ + ReturnValue_t parseSpacePackets(const uint8_t* buffer, const size_t maxSize, + size_t& startIndex, size_t& foundSize); + + ReturnValue_t parseSpacePackets(const uint8_t **buffer, const size_t maxSize, + size_t& startIndex, size_t& foundSize, size_t& readLen); + /** + * Accessor function to get a reference to the internal FIFO which + * stores pairs of index and packet sizes. This FIFO is filled + * by the #parsePusPackets function. + * @return + */ + //DynamicFIFO& fifo(); + + /** + * Retrieve the next index and packet size pair from the FIFO. + * This also removes it from the FIFO. Please note that if the FIFO + * is empty, an empty pair will be returned. + * @return + */ + //IndexSizePair getNextFifoPair(); + +private: + /** + * A FIFO is used to store information about multiple PUS packets + * inside the receive buffer. The maximum number of entries is defined + * by the first constructor argument. + */ + //DynamicFIFO indexSizePairFIFO; + + std::vector validPacketIds; + + //bool storeSplitPackets = false; + +// ReturnValue_t readMultiplePackets(const uint8_t *frame, size_t frameSize, +// size_t startIndex, uint32_t& foundPackets); +// ReturnValue_t readNextPacket(const uint8_t *frame, +// size_t frameSize, size_t& startIndex, uint32_t& foundPackets); +}; + +#endif /* FRAMEWORK_TMTCSERVICES_PUSPARSER_H_ */ From e536918804255bf035ba78e5ddb9171b01f02761 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 28 Sep 2021 15:09:56 +0200 Subject: [PATCH 287/389] wiretapping in runtime config now --- src/fsfw/osal/common/TcpTmTcServer.cpp | 24 +++++++++++++++--------- src/fsfw/osal/common/TcpTmTcServer.h | 5 ++++- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/fsfw/osal/common/TcpTmTcServer.cpp b/src/fsfw/osal/common/TcpTmTcServer.cpp index e320b46b..5be9373e 100644 --- a/src/fsfw/osal/common/TcpTmTcServer.cpp +++ b/src/fsfw/osal/common/TcpTmTcServer.cpp @@ -5,12 +5,13 @@ #include "TcpTmTcBridge.h" #include "tcpipHelpers.h" +#include "fsfw/tmtcservices/SpacePacketParser.h" #include "fsfw/tasks/TaskFactory.h" +#include "fsfw/globalfunctions/arrayprinter.h" #include "fsfw/container/SharedRingBuffer.h" #include "fsfw/ipc/MessageQueueSenderIF.h" #include "fsfw/ipc/MutexGuard.h" #include "fsfw/objectmanager/ObjectManager.h" - #include "fsfw/serviceinterface/ServiceInterface.h" #include "fsfw/tmtcservices/TmTcMessage.h" @@ -20,11 +21,6 @@ #elif defined(PLATFORM_UNIX) #include #endif -#include - -#ifndef FSFW_TCP_RECV_WIRETAPPING_ENABLED -#define FSFW_TCP_RECV_WIRETAPPING_ENABLED 0 -#endif const std::string TcpTmTcServer::DEFAULT_SERVER_PORT = tcpip::DEFAULT_SERVER_PORT; @@ -202,9 +198,11 @@ void TcpTmTcServer::handleServerOperation(socket_t& connSocket) { } ReturnValue_t TcpTmTcServer::handleTcReception(uint8_t* spacePacket, size_t packetSize) { -#if FSFW_TCP_RECV_WIRETAPPING_ENABLED == 1 - arrayprinter::print(receptionBuffer.data(), bytesRead); -#endif + if(wiretappingEnabled) { + sif::info << "Received TC:" << std::endl; + arrayprinter::print(spacePacket, packetSize); + } + if(spacePacket == nullptr or packetSize == 0) { return HasReturnvaluesIF::RETURN_FAILED; } @@ -268,6 +266,10 @@ ReturnValue_t TcpTmTcServer::handleTmSending(socket_t connSocket, bool& tmSent) if(result != HasReturnvaluesIF::RETURN_OK) { return result; } + if(wiretappingEnabled) { + sif::info << "Sending TM:" << std::endl; + arrayprinter::print(storeAccessor.data(), storeAccessor.size()); + } int retval = send(connSocket, reinterpret_cast(storeAccessor.data()), storeAccessor.size(), @@ -346,6 +348,10 @@ ReturnValue_t TcpTmTcServer::handleTcRingBufferData(size_t availableReadData) { return status; } +void TcpTmTcServer::enableWiretapping(bool enable) { + this->wiretappingEnabled = enable; +} + void TcpTmTcServer::handleSocketError(ConstStorageAccessor &accessor) { // Don't delete data accessor.release(); diff --git a/src/fsfw/osal/common/TcpTmTcServer.h b/src/fsfw/osal/common/TcpTmTcServer.h index a0a31655..d5214848 100644 --- a/src/fsfw/osal/common/TcpTmTcServer.h +++ b/src/fsfw/osal/common/TcpTmTcServer.h @@ -1,7 +1,6 @@ #ifndef FSFW_OSAL_COMMON_TCP_TMTC_SERVER_H_ #define FSFW_OSAL_COMMON_TCP_TMTC_SERVER_H_ -#include #include "TcpIpBase.h" #include "fsfw/platform.h" @@ -22,6 +21,7 @@ #include class TcpTmTcBridge; +class SpacePacketParser; /** * @brief TCP server implementation @@ -91,6 +91,8 @@ public: ReceptionModes receptionMode = ReceptionModes::SPACE_PACKETS); virtual~ TcpTmTcServer(); + void enableWiretapping(bool enable); + /** * Get a handle to the TCP configuration struct, which can be used to configure TCP * properties @@ -113,6 +115,7 @@ private: //! TMTC bridge is cached. object_id_t tmtcBridgeId = objects::NO_OBJECT; TcpTmTcBridge* tmtcBridge = nullptr; + bool wiretappingEnabled = false; ReceptionModes receptionMode; TcpConfig tcpConfig; From bbea5e33bc66d05589d6143c0e75931acd99de83 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 28 Sep 2021 15:12:23 +0200 Subject: [PATCH 288/389] removed obsolete empty ctor --- src/fsfw/osal/common/TcpTmTcServer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsfw/osal/common/TcpTmTcServer.cpp b/src/fsfw/osal/common/TcpTmTcServer.cpp index 5be9373e..fb421fc7 100644 --- a/src/fsfw/osal/common/TcpTmTcServer.cpp +++ b/src/fsfw/osal/common/TcpTmTcServer.cpp @@ -29,7 +29,7 @@ TcpTmTcServer::TcpTmTcServer(object_id_t objectId, object_id_t tmtcTcpBridge, ReceptionModes receptionMode): SystemObject(objectId), tmtcBridgeId(tmtcTcpBridge), receptionMode(receptionMode), tcpConfig(customTcpServerPort), receptionBuffer(receptionBufferSize), - ringBuffer(ringBufferSize, true), validPacketIds() { + ringBuffer(ringBufferSize, true) { } ReturnValue_t TcpTmTcServer::initialize() { From f02852d8d2bf40b2941ccd0816c1ed01d703fea7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 28 Sep 2021 15:13:46 +0200 Subject: [PATCH 289/389] cmake lists file update --- src/fsfw/tmtcservices/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fsfw/tmtcservices/CMakeLists.txt b/src/fsfw/tmtcservices/CMakeLists.txt index c30af214..96cf99b5 100644 --- a/src/fsfw/tmtcservices/CMakeLists.txt +++ b/src/fsfw/tmtcservices/CMakeLists.txt @@ -6,4 +6,5 @@ target_sources(${LIB_FSFW_NAME} TmTcBridge.cpp TmTcMessage.cpp VerificationReporter.cpp + SpacePacketParser.cpp ) \ No newline at end of file From a4d6421510575b9eda7f27c1637963c91881f922 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 28 Sep 2021 15:30:01 +0200 Subject: [PATCH 290/389] documentation and bugfixes --- src/fsfw/tmtcservices/SpacePacketParser.cpp | 2 +- src/fsfw/tmtcservices/SpacePacketParser.h | 100 ++++++++------------ 2 files changed, 42 insertions(+), 60 deletions(-) diff --git a/src/fsfw/tmtcservices/SpacePacketParser.cpp b/src/fsfw/tmtcservices/SpacePacketParser.cpp index 84f861cf..3d442458 100644 --- a/src/fsfw/tmtcservices/SpacePacketParser.cpp +++ b/src/fsfw/tmtcservices/SpacePacketParser.cpp @@ -44,7 +44,7 @@ ReturnValue_t SpacePacketParser::parseSpacePackets(const uint8_t **buffer, const foundSize = packetSize; } *buffer += foundSize; - readLen += foundSize; + readLen += idx + foundSize; return result; }; diff --git a/src/fsfw/tmtcservices/SpacePacketParser.h b/src/fsfw/tmtcservices/SpacePacketParser.h index 16b53ea4..82b15010 100644 --- a/src/fsfw/tmtcservices/SpacePacketParser.h +++ b/src/fsfw/tmtcservices/SpacePacketParser.h @@ -8,19 +8,11 @@ #include /** - * @brief This small helper class scans a given buffer for PUS packets. - * Can be used if PUS packets are serialized in a tightly packed frame. + * @brief This small helper class scans a given buffer for space packets. + * Can be used if space packets are serialized in a tightly packed frame. * @details - * The parser uses the length field field of the space packets to find - * the respective space packet sizes. - * - * The parser parses a buffer by taking a pointer and the maximum size to scan. - * If space packets are found, they are stored in a FIFO which stores pairs - * consisting of the index in the buffer and the respective packet sizes. - * - * If the parser detects split packets (which means that the size of the - * next packet is larger than the remaining size to scan), it can either - * store that split packet or throw away the packet. + * The parser uses the length field field and the 16-bit TC packet ID of the space packets to find + * find space packets in a given data stream * @author R. Mueller */ class SpacePacketParser { @@ -35,62 +27,52 @@ public: /** * @brief Parser constructor. - * @param maxExpectedPusPackets - * Maximum expected number of PUS packets. A good estimate is to divide - * the frame size by the minimum size of a PUS packet (12 bytes) - * @param storeSplitPackets - * Specifies whether split packets are also stored inside the FIFO, - * with the size being the remaining frame size. + * @param validPacketIds This vector contains the allowed 16-bit TC packet ID start markers + * The parser will search for these stark markers to detect the start of a space packet. + * It is also possible to pass an empty vector here, but this is not recommended. + * If an empty vector is passed, the parser will assume that the start of the given stream + * contains the start of a new space packet. */ SpacePacketParser(std::vector validPacketIds); + /** + * Parse a given frame for space packets but also increment the given buffer and assign the + * total number of bytes read so far + * @param buffer Parser will look for space packets in this buffer + * @param maxSize Maximum size of the buffer + * @param startIndex Start index of a found space packet + * @param foundSize Found size of the space packet + * @param readLen Length read so far. This value is incremented by the number of parsed + * bytes which also includes the size of a found packet + * -@c NO_PACKET_FOUND if no packet was found in the given buffer or the length field is + * invalid. foundSize will be set to the size of the space packet header. buffer and + * readLen will be incremented accordingly. + * -@c SPLIT_PACKET if a packet was found but the detected size exceeds maxSize. foundSize + * will be set to the detected packet size and startIndex will be set to the start of the + * detected packet. buffer and read length will not be incremented but the found length + * will be assigned. + * -@c RETURN_OK if a packet was found + */ + ReturnValue_t parseSpacePackets(const uint8_t **buffer, const size_t maxSize, + size_t& startIndex, size_t& foundSize, size_t& readLen); + /** - * Parse a given frame for PUS packets - * @param frame - * @param frameSize - * @param foundPackets The number of found packets will be stored here - * @return - * -@c NO_PACKET_FOUND if no packet was found - * -@c SPLIT_PACKET if splitting is enabled and a split packet was found - * -@c RETURN_OK if a packet was found. The index and sizes are stored in the internal FIFO + * Parse a given frame for space packets + * @param buffer Parser will look for space packets in this buffer + * @param maxSize Maximum size of the buffer + * @param startIndex Start index of a found space packet + * @param foundSize Found size of the space packet + * -@c NO_PACKET_FOUND if no packet was found in the given buffer or the length field is + * invalid. foundSize will be set to the size of the space packet header + * -@c SPLIT_PACKET if a packet was found but the detected size exceeds maxSize. foundSize + * will be set to the detected packet size and startIndex will be set to the start of the + * detected packet + * -@c RETURN_OK if a packet was found */ ReturnValue_t parseSpacePackets(const uint8_t* buffer, const size_t maxSize, size_t& startIndex, size_t& foundSize); - - ReturnValue_t parseSpacePackets(const uint8_t **buffer, const size_t maxSize, - size_t& startIndex, size_t& foundSize, size_t& readLen); - /** - * Accessor function to get a reference to the internal FIFO which - * stores pairs of index and packet sizes. This FIFO is filled - * by the #parsePusPackets function. - * @return - */ - //DynamicFIFO& fifo(); - - /** - * Retrieve the next index and packet size pair from the FIFO. - * This also removes it from the FIFO. Please note that if the FIFO - * is empty, an empty pair will be returned. - * @return - */ - //IndexSizePair getNextFifoPair(); - private: - /** - * A FIFO is used to store information about multiple PUS packets - * inside the receive buffer. The maximum number of entries is defined - * by the first constructor argument. - */ - //DynamicFIFO indexSizePairFIFO; - std::vector validPacketIds; - - //bool storeSplitPackets = false; - -// ReturnValue_t readMultiplePackets(const uint8_t *frame, size_t frameSize, -// size_t startIndex, uint32_t& foundPackets); -// ReturnValue_t readNextPacket(const uint8_t *frame, -// size_t frameSize, size_t& startIndex, uint32_t& foundPackets); }; #endif /* FRAMEWORK_TMTCSERVICES_PUSPARSER_H_ */ From 1622e23f1c15ddcf1d4b522c332c1ab156f91fd9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 28 Sep 2021 15:32:58 +0200 Subject: [PATCH 291/389] delay configurable --- src/fsfw/osal/common/TcpTmTcServer.cpp | 2 +- src/fsfw/osal/common/TcpTmTcServer.h | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/fsfw/osal/common/TcpTmTcServer.cpp b/src/fsfw/osal/common/TcpTmTcServer.cpp index fb421fc7..c3936146 100644 --- a/src/fsfw/osal/common/TcpTmTcServer.cpp +++ b/src/fsfw/osal/common/TcpTmTcServer.cpp @@ -187,7 +187,7 @@ void TcpTmTcServer::handleServerOperation(socket_t& connSocket) { return; } if(not tcAvailable and not tmSent) { - TaskFactory::delayTask(DEFAULT_LOOP_DELAY_MS); + TaskFactory::delayTask(tcpConfig.tcpLoopDelay); } } else { diff --git a/src/fsfw/osal/common/TcpTmTcServer.h b/src/fsfw/osal/common/TcpTmTcServer.h index d5214848..da0e8bd5 100644 --- a/src/fsfw/osal/common/TcpTmTcServer.h +++ b/src/fsfw/osal/common/TcpTmTcServer.h @@ -59,9 +59,10 @@ public: int tcpBacklog = 3; /** - * Passed to the select call which is used to ensure non-blocking TC reception + * If no telecommands packets are being received and no telemetry is being sent, + * the TCP server will delay periodically by this amount to decrease the CPU load */ - //uint32_t selectTimeoutMs = DEFAULT_SELECT_TIMEOUT_MS; + uint32_t tcpLoopDelay = DEFAULT_LOOP_DELAY_MS ; /** * Passed to the send call */ From 4f08b2d342d2b025bb477296219d141ad3bfd2d3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 28 Sep 2021 15:42:50 +0200 Subject: [PATCH 292/389] removed include --- hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.h | 1 - 1 file changed, 1 deletion(-) diff --git a/hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.h b/hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.h index 1ba680cb..6627cbb7 100644 --- a/hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.h +++ b/hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.h @@ -2,7 +2,6 @@ #define MISSION_DEVICES_MGMRM3100HANDLER_H_ #include "fsfw/FSFW.h" -#include "devices/powerSwitcherList.h" #include "devicedefinitions/MgmRM3100HandlerDefs.h" #include "fsfw/devicehandlers/DeviceHandlerBase.h" From 358ee0fbf2220109e2b37446486732114ec710c4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 28 Sep 2021 15:45:45 +0200 Subject: [PATCH 293/389] removed C++14 featue --- .../devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hal/src/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h b/hal/src/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h index 0ee2c7f6..b6375692 100644 --- a/hal/src/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h +++ b/hal/src/fsfw_hal/devicehandlers/devicedefinitions/MgmRM3100HandlerDefs.h @@ -49,7 +49,7 @@ static constexpr uint8_t TMRC_DEFAULT_VALUE = TMRC_DEFAULT_37HZ_VALUE; static constexpr uint8_t MEASUREMENT_REG_START = 0x24; static constexpr uint8_t BIST_REGISTER = 0x33; -static constexpr uint8_t DATA_READY_VAL = 0b1000'0000; +static constexpr uint8_t DATA_READY_VAL = 0b10000000; static constexpr uint8_t STATUS_REGISTER = 0x34; static constexpr uint8_t REVID_REGISTER = 0x36; From bf02f14772184394c51c500ccc6dc312839de746 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 28 Sep 2021 16:31:53 +0200 Subject: [PATCH 294/389] C++11 adaptions --- src/fsfw/tmtcpacket/SpacePacket.h | 17 ++++++++--------- src/fsfw/tmtcservices/SpacePacketParser.h | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/fsfw/tmtcpacket/SpacePacket.h b/src/fsfw/tmtcpacket/SpacePacket.h index 9eec87a8..67746859 100644 --- a/src/fsfw/tmtcpacket/SpacePacket.h +++ b/src/fsfw/tmtcpacket/SpacePacket.h @@ -32,15 +32,6 @@ public: */ virtual ~SpacePacket(); - static constexpr uint16_t getTcSpacePacketIdFromApid(uint16_t apid) { - uint16_t tcPacketId = (0x18 << 8) | (((apid >> 8) & 0x07) << 8) | (apid & 0x00ff); - return tcPacketId; - } - static constexpr uint16_t getTmSpacePacketIdFromApid(uint16_t apid) { - uint16_t tmPacketId = (0x08 << 8) | (((apid >> 8) & 0x07) << 8) | (apid & 0x00ff); - return tmPacketId; - } - /** * With this call, the complete data content (including the CCSDS Primary * Header) is overwritten with the byte stream given. @@ -78,4 +69,12 @@ protected: SpacePacketData localData; }; +constexpr uint16_t getTcSpacePacketIdFromApid(uint16_t apid) { + return (0x18 << 8) | (((apid >> 8) & 0x07) << 8) | (apid & 0x00ff); +} + +constexpr uint16_t getTmSpacePacketIdFromApid(uint16_t apid) { + return (0x08 << 8) | (((apid >> 8) & 0x07) << 8) | (apid & 0x00ff); +} + #endif /* SPACEPACKET_H_ */ diff --git a/src/fsfw/tmtcservices/SpacePacketParser.h b/src/fsfw/tmtcservices/SpacePacketParser.h index 82b15010..bed3369b 100644 --- a/src/fsfw/tmtcservices/SpacePacketParser.h +++ b/src/fsfw/tmtcservices/SpacePacketParser.h @@ -21,7 +21,7 @@ public: //! is the size of the PUS packet starting at that index. using IndexSizePair = std::pair; - static constexpr uint8_t INTERFACE_ID = CLASS_ID::PUS_PARSER; + static constexpr uint8_t INTERFACE_ID = CLASS_ID::SPACE_PACKET_PARSER; static constexpr ReturnValue_t NO_PACKET_FOUND = MAKE_RETURN_CODE(0x00); static constexpr ReturnValue_t SPLIT_PACKET = MAKE_RETURN_CODE(0x01); From 936bac5abdd6e56e8f3be85b624620948fecf714 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 28 Sep 2021 16:32:43 +0200 Subject: [PATCH 295/389] class id renamed --- src/fsfw/returnvalues/FwClassIds.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fsfw/returnvalues/FwClassIds.h b/src/fsfw/returnvalues/FwClassIds.h index cdbf5657..337709ed 100644 --- a/src/fsfw/returnvalues/FwClassIds.h +++ b/src/fsfw/returnvalues/FwClassIds.h @@ -78,6 +78,7 @@ enum: uint8_t { HAL_GPIO, //HGIO MGM_LIS3MDL, //MGMLIS3 MGM_RM3100, //MGMRM3100 + SPACE_PACKET_PARSER, //SPPA FW_CLASS_ID_COUNT // [EXPORT] : [END] }; From 32b5060c626261bd2729210f318bcc127d0117c3 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 28 Sep 2021 17:26:02 +0200 Subject: [PATCH 296/389] all windows fixes --- src/fsfw/osal/common/TcpTmTcServer.cpp | 158 +++++++++++++++++++++++-- src/fsfw/osal/common/TcpTmTcServer.h | 17 ++- 2 files changed, 162 insertions(+), 13 deletions(-) diff --git a/src/fsfw/osal/common/TcpTmTcServer.cpp b/src/fsfw/osal/common/TcpTmTcServer.cpp index 11ab71af..b22f4412 100644 --- a/src/fsfw/osal/common/TcpTmTcServer.cpp +++ b/src/fsfw/osal/common/TcpTmTcServer.cpp @@ -41,6 +41,17 @@ ReturnValue_t TcpTmTcServer::initialize() { return result; } + switch(receptionMode) { + case(ReceptionModes::SPACE_PACKETS): { + spacePacketParser = new SpacePacketParser(validPacketIds); + if(spacePacketParser == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } +#if defined PLATFORM_UNIX + tcpConfig.tcpFlags |= MSG_DONTWAIT; +#endif + } + } tcStore = ObjectManager::instance()->get(objects::TC_STORE); if (tcStore == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 @@ -144,11 +155,14 @@ ReturnValue_t TcpTmTcServer::initializeAfterTaskCreation() { return HasReturnvaluesIF::RETURN_OK; } -void TcpTmTcServer::handleServerOperation(socket_t connSocket) { - int retval = 0; - do { - // Read all telecommands sent by the client - retval = recv(connSocket, +void TcpTmTcServer::handleServerOperation(socket_t& connSocket) { +#if defined PLATFORM_WIN + setSocketNonBlocking(connSocket); +#endif + + while (true) { + int retval = recv( + connSocket, reinterpret_cast(receptionBuffer.data()), receptionBuffer.capacity(), tcpFlags); @@ -159,9 +173,34 @@ void TcpTmTcServer::handleServerOperation(socket_t connSocket) { // Client has finished sending telecommands, send telemetry now handleTmSending(connSocket); } - else { - // Should not happen - tcpip::handleError(tcpip::Protocol::TCP, tcpip::ErrorSources::RECV_CALL); + else if(retval < 0) { + int errorValue = GetLastError(); +#if defined PLATFORM_UNIX + int wouldBlockValue = EAGAIN; +#elif defined PLATFORM_WIN + int wouldBlockValue = WSAEWOULDBLOCK; +#endif + if(errorValue == wouldBlockValue) { + // No data available. Check whether any packets have been read, then send back + // telemetry if available + bool tcAvailable = false; + bool tmSent = false; + size_t availableReadData = ringBuffer.getAvailableReadData(); + if(availableReadData > lastRingBufferSize) { + tcAvailable = true; + handleTcRingBufferData(availableReadData); + } + ReturnValue_t result = handleTmSending(connSocket, tmSent); + if(result == CONN_BROKEN) { + return; + } + if(not tcAvailable and not tmSent) { + TaskFactory::delayTask(tcpConfig.tcpLoopDelay); + } + } + else { + tcpip::handleError(tcpip::Protocol::TCP, tcpip::ErrorSources::RECV_CALL, 300); + } } } while(retval > 0); } @@ -228,3 +267,106 @@ ReturnValue_t TcpTmTcServer::handleTmSending(socket_t connSocket) { } return HasReturnvaluesIF::RETURN_OK; } + +ReturnValue_t TcpTmTcServer::handleTcRingBufferData(size_t availableReadData) { + ReturnValue_t status = HasReturnvaluesIF::RETURN_OK; + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + size_t readAmount = availableReadData; + lastRingBufferSize = availableReadData; + if(readAmount >= ringBuffer.getMaxSize()) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + // Possible configuration error, too much data or/and data coming in too fast, + // requiring larger buffers + sif::warning << "TcpTmTcServer::handleServerOperation: Ring buffer reached " << + "fill count" << std::endl; +#else + sif::printWarning("TcpTmTcServer::handleServerOperation: Ring buffer reached " + "fill count"); +#endif +#endif + } + if(readAmount >= receptionBuffer.size()) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + // Possible configuration error, too much data or/and data coming in too fast, + // requiring larger buffers + sif::warning << "TcpTmTcServer::handleServerOperation: " + "Reception buffer too small " << std::endl; +#else + sif::printWarning("TcpTmTcServer::handleServerOperation: Reception buffer too small\n"); +#endif +#endif + readAmount = receptionBuffer.size(); + } + ringBuffer.readData(receptionBuffer.data(), readAmount, true); + const uint8_t* bufPtr = receptionBuffer.data(); + const uint8_t** bufPtrPtr = &bufPtr; + size_t startIdx = 0; + size_t foundSize = 0; + size_t readLen = 0; + while(readLen < readAmount) { + result = spacePacketParser->parseSpacePackets(bufPtrPtr, readAmount, + startIdx, foundSize, readLen); + switch(result) { + case(SpacePacketParser::NO_PACKET_FOUND): + case(SpacePacketParser::SPLIT_PACKET): { + break; + } + case(HasReturnvaluesIF::RETURN_OK): { + result = handleTcReception(receptionBuffer.data() + startIdx, foundSize); + if(result != HasReturnvaluesIF::RETURN_OK) { + status = result; + } + } + } + ringBuffer.deleteData(foundSize); + lastRingBufferSize = ringBuffer.getAvailableReadData(); + std::memset(receptionBuffer.data() + startIdx, 0, foundSize); + } + return status; +} + +void TcpTmTcServer::enableWiretapping(bool enable) { + this->wiretappingEnabled = enable; +} + +void TcpTmTcServer::handleSocketError(ConstStorageAccessor &accessor) { + // Don't delete data + accessor.release(); + auto socketError = getLastSocketError(); + switch(socketError) { +#if defined PLATFORM_WIN + case(WSAECONNRESET): { + // See https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send + // Remote client might have shut down connection + return; + } +#else + case(EPIPE): { + // See https://man7.org/linux/man-pages/man2/send.2.html + // Remote client might have shut down connection + return; + } +#endif + default: { + tcpip::handleError(tcpip::Protocol::TCP, tcpip::ErrorSources::SEND_CALL); + } + } +} + +void TcpTmTcServer::setSocketNonBlocking(socket_t &connSocket) { + u_long iMode = 1; + int iResult = ioctlsocket(connSocket, FIONBIO, &iMode); + if(iResult != NO_ERROR) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "TcpTmTcServer::handleServerOperation: Setting socket" + " non-blocking failed with error " << iResult; +#else + sif::printWarning("TcpTmTcServer::handleServerOperation: Setting socket" + " non-blocking failed with error %d\n", iResult); +#endif +#endif + } +} diff --git a/src/fsfw/osal/common/TcpTmTcServer.h b/src/fsfw/osal/common/TcpTmTcServer.h index c6916080..2104d859 100644 --- a/src/fsfw/osal/common/TcpTmTcServer.h +++ b/src/fsfw/osal/common/TcpTmTcServer.h @@ -84,12 +84,19 @@ private: int tcpBacklog = 3; std::vector receptionBuffer; - int tcpSockOpt = 0; - int tcpTmFlags = 0; + SimpleRingBuffer ringBuffer; + std::vector validPacketIds; + SpacePacketParser* spacePacketParser = nullptr; + uint8_t lastRingBufferSize = 0; - void handleServerOperation(socket_t connSocket); - ReturnValue_t handleTcReception(size_t bytesRecvd); - ReturnValue_t handleTmSending(socket_t connSocket); + virtual void handleServerOperation(socket_t& connSocket); + ReturnValue_t handleTcReception(uint8_t* spacePacket, size_t packetSize); + ReturnValue_t handleTmSending(socket_t connSocket, bool& tmSent); + ReturnValue_t handleTcRingBufferData(size_t availableReadData); + void handleSocketError(ConstStorageAccessor& accessor); +#if defined PLATFORM_WIN + void setSocketNonBlocking(socket_t& connSocket); +#endif }; #endif /* FSFW_OSAL_COMMON_TCP_TMTC_SERVER_H_ */ From b1a9c90087bad07c81f9f96594edf7e2fa51d077 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 28 Sep 2021 17:38:35 +0200 Subject: [PATCH 297/389] this should work for both OSes --- src/fsfw/osal/common/TcpTmTcServer.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/fsfw/osal/common/TcpTmTcServer.cpp b/src/fsfw/osal/common/TcpTmTcServer.cpp index 4348e21e..519df547 100644 --- a/src/fsfw/osal/common/TcpTmTcServer.cpp +++ b/src/fsfw/osal/common/TcpTmTcServer.cpp @@ -177,7 +177,7 @@ void TcpTmTcServer::handleServerOperation(socket_t& connSocket) { ringBuffer.writeData(receptionBuffer.data(), retval); } else if(retval < 0) { - int errorValue = GetLastError(); + int errorValue = getLastSocketError(); #if defined PLATFORM_UNIX int wouldBlockValue = EAGAIN; #elif defined PLATFORM_WIN @@ -387,6 +387,7 @@ void TcpTmTcServer::handleSocketError(ConstStorageAccessor &accessor) { } } +#if defined PLATFORM_WIN void TcpTmTcServer::setSocketNonBlocking(socket_t &connSocket) { u_long iMode = 1; int iResult = ioctlsocket(connSocket, FIONBIO, &iMode); @@ -402,3 +403,4 @@ void TcpTmTcServer::setSocketNonBlocking(socket_t &connSocket) { #endif } } +#endif From cffd77ed325aa24bef3f22bc85dbd573c2db362e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 28 Sep 2021 17:42:29 +0200 Subject: [PATCH 298/389] put functions in namespace --- src/fsfw/tmtcpacket/SpacePacket.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/fsfw/tmtcpacket/SpacePacket.h b/src/fsfw/tmtcpacket/SpacePacket.h index 67746859..fe8a1044 100644 --- a/src/fsfw/tmtcpacket/SpacePacket.h +++ b/src/fsfw/tmtcpacket/SpacePacket.h @@ -69,6 +69,8 @@ protected: SpacePacketData localData; }; +namespace spacepacket { + constexpr uint16_t getTcSpacePacketIdFromApid(uint16_t apid) { return (0x18 << 8) | (((apid >> 8) & 0x07) << 8) | (apid & 0x00ff); } @@ -77,4 +79,6 @@ constexpr uint16_t getTmSpacePacketIdFromApid(uint16_t apid) { return (0x08 << 8) | (((apid >> 8) & 0x07) << 8) | (apid & 0x00ff); } +} + #endif /* SPACEPACKET_H_ */ From 0a6a32a13003103ee6462d1c46f814e0c44ab07b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 29 Sep 2021 11:45:20 +0200 Subject: [PATCH 299/389] printout separation --- src/fsfw/osal/common/TcpTmTcServer.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/fsfw/osal/common/TcpTmTcServer.cpp b/src/fsfw/osal/common/TcpTmTcServer.cpp index 519df547..8b34b1a3 100644 --- a/src/fsfw/osal/common/TcpTmTcServer.cpp +++ b/src/fsfw/osal/common/TcpTmTcServer.cpp @@ -210,7 +210,11 @@ void TcpTmTcServer::handleServerOperation(socket_t& connSocket) { ReturnValue_t TcpTmTcServer::handleTcReception(uint8_t* spacePacket, size_t packetSize) { if(wiretappingEnabled) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 sif::info << "Received TC:" << std::endl; +#else + sif::printInfo("Received TC:\n"); +#endif arrayprinter::print(spacePacket, packetSize); } @@ -278,7 +282,11 @@ ReturnValue_t TcpTmTcServer::handleTmSending(socket_t connSocket, bool& tmSent) return result; } if(wiretappingEnabled) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 sif::info << "Sending TM:" << std::endl; +#else + sif::printInfo("Sending TM:\n"); +#endif arrayprinter::print(storeAccessor.data(), storeAccessor.size()); } int retval = send(connSocket, From 42b5f8a79df039a07ad1c0c886be685176a5165c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 29 Sep 2021 11:49:45 +0200 Subject: [PATCH 300/389] small fix for DLE unittest --- tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp b/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp index a82ac73a..8c2e55ed 100644 --- a/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp +++ b/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp @@ -103,7 +103,7 @@ TEST_CASE("DleEncoder" , "[DleEncoder]") { for(size_t faultyDestSize = 0; faultyDestSize < expectedVec.size(); faultyDestSize ++) { result = dleEncoder.encode(vecToEncode.data(), vecToEncode.size(), buffer.data(), faultyDestSize, &encodedLen); - REQUIRE(result == DleEncoder::STREAM_TOO_SHORT); + REQUIRE(result == static_cast(DleEncoder::STREAM_TOO_SHORT)); } }; From 9002c12cf157aec1d84984d0316d6bf94a60ba39 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 29 Sep 2021 11:55:20 +0200 Subject: [PATCH 301/389] update FSFW.h.in --- src/fsfw/FSFW.h.in | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/fsfw/FSFW.h.in b/src/fsfw/FSFW.h.in index f0eb9365..ddc69373 100644 --- a/src/fsfw/FSFW.h.in +++ b/src/fsfw/FSFW.h.in @@ -16,8 +16,21 @@ #cmakedefine FSFW_ADD_MONITORING #cmakedefine FSFW_ADD_SGP4_PROPAGATOR +// Can be used for low-level debugging of the SPI bus +#ifndef FSFW_HAL_SPI_WIRETAPPING +#define FSFW_HAL_SPI_WIRETAPPING 0 +#endif + #ifndef FSFW_HAL_L3GD20_GYRO_DEBUG -#define FSFW_HAL_L3GD20_GYRO_DEBUG 0 +#define FSFW_HAL_L3GD20_GYRO_DEBUG 0 #endif /* FSFW_HAL_L3GD20_GYRO_DEBUG */ +#ifndef FSFW_HAL_RM3100_MGM_DEBUG +#define FSFW_HAL_RM3100_MGM_DEBUG 0 +#endif /* FSFW_HAL_RM3100_MGM_DEBUG */ + +#ifndef FSFW_HAL_LIS3MDL_MGM_DEBUG +#define FSFW_HAL_LIS3MDL_MGM_DEBUG 0 +#endif /* FSFW_HAL_LIS3MDL_MGM_DEBUG */ + #endif /* FSFW_FSFW_H_ */ From faa7e1e24f1f6943111b1445db01b70870d2e717 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 29 Sep 2021 12:00:59 +0200 Subject: [PATCH 302/389] default values for PUS c config --- src/fsfw/FSFW.h.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/fsfw/FSFW.h.in b/src/fsfw/FSFW.h.in index ddc69373..e2591197 100644 --- a/src/fsfw/FSFW.h.in +++ b/src/fsfw/FSFW.h.in @@ -16,6 +16,14 @@ #cmakedefine FSFW_ADD_MONITORING #cmakedefine FSFW_ADD_SGP4_PROPAGATOR +#ifndef FSFW_USE_PUS_C_TELEMETRY +#define FSFW_USE_PUS_C_TELEMETRY 1 +#endif + +#ifndef FSFW_USE_PUS_C_TELECOMMANDS +#define FSFW_USE_PUS_C_TELECOMMANDS 1 +#endif + // Can be used for low-level debugging of the SPI bus #ifndef FSFW_HAL_SPI_WIRETAPPING #define FSFW_HAL_SPI_WIRETAPPING 0 From f388878b99bd30d1faa8429a7f64c300c4cecb23 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 29 Sep 2021 12:05:15 +0200 Subject: [PATCH 303/389] added more defines --- src/fsfw/FSFW.h.in | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/fsfw/FSFW.h.in b/src/fsfw/FSFW.h.in index e2591197..512a25be 100644 --- a/src/fsfw/FSFW.h.in +++ b/src/fsfw/FSFW.h.in @@ -14,19 +14,39 @@ #cmakedefine FSFW_ADD_COORDINATES #cmakedefine FSFW_ADD_PUS #cmakedefine FSFW_ADD_MONITORING -#cmakedefine FSFW_ADD_SGP4_PROPAGATOR +#cmakedefine FSFW_ADD_SGP4_PROPAGATOR0 + +// FSFW core defines + +#ifndef FSFW_CPP_OSTREAM_ENABLED +#define FSFW_CPP_OSTREAM_ENABLED 1 +#endif /* FSFW_CPP_OSTREAM_ENABLED */ + +#ifndef FSFW_VERBOSE_LEVEL +#define FSFW_VERBOSE_LEVEL 1 +#endif /* FSFW_VERBOSE_LEVEL */ + +#ifndef FSFW_USE_REALTIME_FOR_LINUX +#define FSFW_USE_REALTIME_FOR_LINUX 0 +#endif /* FSFW_USE_REALTIME_FOR_LINUX */ + +#ifndef FSFW_NO_C99_IO +#define FSFW_NO_C99_IO 0 +#endif /* FSFW_NO_C99_IO */ #ifndef FSFW_USE_PUS_C_TELEMETRY #define FSFW_USE_PUS_C_TELEMETRY 1 -#endif +#endif /* FSFW_USE_PUS_C_TELEMETRY */ #ifndef FSFW_USE_PUS_C_TELECOMMANDS #define FSFW_USE_PUS_C_TELECOMMANDS 1 #endif +// FSFW HAL defines + // Can be used for low-level debugging of the SPI bus #ifndef FSFW_HAL_SPI_WIRETAPPING -#define FSFW_HAL_SPI_WIRETAPPING 0 +#define FSFW_HAL_SPI_WIRETAPPING 0 #endif #ifndef FSFW_HAL_L3GD20_GYRO_DEBUG From febe3cc4d45ac2a324a0d956e655a988a79abf68 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 29 Sep 2021 12:05:24 +0200 Subject: [PATCH 304/389] define fix --- src/fsfw/FSFW.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsfw/FSFW.h.in b/src/fsfw/FSFW.h.in index 512a25be..7e52b646 100644 --- a/src/fsfw/FSFW.h.in +++ b/src/fsfw/FSFW.h.in @@ -14,7 +14,7 @@ #cmakedefine FSFW_ADD_COORDINATES #cmakedefine FSFW_ADD_PUS #cmakedefine FSFW_ADD_MONITORING -#cmakedefine FSFW_ADD_SGP4_PROPAGATOR0 +#cmakedefine FSFW_ADD_SGP4_PROPAGATOR // FSFW core defines From b0cbd40e647d1a131e12f1e3ff7ae4ff45443d26 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 30 Sep 2021 11:25:42 +0200 Subject: [PATCH 305/389] possible bugfix for DLE encoder --- src/fsfw/globalfunctions/DleEncoder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsfw/globalfunctions/DleEncoder.cpp b/src/fsfw/globalfunctions/DleEncoder.cpp index 47ea5c4e..f4691cc6 100644 --- a/src/fsfw/globalfunctions/DleEncoder.cpp +++ b/src/fsfw/globalfunctions/DleEncoder.cpp @@ -165,7 +165,7 @@ ReturnValue_t DleEncoder::decodeStreamEscaped(const uint8_t *sourceStream, size_ if (sourceStream[encodedIndex++] != STX_CHAR) { return DECODING_ERROR; } - while ((encodedIndex < sourceStreamLen) + while ((encodedIndex < sourceStreamLen - 1) and (decodedIndex < maxDestStreamlen) and (sourceStream[encodedIndex] != ETX_CHAR) and (sourceStream[encodedIndex] != STX_CHAR)) { From f76f462022e45dbc13b452bb2e2c4e8cea5159f5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 30 Sep 2021 11:27:14 +0200 Subject: [PATCH 306/389] test added --- tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp b/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp index 8c2e55ed..cffd5308 100644 --- a/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp +++ b/tests/src/fsfw_tests/unit/globalfunctions/testDleEncoder.cpp @@ -218,5 +218,10 @@ TEST_CASE("DleEncoder" , "[DleEncoder]") { REQUIRE(result == static_cast(DleEncoder::DECODING_ERROR)); dleEncoder.setEscapeMode(true); + testArray1EncodedFaulty = TEST_ARRAY_1_ENCODED_ESCAPED; + testArray1EncodedFaulty[5] = 0; + result = dleEncoder.decode(testArray1EncodedFaulty.data(), testArray1EncodedFaulty.size(), + &readLen, buffer.data(), buffer.size(), &encodedLen); + REQUIRE(result == static_cast(DleEncoder::DECODING_ERROR)); } } From afb472996c219c20a94a0df3754430b9df3a546a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 30 Sep 2021 16:49:30 +0200 Subject: [PATCH 307/389] refactoring, code more understandable --- src/fsfw/globalfunctions/DleEncoder.cpp | 48 +++++++++++++------------ 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/src/fsfw/globalfunctions/DleEncoder.cpp b/src/fsfw/globalfunctions/DleEncoder.cpp index f4691cc6..f77d5472 100644 --- a/src/fsfw/globalfunctions/DleEncoder.cpp +++ b/src/fsfw/globalfunctions/DleEncoder.cpp @@ -165,11 +165,9 @@ ReturnValue_t DleEncoder::decodeStreamEscaped(const uint8_t *sourceStream, size_ if (sourceStream[encodedIndex++] != STX_CHAR) { return DECODING_ERROR; } - while ((encodedIndex < sourceStreamLen - 1) - and (decodedIndex < maxDestStreamlen) - and (sourceStream[encodedIndex] != ETX_CHAR) - and (sourceStream[encodedIndex] != STX_CHAR)) { - if (sourceStream[encodedIndex] == DLE_CHAR) { + while ((encodedIndex < sourceStreamLen) and (decodedIndex < maxDestStreamlen)) { + switch(sourceStream[encodedIndex]) { + case(DLE_CHAR): { if(encodedIndex + 1 >= sourceStreamLen) { //reached the end of the sourceStream *readLen = sourceStreamLen; @@ -197,29 +195,33 @@ ReturnValue_t DleEncoder::decodeStreamEscaped(const uint8_t *sourceStream, size_ } } ++encodedIndex; + break; } - else { - destStream[decodedIndex] = sourceStream[encodedIndex]; - } - - ++encodedIndex; - ++decodedIndex; - } - if (sourceStream[encodedIndex] != ETX_CHAR) { - if(decodedIndex == maxDestStreamlen) { - //so far we did not find anything wrong here, so let user try again - *readLen = 0; - return STREAM_TOO_SHORT; - } - else { + case(STX_CHAR): { *readLen = ++encodedIndex; return DECODING_ERROR; } + case(ETX_CHAR): { + *readLen = ++encodedIndex; + *decodedLen = decodedIndex; + return RETURN_OK; + } + default: { + destStream[decodedIndex] = sourceStream[encodedIndex]; + break; + } + } + ++encodedIndex; + ++decodedIndex; } - else { - *readLen = ++encodedIndex; - *decodedLen = decodedIndex; - return RETURN_OK; + + if(decodedIndex == maxDestStreamlen) { + //so far we did not find anything wrong here, so let user try again + *readLen = 0; + return STREAM_TOO_SHORT; + } else { + *readLen = encodedIndex; + return DECODING_ERROR; } } From 2439613f210d416c4d1c734756f76d4951fa2ab1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 4 Oct 2021 14:38:10 +0200 Subject: [PATCH 308/389] preserve STX char --- src/fsfw/globalfunctions/DleEncoder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsfw/globalfunctions/DleEncoder.cpp b/src/fsfw/globalfunctions/DleEncoder.cpp index f77d5472..91db5445 100644 --- a/src/fsfw/globalfunctions/DleEncoder.cpp +++ b/src/fsfw/globalfunctions/DleEncoder.cpp @@ -198,7 +198,7 @@ ReturnValue_t DleEncoder::decodeStreamEscaped(const uint8_t *sourceStream, size_ break; } case(STX_CHAR): { - *readLen = ++encodedIndex; + *readLen = encodedIndex; return DECODING_ERROR; } case(ETX_CHAR): { From 146e1e32827f6bdc705549466025699e8b4f12a3 Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Mon, 4 Oct 2021 14:47:32 +0200 Subject: [PATCH 309/389] bumped version to 2.0.0 for next release --- src/fsfw/FSFWVersion.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fsfw/FSFWVersion.h b/src/fsfw/FSFWVersion.h index f8e89694..c581a85c 100644 --- a/src/fsfw/FSFWVersion.h +++ b/src/fsfw/FSFWVersion.h @@ -3,8 +3,8 @@ const char* const FSFW_VERSION_NAME = "ASTP"; -#define FSFW_VERSION 1 -#define FSFW_SUBVERSION 2 +#define FSFW_VERSION 2 +#define FSFW_SUBVERSION 0 #define FSFW_REVISION 0 #endif /* FSFW_VERSION_H_ */ From 5749e159e4f487dbe0c2fe7b66811ee3f1d21cc7 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 7 Oct 2021 10:39:16 +0200 Subject: [PATCH 310/389] minor updates for PUS services --- src/fsfw/pus/Service5EventReporting.cpp | 10 ++++++---- src/fsfw/pus/Service8FunctionManagement.cpp | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/fsfw/pus/Service5EventReporting.cpp b/src/fsfw/pus/Service5EventReporting.cpp index 36aa7e70..2293ab20 100644 --- a/src/fsfw/pus/Service5EventReporting.cpp +++ b/src/fsfw/pus/Service5EventReporting.cpp @@ -41,8 +41,7 @@ ReturnValue_t Service5EventReporting::performService() { } } #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << "Service5EventReporting::generateEventReport:" - " Too many events" << std::endl; + sif::warning << "Service5EventReporting::generateEventReport: Too many events" << std::endl; #endif return HasReturnvaluesIF::RETURN_OK; } @@ -64,8 +63,11 @@ ReturnValue_t Service5EventReporting::generateEventReport( requestQueue->getDefaultDestination(),requestQueue->getId()); if(result != HasReturnvaluesIF::RETURN_OK) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << "Service5EventReporting::generateEventReport:" - " Could not send TM packet" << std::endl; + sif::warning << "Service5EventReporting::generateEventReport: " + "Could not send TM packet" << std::endl; +#else + sif::printWarning("Service5EventReporting::generateEventReport: " + "Could not send TM packet\n"); #endif } return result; diff --git a/src/fsfw/pus/Service8FunctionManagement.cpp b/src/fsfw/pus/Service8FunctionManagement.cpp index 39e872a0..48820d6e 100644 --- a/src/fsfw/pus/Service8FunctionManagement.cpp +++ b/src/fsfw/pus/Service8FunctionManagement.cpp @@ -33,8 +33,8 @@ ReturnValue_t Service8FunctionManagement::getMessageQueueAndObject( if(tcDataLen < sizeof(object_id_t)) { return CommandingServiceBase::INVALID_TC; } - SerializeAdapter::deSerialize(objectId, &tcData, - &tcDataLen, SerializeIF::Endianness::BIG); + // Can't fail, size was checked before + SerializeAdapter::deSerialize(objectId, &tcData, &tcDataLen, SerializeIF::Endianness::BIG); return checkInterfaceAndAcquireMessageQueue(id,objectId); } From 76416f523d055807f5f2f8d7b57f38eaee0d7102 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 7 Oct 2021 10:44:44 +0200 Subject: [PATCH 311/389] better naming for parameter --- src/fsfw/returnvalues/HasReturnvaluesIF.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fsfw/returnvalues/HasReturnvaluesIF.h b/src/fsfw/returnvalues/HasReturnvaluesIF.h index 4a3835b6..e9321ace 100644 --- a/src/fsfw/returnvalues/HasReturnvaluesIF.h +++ b/src/fsfw/returnvalues/HasReturnvaluesIF.h @@ -22,9 +22,9 @@ public: * @param number * @return */ - static constexpr ReturnValue_t makeReturnCode(uint8_t interfaceId, + static constexpr ReturnValue_t makeReturnCode(uint8_t classId, uint8_t number) { - return (static_cast(interfaceId) << 8) + number; + return (static_cast(classId) << 8) + number; } }; From ade15ad16d9d03512b148fa83e1be14cb3d48570 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 7 Oct 2021 13:24:46 +0200 Subject: [PATCH 312/389] tests can now be built as part of FSFW This PR refactores the tests so they are built as part of the FSFW. This is done by adding Catch2 with the FetchContent directive. A future implementation might also use a system installation of Catch2 by first checking whether Catch2 can already be found as a package The custom configuration folder testcfg was moved from the user folder to the actual unittest folder. The tests can be built by setting the CMake FSFW_BUILD_UNITTESTS option to TRUE/ON. They are built with the static library and dropped inside the build folders fsfw directory. --- CMakeLists.txt | 129 +++++++++++++++++- README.md | 76 ++++++++++- scripts/coverage.py | 74 ++++++++++ tests/src/fsfw_tests/CMakeLists.txt | 2 +- .../internal/InternalUnitTester.cpp | 6 +- .../fsfw_tests/internal/osal/CMakeLists.txt | 6 +- .../internal/osal/testCmdExecutor.cpp | 1 + .../internal/osal/testCmdExecutor.h | 10 ++ .../osal/{IntTestMq.cpp => testMq.cpp} | 2 +- .../internal/osal/{IntTestMq.h => testMq.h} | 0 .../osal/{IntTestMutex.cpp => testMutex.cpp} | 2 +- .../osal/{IntTestMutex.h => testMutex.h} | 0 ...IntTestSemaphore.cpp => testSemaphore.cpp} | 2 +- .../{IntTestSemaphore.h => testSemaphore.h} | 0 tests/src/fsfw_tests/unit/CMakeLists.txt | 9 +- tests/src/fsfw_tests/unit/CatchFactory.h | 2 +- tests/src/fsfw_tests/unit/CatchRunner.cpp | 2 +- tests/src/fsfw_tests/unit/CatchRunner.h | 2 +- .../src/fsfw_tests/unit/action/CMakeLists.txt | 2 +- .../fsfw_tests/unit/container/CMakeLists.txt | 2 +- .../unit/datapoollocal/CMakeLists.txt | 2 +- .../unit/globalfunctions/CMakeLists.txt | 2 +- tests/src/fsfw_tests/unit/osal/CMakeLists.txt | 2 +- .../fsfw_tests/unit/serialize/CMakeLists.txt | 2 +- .../unit/storagemanager/CMakeLists.txt | 2 +- .../fsfw_tests/unit/testcfg/CMakeLists.txt | 28 ++++ .../fsfw_tests/unit}/testcfg/FSFWConfig.h.in | 39 +++--- .../fsfw_tests/unit/testcfg/OBSWConfig.h.in | 15 ++ .../fsfw_tests/unit}/testcfg/TestsConfig.h.in | 0 .../testcfg/devices/logicalAddresses.cpp | 0 .../unit}/testcfg/devices/logicalAddresses.h | 3 +- .../testcfg/devices/powerSwitcherList.cpp | 0 .../unit}/testcfg/devices/powerSwitcherList.h | 0 .../unit}/testcfg/events/subsystemIdRanges.h | 7 +- .../unit/testcfg/events/translateEvents.cpp | 15 ++ .../unit/testcfg/events/translateEvents.h | 8 ++ .../unit}/testcfg/ipc/MissionMessageTypes.cpp | 0 .../unit}/testcfg/ipc/MissionMessageTypes.h | 0 .../unit}/testcfg/objects/systemObjectList.h | 7 +- .../unit/testcfg/objects/translateObjects.cpp | 19 +++ .../unit/testcfg/objects/translateObjects.h | 8 ++ .../PollingSequenceFactory.cpp | 2 +- .../pollingsequence/PollingSequenceFactory.h | 0 .../unit}/testcfg/returnvalues/classIds.h | 3 +- .../fsfw_tests/unit}/testcfg/tmtc/apid.h | 1 + .../fsfw_tests/unit}/testcfg/tmtc/pusIds.h | 0 .../unit/timemanager/CMakeLists.txt | 2 +- .../fsfw_tests/unit/tmtcpacket/CMakeLists.txt | 2 +- tests/user/README.md | 19 --- tests/user/testcfg/CMakeLists.txt | 11 -- tests/user/testcfg/OBSWConfig.h.in | 8 -- 51 files changed, 429 insertions(+), 107 deletions(-) create mode 100755 scripts/coverage.py create mode 100644 tests/src/fsfw_tests/internal/osal/testCmdExecutor.cpp create mode 100644 tests/src/fsfw_tests/internal/osal/testCmdExecutor.h rename tests/src/fsfw_tests/internal/osal/{IntTestMq.cpp => testMq.cpp} (96%) rename tests/src/fsfw_tests/internal/osal/{IntTestMq.h => testMq.h} (100%) rename tests/src/fsfw_tests/internal/osal/{IntTestMutex.cpp => testMutex.cpp} (96%) rename tests/src/fsfw_tests/internal/osal/{IntTestMutex.h => testMutex.h} (100%) rename tests/src/fsfw_tests/internal/osal/{IntTestSemaphore.cpp => testSemaphore.cpp} (98%) rename tests/src/fsfw_tests/internal/osal/{IntTestSemaphore.h => testSemaphore.h} (100%) create mode 100644 tests/src/fsfw_tests/unit/testcfg/CMakeLists.txt rename tests/{user => src/fsfw_tests/unit}/testcfg/FSFWConfig.h.in (67%) create mode 100644 tests/src/fsfw_tests/unit/testcfg/OBSWConfig.h.in rename tests/{user => src/fsfw_tests/unit}/testcfg/TestsConfig.h.in (100%) rename tests/{user => src/fsfw_tests/unit}/testcfg/devices/logicalAddresses.cpp (100%) rename tests/{user => src/fsfw_tests/unit}/testcfg/devices/logicalAddresses.h (84%) rename tests/{user => src/fsfw_tests/unit}/testcfg/devices/powerSwitcherList.cpp (100%) rename tests/{user => src/fsfw_tests/unit}/testcfg/devices/powerSwitcherList.h (100%) rename tests/{user => src/fsfw_tests/unit}/testcfg/events/subsystemIdRanges.h (64%) create mode 100644 tests/src/fsfw_tests/unit/testcfg/events/translateEvents.cpp create mode 100644 tests/src/fsfw_tests/unit/testcfg/events/translateEvents.h rename tests/{user => src/fsfw_tests/unit}/testcfg/ipc/MissionMessageTypes.cpp (100%) rename tests/{user => src/fsfw_tests/unit}/testcfg/ipc/MissionMessageTypes.h (100%) rename tests/{user => src/fsfw_tests/unit}/testcfg/objects/systemObjectList.h (84%) create mode 100644 tests/src/fsfw_tests/unit/testcfg/objects/translateObjects.cpp create mode 100644 tests/src/fsfw_tests/unit/testcfg/objects/translateObjects.h rename tests/{user => src/fsfw_tests/unit}/testcfg/pollingsequence/PollingSequenceFactory.cpp (97%) rename tests/{user => src/fsfw_tests/unit}/testcfg/pollingsequence/PollingSequenceFactory.h (100%) rename tests/{user => src/fsfw_tests/unit}/testcfg/returnvalues/classIds.h (76%) rename tests/{user => src/fsfw_tests/unit}/testcfg/tmtc/apid.h (90%) rename tests/{user => src/fsfw_tests/unit}/testcfg/tmtc/pusIds.h (100%) delete mode 100644 tests/user/README.md delete mode 100644 tests/user/testcfg/CMakeLists.txt delete mode 100644 tests/user/testcfg/OBSWConfig.h.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ff66a6d..ff631201 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION 3.13) +set(FSFW_VERSION 2) +set(FSFW_SUBVERSION 0) +set(FSFW_REVISION 0) + option(FSFW_GENERATE_SECTIONS "Generate function and data sections. Required to remove unused code" ON ) @@ -7,6 +11,11 @@ if(FSFW_GENERATE_SECTIONS) option(FSFW_REMOVE_UNUSED_CODE "Remove unused code" ON) endif() +option(FSFW_BUILD_UNITTESTS "Build unittest binary in addition to static library" OFF) +if(FSFW_BUILD_UNITTESTS) + option(FSFW_TESTS_GEN_COV "Generate coverage data for unittests" ON) +endif() + option(FSFW_WARNING_SHADOW_LOCAL_GCC "Enable -Wshadow=local warning in GCC" ON) # Options to exclude parts of the FSFW from compilation. option(FSFW_ADD_INTERNAL_TESTS "Add internal unit tests" ON) @@ -26,11 +35,57 @@ option(FSFW_ADD_TMSTORAGE "Compile with tm storage components" OFF) option(FSFW_ADD_SGP4_PROPAGATOR "Add SGP4 propagator code" OFF) set(LIB_FSFW_NAME fsfw) +set(FSFW_TEST_TGT fsfw-tests) + add_library(${LIB_FSFW_NAME}) + +if(FSFW_BUILD_UNITTESTS) + # Check whether the user has already installed Catch2 first + find_package(Catch2 3) + # Not installed, so use FetchContent to download and provide Catch2 + if(NOT Catch2_FOUND) + include(FetchContent) + + FetchContent_Declare( + Catch2 + GIT_REPOSITORY https://github.com/catchorg/Catch2.git + GIT_TAG v3.0.0-preview3 + ) + + FetchContent_MakeAvailable(Catch2) + endif() + + configure_file(tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in tests/FSFWConfig.h) + configure_file(tests/src/fsfw_tests/unit/testcfg/TestsConfig.h.in tests/TestsConfig.h) + configure_file(tests/src/fsfw_tests/unit/testcfg/OBSWConfig.h.in tests/OBSWConfig.h) + add_executable(${FSFW_TEST_TGT}) + + if(FSFW_TESTS_GEN_COV) + include(FetchContent) + FetchContent_Declare( + cmake-modules + GIT_REPOSITORY https://github.com/bilke/cmake-modules.git + ) + FetchContent_MakeAvailable(cmake-modules) + list(APPEND CMAKE_MODULE_PATH ${cmake-modules_SOURCE_DIR}) + include(CodeCoverage) + endif() +endif() + set(FSFW_CORE_INC_PATH "inc") set_property(CACHE FSFW_OSAL PROPERTY STRINGS host linux rtems freertos) +# Configure Files +target_include_directories(${LIB_FSFW_NAME} PRIVATE + ${CMAKE_CURRENT_BINARY_DIR} +) +target_include_directories(${LIB_FSFW_NAME} INTERFACE + ${CMAKE_CURRENT_BINARY_DIR} +) +configure_file(src/fsfw/FSFW.h.in FSFW.h) +configure_file(src/fsfw/FSFWVersion.h.in FSFWVersion.h) + if(NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED True) @@ -63,29 +118,29 @@ endif() set(FSFW_OSAL_DEFINITION FSFW_OSAL_HOST) if(FSFW_OSAL MATCHES host) - set(OS_FSFW_NAME "Host") + set(FSFW_OS_NAME "Host") set(FSFW_OSAL_HOST ON) elseif(FSFW_OSAL MATCHES linux) - set(OS_FSFW_NAME "Linux") + set(FSFW_OS_NAME "Linux") set(FSFW_OSAL_LINUX ON) elseif(FSFW_OSAL MATCHES freertos) - set(OS_FSFW_NAME "FreeRTOS") + set(FSFW_OS_NAME "FreeRTOS") set(FSFW_OSAL_FREERTOS ON) target_link_libraries(${LIB_FSFW_NAME} PRIVATE ${LIB_OS_NAME} ) elseif(FSFW_OSAL STREQUAL rtems) - set(OS_FSFW_NAME "RTEMS") + set(FSFW_OS_NAME "RTEMS") set(FSFW_OSAL_RTEMS ON) else() message(WARNING "Invalid operating system for FSFW specified! Setting to host.." ) - set(OS_FSFW_NAME "Host") + set(FSFW_OS_NAME "Host") set(OS_FSFW "host") endif() -message(STATUS "Compiling FSFW for the ${OS_FSFW_NAME} operating system.") +message(STATUS "Compiling FSFW for the ${FSFW_OS_NAME} operating system.") add_subdirectory(src) add_subdirectory(tests) @@ -94,6 +149,66 @@ if(FSFW_ADD_HAL) endif() add_subdirectory(contrib) +if(FSFW_BUILD_UNITTESTS) + if(FSFW_TESTS_GEN_COV) + if(CMAKE_COMPILER_IS_GNUCXX) + include(CodeCoverage) + + # Remove quotes. + separate_arguments(COVERAGE_COMPILER_FLAGS + NATIVE_COMMAND "${COVERAGE_COMPILER_FLAGS}" + ) + + # Add compile options manually, we don't want coverage for Catch2 + target_compile_options(${FSFW_TEST_TGT} PRIVATE + "${COVERAGE_COMPILER_FLAGS}" + ) + target_compile_options(${LIB_FSFW_NAME} PRIVATE + "${COVERAGE_COMPILER_FLAGS}" + ) + + # Exclude directories here + if(WIN32) + set(GCOVR_ADDITIONAL_ARGS + "--exclude-throw-branches" + "--exclude-unreachable-branches" + ) + set(COVERAGE_EXCLUDES + "/c/msys64/mingw64/*" + ) + elseif(UNIX) + set(COVERAGE_EXCLUDES + "/usr/include/*" "/usr/bin/*" "Catch2/*" + ) + endif() + + target_link_options(${FSFW_TEST_TGT} PRIVATE + -fprofile-arcs + -ftest-coverage + ) + target_link_options(${LIB_FSFW_NAME} PRIVATE + -fprofile-arcs + -ftest-coverage + ) + + if(WIN32) + setup_target_for_coverage_gcovr_html( + NAME ${FSFW_TEST_TGT}_coverage + EXECUTABLE ${FSFW_TEST_TGT} + DEPENDENCIES ${FSFW_TEST_TGT} + ) + else() + setup_target_for_coverage_lcov( + NAME ${FSFW_TEST_TGT}_coverage + EXECUTABLE ${FSFW_TEST_TGT} + DEPENDENCIES ${FSFW_TEST_TGT} + ) + endif() + endif() + endif() + target_link_libraries(${FSFW_TEST_TGT} PRIVATE Catch2::Catch2 ${LIB_FSFW_NAME}) +endif() + # The project CMakeLists file has to set the FSFW_CONFIG_PATH and add it. # If this is not given, we include the default configuration and emit a warning. if(NOT FSFW_CONFIG_PATH) @@ -186,4 +301,4 @@ target_compile_options(${LIB_FSFW_NAME} PRIVATE target_link_libraries(${LIB_FSFW_NAME} PRIVATE ${FSFW_ADDITIONAL_LINK_LIBS} -) \ No newline at end of file +) diff --git a/README.md b/README.md index 48d2b8e7..a7ae0e20 100644 --- a/README.md +++ b/README.md @@ -22,17 +22,83 @@ Currently, the FSFW provides the following OSALs: - FreeRTOS - RTEMS -The recommended hardware is a microprocessor with more than 1 MB of RAM and 1 MB of non-volatile Memory. For reference, current applications use a Cobham Gaisler UT699 (LEON3FT), a ISISPACE IOBC or a Zynq-7020 SoC. The `fsfw` was also successfully run on the STM32H743ZI-Nucleo board and on a Raspberry Pi and is currently running on the active satellite mission Flying Laptop. +The recommended hardware is a microprocessor with more than 1 MB of RAM and 1 MB of non-volatile +memory. For reference, current applications use a Cobham Gaisler UT699 (LEON3FT), a +ISISPACE IOBC or a Zynq-7020 SoC. The `fsfw` was also successfully run on the +STM32H743ZI-Nucleo board and on a Raspberry Pi and is currently running on the active +satellite mission Flying Laptop. ## Getting started -The [FSFW example](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example) provides a good starting point and a demo to see the FSFW capabilities and build it with the Make or the CMake build system. It is recommended to evaluate the FSFW by building and playing around with the demo application. +The [Hosted FSFW example](https://egit.irs.uni-stuttgart.de/fsfw/fsfw-example-hosted) provides a +good starting point and a demo to see the FSFW capabilities. +It is recommended to get started by building and playing around with the demo application. +There are also other examples provided for all OSALs using the popular embedded platforms +Raspberry Pi, Beagle Bone Black and STM32H7. -Generally, the FSFW is included in a project by compiling the FSFW sources and providing -a configuration folder and adding it to the include path. There are some functions like `printChar` which are different depending on the target architecture and need to be implemented by the mission developer. +Generally, the FSFW is included in a project by providing +a configuration folder, building the static library and linking against it. +There are some functions like `printChar` which are different depending on the target architecture +and need to be implemented by the mission developer. A template configuration folder was provided and can be copied into the project root to have -a starting point. The [configuration section](doc/README-config.md#top) provides more specific information about the possible options. +a starting point. The [configuration section](doc/README-config.md#top) provides more specific +information about the possible options. + +## Adding the library + +The following steps show how to add and use FSFW components. It is still recommended to +try out the example mentioned above to get started, but the following steps show how to +add and link against the FSFW library in general. + +1. Add this repository as a submodule + + ```sh + git submodule add https://egit.irs.uni-stuttgart.de/fsfw/fsfw.git fsfw + ``` + +2. Add the following directive inside the uppermost `CMakeLists.txt` file of your project + + ```cmake + add_subdirectory(fsfw) + ``` + +3. Make sure to provide a configuration folder and supply the path to that folder with + the `FSFW_CONFIG_PATH` CMake variable from the uppermost `CMakeLists.txt` file. + It is also necessary to provide the `printChar` function. You can find an example + implementation for a hosted build + [here](https://egit.irs.uni-stuttgart.de/fsfw/fsfw-example-hosted/src/branch/master/bsp_hosted/utility/printChar.c). + +4. Link against the FSFW library + + ```cmake + target_link_libraries( PRIVATE fsfw) + ``` + +5. It should now be possible use the FSFW as a static library from the user code. + +## Building the unittests + +The FSFW also has unittests which use the [Catch2 library](https://github.com/catchorg/Catch2). +These are built by setting the CMake option `FSFW_BUILD_UNITTESTS` to `ON` or `TRUE` +from your project `CMakeLists.txt` file or from the command line. + +The fsfw-tests binary will be built as part of the static library and dropped alongside it inside +the `fsfw` folder of the build folder. + +If the unittests are built, the library and the tests will be built with coverage information by +default. This can be disabled by setting the `FSFW_TESTS_COV_GEN` option to `OFF` or `FALSE`. + +Coverage data in HTML format can be generated using the `CodeCoverage` +[CMake module](https://github.com/bilke/cmake-modules/tree/master). +To build the unittests, run them and then generare the coverage data in this format, +the following command can be used inside the build directory after the build system was set up + +```sh +cmake --build . -- fsfw-tests_coverage -j +``` + +The `coverage.py` script located in the `script` folder can also be used to do this conveniently. ## Index diff --git a/scripts/coverage.py b/scripts/coverage.py new file mode 100755 index 00000000..d15c3154 --- /dev/null +++ b/scripts/coverage.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -* +"""Small portable helper script to generate LCOV HTML coverage data""" +import os +import platform +import sys +import time +import argparse +from typing import List + + +"""Copy this helper script into your project folder. It will try to determine a CMake build folder +and then attempt to build your project with coverage information. + +See Unittest documentation at https://egit.irs.uni-stuttgart.de/fsfw/fsfw for more +information how to set up the build folder. +""" +def main(): + + parser = argparse.ArgumentParser(description="Processing arguments for LCOV helper script.") + + build_dir_list = [] + for directory in os.listdir("."): + if os.path.isdir(directory): + os.chdir(directory) + check_for_cmake_build_dir(build_dir_list) + os.chdir("..") + + if len(build_dir_list) == 0: + print("No valid CMake build directory found. Trying to set up hosted build") + build_directory = 'build-Debug-Host' + os.mkdir(build_directory) + os.chdir(build_directory) + os.system('cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON ..') + os.chdir('..') + elif len(build_dir_list) == 1: + build_directory = build_dir_list[0] + else: + print("Multiple build directories found!") + build_directory = determine_build_dir(build_dir_list) + perform_lcov_operation(build_directory) + + +def check_for_cmake_build_dir(build_dir_dict: list): + if os.path.isfile("CMakeCache.txt"): + build_dir_dict.append(os.getcwd()) + + +def perform_lcov_operation(directory): + os.chdir(directory) + os.system("cmake --build . -- fsfw-tests_coverage -j") + + +def determine_build_dir(build_dir_list: List[str]): + build_directory = "" + for idx, directory in enumerate(build_dir_list): + print(f"{idx + 1}: {directory}") + while True: + idx = input("Pick the directory to perform LCOV HTML generation by index: ") + if not idx.isdigit(): + print("Invalid input!") + continue + + idx = int(idx) + if idx > len(build_dir_list) or idx < 1: + print("Invalid input!") + continue + build_directory = build_dir_list[idx - 1] + break + return build_directory + + +if __name__ == "__main__": + main() diff --git a/tests/src/fsfw_tests/CMakeLists.txt b/tests/src/fsfw_tests/CMakeLists.txt index e4a6be80..80efdeaf 100644 --- a/tests/src/fsfw_tests/CMakeLists.txt +++ b/tests/src/fsfw_tests/CMakeLists.txt @@ -3,6 +3,6 @@ if(FSFW_ADD_INTERNAL_TESTS) add_subdirectory(internal) endif() -if(FSFW_ADD_UNITTESTS) +if(FSFW_BUILD_UNITTESTS) add_subdirectory(unit) endif() diff --git a/tests/src/fsfw_tests/internal/InternalUnitTester.cpp b/tests/src/fsfw_tests/internal/InternalUnitTester.cpp index 20998d64..3c8eec1e 100644 --- a/tests/src/fsfw_tests/internal/InternalUnitTester.cpp +++ b/tests/src/fsfw_tests/internal/InternalUnitTester.cpp @@ -1,9 +1,9 @@ #include "fsfw_tests/internal/InternalUnitTester.h" #include "fsfw_tests/internal/UnittDefinitions.h" -#include "fsfw_tests/internal/osal/IntTestMq.h" -#include "fsfw_tests/internal/osal/IntTestSemaphore.h" -#include "fsfw_tests/internal/osal/IntTestMutex.h" +#include "fsfw_tests/internal/osal/testMq.h" +#include "fsfw_tests/internal/osal/testSemaphore.h" +#include "fsfw_tests/internal/osal/testMutex.h" #include "fsfw_tests/internal/serialize/IntTestSerialization.h" #include "fsfw_tests/internal/globalfunctions/TestArrayPrinter.h" diff --git a/tests/src/fsfw_tests/internal/osal/CMakeLists.txt b/tests/src/fsfw_tests/internal/osal/CMakeLists.txt index 84316089..8d79d759 100644 --- a/tests/src/fsfw_tests/internal/osal/CMakeLists.txt +++ b/tests/src/fsfw_tests/internal/osal/CMakeLists.txt @@ -1,5 +1,5 @@ target_sources(${LIB_FSFW_NAME} PRIVATE - IntTestMq.cpp - IntTestMutex.cpp - IntTestSemaphore.cpp + testMq.cpp + testMutex.cpp + testSemaphore.cpp ) diff --git a/tests/src/fsfw_tests/internal/osal/testCmdExecutor.cpp b/tests/src/fsfw_tests/internal/osal/testCmdExecutor.cpp new file mode 100644 index 00000000..f0bed8ad --- /dev/null +++ b/tests/src/fsfw_tests/internal/osal/testCmdExecutor.cpp @@ -0,0 +1 @@ +#include "testCmdExecutor.h" diff --git a/tests/src/fsfw_tests/internal/osal/testCmdExecutor.h b/tests/src/fsfw_tests/internal/osal/testCmdExecutor.h new file mode 100644 index 00000000..4779dde9 --- /dev/null +++ b/tests/src/fsfw_tests/internal/osal/testCmdExecutor.h @@ -0,0 +1,10 @@ +#ifndef FSFW_TESTS_SRC_FSFW_TESTS_INTERNAL_OSAL_TESTCMDEXECUTOR_H_ +#define FSFW_TESTS_SRC_FSFW_TESTS_INTERNAL_OSAL_TESTCMDEXECUTOR_H_ + +namespace testcmdexec { + +} + + + +#endif /* FSFW_TESTS_SRC_FSFW_TESTS_INTERNAL_OSAL_TESTCMDEXECUTOR_H_ */ diff --git a/tests/src/fsfw_tests/internal/osal/IntTestMq.cpp b/tests/src/fsfw_tests/internal/osal/testMq.cpp similarity index 96% rename from tests/src/fsfw_tests/internal/osal/IntTestMq.cpp rename to tests/src/fsfw_tests/internal/osal/testMq.cpp index 6c31b354..8a252910 100644 --- a/tests/src/fsfw_tests/internal/osal/IntTestMq.cpp +++ b/tests/src/fsfw_tests/internal/osal/testMq.cpp @@ -1,4 +1,4 @@ -#include "fsfw_tests/internal/osal/IntTestMq.h" +#include "testMq.h" #include "fsfw_tests/internal/UnittDefinitions.h" #include diff --git a/tests/src/fsfw_tests/internal/osal/IntTestMq.h b/tests/src/fsfw_tests/internal/osal/testMq.h similarity index 100% rename from tests/src/fsfw_tests/internal/osal/IntTestMq.h rename to tests/src/fsfw_tests/internal/osal/testMq.h diff --git a/tests/src/fsfw_tests/internal/osal/IntTestMutex.cpp b/tests/src/fsfw_tests/internal/osal/testMutex.cpp similarity index 96% rename from tests/src/fsfw_tests/internal/osal/IntTestMutex.cpp rename to tests/src/fsfw_tests/internal/osal/testMutex.cpp index d9184cd8..9b50121a 100644 --- a/tests/src/fsfw_tests/internal/osal/IntTestMutex.cpp +++ b/tests/src/fsfw_tests/internal/osal/testMutex.cpp @@ -1,4 +1,4 @@ -#include "fsfw_tests/internal/osal/IntTestMutex.h" +#include "testMutex.h" #include "fsfw_tests/internal/UnittDefinitions.h" #include "fsfw/platform.h" diff --git a/tests/src/fsfw_tests/internal/osal/IntTestMutex.h b/tests/src/fsfw_tests/internal/osal/testMutex.h similarity index 100% rename from tests/src/fsfw_tests/internal/osal/IntTestMutex.h rename to tests/src/fsfw_tests/internal/osal/testMutex.h diff --git a/tests/src/fsfw_tests/internal/osal/IntTestSemaphore.cpp b/tests/src/fsfw_tests/internal/osal/testSemaphore.cpp similarity index 98% rename from tests/src/fsfw_tests/internal/osal/IntTestSemaphore.cpp rename to tests/src/fsfw_tests/internal/osal/testSemaphore.cpp index 4b28f961..458dcb04 100644 --- a/tests/src/fsfw_tests/internal/osal/IntTestSemaphore.cpp +++ b/tests/src/fsfw_tests/internal/osal/testSemaphore.cpp @@ -1,5 +1,5 @@ #include "fsfw/FSFW.h" -#include "fsfw_tests/internal/osal/IntTestSemaphore.h" +#include "testSemaphore.h" #include "fsfw_tests/internal/UnittDefinitions.h" #include "fsfw/tasks/SemaphoreFactory.h" diff --git a/tests/src/fsfw_tests/internal/osal/IntTestSemaphore.h b/tests/src/fsfw_tests/internal/osal/testSemaphore.h similarity index 100% rename from tests/src/fsfw_tests/internal/osal/IntTestSemaphore.h rename to tests/src/fsfw_tests/internal/osal/testSemaphore.h diff --git a/tests/src/fsfw_tests/unit/CMakeLists.txt b/tests/src/fsfw_tests/unit/CMakeLists.txt index f30e4b6b..164e3bde 100644 --- a/tests/src/fsfw_tests/unit/CMakeLists.txt +++ b/tests/src/fsfw_tests/unit/CMakeLists.txt @@ -1,16 +1,17 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${FSFW_TEST_TGT} PRIVATE CatchDefinitions.cpp CatchFactory.cpp printChar.cpp ) -if(FSFW_CUSTOM_UNITTEST_RUNNER) - target_sources(${TARGET_NAME} PRIVATE +# if(FSFW_CUSTOM_UNITTEST_RUNNER) + target_sources(${FSFW_TEST_TGT} PRIVATE CatchRunner.cpp CatchSetup.cpp ) -endif() +# endif() +add_subdirectory(testcfg) add_subdirectory(action) add_subdirectory(container) add_subdirectory(osal) diff --git a/tests/src/fsfw_tests/unit/CatchFactory.h b/tests/src/fsfw_tests/unit/CatchFactory.h index 38ec46bd..cc14e3d9 100644 --- a/tests/src/fsfw_tests/unit/CatchFactory.h +++ b/tests/src/fsfw_tests/unit/CatchFactory.h @@ -1,7 +1,7 @@ #ifndef FSFW_CATCHFACTORY_H_ #define FSFW_CATCHFACTORY_H_ -#include "TestsConfig.h" +#include "tests/TestsConfig.h" #include "fsfw/objectmanager/SystemObjectIF.h" #include "fsfw/objectmanager/ObjectManager.h" diff --git a/tests/src/fsfw_tests/unit/CatchRunner.cpp b/tests/src/fsfw_tests/unit/CatchRunner.cpp index c96db7f4..1ea3ab35 100644 --- a/tests/src/fsfw_tests/unit/CatchRunner.cpp +++ b/tests/src/fsfw_tests/unit/CatchRunner.cpp @@ -14,7 +14,7 @@ extern int customSetup(); -int fsfwtest::customMain(int argc, char* argv[]) { +int main(int argc, char* argv[]) { customSetup(); // Catch internal function call diff --git a/tests/src/fsfw_tests/unit/CatchRunner.h b/tests/src/fsfw_tests/unit/CatchRunner.h index 720625c6..06ff07b6 100644 --- a/tests/src/fsfw_tests/unit/CatchRunner.h +++ b/tests/src/fsfw_tests/unit/CatchRunner.h @@ -7,7 +7,7 @@ namespace fsfwtest { * Can be called by upper level main() if default Catch2 main is overriden * @return */ -int customMain(int argc, char* argv[]); +//int customMain(int argc, char* argv[]); } diff --git a/tests/src/fsfw_tests/unit/action/CMakeLists.txt b/tests/src/fsfw_tests/unit/action/CMakeLists.txt index 0339000f..659f251a 100644 --- a/tests/src/fsfw_tests/unit/action/CMakeLists.txt +++ b/tests/src/fsfw_tests/unit/action/CMakeLists.txt @@ -1,3 +1,3 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${FSFW_TEST_TGT} PRIVATE TestActionHelper.cpp ) diff --git a/tests/src/fsfw_tests/unit/container/CMakeLists.txt b/tests/src/fsfw_tests/unit/container/CMakeLists.txt index 966c5834..5dae974c 100644 --- a/tests/src/fsfw_tests/unit/container/CMakeLists.txt +++ b/tests/src/fsfw_tests/unit/container/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${FSFW_TEST_TGT} PRIVATE RingBufferTest.cpp TestArrayList.cpp TestDynamicFifo.cpp diff --git a/tests/src/fsfw_tests/unit/datapoollocal/CMakeLists.txt b/tests/src/fsfw_tests/unit/datapoollocal/CMakeLists.txt index 1c98e7dc..bf465282 100644 --- a/tests/src/fsfw_tests/unit/datapoollocal/CMakeLists.txt +++ b/tests/src/fsfw_tests/unit/datapoollocal/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${FSFW_TEST_TGT} PRIVATE LocalPoolVariableTest.cpp LocalPoolVectorTest.cpp DataSetTest.cpp diff --git a/tests/src/fsfw_tests/unit/globalfunctions/CMakeLists.txt b/tests/src/fsfw_tests/unit/globalfunctions/CMakeLists.txt index 617c7f5a..209ce75f 100644 --- a/tests/src/fsfw_tests/unit/globalfunctions/CMakeLists.txt +++ b/tests/src/fsfw_tests/unit/globalfunctions/CMakeLists.txt @@ -1,3 +1,3 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${FSFW_TEST_TGT} PRIVATE testDleEncoder.cpp ) diff --git a/tests/src/fsfw_tests/unit/osal/CMakeLists.txt b/tests/src/fsfw_tests/unit/osal/CMakeLists.txt index 5ca5e400..293be2e8 100644 --- a/tests/src/fsfw_tests/unit/osal/CMakeLists.txt +++ b/tests/src/fsfw_tests/unit/osal/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${FSFW_TEST_TGT} PRIVATE TestMessageQueue.cpp TestSemaphore.cpp ) diff --git a/tests/src/fsfw_tests/unit/serialize/CMakeLists.txt b/tests/src/fsfw_tests/unit/serialize/CMakeLists.txt index 5a9d9a0f..96c80f4a 100644 --- a/tests/src/fsfw_tests/unit/serialize/CMakeLists.txt +++ b/tests/src/fsfw_tests/unit/serialize/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${FSFW_TEST_TGT} PRIVATE TestSerialBufferAdapter.cpp TestSerialization.cpp TestSerialLinkedPacket.cpp diff --git a/tests/src/fsfw_tests/unit/storagemanager/CMakeLists.txt b/tests/src/fsfw_tests/unit/storagemanager/CMakeLists.txt index ed7be7d5..7b6280df 100644 --- a/tests/src/fsfw_tests/unit/storagemanager/CMakeLists.txt +++ b/tests/src/fsfw_tests/unit/storagemanager/CMakeLists.txt @@ -1,4 +1,4 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${FSFW_TEST_TGT} PRIVATE TestNewAccessor.cpp TestPool.cpp ) diff --git a/tests/src/fsfw_tests/unit/testcfg/CMakeLists.txt b/tests/src/fsfw_tests/unit/testcfg/CMakeLists.txt new file mode 100644 index 00000000..3272958a --- /dev/null +++ b/tests/src/fsfw_tests/unit/testcfg/CMakeLists.txt @@ -0,0 +1,28 @@ +target_sources(${FSFW_TEST_TGT} PRIVATE + ipc/MissionMessageTypes.cpp + pollingsequence/PollingSequenceFactory.cpp +) + +# Add include paths for the executable +target_include_directories(${FSFW_TEST_TGT} PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} +) + +# These translation files are actually not that relevant for the tests. However, the FSFW tests +# compile against a user-configured variant of the FSFW, which might be configured to include +# translation information. Therefore, empty dummy translation files are compiled here +# so the tests compile in any case. + +# If a special translation file for object IDs exists, compile it. +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp") + target_sources(${FSFW_TEST_TGT} PRIVATE + objects/translateObjects.cpp + ) +endif() + +# If a special translation file for events exists, compile it. +if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp") + target_sources(${FSFW_TEST_TGT} PRIVATE + events/translateEvents.cpp + ) +endif() \ No newline at end of file diff --git a/tests/user/testcfg/FSFWConfig.h.in b/tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in similarity index 67% rename from tests/user/testcfg/FSFWConfig.h.in rename to tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in index d38f0648..d03ec3e5 100644 --- a/tests/user/testcfg/FSFWConfig.h.in +++ b/tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in @@ -7,33 +7,30 @@ //! Used to determine whether C++ ostreams are used which can increase //! the binary size significantly. If this is disabled, //! the C stdio functions can be used alternatively -#define FSFW_CPP_OSTREAM_ENABLED 0 +#define FSFW_CPP_OSTREAM_ENABLED 0 -//! More FSFW related printouts. Useful for development. -#define FSFW_ENHANCED_PRINTOUT 0 +//! More FSFW related printouts depending on level. Useful for development. +#define FSFW_VERBOSE_LEVEL 1 //! Can be used to completely disable printouts, even the C stdio ones. -//! By default, printouts will be disabled for the unit tests. -#if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_ENHANCED_PRINTOUT == 0 - #ifndef FSFW_DISABLE_PRINTOUT - #define FSFW_DISABLE_PRINTOUT 1 - #endif +#if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_VERBOSE_LEVEL == 0 + #define FSFW_DISABLE_PRINTOUT 0 #endif -//! Can be used to enable additional debugging printouts for developing the FSFW -#define FSFW_PRINT_VERBOSITY_LEVEL 0 +#define FSFW_USE_PUS_C_TELEMETRY 1 +#define FSFW_USE_PUS_C_TELECOMMANDS 1 //! Can be used to disable the ANSI color sequences for C stdio. -#define FSFW_COLORED_OUTPUT 0 +#define FSFW_COLORED_OUTPUT 1 //! If FSFW_OBJ_EVENT_TRANSLATION is set to one, //! additional output which requires the translation files translateObjects //! and translateEvents (and their compiled source files) -#define FSFW_OBJ_EVENT_TRANSLATION 0 +#define FSFW_OBJ_EVENT_TRANSLATION 0 #if FSFW_OBJ_EVENT_TRANSLATION == 1 //! Specify whether info events are printed too. -#define FSFW_DEBUG_INFO 1 +#define FSFW_DEBUG_INFO 1 #include "objects/translateObjects.h" #include "events/translateEvents.h" #else @@ -41,22 +38,22 @@ //! When using the newlib nano library, C99 support for stdio facilities //! will not be provided. This define should be set to 1 if this is the case. -#define FSFW_NO_C99_IO 1 +#define FSFW_NO_C99_IO 1 //! Specify whether a special mode store is used for Subsystem components. -#define FSFW_USE_MODESTORE 0 +#define FSFW_USE_MODESTORE 0 //! Defines if the real time scheduler for linux should be used. //! If set to 0, this will also disable priority settings for linux //! as most systems will not allow to set nice values without privileges //! For embedded linux system set this to 1. //! If set to 1 the binary needs "cap_sys_nice=eip" privileges to run -#define FSFW_USE_REALTIME_FOR_LINUX 1 +#define FSFW_USE_REALTIME_FOR_LINUX 1 namespace fsfwconfig { -//! Default timestamp size. The default timestamp will be an eight byte CDC -//! short timestamp. -static constexpr uint8_t FSFW_MISSION_TIMESTAMP_SIZE = 8; + +//! Default timestamp size. The default timestamp will be an seven byte CDC short timestamp. +static constexpr uint8_t FSFW_MISSION_TIMESTAMP_SIZE = 7; //! Configure the allocated pool sizes for the event manager. static constexpr size_t FSFW_EVENTMGMR_MATCHTREE_NODES = 240; @@ -65,13 +62,13 @@ static constexpr size_t FSFW_EVENTMGMR_RANGEMATCHERS = 120; //! Defines the FIFO depth of each commanding service base which //! also determines how many commands a CSB service can handle in one cycle -//! simulataneously. This will increase the required RAM for +//! simultaneously. This will increase the required RAM for //! each CSB service ! static constexpr uint8_t FSFW_CSB_FIFO_DEPTH = 6; static constexpr size_t FSFW_PRINT_BUFFER_SIZE = 124; -static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 1500; +static constexpr size_t FSFW_MAX_TM_PACKET_SIZE = 2048; } diff --git a/tests/src/fsfw_tests/unit/testcfg/OBSWConfig.h.in b/tests/src/fsfw_tests/unit/testcfg/OBSWConfig.h.in new file mode 100644 index 00000000..5d8a9255 --- /dev/null +++ b/tests/src/fsfw_tests/unit/testcfg/OBSWConfig.h.in @@ -0,0 +1,15 @@ +#ifndef CONFIG_TMTC_TMTCSIZE_H_ +#define CONFIG_TMTC_TMTCSIZE_H_ + +#include +#include + +#define OBSW_PRINT_MISSED_DEADLINES 0 +#define OBSW_VERBOSE_LEVEL 0 +#define OBSW_ADD_TEST_CODE 1 + +namespace config { +static constexpr uint32_t MAX_STORED_TELECOMMANDS = 2000; +} + +#endif /* CONFIG_TMTC_TMTCSIZE_H_ */ diff --git a/tests/user/testcfg/TestsConfig.h.in b/tests/src/fsfw_tests/unit/testcfg/TestsConfig.h.in similarity index 100% rename from tests/user/testcfg/TestsConfig.h.in rename to tests/src/fsfw_tests/unit/testcfg/TestsConfig.h.in diff --git a/tests/user/testcfg/devices/logicalAddresses.cpp b/tests/src/fsfw_tests/unit/testcfg/devices/logicalAddresses.cpp similarity index 100% rename from tests/user/testcfg/devices/logicalAddresses.cpp rename to tests/src/fsfw_tests/unit/testcfg/devices/logicalAddresses.cpp diff --git a/tests/user/testcfg/devices/logicalAddresses.h b/tests/src/fsfw_tests/unit/testcfg/devices/logicalAddresses.h similarity index 84% rename from tests/user/testcfg/devices/logicalAddresses.h rename to tests/src/fsfw_tests/unit/testcfg/devices/logicalAddresses.h index cdf87025..a0240037 100644 --- a/tests/user/testcfg/devices/logicalAddresses.h +++ b/tests/src/fsfw_tests/unit/testcfg/devices/logicalAddresses.h @@ -2,7 +2,8 @@ #define CONFIG_DEVICES_LOGICALADDRESSES_H_ #include -#include +#include "common/devices/commonAddresses.h" + #include namespace addresses { diff --git a/tests/user/testcfg/devices/powerSwitcherList.cpp b/tests/src/fsfw_tests/unit/testcfg/devices/powerSwitcherList.cpp similarity index 100% rename from tests/user/testcfg/devices/powerSwitcherList.cpp rename to tests/src/fsfw_tests/unit/testcfg/devices/powerSwitcherList.cpp diff --git a/tests/user/testcfg/devices/powerSwitcherList.h b/tests/src/fsfw_tests/unit/testcfg/devices/powerSwitcherList.h similarity index 100% rename from tests/user/testcfg/devices/powerSwitcherList.h rename to tests/src/fsfw_tests/unit/testcfg/devices/powerSwitcherList.h diff --git a/tests/user/testcfg/events/subsystemIdRanges.h b/tests/src/fsfw_tests/unit/testcfg/events/subsystemIdRanges.h similarity index 64% rename from tests/user/testcfg/events/subsystemIdRanges.h rename to tests/src/fsfw_tests/unit/testcfg/events/subsystemIdRanges.h index 24eee819..c9c7c20d 100644 --- a/tests/user/testcfg/events/subsystemIdRanges.h +++ b/tests/src/fsfw_tests/unit/testcfg/events/subsystemIdRanges.h @@ -1,8 +1,10 @@ #ifndef CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ #define CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ +#include "fsfw/events/fwSubsystemIdRanges.h" +#include "common/events/commonSubsystemIds.h" #include -#include + /** * @brief Custom subsystem IDs can be added here @@ -11,7 +13,8 @@ */ namespace SUBSYSTEM_ID { enum: uint8_t { - SUBSYSTEM_ID_START = FW_SUBSYSTEM_ID_RANGE, + SUBSYSTEM_ID_START = COMMON_SUBSYSTEM_ID_RANGE, + SUBSYSTEM_ID_END // [EXPORT] : [END] }; } diff --git a/tests/src/fsfw_tests/unit/testcfg/events/translateEvents.cpp b/tests/src/fsfw_tests/unit/testcfg/events/translateEvents.cpp new file mode 100644 index 00000000..47186727 --- /dev/null +++ b/tests/src/fsfw_tests/unit/testcfg/events/translateEvents.cpp @@ -0,0 +1,15 @@ +/** + * @brief Auto-generated event translation file. Contains 81 translations. + * @details + * Generated on: 2021-05-18 16:28:16 + */ +#include "translateEvents.h" + + +const char * translateEvents(Event event) { + switch( (event & 0xffff) ) { + default: + return "UNKNOWN_EVENT"; + } + return 0; +} diff --git a/tests/src/fsfw_tests/unit/testcfg/events/translateEvents.h b/tests/src/fsfw_tests/unit/testcfg/events/translateEvents.h new file mode 100644 index 00000000..9034dcf2 --- /dev/null +++ b/tests/src/fsfw_tests/unit/testcfg/events/translateEvents.h @@ -0,0 +1,8 @@ +#ifndef FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_ +#define FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_ + +#include + +const char * translateEvents(Event event); + +#endif /* FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_ */ diff --git a/tests/user/testcfg/ipc/MissionMessageTypes.cpp b/tests/src/fsfw_tests/unit/testcfg/ipc/MissionMessageTypes.cpp similarity index 100% rename from tests/user/testcfg/ipc/MissionMessageTypes.cpp rename to tests/src/fsfw_tests/unit/testcfg/ipc/MissionMessageTypes.cpp diff --git a/tests/user/testcfg/ipc/MissionMessageTypes.h b/tests/src/fsfw_tests/unit/testcfg/ipc/MissionMessageTypes.h similarity index 100% rename from tests/user/testcfg/ipc/MissionMessageTypes.h rename to tests/src/fsfw_tests/unit/testcfg/ipc/MissionMessageTypes.h diff --git a/tests/user/testcfg/objects/systemObjectList.h b/tests/src/fsfw_tests/unit/testcfg/objects/systemObjectList.h similarity index 84% rename from tests/user/testcfg/objects/systemObjectList.h rename to tests/src/fsfw_tests/unit/testcfg/objects/systemObjectList.h index efd21e0d..bd0daa62 100644 --- a/tests/user/testcfg/objects/systemObjectList.h +++ b/tests/src/fsfw_tests/unit/testcfg/objects/systemObjectList.h @@ -1,8 +1,9 @@ #ifndef HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ #define HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ +#include "fsfw/objectmanager/frameworkObjects.h" +#include "common/objects/commonObjectsList.h" #include -#include // The objects will be instantiated in the ID order namespace objects { @@ -11,10 +12,6 @@ namespace objects { FSFW_CONFIG_RESERVED_START = PUS_SERVICE_1_VERIFICATION, FSFW_CONFIG_RESERVED_END = TM_STORE, - CCSDS_DISTRIBUTOR = 10, - PUS_DISTRIBUTOR = 11, - TM_FUNNEL = 12, - UDP_BRIDGE = 15, UDP_POLLING_TASK = 16, diff --git a/tests/src/fsfw_tests/unit/testcfg/objects/translateObjects.cpp b/tests/src/fsfw_tests/unit/testcfg/objects/translateObjects.cpp new file mode 100644 index 00000000..63636ced --- /dev/null +++ b/tests/src/fsfw_tests/unit/testcfg/objects/translateObjects.cpp @@ -0,0 +1,19 @@ +/** + * @brief Auto-generated object translation file. + * @details + * Contains 69 translations. + * Generated on: 2021-05-18 16:37:37 + */ +#include "translateObjects.h" + +const char *NO_OBJECT_STRING = "NO_OBJECT"; + +const char* translateObject(object_id_t object) { + switch( (object & 0xFFFFFFFF) ) { + case 0xFFFFFFFF: + return NO_OBJECT_STRING; + default: + return "UNKNOWN_OBJECT"; + } + return 0; +} diff --git a/tests/src/fsfw_tests/unit/testcfg/objects/translateObjects.h b/tests/src/fsfw_tests/unit/testcfg/objects/translateObjects.h new file mode 100644 index 00000000..dbf5b468 --- /dev/null +++ b/tests/src/fsfw_tests/unit/testcfg/objects/translateObjects.h @@ -0,0 +1,8 @@ +#ifndef FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_ +#define FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_ + +#include + +const char* translateObject(object_id_t object); + +#endif /* FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_ */ diff --git a/tests/user/testcfg/pollingsequence/PollingSequenceFactory.cpp b/tests/src/fsfw_tests/unit/testcfg/pollingsequence/PollingSequenceFactory.cpp similarity index 97% rename from tests/user/testcfg/pollingsequence/PollingSequenceFactory.cpp rename to tests/src/fsfw_tests/unit/testcfg/pollingsequence/PollingSequenceFactory.cpp index e3ee874a..1d29ef86 100644 --- a/tests/user/testcfg/pollingsequence/PollingSequenceFactory.cpp +++ b/tests/src/fsfw_tests/unit/testcfg/pollingsequence/PollingSequenceFactory.cpp @@ -1,6 +1,6 @@ #include "PollingSequenceFactory.h" -#include +#include "tests/TestsConfig.h" #include #include diff --git a/tests/user/testcfg/pollingsequence/PollingSequenceFactory.h b/tests/src/fsfw_tests/unit/testcfg/pollingsequence/PollingSequenceFactory.h similarity index 100% rename from tests/user/testcfg/pollingsequence/PollingSequenceFactory.h rename to tests/src/fsfw_tests/unit/testcfg/pollingsequence/PollingSequenceFactory.h diff --git a/tests/user/testcfg/returnvalues/classIds.h b/tests/src/fsfw_tests/unit/testcfg/returnvalues/classIds.h similarity index 76% rename from tests/user/testcfg/returnvalues/classIds.h rename to tests/src/fsfw_tests/unit/testcfg/returnvalues/classIds.h index 606cc60b..919b9628 100644 --- a/tests/user/testcfg/returnvalues/classIds.h +++ b/tests/src/fsfw_tests/unit/testcfg/returnvalues/classIds.h @@ -1,7 +1,8 @@ #ifndef CONFIG_RETURNVALUES_CLASSIDS_H_ #define CONFIG_RETURNVALUES_CLASSIDS_H_ -#include +#include "common/returnvalues/commonClassIds.h" +#include "fsfw/returnvalues/FwClassIds.h" /** * @brief CLASS_ID defintions which are required for custom returnvalues. diff --git a/tests/user/testcfg/tmtc/apid.h b/tests/src/fsfw_tests/unit/testcfg/tmtc/apid.h similarity index 90% rename from tests/user/testcfg/tmtc/apid.h rename to tests/src/fsfw_tests/unit/testcfg/tmtc/apid.h index c0231bca..0e633afb 100644 --- a/tests/user/testcfg/tmtc/apid.h +++ b/tests/src/fsfw_tests/unit/testcfg/tmtc/apid.h @@ -12,6 +12,7 @@ */ namespace apid { static const uint16_t DEFAULT_APID = 0x00; + static const uint16_t SOURCE_OBSW = 0x73; } diff --git a/tests/user/testcfg/tmtc/pusIds.h b/tests/src/fsfw_tests/unit/testcfg/tmtc/pusIds.h similarity index 100% rename from tests/user/testcfg/tmtc/pusIds.h rename to tests/src/fsfw_tests/unit/testcfg/tmtc/pusIds.h diff --git a/tests/src/fsfw_tests/unit/timemanager/CMakeLists.txt b/tests/src/fsfw_tests/unit/timemanager/CMakeLists.txt index 2c635711..6ce1c6c6 100644 --- a/tests/src/fsfw_tests/unit/timemanager/CMakeLists.txt +++ b/tests/src/fsfw_tests/unit/timemanager/CMakeLists.txt @@ -1,3 +1,3 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${FSFW_TEST_TGT} PRIVATE TestCountdown.cpp ) diff --git a/tests/src/fsfw_tests/unit/tmtcpacket/CMakeLists.txt b/tests/src/fsfw_tests/unit/tmtcpacket/CMakeLists.txt index a1a4c1b6..36838b24 100644 --- a/tests/src/fsfw_tests/unit/tmtcpacket/CMakeLists.txt +++ b/tests/src/fsfw_tests/unit/tmtcpacket/CMakeLists.txt @@ -1,3 +1,3 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${FSFW_TEST_TGT} PRIVATE PusTmTest.cpp ) diff --git a/tests/user/README.md b/tests/user/README.md deleted file mode 100644 index d6a4bb85..00000000 --- a/tests/user/README.md +++ /dev/null @@ -1,19 +0,0 @@ -## FSFW Testing - -This folder contains testing and unit testing components. - -### Instructions - -The easiest way to run the unittest contained in this folder is to follow -the steps in the [test repository](https://egit.irs.uni-stuttgart.de/fsfw/fsfw_tests). -This is recommended even if the goal is to set up a custom test repository to have -a starting point. - -To set up a custom test repository or project, following steps can be performed: - -1. Copy the user folder content into the project root. -2. Clone [Catch2](https://github.com/catchorg/Catch2) in the project root. -3. Use the `CMakeLists.txt` as a starting point to add tests and build the test - executable. - - diff --git a/tests/user/testcfg/CMakeLists.txt b/tests/user/testcfg/CMakeLists.txt deleted file mode 100644 index dbf0256f..00000000 --- a/tests/user/testcfg/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -target_sources(${TARGET_NAME} - PRIVATE - ipc/MissionMessageTypes.cpp - pollingsequence/PollingSequenceFactory.cpp -) - -# Add include paths for the executable -target_include_directories(${TARGET_NAME} - PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR} -) diff --git a/tests/user/testcfg/OBSWConfig.h.in b/tests/user/testcfg/OBSWConfig.h.in deleted file mode 100644 index 34eda31f..00000000 --- a/tests/user/testcfg/OBSWConfig.h.in +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef TESTCFG_OBSWCONFIG_H_ -#define TESTCFG_OBSWCONFIG_H_ - - - - - -#endif /* TESTCFG_OBSWCONFIG_H_ */ From cd6d616806d55c665152485d2521ec4d3919e2db Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 7 Oct 2021 13:26:31 +0200 Subject: [PATCH 313/389] using .h.in version fle now --- src/fsfw/FSFWVersion.h | 10 ---------- src/fsfw/FSFWVersion.h.in | 11 +++++++++++ 2 files changed, 11 insertions(+), 10 deletions(-) delete mode 100644 src/fsfw/FSFWVersion.h create mode 100644 src/fsfw/FSFWVersion.h.in diff --git a/src/fsfw/FSFWVersion.h b/src/fsfw/FSFWVersion.h deleted file mode 100644 index c581a85c..00000000 --- a/src/fsfw/FSFWVersion.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef FSFW_VERSION_H_ -#define FSFW_VERSION_H_ - -const char* const FSFW_VERSION_NAME = "ASTP"; - -#define FSFW_VERSION 2 -#define FSFW_SUBVERSION 0 -#define FSFW_REVISION 0 - -#endif /* FSFW_VERSION_H_ */ diff --git a/src/fsfw/FSFWVersion.h.in b/src/fsfw/FSFWVersion.h.in new file mode 100644 index 00000000..a858d703 --- /dev/null +++ b/src/fsfw/FSFWVersion.h.in @@ -0,0 +1,11 @@ +#ifndef FSFW_VERSION_H_ +#define FSFW_VERSION_H_ + +const char* const FSFW_VERSION_NAME = "ASTP"; + +// Versioning is kept in project CMakeLists.txt file +#define FSFW_VERSION @FSFW_VERSION@ +#define FSFW_SUBVERSION @FSFW_SUBVERSION@ +#define FSFW_REVISION @FSFW_REVISION@ + +#endif /* FSFW_VERSION_H_ */ From dd1631a45623dc8cc3c96e1708f558bd1b4d0089 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 7 Oct 2021 14:20:34 +0200 Subject: [PATCH 314/389] updated CMakeLists.txt - More information about FSFW build --- CMakeLists.txt | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ff631201..fd6850a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,7 @@ set(FSFW_TEST_TGT fsfw-tests) add_library(${LIB_FSFW_NAME}) if(FSFW_BUILD_UNITTESTS) + message(STATUS "Building the FSFW unittests in addition to the static library") # Check whether the user has already installed Catch2 first find_package(Catch2 3) # Not installed, so use FetchContent to download and provide Catch2 @@ -61,12 +62,17 @@ if(FSFW_BUILD_UNITTESTS) add_executable(${FSFW_TEST_TGT}) if(FSFW_TESTS_GEN_COV) + message(STATUS "Generating coverage data for the library") + message(STATUS "Targets linking against ${LIB_FSFW_NAME} " + "will be compiled with coverage data as well" + ) include(FetchContent) FetchContent_Declare( cmake-modules GIT_REPOSITORY https://github.com/bilke/cmake-modules.git ) FetchContent_MakeAvailable(cmake-modules) + set(CMAKE_BUILD_TYPE "Debug") list(APPEND CMAKE_MODULE_PATH ${cmake-modules_SOURCE_DIR}) include(CodeCoverage) endif() @@ -190,6 +196,11 @@ if(FSFW_BUILD_UNITTESTS) -fprofile-arcs -ftest-coverage ) + # Need to specify this as an interface, otherwise there will the compile issues + target_link_options(${LIB_FSFW_NAME} INTERFACE + -fprofile-arcs + -ftest-coverage + ) if(WIN32) setup_target_for_coverage_gcovr_html( @@ -302,3 +313,16 @@ target_compile_options(${LIB_FSFW_NAME} PRIVATE target_link_libraries(${LIB_FSFW_NAME} PRIVATE ${FSFW_ADDITIONAL_LINK_LIBS} ) + +string(CONCAT POST_BUILD_COMMENT + "######################################################################\n" + "Building FSFW v${FSFW_VERSION}.${FSFW_SUBVERSION}.${FSFW_REVISION}, " + "Target OSAL: ${FSFW_OS_NAME}\n" + "######################################################################\n" +) + +add_custom_command( + TARGET ${LIB_FSFW_NAME} + POST_BUILD + COMMENT ${POST_BUILD_COMMENT} +) From 6ad7f51297bff44f07543c3875481388460a8179 Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Fri, 8 Oct 2021 13:24:51 +0200 Subject: [PATCH 315/389] added bind call error string --- src/fsfw/osal/common/tcpipCommon.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/fsfw/osal/common/tcpipCommon.cpp b/src/fsfw/osal/common/tcpipCommon.cpp index 0fdbf867..2551496d 100644 --- a/src/fsfw/osal/common/tcpipCommon.cpp +++ b/src/fsfw/osal/common/tcpipCommon.cpp @@ -21,6 +21,9 @@ void tcpip::determineErrorStrings(Protocol protocol, ErrorSources errorSrc, std: if(errorSrc == ErrorSources::SETSOCKOPT_CALL) { srcString = "setsockopt call"; } + if(errorSrc == ErrorSources::BIND_CALL) { + srcString = "bind call"; + } else if(errorSrc == ErrorSources::SOCKET_CALL) { srcString = "socket call"; } From 9bcd701a50151491d3fe1b7d1c4d652556266cbd Mon Sep 17 00:00:00 2001 From: Jakob Meier Date: Fri, 8 Oct 2021 13:51:32 +0200 Subject: [PATCH 316/389] tcp server also parses TCs when client closes connection --- src/fsfw/osal/common/TcpTmTcServer.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/fsfw/osal/common/TcpTmTcServer.cpp b/src/fsfw/osal/common/TcpTmTcServer.cpp index 8b34b1a3..7e6853fc 100644 --- a/src/fsfw/osal/common/TcpTmTcServer.cpp +++ b/src/fsfw/osal/common/TcpTmTcServer.cpp @@ -168,7 +168,10 @@ void TcpTmTcServer::handleServerOperation(socket_t& connSocket) { tcpConfig.tcpFlags ); if(retval == 0) { - // Client closed connection + size_t availableReadData = ringBuffer.getAvailableReadData(); + if(availableReadData > lastRingBufferSize) { + handleTcRingBufferData(availableReadData); + } return; } else if(retval > 0) { From ad3238aa19ecbab79743a5db38e33f370591e198 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 13:48:17 +0200 Subject: [PATCH 317/389] removed problematic includes --- tests/src/fsfw_tests/unit/testcfg/events/subsystemIdRanges.h | 3 +-- tests/src/fsfw_tests/unit/testcfg/returnvalues/classIds.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/src/fsfw_tests/unit/testcfg/events/subsystemIdRanges.h b/tests/src/fsfw_tests/unit/testcfg/events/subsystemIdRanges.h index c9c7c20d..b88cd875 100644 --- a/tests/src/fsfw_tests/unit/testcfg/events/subsystemIdRanges.h +++ b/tests/src/fsfw_tests/unit/testcfg/events/subsystemIdRanges.h @@ -2,7 +2,6 @@ #define CONFIG_EVENTS_SUBSYSTEMIDRANGES_H_ #include "fsfw/events/fwSubsystemIdRanges.h" -#include "common/events/commonSubsystemIds.h" #include @@ -13,7 +12,7 @@ */ namespace SUBSYSTEM_ID { enum: uint8_t { - SUBSYSTEM_ID_START = COMMON_SUBSYSTEM_ID_RANGE, + SUBSYSTEM_ID_START = 0, SUBSYSTEM_ID_END // [EXPORT] : [END] }; } diff --git a/tests/src/fsfw_tests/unit/testcfg/returnvalues/classIds.h b/tests/src/fsfw_tests/unit/testcfg/returnvalues/classIds.h index 919b9628..1001d012 100644 --- a/tests/src/fsfw_tests/unit/testcfg/returnvalues/classIds.h +++ b/tests/src/fsfw_tests/unit/testcfg/returnvalues/classIds.h @@ -1,7 +1,6 @@ #ifndef CONFIG_RETURNVALUES_CLASSIDS_H_ #define CONFIG_RETURNVALUES_CLASSIDS_H_ -#include "common/returnvalues/commonClassIds.h" #include "fsfw/returnvalues/FwClassIds.h" /** From a827ec6a92b0cdf37138b084c182e7cd5cf866eb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 13:51:08 +0200 Subject: [PATCH 318/389] removed another include --- tests/src/fsfw_tests/unit/testcfg/objects/systemObjectList.h | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/src/fsfw_tests/unit/testcfg/objects/systemObjectList.h b/tests/src/fsfw_tests/unit/testcfg/objects/systemObjectList.h index bd0daa62..accf0d81 100644 --- a/tests/src/fsfw_tests/unit/testcfg/objects/systemObjectList.h +++ b/tests/src/fsfw_tests/unit/testcfg/objects/systemObjectList.h @@ -2,7 +2,6 @@ #define HOSTED_CONFIG_OBJECTS_SYSTEMOBJECTLIST_H_ #include "fsfw/objectmanager/frameworkObjects.h" -#include "common/objects/commonObjectsList.h" #include // The objects will be instantiated in the ID order From e02ac0509702af5056a5f3b9199a96001856c50b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 13:57:00 +0200 Subject: [PATCH 319/389] fixed a bug for default cfg path --- CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fd6850a0..192134fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -223,9 +223,10 @@ endif() # The project CMakeLists file has to set the FSFW_CONFIG_PATH and add it. # If this is not given, we include the default configuration and emit a warning. if(NOT FSFW_CONFIG_PATH) - message(WARNING "Flight Software Framework configuration path not set!") - message(WARNING "Setting default configuration!") - add_subdirectory(defaultcfg/fsfwconfig) + message(WARNING "Flight Software Framework configuration path not set!") + set(DEF_CONF_PATH misc/defaultcfg/fsfwconfig) + message(WARNING "Setting default configuration from ${DEF_CONF_PATH} ..") + add_subdirectory(${DEF_CONF_PATH}) endif() # FSFW might be part of a possibly complicated folder structure, so we From c26c2a5a96e25ebb0b1352f0896a2ee456c7ae25 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 14:56:42 +0200 Subject: [PATCH 320/389] hardcoding config path --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 192134fd..847ea572 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,9 +56,8 @@ if(FSFW_BUILD_UNITTESTS) FetchContent_MakeAvailable(Catch2) endif() - configure_file(tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in tests/FSFWConfig.h) + set(FSFW_CONFIG_PATH tests/src/fsfw_tests/unit/testcfg) configure_file(tests/src/fsfw_tests/unit/testcfg/TestsConfig.h.in tests/TestsConfig.h) - configure_file(tests/src/fsfw_tests/unit/testcfg/OBSWConfig.h.in tests/OBSWConfig.h) add_executable(${FSFW_TEST_TGT}) if(FSFW_TESTS_GEN_COV) From ad117e07e0fb1875af3b4c960c724dc826348a02 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 15:03:03 +0200 Subject: [PATCH 321/389] FSFW_CONFIG_PATH update --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 847ea572..34f16d0f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -226,6 +226,7 @@ if(NOT FSFW_CONFIG_PATH) set(DEF_CONF_PATH misc/defaultcfg/fsfwconfig) message(WARNING "Setting default configuration from ${DEF_CONF_PATH} ..") add_subdirectory(${DEF_CONF_PATH}) + set(FSFW_CONFIG_PATH ${DEF_CONF_PATH}) endif() # FSFW might be part of a possibly complicated folder structure, so we From b00f61445d97b183456b5f778df32411002c745b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 15:07:52 +0200 Subject: [PATCH 322/389] works --- .gitignore | 2 ++ CMakeLists.txt | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index fbd138e9..d6efb9cf 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ .project .settings .metadata + +/build* diff --git a/CMakeLists.txt b/CMakeLists.txt index 34f16d0f..5000b9b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,9 @@ if(FSFW_BUILD_UNITTESTS) endif() set(FSFW_CONFIG_PATH tests/src/fsfw_tests/unit/testcfg) + configure_file(tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in FSFWConfig.h) configure_file(tests/src/fsfw_tests/unit/testcfg/TestsConfig.h.in tests/TestsConfig.h) + configure_file(tests/src/fsfw_tests/unit/testcfg/OBSWConfig.h.in OBSWConfig.h) add_executable(${FSFW_TEST_TGT}) if(FSFW_TESTS_GEN_COV) From 5798aa1e3abd55f94bc138ea26f93ef43644975b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 15:09:19 +0200 Subject: [PATCH 323/389] create project to suppress warning --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5000b9b0..eae1fc25 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,6 +60,7 @@ if(FSFW_BUILD_UNITTESTS) configure_file(tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in FSFWConfig.h) configure_file(tests/src/fsfw_tests/unit/testcfg/TestsConfig.h.in tests/TestsConfig.h) configure_file(tests/src/fsfw_tests/unit/testcfg/OBSWConfig.h.in OBSWConfig.h) + project(${FSFW_TEST_TGT} CXX C) add_executable(${FSFW_TEST_TGT}) if(FSFW_TESTS_GEN_COV) From 1b6fa9822b35ad63d7347f5f836c7f9212a42736 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 15:40:29 +0200 Subject: [PATCH 324/389] this should work --- scripts/coverage.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/coverage.py b/scripts/coverage.py index d15c3154..71b6fb03 100755 --- a/scripts/coverage.py +++ b/scripts/coverage.py @@ -20,6 +20,8 @@ def main(): parser = argparse.ArgumentParser(description="Processing arguments for LCOV helper script.") build_dir_list = [] + if not os.path.isfile('README.md'): + os.chdir('..') for directory in os.listdir("."): if os.path.isdir(directory): os.chdir(directory) From fb67df6d7f447e651eac1e02f81ca80028500678 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 15:45:37 +0200 Subject: [PATCH 325/389] using testsconfig.h now --- tests/src/fsfw_tests/unit/CatchFactory.cpp | 1 + tests/src/fsfw_tests/unit/datapoollocal/DataSetTest.cpp | 1 + tests/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.h | 2 +- .../src/fsfw_tests/unit/datapoollocal/LocalPoolVariableTest.cpp | 1 + tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVectorTest.cpp | 1 + tests/src/fsfw_tests/unit/testcfg/CMakeLists.txt | 2 +- 6 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/src/fsfw_tests/unit/CatchFactory.cpp b/tests/src/fsfw_tests/unit/CatchFactory.cpp index 010ab5dd..42cb927e 100644 --- a/tests/src/fsfw_tests/unit/CatchFactory.cpp +++ b/tests/src/fsfw_tests/unit/CatchFactory.cpp @@ -1,4 +1,5 @@ #include "CatchFactory.h" +#include "tests/TestsConfig.h" #include "datapoollocal/LocalPoolOwnerBase.h" #include "mocks/HkReceiverMock.h" diff --git a/tests/src/fsfw_tests/unit/datapoollocal/DataSetTest.cpp b/tests/src/fsfw_tests/unit/datapoollocal/DataSetTest.cpp index 94b13f2f..c967b241 100644 --- a/tests/src/fsfw_tests/unit/datapoollocal/DataSetTest.cpp +++ b/tests/src/fsfw_tests/unit/datapoollocal/DataSetTest.cpp @@ -1,4 +1,5 @@ #include "LocalPoolOwnerBase.h" +#include "tests/TestsConfig.h" #include "fsfw_tests/unit/CatchDefinitions.h" #include diff --git a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.h b/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.h index ea5bb7e0..1f532568 100644 --- a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.h +++ b/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolOwnerBase.h @@ -1,7 +1,7 @@ #ifndef FSFW_UNITTEST_TESTS_DATAPOOLLOCAL_LOCALPOOLOWNERBASE_H_ #define FSFW_UNITTEST_TESTS_DATAPOOLLOCAL_LOCALPOOLOWNERBASE_H_ -#include "objects/systemObjectList.h" +#include "tests/TestsConfig.h" #include "../mocks/MessageQueueMockBase.h" #include diff --git a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVariableTest.cpp b/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVariableTest.cpp index 648a76e2..b029ec26 100644 --- a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVariableTest.cpp +++ b/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVariableTest.cpp @@ -1,4 +1,5 @@ #include "LocalPoolOwnerBase.h" +#include "tests/TestsConfig.h" #include "fsfw_tests/unit/CatchDefinitions.h" #include diff --git a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVectorTest.cpp b/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVectorTest.cpp index 3f846dec..5298e5b9 100644 --- a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVectorTest.cpp +++ b/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolVectorTest.cpp @@ -1,4 +1,5 @@ #include "LocalPoolOwnerBase.h" +#include "tests/TestsConfig.h" #include "fsfw_tests/unit/CatchDefinitions.h" #include diff --git a/tests/src/fsfw_tests/unit/testcfg/CMakeLists.txt b/tests/src/fsfw_tests/unit/testcfg/CMakeLists.txt index 3272958a..531972ac 100644 --- a/tests/src/fsfw_tests/unit/testcfg/CMakeLists.txt +++ b/tests/src/fsfw_tests/unit/testcfg/CMakeLists.txt @@ -4,7 +4,7 @@ target_sources(${FSFW_TEST_TGT} PRIVATE ) # Add include paths for the executable -target_include_directories(${FSFW_TEST_TGT} PUBLIC +target_include_directories(${FSFW_TEST_TGT} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ) From 6c75b56054c841b83a8057a0b99ff62337e5e654 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 15:51:27 +0200 Subject: [PATCH 326/389] README update --- README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a7ae0e20..eea403a1 100644 --- a/README.md +++ b/README.md @@ -83,12 +83,17 @@ The FSFW also has unittests which use the [Catch2 library](https://github.com/ca These are built by setting the CMake option `FSFW_BUILD_UNITTESTS` to `ON` or `TRUE` from your project `CMakeLists.txt` file or from the command line. -The fsfw-tests binary will be built as part of the static library and dropped alongside it inside -the `fsfw` folder of the build folder. - +The fsfw-tests binary will be built as part of the static library and dropped alongside it. If the unittests are built, the library and the tests will be built with coverage information by default. This can be disabled by setting the `FSFW_TESTS_COV_GEN` option to `OFF` or `FALSE`. +You can use the following commands inside the `fsfw` folder to set up the build system + +```sh +mkdir build-Unittest && cd build-Unittest +cmake -DFSFW_BUILD_UNITTESTS=ON .. +``` + Coverage data in HTML format can be generated using the `CodeCoverage` [CMake module](https://github.com/bilke/cmake-modules/tree/master). To build the unittests, run them and then generare the coverage data in this format, From ad744fb593a5ce70d1a365ffcda255bc1ead89f0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 15:56:04 +0200 Subject: [PATCH 327/389] README improvement --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index eea403a1..312bc077 100644 --- a/README.md +++ b/README.md @@ -91,9 +91,11 @@ You can use the following commands inside the `fsfw` folder to set up the build ```sh mkdir build-Unittest && cd build-Unittest -cmake -DFSFW_BUILD_UNITTESTS=ON .. +cmake -DFSFW_BUILD_UNITTESTS=ON -DFSFW_OSAL=host .. ``` +You can also use `-DFSFW_OSAL=linux` on Linux systems. + Coverage data in HTML format can be generated using the `CodeCoverage` [CMake module](https://github.com/bilke/cmake-modules/tree/master). To build the unittests, run them and then generare the coverage data in this format, From ac8df112b1a51896279ab6a0bb566dcd133fbf0e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 16:01:14 +0200 Subject: [PATCH 328/389] small correction --- tests/src/fsfw_tests/unit/testcfg/events/subsystemIdRanges.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/fsfw_tests/unit/testcfg/events/subsystemIdRanges.h b/tests/src/fsfw_tests/unit/testcfg/events/subsystemIdRanges.h index b88cd875..b14c4bc5 100644 --- a/tests/src/fsfw_tests/unit/testcfg/events/subsystemIdRanges.h +++ b/tests/src/fsfw_tests/unit/testcfg/events/subsystemIdRanges.h @@ -12,7 +12,7 @@ */ namespace SUBSYSTEM_ID { enum: uint8_t { - SUBSYSTEM_ID_START = 0, + SUBSYSTEM_ID_START = FW_SUBSYSTEM_ID_RANGE, SUBSYSTEM_ID_END // [EXPORT] : [END] }; } From 22dbabba38d998108a1a7b5e2e5cccd5a6b4f512 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 16:01:58 +0200 Subject: [PATCH 329/389] removed copy and paste error --- tests/src/fsfw_tests/unit/testcfg/tmtc/apid.h | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/src/fsfw_tests/unit/testcfg/tmtc/apid.h b/tests/src/fsfw_tests/unit/testcfg/tmtc/apid.h index 0e633afb..c0231bca 100644 --- a/tests/src/fsfw_tests/unit/testcfg/tmtc/apid.h +++ b/tests/src/fsfw_tests/unit/testcfg/tmtc/apid.h @@ -12,7 +12,6 @@ */ namespace apid { static const uint16_t DEFAULT_APID = 0x00; - static const uint16_t SOURCE_OBSW = 0x73; } From 19061c3d50c74dce25159aa3e1850938f5518b6e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 16:04:43 +0200 Subject: [PATCH 330/389] removed obsolete files --- tests/src/fsfw_tests/internal/osal/testCmdExecutor.cpp | 1 - tests/src/fsfw_tests/internal/osal/testCmdExecutor.h | 10 ---------- 2 files changed, 11 deletions(-) delete mode 100644 tests/src/fsfw_tests/internal/osal/testCmdExecutor.cpp delete mode 100644 tests/src/fsfw_tests/internal/osal/testCmdExecutor.h diff --git a/tests/src/fsfw_tests/internal/osal/testCmdExecutor.cpp b/tests/src/fsfw_tests/internal/osal/testCmdExecutor.cpp deleted file mode 100644 index f0bed8ad..00000000 --- a/tests/src/fsfw_tests/internal/osal/testCmdExecutor.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "testCmdExecutor.h" diff --git a/tests/src/fsfw_tests/internal/osal/testCmdExecutor.h b/tests/src/fsfw_tests/internal/osal/testCmdExecutor.h deleted file mode 100644 index 4779dde9..00000000 --- a/tests/src/fsfw_tests/internal/osal/testCmdExecutor.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef FSFW_TESTS_SRC_FSFW_TESTS_INTERNAL_OSAL_TESTCMDEXECUTOR_H_ -#define FSFW_TESTS_SRC_FSFW_TESTS_INTERNAL_OSAL_TESTCMDEXECUTOR_H_ - -namespace testcmdexec { - -} - - - -#endif /* FSFW_TESTS_SRC_FSFW_TESTS_INTERNAL_OSAL_TESTCMDEXECUTOR_H_ */ From 306a4b647f5afa72ee7cf6664103886a3a5b126b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 16:06:12 +0200 Subject: [PATCH 331/389] more review corrections --- CMakeLists.txt | 2 +- src/fsfw/FSFWVersion.h.in | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eae1fc25..101232e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -320,7 +320,7 @@ target_link_libraries(${LIB_FSFW_NAME} PRIVATE string(CONCAT POST_BUILD_COMMENT "######################################################################\n" - "Building FSFW v${FSFW_VERSION}.${FSFW_SUBVERSION}.${FSFW_REVISION}, " + "Built FSFW v${FSFW_VERSION}.${FSFW_SUBVERSION}.${FSFW_REVISION}, " "Target OSAL: ${FSFW_OS_NAME}\n" "######################################################################\n" ) diff --git a/src/fsfw/FSFWVersion.h.in b/src/fsfw/FSFWVersion.h.in index a858d703..7935b2f6 100644 --- a/src/fsfw/FSFWVersion.h.in +++ b/src/fsfw/FSFWVersion.h.in @@ -1,8 +1,6 @@ #ifndef FSFW_VERSION_H_ #define FSFW_VERSION_H_ -const char* const FSFW_VERSION_NAME = "ASTP"; - // Versioning is kept in project CMakeLists.txt file #define FSFW_VERSION @FSFW_VERSION@ #define FSFW_SUBVERSION @FSFW_SUBVERSION@ From bb9ae86159bb68a9fc830ade50581a9022266833 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 16:12:32 +0200 Subject: [PATCH 332/389] indentation fixes --- tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in b/tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in index d03ec3e5..1df7ef48 100644 --- a/tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in +++ b/tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in @@ -7,30 +7,30 @@ //! Used to determine whether C++ ostreams are used which can increase //! the binary size significantly. If this is disabled, //! the C stdio functions can be used alternatively -#define FSFW_CPP_OSTREAM_ENABLED 0 +#define FSFW_CPP_OSTREAM_ENABLED 0 //! More FSFW related printouts depending on level. Useful for development. -#define FSFW_VERBOSE_LEVEL 1 +#define FSFW_VERBOSE_LEVEL 1 //! Can be used to completely disable printouts, even the C stdio ones. #if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_VERBOSE_LEVEL == 0 - #define FSFW_DISABLE_PRINTOUT 0 + #define FSFW_DISABLE_PRINTOUT 1 #endif #define FSFW_USE_PUS_C_TELEMETRY 1 #define FSFW_USE_PUS_C_TELECOMMANDS 1 //! Can be used to disable the ANSI color sequences for C stdio. -#define FSFW_COLORED_OUTPUT 1 +#define FSFW_COLORED_OUTPUT 1 //! If FSFW_OBJ_EVENT_TRANSLATION is set to one, //! additional output which requires the translation files translateObjects //! and translateEvents (and their compiled source files) -#define FSFW_OBJ_EVENT_TRANSLATION 0 +#define FSFW_OBJ_EVENT_TRANSLATION 0 #if FSFW_OBJ_EVENT_TRANSLATION == 1 //! Specify whether info events are printed too. -#define FSFW_DEBUG_INFO 1 +#define FSFW_DEBUG_INFO 1 #include "objects/translateObjects.h" #include "events/translateEvents.h" #else @@ -38,7 +38,7 @@ //! When using the newlib nano library, C99 support for stdio facilities //! will not be provided. This define should be set to 1 if this is the case. -#define FSFW_NO_C99_IO 1 +#define FSFW_NO_C99_IO 1 //! Specify whether a special mode store is used for Subsystem components. #define FSFW_USE_MODESTORE 0 From 3d6f28c48df51d093f01797faa90a22128ffdfca Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 16:14:30 +0200 Subject: [PATCH 333/389] printouts disable by default --- tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in b/tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in index 1df7ef48..f05ef40b 100644 --- a/tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in +++ b/tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in @@ -10,7 +10,7 @@ #define FSFW_CPP_OSTREAM_ENABLED 0 //! More FSFW related printouts depending on level. Useful for development. -#define FSFW_VERBOSE_LEVEL 1 +#define FSFW_VERBOSE_LEVEL 0 //! Can be used to completely disable printouts, even the C stdio ones. #if FSFW_CPP_OSTREAM_ENABLED == 0 && FSFW_VERBOSE_LEVEL == 0 From 460941c2251476eb9863c54422244a253441d3a9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 16:16:49 +0200 Subject: [PATCH 334/389] tiny tweak --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 101232e9..af19b4c5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,6 +60,7 @@ if(FSFW_BUILD_UNITTESTS) configure_file(tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in FSFWConfig.h) configure_file(tests/src/fsfw_tests/unit/testcfg/TestsConfig.h.in tests/TestsConfig.h) configure_file(tests/src/fsfw_tests/unit/testcfg/OBSWConfig.h.in OBSWConfig.h) + project(${FSFW_TEST_TGT} CXX C) add_executable(${FSFW_TEST_TGT}) From bf5590ce2632102abd77711df3e64c5edffc7d80 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 16:25:01 +0200 Subject: [PATCH 335/389] configure file correction --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index af19b4c5..4af52a5b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,8 +92,8 @@ target_include_directories(${LIB_FSFW_NAME} PRIVATE target_include_directories(${LIB_FSFW_NAME} INTERFACE ${CMAKE_CURRENT_BINARY_DIR} ) -configure_file(src/fsfw/FSFW.h.in FSFW.h) -configure_file(src/fsfw/FSFWVersion.h.in FSFWVersion.h) +configure_file(src/fsfw/FSFW.h.in fsfw/FSFW.h) +configure_file(src/fsfw/FSFWVersion.h.in fsfw/FSFWVersion.h) if(NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 11) From d4bb9397ee24f766be36350b7179e7e7c3df3e21 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 16:32:19 +0200 Subject: [PATCH 336/389] better handling for configure files --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4af52a5b..e0a0bfb0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,8 +92,14 @@ target_include_directories(${LIB_FSFW_NAME} PRIVATE target_include_directories(${LIB_FSFW_NAME} INTERFACE ${CMAKE_CURRENT_BINARY_DIR} ) -configure_file(src/fsfw/FSFW.h.in fsfw/FSFW.h) -configure_file(src/fsfw/FSFWVersion.h.in fsfw/FSFWVersion.h) + +if(FSFW_BUILD_UNITTESTS) + configure_file(src/fsfw/FSFW.h.in fsfw/FSFW.h) + configure_file(src/fsfw/FSFWVersion.h.in fsfw/FSFWVersion.h) +else() + configure_file(src/fsfw/FSFW.h.in FSFW.h) + configure_file(src/fsfw/FSFWVersion.h.in FSFWVersion.h) +endif() if(NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 11) From 9efe9e78d8bfcd2c4305f1161416e7a218029876 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 27 Sep 2021 11:05:26 +0200 Subject: [PATCH 337/389] Increased TM stack robustness 1. More nullptr check 2. returnvalue for inititalize function which can fail --- src/fsfw/tmtcpacket/SpacePacket.h | 3 +- src/fsfw/tmtcpacket/SpacePacketBase.cpp | 102 ++++--- src/fsfw/tmtcpacket/SpacePacketBase.h | 276 +++++++++--------- src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.cpp | 8 +- src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h | 2 +- .../tmtcpacket/pus/tm/TmPacketStoredPusC.cpp | 44 ++- 6 files changed, 248 insertions(+), 187 deletions(-) diff --git a/src/fsfw/tmtcpacket/SpacePacket.h b/src/fsfw/tmtcpacket/SpacePacket.h index 49dd5ae5..2957576f 100644 --- a/src/fsfw/tmtcpacket/SpacePacket.h +++ b/src/fsfw/tmtcpacket/SpacePacket.h @@ -19,7 +19,8 @@ public: /** * The constructor initializes the packet and sets all header information * according to the passed parameters. - * @param packetDataLength Sets the packet data length field and therefore specifies the size of the packet. + * @param packetDataLength Sets the packet data length field and therefore specifies + * the size of the packet. * @param isTelecommand Sets the packet type field to either TC (true) or TM (false). * @param apid Sets the packet's APID field. The default value describes an idle packet. * @param sequenceCount ets the packet's Source Sequence Count field. diff --git a/src/fsfw/tmtcpacket/SpacePacketBase.cpp b/src/fsfw/tmtcpacket/SpacePacketBase.cpp index e9a0b836..16883d7f 100644 --- a/src/fsfw/tmtcpacket/SpacePacketBase.cpp +++ b/src/fsfw/tmtcpacket/SpacePacketBase.cpp @@ -3,8 +3,8 @@ #include -SpacePacketBase::SpacePacketBase( const uint8_t* set_address ) { - this->data = (SpacePacketPointer*) set_address; +SpacePacketBase::SpacePacketBase(const uint8_t* setAddress) { + this->data = reinterpret_cast(const_cast(setAddress)); } SpacePacketBase::~SpacePacketBase() { @@ -12,94 +12,112 @@ SpacePacketBase::~SpacePacketBase() { //CCSDS Methods: uint8_t SpacePacketBase::getPacketVersionNumber( void ) { - return (this->data->header.packet_id_h & 0b11100000) >> 5; + return (this->data->header.packet_id_h & 0b11100000) >> 5; } -void SpacePacketBase::initSpacePacketHeader(bool isTelecommand, - bool hasSecondaryHeader, uint16_t apid, uint16_t sequenceCount) { - //reset header to zero: - memset(data,0, sizeof(this->data->header) ); - //Set TC/TM bit. - data->header.packet_id_h = ((isTelecommand? 1 : 0)) << 4; - //Set secondaryHeader bit - data->header.packet_id_h |= ((hasSecondaryHeader? 1 : 0)) << 3; - this->setAPID( apid ); - //Always initialize as standalone packets. - data->header.sequence_control_h = 0b11000000; - setPacketSequenceCount(sequenceCount); - +ReturnValue_t SpacePacketBase::initSpacePacketHeader(bool isTelecommand, + bool hasSecondaryHeader, uint16_t apid, uint16_t sequenceCount) { + if(data == nullptr) { +#if FSFW_VERBOSE_LEVEL >= 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "SpacePacketBase::initSpacePacketHeader: Data pointer is invalid" + << std::endl; +#else + sif::printWarning("SpacePacketBase::initSpacePacketHeader: Data pointer is invalid!\n"); +#endif +#endif + return HasReturnvaluesIF::RETURN_FAILED; + } + //reset header to zero: + memset(data, 0, sizeof(this->data->header) ); + //Set TC/TM bit. + data->header.packet_id_h = ((isTelecommand? 1 : 0)) << 4; + //Set secondaryHeader bit + data->header.packet_id_h |= ((hasSecondaryHeader? 1 : 0)) << 3; + this->setAPID( apid ); + //Always initialize as standalone packets. + data->header.sequence_control_h = 0b11000000; + setPacketSequenceCount(sequenceCount); + return HasReturnvaluesIF::RETURN_OK; } bool SpacePacketBase::isTelecommand( void ) { - return (this->data->header.packet_id_h & 0b00010000) >> 4; + return (this->data->header.packet_id_h & 0b00010000) >> 4; } bool SpacePacketBase::hasSecondaryHeader( void ) { - return (this->data->header.packet_id_h & 0b00001000) >> 3; + return (this->data->header.packet_id_h & 0b00001000) >> 3; } uint16_t SpacePacketBase::getPacketId() { - return ( (this->data->header.packet_id_h) << 8 ) + - this->data->header.packet_id_l; + return ( (this->data->header.packet_id_h) << 8 ) + + this->data->header.packet_id_l; } uint16_t SpacePacketBase::getAPID( void ) const { - return ( (this->data->header.packet_id_h & 0b00000111) << 8 ) + - this->data->header.packet_id_l; + return ( (this->data->header.packet_id_h & 0b00000111) << 8 ) + + this->data->header.packet_id_l; } void SpacePacketBase::setAPID( uint16_t new_apid ) { - //Use first three bits of new APID, but keep rest of packet id as it was (see specification). - this->data->header.packet_id_h = (this->data->header.packet_id_h & 0b11111000) | ( ( new_apid & 0x0700 ) >> 8 ); - this->data->header.packet_id_l = ( new_apid & 0x00FF ); + // Use first three bits of new APID, but keep rest of packet id as it was (see specification). + this->data->header.packet_id_h = (this->data->header.packet_id_h & 0b11111000) | + ( ( new_apid & 0x0700 ) >> 8 ); + this->data->header.packet_id_l = ( new_apid & 0x00FF ); +} + +void SpacePacketBase::setSequenceFlags( uint8_t sequenceflags ) { + this->data->header.sequence_control_h &= 0x3F; + this->data->header.sequence_control_h |= sequenceflags << 6; } uint16_t SpacePacketBase::getPacketSequenceControl( void ) { - return ( (this->data->header.sequence_control_h) << 8 ) - + this->data->header.sequence_control_l; + return ( (this->data->header.sequence_control_h) << 8 ) + + this->data->header.sequence_control_l; } uint8_t SpacePacketBase::getSequenceFlags( void ) { - return (this->data->header.sequence_control_h & 0b11000000) >> 6 ; + return (this->data->header.sequence_control_h & 0b11000000) >> 6 ; } uint16_t SpacePacketBase::getPacketSequenceCount( void ) const { - return ( (this->data->header.sequence_control_h & 0b00111111) << 8 ) - + this->data->header.sequence_control_l; + return ( (this->data->header.sequence_control_h & 0b00111111) << 8 ) + + this->data->header.sequence_control_l; } void SpacePacketBase::setPacketSequenceCount( uint16_t new_count) { - this->data->header.sequence_control_h = ( this->data->header.sequence_control_h & 0b11000000 ) | ( ( (new_count%LIMIT_SEQUENCE_COUNT) & 0x3F00 ) >> 8 ); - this->data->header.sequence_control_l = ( (new_count%LIMIT_SEQUENCE_COUNT) & 0x00FF ); + this->data->header.sequence_control_h = ( this->data->header.sequence_control_h & 0b11000000 ) | + ( ( (new_count%LIMIT_SEQUENCE_COUNT) & 0x3F00 ) >> 8 ); + this->data->header.sequence_control_l = ( (new_count%LIMIT_SEQUENCE_COUNT) & 0x00FF ); } uint16_t SpacePacketBase::getPacketDataLength() const { - return ( (this->data->header.packet_length_h) << 8 ) - + this->data->header.packet_length_l; + return ( (this->data->header.packet_length_h) << 8 ) + + this->data->header.packet_length_l; } void SpacePacketBase::setPacketDataLength( uint16_t new_length) { - this->data->header.packet_length_h = ( ( new_length & 0xFF00 ) >> 8 ); - this->data->header.packet_length_l = ( new_length & 0x00FF ); + this->data->header.packet_length_h = ( ( new_length & 0xFF00 ) >> 8 ); + this->data->header.packet_length_l = ( new_length & 0x00FF ); } size_t SpacePacketBase::getFullSize() { - //+1 is done because size in packet data length field is: size of data field -1 - return this->getPacketDataLength() + sizeof(this->data->header) + 1; + // +1 is done because size in packet data length field is: size of data field -1 + return this->getPacketDataLength() + sizeof(this->data->header) + 1; } uint8_t* SpacePacketBase::getWholeData() { - return (uint8_t*)this->data; + return (uint8_t*)this->data; } void SpacePacketBase::setData( const uint8_t* p_Data ) { - this->data = (SpacePacketPointer*)p_Data; + this->data = (SpacePacketPointer*)p_Data; } uint32_t SpacePacketBase::getApidAndSequenceCount() const { - return (getAPID() << 16) + getPacketSequenceCount(); + return (getAPID() << 16) + getPacketSequenceCount(); } uint8_t* SpacePacketBase::getPacketData() { - return &(data->packet_data); + return &(data->packet_data); } diff --git a/src/fsfw/tmtcpacket/SpacePacketBase.h b/src/fsfw/tmtcpacket/SpacePacketBase.h index 13cb3130..1ebc484f 100644 --- a/src/fsfw/tmtcpacket/SpacePacketBase.h +++ b/src/fsfw/tmtcpacket/SpacePacketBase.h @@ -2,6 +2,8 @@ #define FSFW_TMTCPACKET_SPACEPACKETBASE_H_ #include "ccsds_header.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" + #include /** @@ -20,8 +22,8 @@ * @ingroup tmtcpackets */ struct SpacePacketPointer { - CCSDSPrimaryHeader header; - uint8_t packet_data; + CCSDSPrimaryHeader header; + uint8_t packet_data; }; /** @@ -37,143 +39,151 @@ struct SpacePacketPointer { */ class SpacePacketBase { protected: - /** - * A pointer to a structure which defines the data structure of - * the packet header. - * To be hardware-safe, all elements are of byte size. - */ - SpacePacketPointer* data; + /** + * A pointer to a structure which defines the data structure of + * the packet header. + * To be hardware-safe, all elements are of byte size. + */ + SpacePacketPointer* data; public: - static const uint16_t LIMIT_APID = 2048; //2^1 - static const uint16_t LIMIT_SEQUENCE_COUNT = 16384; // 2^14 - static const uint16_t APID_IDLE_PACKET = 0x7FF; - static const uint8_t TELECOMMAND_PACKET = 1; - static const uint8_t TELEMETRY_PACKET = 0; - /** - * This definition defines the CRC size in byte. - */ - static const uint8_t CRC_SIZE = 2; - /** - * This is the minimum size of a SpacePacket. - */ - static const uint16_t MINIMUM_SIZE = sizeof(CCSDSPrimaryHeader) + CRC_SIZE; - /** - * This is the default constructor. - * It sets its internal data pointer to the address passed. - * @param set_address The position where the packet data lies. - */ - SpacePacketBase( const uint8_t* set_address ); - /** - * No data is allocated, so the destructor is empty. - */ - virtual ~SpacePacketBase(); + static const uint16_t LIMIT_APID = 2048; //2^1 + static const uint16_t LIMIT_SEQUENCE_COUNT = 16384; // 2^14 + static const uint16_t APID_IDLE_PACKET = 0x7FF; + static const uint8_t TELECOMMAND_PACKET = 1; + static const uint8_t TELEMETRY_PACKET = 0; + /** + * This definition defines the CRC size in byte. + */ + static const uint8_t CRC_SIZE = 2; + /** + * This is the minimum size of a SpacePacket. + */ + static const uint16_t MINIMUM_SIZE = sizeof(CCSDSPrimaryHeader) + CRC_SIZE; + /** + * This is the default constructor. + * It sets its internal data pointer to the address passed. + * @param set_address The position where the packet data lies. + */ + SpacePacketBase( const uint8_t* set_address ); + /** + * No data is allocated, so the destructor is empty. + */ + virtual ~SpacePacketBase(); - //CCSDS Methods: - /** - * Getter for the packet version number field. - * @return Returns the highest three bit of the packet in one byte. - */ - uint8_t getPacketVersionNumber( void ); - /** - * This method checks the type field in the header. - * This bit specifies, if the command is interpreted as Telecommand of - * as Telemetry. For a Telecommand, the bit is set. - * @return Returns true if the bit is set and false if not. - */ - bool isTelecommand( void ); + //CCSDS Methods - void initSpacePacketHeader(bool isTelecommand, bool hasSecondaryHeader, - uint16_t apid, uint16_t sequenceCount = 0); - /** - * The CCSDS header provides a secondary header flag (the fifth-highest bit), - * which is checked with this method. - * @return Returns true if the bit is set and false if not. - */ - bool hasSecondaryHeader( void ); - /** - * Returns the complete first two bytes of the packet, which together form - * the CCSDS packet id. - * @return The CCSDS packet id. - */ - uint16_t getPacketId( void ); - /** - * Returns the APID of a packet, which are the lowest 11 bit of the packet - * id. - * @return The CCSDS APID. - */ - uint16_t getAPID( void ) const; - /** - * Sets the APID of a packet, which are the lowest 11 bit of the packet - * id. - * @param The APID to set. The highest five bits of the parameter are - * ignored. - */ - void setAPID( uint16_t setAPID ); - /** - * Returns the CCSDS packet sequence control field, which are the third and - * the fourth byte of the CCSDS primary header. - * @return The CCSDS packet sequence control field. - */ - uint16_t getPacketSequenceControl( void ); - /** - * Returns the SequenceFlags, which are the highest two bit of the packet - * sequence control field. - * @return The CCSDS sequence flags. - */ - uint8_t getSequenceFlags( void ); - /** - * Returns the packet sequence count, which are the lowest 14 bit of the - * packet sequence control field. - * @return The CCSDS sequence count. - */ - uint16_t getPacketSequenceCount( void ) const; - /** - * Sets the packet sequence count, which are the lowest 14 bit of the - * packet sequence control field. - * setCount is modulo-divided by \c LIMIT_SEQUENCE_COUNT to avoid overflows. - * @param setCount The value to set the count to. - */ - void setPacketSequenceCount( uint16_t setCount ); - /** - * Returns the packet data length, which is the fifth and sixth byte of the - * CCSDS Primary Header. The packet data length is the size of every kind - * of data \b after the CCSDS Primary Header \b -1. - * @return - * The CCSDS packet data length. uint16_t is sufficient, - * because this is limit in CCSDS standard - */ - uint16_t getPacketDataLength(void) const; - /** - * Sets the packet data length, which is the fifth and sixth byte of the - * CCSDS Primary Header. - * @param setLength The value of the length to set. It must fit the true - * CCSDS packet data length . The packet data length is - * the size of every kind of data \b after the CCSDS - * Primary Header \b -1. - */ - void setPacketDataLength( uint16_t setLength ); + /** + * Getter for the packet version number field. + * @return Returns the highest three bit of the packet in one byte. + */ + uint8_t getPacketVersionNumber( void ); + /** + * This method checks the type field in the header. + * This bit specifies, if the command is interpreted as Telecommand of + * as Telemetry. For a Telecommand, the bit is set. + * @return Returns true if the bit is set and false if not. + */ + bool isTelecommand( void ); - //Helper methods: - /** - * This method returns a raw uint8_t pointer to the packet. - * @return A \c uint8_t pointer to the first byte of the CCSDS primary header. - */ - virtual uint8_t* getWholeData( void ); + ReturnValue_t initSpacePacketHeader(bool isTelecommand, bool hasSecondaryHeader, + uint16_t apid, uint16_t sequenceCount = 0); + /** + * The CCSDS header provides a secondary header flag (the fifth-highest bit), + * which is checked with this method. + * @return Returns true if the bit is set and false if not. + */ + bool hasSecondaryHeader( void ); + /** + * Returns the complete first two bytes of the packet, which together form + * the CCSDS packet id. + * @return The CCSDS packet id. + */ + uint16_t getPacketId( void ); + /** + * Returns the APID of a packet, which are the lowest 11 bit of the packet + * id. + * @return The CCSDS APID. + */ + uint16_t getAPID( void ) const; + /** + * Sets the APID of a packet, which are the lowest 11 bit of the packet + * id. + * @param The APID to set. The highest five bits of the parameter are + * ignored. + */ + void setAPID( uint16_t setAPID ); - uint8_t* getPacketData(); - /** - * With this method, the packet data pointer can be redirected to another - * location. - * @param p_Data A pointer to another raw Space Packet. - */ - virtual void setData( const uint8_t* p_Data ); - /** - * This method returns the full raw packet size. - * @return The full size of the packet in bytes. - */ - size_t getFullSize(); + /** + * Sets the sequence flags of a packet, which are bit 17 and 18 in the space packet header. + * @param The sequence flags to set + */ + void setSequenceFlags( uint8_t sequenceflags ); - uint32_t getApidAndSequenceCount() const; + /** + * Returns the CCSDS packet sequence control field, which are the third and + * the fourth byte of the CCSDS primary header. + * @return The CCSDS packet sequence control field. + */ + uint16_t getPacketSequenceControl( void ); + /** + * Returns the SequenceFlags, which are the highest two bit of the packet + * sequence control field. + * @return The CCSDS sequence flags. + */ + uint8_t getSequenceFlags( void ); + /** + * Returns the packet sequence count, which are the lowest 14 bit of the + * packet sequence control field. + * @return The CCSDS sequence count. + */ + uint16_t getPacketSequenceCount( void ) const; + /** + * Sets the packet sequence count, which are the lowest 14 bit of the + * packet sequence control field. + * setCount is modulo-divided by \c LIMIT_SEQUENCE_COUNT to avoid overflows. + * @param setCount The value to set the count to. + */ + void setPacketSequenceCount( uint16_t setCount ); + /** + * Returns the packet data length, which is the fifth and sixth byte of the + * CCSDS Primary Header. The packet data length is the size of every kind + * of data \b after the CCSDS Primary Header \b -1. + * @return + * The CCSDS packet data length. uint16_t is sufficient, + * because this is limit in CCSDS standard + */ + uint16_t getPacketDataLength(void) const; + /** + * Sets the packet data length, which is the fifth and sixth byte of the + * CCSDS Primary Header. + * @param setLength The value of the length to set. It must fit the true + * CCSDS packet data length . The packet data length is + * the size of every kind of data \b after the CCSDS + * Primary Header \b -1. + */ + void setPacketDataLength( uint16_t setLength ); + + // Helper methods + /** + * This method returns a raw uint8_t pointer to the packet. + * @return A \c uint8_t pointer to the first byte of the CCSDS primary header. + */ + virtual uint8_t* getWholeData( void ); + + uint8_t* getPacketData(); + /** + * With this method, the packet data pointer can be redirected to another + * location. + * @param p_Data A pointer to another raw Space Packet. + */ + virtual void setData( const uint8_t* p_Data ); + /** + * This method returns the full raw packet size. + * @return The full size of the packet in bytes. + */ + size_t getFullSize(); + + uint32_t getApidAndSequenceCount() const; }; diff --git a/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.cpp index ea25f5d2..2c6e1d97 100644 --- a/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.cpp +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.cpp @@ -53,11 +53,14 @@ uint8_t* TmPacketPusC::getPacketTimeRaw() const{ } -void TmPacketPusC::initializeTmPacket(uint16_t apid, uint8_t service, +ReturnValue_t TmPacketPusC::initializeTmPacket(uint16_t apid, uint8_t service, uint8_t subservice, uint16_t packetSubcounter, uint16_t destinationId, uint8_t timeRefField) { //Set primary header: - initSpacePacketHeader(false, true, apid); + ReturnValue_t result = initSpacePacketHeader(false, true, apid); + if(result != HasReturnvaluesIF::RETURN_OK) { + return result; + } //Set data Field Header: //First, set to zero. memset(&tmData->dataField, 0, sizeof(tmData->dataField)); @@ -76,6 +79,7 @@ void TmPacketPusC::initializeTmPacket(uint16_t apid, uint8_t service, timeStamper->addTimeStamp(tmData->dataField.time, sizeof(tmData->dataField.time)); } + return HasReturnvaluesIF::RETURN_OK; } void TmPacketPusC::setSourceDataSize(uint16_t size) { diff --git a/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h index fe373c6f..3a9be132 100644 --- a/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h @@ -100,7 +100,7 @@ protected: * @param subservice PUS Subservice * @param packetSubcounter Additional subcounter used. */ - void initializeTmPacket(uint16_t apid, uint8_t service, uint8_t subservice, + ReturnValue_t initializeTmPacket(uint16_t apid, uint8_t service, uint8_t subservice, uint16_t packetSubcounter, uint16_t destinationId = 0, uint8_t timeRefField = 0); /** diff --git a/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp index add4f4b9..4a6e4d21 100644 --- a/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp @@ -43,27 +43,55 @@ TmPacketStoredPusC::TmPacketStoredPusC(uint16_t apid, uint8_t service, return; } size_t sourceDataSize = 0; - if (content != NULL) { + if (content != nullptr) { sourceDataSize += content->getSerializedSize(); } - if (header != NULL) { + if (header != nullptr) { sourceDataSize += header->getSerializedSize(); } - uint8_t *p_data = NULL; - ReturnValue_t returnValue = store->getFreeElement(&storeAddress, - (getPacketMinimumSize() + sourceDataSize), &p_data); + uint8_t *pData = nullptr; + size_t sizeToReserve = getPacketMinimumSize() + sourceDataSize; + ReturnValue_t returnValue = store->getFreeElement(&storeAddress, sizeToReserve, &pData); if (returnValue != store->RETURN_OK) { +#if FSFW_VERBOSE_LEVEL >= 1 + switch(returnValue) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + case(StorageManagerIF::DATA_STORAGE_FULL): { + sif::warning << "TmPacketStoredPusC::TmPacketStoredPusC: Store full for packet with " + "size " << sizeToReserve << std::endl; + break; + } + case(StorageManagerIF::DATA_TOO_LARGE): { + sif::warning << "TmPacketStoredPusC::TmPacketStoredPusC: Data with size " << + sizeToReserve << " too large" << std::endl; + break; + } +#else + case(StorageManagerIF::DATA_STORAGE_FULL): { + sif::printWarning("TmPacketStoredPusC::TmPacketStoredPusC: Store full for packet with " + "size %d\n", sizeToReserve); + break; + } + case(StorageManagerIF::DATA_TOO_LARGE): { + sif::printWarning("TmPacketStoredPusC::TmPacketStoredPusC: Data with size " + "%d too large\n", sizeToReserve); + break; + } +#endif +#endif + } TmPacketStoredBase::checkAndReportLostTm(); + return; } - setData(p_data); + setData(pData); initializeTmPacket(apid, service, subservice, packetSubcounter, destinationId, timeRefField); uint8_t *putDataHere = getSourceData(); size_t size = 0; - if (header != NULL) { + if (header != nullptr) { header->serialize(&putDataHere, &size, sourceDataSize, SerializeIF::Endianness::BIG); } - if (content != NULL) { + if (content != nullptr) { content->serialize(&putDataHere, &size, sourceDataSize, SerializeIF::Endianness::BIG); } From 54a6c1b0aaf7bebac28b8e5d656a62035ec002a5 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 5 Oct 2021 12:36:21 +0200 Subject: [PATCH 338/389] bugfix for PUS A --- .../tmtcpacket/pus/tm/TmPacketStoredPusA.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp index 538dc95e..ad19cc11 100644 --- a/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp @@ -42,32 +42,32 @@ TmPacketStoredPusA::TmPacketStoredPusA(uint16_t apid, uint8_t service, return; } size_t sourceDataSize = 0; - if (content != NULL) { + if (content != nullptr) { sourceDataSize += content->getSerializedSize(); } - if (header != NULL) { + if (header != nullptr) { sourceDataSize += header->getSerializedSize(); } - uint8_t *p_data = NULL; + uint8_t *pData = nullptr; ReturnValue_t returnValue = store->getFreeElement(&storeAddress, - (getPacketMinimumSize() + sourceDataSize), &p_data); + (getPacketMinimumSize() + sourceDataSize), &pData); if (returnValue != store->RETURN_OK) { TmPacketStoredBase::checkAndReportLostTm(); + return; } - setData(p_data); + setData(pData); initializeTmPacket(apid, service, subservice, packetSubcounter); uint8_t *putDataHere = getSourceData(); size_t size = 0; - if (header != NULL) { + if (header != nullptr) { header->serialize(&putDataHere, &size, sourceDataSize, SerializeIF::Endianness::BIG); } - if (content != NULL) { + if (content != nullptr) { content->serialize(&putDataHere, &size, sourceDataSize, SerializeIF::Endianness::BIG); } - setPacketDataLength( - sourceDataSize + sizeof(PUSTmDataFieldHeaderPusA) + CRC_SIZE - 1); + setPacketDataLength(sourceDataSize + sizeof(PUSTmDataFieldHeaderPusA) + CRC_SIZE - 1); } uint8_t* TmPacketStoredPusA::getAllTmData() { From ecdbf98ca43c98d763784a8c413181819bc455cb Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 5 Oct 2021 12:38:58 +0200 Subject: [PATCH 339/389] added printouts for PUS A --- .../tmtcpacket/pus/tm/TmPacketStoredPusA.cpp | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp index ad19cc11..3b183f09 100644 --- a/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp @@ -49,10 +49,38 @@ TmPacketStoredPusA::TmPacketStoredPusA(uint16_t apid, uint8_t service, sourceDataSize += header->getSerializedSize(); } uint8_t *pData = nullptr; + size_t sizeToReserve = getPacketMinimumSize() + sourceDataSize; ReturnValue_t returnValue = store->getFreeElement(&storeAddress, - (getPacketMinimumSize() + sourceDataSize), &pData); + sizeToReserve, &pData); if (returnValue != store->RETURN_OK) { TmPacketStoredBase::checkAndReportLostTm(); +#if FSFW_VERBOSE_LEVEL >= 1 + switch(returnValue) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + case(StorageManagerIF::DATA_STORAGE_FULL): { + sif::warning << "TmPacketStoredPusA::TmPacketStoredPusC: Store full for packet with " + "size " << sizeToReserve << std::endl; + break; + } + case(StorageManagerIF::DATA_TOO_LARGE): { + sif::warning << "TmPacketStoredPusA::TmPacketStoredPusC: Data with size " << + sizeToReserve << " too large" << std::endl; + break; + } +#else + case(StorageManagerIF::DATA_STORAGE_FULL): { + sif::printWarning("TmPacketStoredPusA::TmPacketStoredPusC: Store full for packet with " + "size %d\n", sizeToReserve); + break; + } + case(StorageManagerIF::DATA_TOO_LARGE): { + sif::printWarning("TmPacketStoredPusA::TmPacketStoredPusC: Data with size " + "%d too large\n", sizeToReserve); + break; + } +#endif +#endif + } return; } setData(pData); From 155432663b42b73cd8a23782cdb7fc39e04509b4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 5 Oct 2021 12:47:30 +0200 Subject: [PATCH 340/389] moved store failure to separate function --- .../tmtcpacket/pus/tm/TmPacketStoredBase.cpp | 32 +++- .../tmtcpacket/pus/tm/TmPacketStoredBase.h | 3 + .../tmtcpacket/pus/tm/TmPacketStoredPusA.cpp | 140 +++++++----------- .../tmtcpacket/pus/tm/TmPacketStoredPusA.h | 74 ++++----- .../tmtcpacket/pus/tm/TmPacketStoredPusC.cpp | 34 +---- 5 files changed, 132 insertions(+), 151 deletions(-) diff --git a/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.cpp index 466e4cd2..20a8ed89 100644 --- a/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.cpp +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.cpp @@ -91,4 +91,34 @@ void TmPacketStoredBase::checkAndReportLostTm() { } } - +void TmPacketStoredBase::handleStoreFailure(const char *const packetType, ReturnValue_t result, + size_t sizeToReserve) { + checkAndReportLostTm(); +#if FSFW_VERBOSE_LEVEL >= 1 + switch(result) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + case(StorageManagerIF::DATA_STORAGE_FULL): { + sif::warning << "TmPacketStoredPus" << packetType << ": " << + "Store full for packet with size" << sizeToReserve << std::endl; + break; + } + case(StorageManagerIF::DATA_TOO_LARGE): { + sif::warning << "TmPacketStoredPus" << packetType << ": Data with size " << + sizeToReserve << " too large" << std::endl; + break; + } +#else + case(StorageManagerIF::DATA_STORAGE_FULL): { + sif::printWarning("TmPacketStoredPus%s: Store full for packet with " + "size %d\n", packetType, sizeToReserve); + break; + } + case(StorageManagerIF::DATA_TOO_LARGE): { + sif::printWarning("TmPacketStoredPus%s: Data with size " + "%d too large\n", packetType, sizeToReserve); + break; + } +#endif +#endif + } +} diff --git a/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.h b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.h index 8e8b9c70..91ca2f93 100644 --- a/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.h +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.h @@ -82,6 +82,9 @@ protected: bool checkAndSetStore(); void checkAndReportLostTm(); + + void handleStoreFailure(const char* const packetType, ReturnValue_t result, + size_t sizeToReserve); }; diff --git a/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp index 3b183f09..067b4f8f 100644 --- a/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp @@ -5,97 +5,71 @@ #include -TmPacketStoredPusA::TmPacketStoredPusA(store_address_t setAddress) : - TmPacketStoredBase(setAddress), TmPacketPusA(nullptr){ +TmPacketStoredPusA::TmPacketStoredPusA(store_address_t setAddress): + TmPacketStoredBase(setAddress), TmPacketPusA(nullptr){ } TmPacketStoredPusA::TmPacketStoredPusA(uint16_t apid, uint8_t service, - uint8_t subservice, uint8_t packetSubcounter, const uint8_t *data, - uint32_t size, const uint8_t *headerData, uint32_t headerSize) : + uint8_t subservice, uint8_t packetSubcounter, const uint8_t *data, + uint32_t size, const uint8_t *headerData, uint32_t headerSize): TmPacketPusA(nullptr) { - storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; - if (not TmPacketStoredBase::checkAndSetStore()) { - return; - } - uint8_t *pData = nullptr; - ReturnValue_t returnValue = store->getFreeElement(&storeAddress, - (getPacketMinimumSize() + size + headerSize), &pData); + storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; + if (not TmPacketStoredBase::checkAndSetStore()) { + return; + } + uint8_t *pData = nullptr; + size_t sizeToReserve = getPacketMinimumSize() + size + headerSize; + ReturnValue_t returnValue = store->getFreeElement(&storeAddress, + sizeToReserve, &pData); - if (returnValue != store->RETURN_OK) { - TmPacketStoredBase::checkAndReportLostTm(); - return; - } - setData(pData); - initializeTmPacket(apid, service, subservice, packetSubcounter); - memcpy(getSourceData(), headerData, headerSize); - memcpy(getSourceData() + headerSize, data, size); - setPacketDataLength( - size + headerSize + sizeof(PUSTmDataFieldHeaderPusA) + CRC_SIZE - 1); + if (returnValue != store->RETURN_OK) { + handleStoreFailure("A", returnValue, sizeToReserve); + return; + } + setData(pData); + initializeTmPacket(apid, service, subservice, packetSubcounter); + memcpy(getSourceData(), headerData, headerSize); + memcpy(getSourceData() + headerSize, data, size); + setPacketDataLength( + size + headerSize + sizeof(PUSTmDataFieldHeaderPusA) + CRC_SIZE - 1); } TmPacketStoredPusA::TmPacketStoredPusA(uint16_t apid, uint8_t service, - uint8_t subservice, uint8_t packetSubcounter, SerializeIF *content, - SerializeIF *header) : - TmPacketPusA(nullptr) { - storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; - if (not TmPacketStoredBase::checkAndSetStore()) { - return; - } - size_t sourceDataSize = 0; - if (content != nullptr) { - sourceDataSize += content->getSerializedSize(); - } - if (header != nullptr) { - sourceDataSize += header->getSerializedSize(); - } - uint8_t *pData = nullptr; - size_t sizeToReserve = getPacketMinimumSize() + sourceDataSize; - ReturnValue_t returnValue = store->getFreeElement(&storeAddress, - sizeToReserve, &pData); - if (returnValue != store->RETURN_OK) { - TmPacketStoredBase::checkAndReportLostTm(); -#if FSFW_VERBOSE_LEVEL >= 1 - switch(returnValue) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - case(StorageManagerIF::DATA_STORAGE_FULL): { - sif::warning << "TmPacketStoredPusA::TmPacketStoredPusC: Store full for packet with " - "size " << sizeToReserve << std::endl; - break; - } - case(StorageManagerIF::DATA_TOO_LARGE): { - sif::warning << "TmPacketStoredPusA::TmPacketStoredPusC: Data with size " << - sizeToReserve << " too large" << std::endl; - break; - } -#else - case(StorageManagerIF::DATA_STORAGE_FULL): { - sif::printWarning("TmPacketStoredPusA::TmPacketStoredPusC: Store full for packet with " - "size %d\n", sizeToReserve); - break; - } - case(StorageManagerIF::DATA_TOO_LARGE): { - sif::printWarning("TmPacketStoredPusA::TmPacketStoredPusC: Data with size " - "%d too large\n", sizeToReserve); - break; - } -#endif -#endif - } - return; - } - setData(pData); - initializeTmPacket(apid, service, subservice, packetSubcounter); - uint8_t *putDataHere = getSourceData(); - size_t size = 0; - if (header != nullptr) { - header->serialize(&putDataHere, &size, sourceDataSize, - SerializeIF::Endianness::BIG); - } - if (content != nullptr) { - content->serialize(&putDataHere, &size, sourceDataSize, - SerializeIF::Endianness::BIG); - } - setPacketDataLength(sourceDataSize + sizeof(PUSTmDataFieldHeaderPusA) + CRC_SIZE - 1); + uint8_t subservice, uint8_t packetSubcounter, SerializeIF *content, + SerializeIF *header) : + TmPacketPusA(nullptr) { + storeAddress.raw = StorageManagerIF::INVALID_ADDRESS; + if (not TmPacketStoredBase::checkAndSetStore()) { + return; + } + size_t sourceDataSize = 0; + if (content != nullptr) { + sourceDataSize += content->getSerializedSize(); + } + if (header != nullptr) { + sourceDataSize += header->getSerializedSize(); + } + uint8_t *pData = nullptr; + size_t sizeToReserve = getPacketMinimumSize() + sourceDataSize; + ReturnValue_t returnValue = store->getFreeElement(&storeAddress, + sizeToReserve, &pData); + if (returnValue != store->RETURN_OK) { + handleStoreFailure("A", returnValue, sizeToReserve); + return; + } + setData(pData); + initializeTmPacket(apid, service, subservice, packetSubcounter); + uint8_t *putDataHere = getSourceData(); + size_t size = 0; + if (header != nullptr) { + header->serialize(&putDataHere, &size, sourceDataSize, + SerializeIF::Endianness::BIG); + } + if (content != nullptr) { + content->serialize(&putDataHere, &size, sourceDataSize, + SerializeIF::Endianness::BIG); + } + setPacketDataLength(sourceDataSize + sizeof(PUSTmDataFieldHeaderPusA) + CRC_SIZE - 1); } uint8_t* TmPacketStoredPusA::getAllTmData() { diff --git a/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.h b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.h index 0cfcf0b8..6a338cd5 100644 --- a/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.h +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.h @@ -15,46 +15,46 @@ * packets in a store with the help of a storeAddress. * @ingroup tmtcpackets */ -class TmPacketStoredPusA : +class TmPacketStoredPusA: public TmPacketStoredBase, public TmPacketPusA { public: - /** - * This is a default constructor which does not set the data pointer. - * However, it does try to set the packet store. - */ - TmPacketStoredPusA( store_address_t setAddress ); - /** - * With this constructor, new space is allocated in the packet store and - * a new PUS Telemetry Packet is created there. - * Packet Application Data passed in data is copied into the packet. - * The Application data is passed in two parts, first a header, then a - * data field. This allows building a Telemetry Packet from two separate - * data sources. - * @param apid Sets the packet's APID field. - * @param service Sets the packet's Service ID field. - * This specifies the source service. - * @param subservice Sets the packet's Service Subtype field. - * This specifies the source sub-service. - * @param packet_counter Sets the Packet counter field of this packet - * @param data The payload data to be copied to the - * Application Data Field - * @param size The amount of data to be copied. - * @param headerData The header Data of the Application field, - * will be copied in front of data - * @param headerSize The size of the headerDataF - */ - TmPacketStoredPusA( uint16_t apid, uint8_t service, uint8_t subservice, - uint8_t packet_counter = 0, const uint8_t* data = nullptr, - uint32_t size = 0, const uint8_t* headerData = nullptr, - uint32_t headerSize = 0); - /** - * Another ctor to directly pass structured content and header data to the - * packet to avoid additional buffers. - */ - TmPacketStoredPusA( uint16_t apid, uint8_t service, uint8_t subservice, - uint8_t packet_counter, SerializeIF* content, - SerializeIF* header = nullptr); + /** + * This is a default constructor which does not set the data pointer. + * However, it does try to set the packet store. + */ + TmPacketStoredPusA( store_address_t setAddress ); + /** + * With this constructor, new space is allocated in the packet store and + * a new PUS Telemetry Packet is created there. + * Packet Application Data passed in data is copied into the packet. + * The Application data is passed in two parts, first a header, then a + * data field. This allows building a Telemetry Packet from two separate + * data sources. + * @param apid Sets the packet's APID field. + * @param service Sets the packet's Service ID field. + * This specifies the source service. + * @param subservice Sets the packet's Service Subtype field. + * This specifies the source sub-service. + * @param packet_counter Sets the Packet counter field of this packet + * @param data The payload data to be copied to the + * Application Data Field + * @param size The amount of data to be copied. + * @param headerData The header Data of the Application field, + * will be copied in front of data + * @param headerSize The size of the headerDataF + */ + TmPacketStoredPusA( uint16_t apid, uint8_t service, uint8_t subservice, + uint8_t packet_counter = 0, const uint8_t* data = nullptr, + uint32_t size = 0, const uint8_t* headerData = nullptr, + uint32_t headerSize = 0); + /** + * Another ctor to directly pass structured content and header data to the + * packet to avoid additional buffers. + */ + TmPacketStoredPusA( uint16_t apid, uint8_t service, uint8_t subservice, + uint8_t packet_counter, SerializeIF* content, + SerializeIF* header = nullptr); uint8_t* getAllTmData() override; void setDataPointer(const uint8_t* newPointer) override; diff --git a/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp index 4a6e4d21..2fbc8043 100644 --- a/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp @@ -19,11 +19,12 @@ TmPacketStoredPusC::TmPacketStoredPusC(uint16_t apid, uint8_t service, return; } uint8_t *pData = nullptr; + size_t sizeToReserve = getPacketMinimumSize() + size + headerSize; ReturnValue_t returnValue = store->getFreeElement(&storeAddress, - (getPacketMinimumSize() + size + headerSize), &pData); + sizeToReserve, &pData); if (returnValue != store->RETURN_OK) { - TmPacketStoredBase::checkAndReportLostTm(); + handleStoreFailure("C", returnValue, sizeToReserve); return; } setData(pData); @@ -53,34 +54,7 @@ TmPacketStoredPusC::TmPacketStoredPusC(uint16_t apid, uint8_t service, size_t sizeToReserve = getPacketMinimumSize() + sourceDataSize; ReturnValue_t returnValue = store->getFreeElement(&storeAddress, sizeToReserve, &pData); if (returnValue != store->RETURN_OK) { -#if FSFW_VERBOSE_LEVEL >= 1 - switch(returnValue) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - case(StorageManagerIF::DATA_STORAGE_FULL): { - sif::warning << "TmPacketStoredPusC::TmPacketStoredPusC: Store full for packet with " - "size " << sizeToReserve << std::endl; - break; - } - case(StorageManagerIF::DATA_TOO_LARGE): { - sif::warning << "TmPacketStoredPusC::TmPacketStoredPusC: Data with size " << - sizeToReserve << " too large" << std::endl; - break; - } -#else - case(StorageManagerIF::DATA_STORAGE_FULL): { - sif::printWarning("TmPacketStoredPusC::TmPacketStoredPusC: Store full for packet with " - "size %d\n", sizeToReserve); - break; - } - case(StorageManagerIF::DATA_TOO_LARGE): { - sif::printWarning("TmPacketStoredPusC::TmPacketStoredPusC: Data with size " - "%d too large\n", sizeToReserve); - break; - } -#endif -#endif - } - TmPacketStoredBase::checkAndReportLostTm(); + handleStoreFailure("C", returnValue, sizeToReserve); return; } setData(pData); From ae689408f377f3add49ca2151bfdfbb34a92171c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 5 Oct 2021 01:23:56 +0200 Subject: [PATCH 341/389] using correct version number now --- src/fsfw/tmtcpacket/pus/tm/TmPacketBase.h | 2 -- src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.cpp | 7 +------ src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h | 3 +++ src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.cpp | 2 +- src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h | 3 +++ src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp | 3 +-- src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp | 3 +-- 7 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/fsfw/tmtcpacket/pus/tm/TmPacketBase.h b/src/fsfw/tmtcpacket/pus/tm/TmPacketBase.h index 0379b977..31bfe3c8 100644 --- a/src/fsfw/tmtcpacket/pus/tm/TmPacketBase.h +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketBase.h @@ -31,8 +31,6 @@ public: //! Maximum size of a TM Packet in this mission. //! TODO: Make this dependant on a config variable. static const uint32_t MISSION_TM_PACKET_MAX_SIZE = 2048; - //! First four bits of first byte of secondary header - static const uint8_t VERSION_NUMBER_BYTE = 0b00010000; /** * This is the default constructor. diff --git a/src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.cpp index c6540af5..a70fc45e 100644 --- a/src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.cpp +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.cpp @@ -62,12 +62,7 @@ void TmPacketPusA::initializeTmPacket(uint16_t apid, uint8_t service, //First, set to zero. memset(&tmData->data_field, 0, sizeof(tmData->data_field)); - // NOTE: In PUS-C, the PUS Version is 2 and specified for the first 4 bits. - // The other 4 bits of the first byte are the spacecraft time reference - // status. To change to PUS-C, set 0b00100000. - // Set CCSDS_secondary header flag to 0, version number to 001 and ack - // to 0000 - tmData->data_field.version_type_ack = 0b00010000; + tmData->data_field.version_type_ack = TM_PUS_VERSION_NUMBER << 4; tmData->data_field.service_type = service; tmData->data_field.service_subtype = subservice; tmData->data_field.subcounter = packetSubcounter; diff --git a/src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h index 3856c779..839a6302 100644 --- a/src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h @@ -52,6 +52,9 @@ public: sizeof(PUSTmDataFieldHeaderPusA) + 2); //! Maximum size of a TM Packet in this mission. static const uint32_t MISSION_TM_PACKET_MAX_SIZE = fsfwconfig::FSFW_MAX_TM_PACKET_SIZE; + //! First four bits of first byte of secondary header. Set to 1 according + //! to ECSS-E-ST-70-41C p.439 + static constexpr uint8_t TM_PUS_VERSION_NUMBER = 1; /** * This is the default constructor. diff --git a/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.cpp index ea25f5d2..1921a154 100644 --- a/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.cpp +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.cpp @@ -64,7 +64,7 @@ void TmPacketPusC::initializeTmPacket(uint16_t apid, uint8_t service, /* Only account for last 4 bytes for time reference field */ timeRefField &= 0b1111; - tmData->dataField.versionTimeReferenceField = VERSION_NUMBER_BYTE | timeRefField; + tmData->dataField.versionTimeReferenceField = (TM_PUS_VERSION_NUMBER << 4) | timeRefField; tmData->dataField.serviceType = service; tmData->dataField.serviceSubtype = subservice; tmData->dataField.subcounterMsb = packetSubcounter << 8 & 0xff; diff --git a/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h index fe373c6f..5e48445e 100644 --- a/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h @@ -54,6 +54,9 @@ public: sizeof(PUSTmDataFieldHeaderPusC) + 2); //! Maximum size of a TM Packet in this mission. static const uint32_t MISSION_TM_PACKET_MAX_SIZE = fsfwconfig::FSFW_MAX_TM_PACKET_SIZE; + //! First four bits of first byte of secondary header. Set to 2 according + //! to ECSS-E-ST-70-41C p.439 + static constexpr uint8_t TM_PUS_VERSION_NUMBER = 2; /** * This is the default constructor. diff --git a/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp index 538dc95e..6f249667 100644 --- a/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusA.cpp @@ -29,8 +29,7 @@ TmPacketStoredPusA::TmPacketStoredPusA(uint16_t apid, uint8_t service, initializeTmPacket(apid, service, subservice, packetSubcounter); memcpy(getSourceData(), headerData, headerSize); memcpy(getSourceData() + headerSize, data, size); - setPacketDataLength( - size + headerSize + sizeof(PUSTmDataFieldHeaderPusA) + CRC_SIZE - 1); + setPacketDataLength(size + headerSize + sizeof(PUSTmDataFieldHeaderPusA) + CRC_SIZE - 1); } TmPacketStoredPusA::TmPacketStoredPusA(uint16_t apid, uint8_t service, diff --git a/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp index add4f4b9..149cbba1 100644 --- a/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredPusC.cpp @@ -30,8 +30,7 @@ TmPacketStoredPusC::TmPacketStoredPusC(uint16_t apid, uint8_t service, initializeTmPacket(apid, service, subservice, packetSubcounter, destinationId, timeRefField); memcpy(getSourceData(), headerData, headerSize); memcpy(getSourceData() + headerSize, data, size); - setPacketDataLength( - size + headerSize + sizeof(PUSTmDataFieldHeaderPusC) + CRC_SIZE - 1); + setPacketDataLength(size + headerSize + sizeof(PUSTmDataFieldHeaderPusC) + CRC_SIZE - 1); } TmPacketStoredPusC::TmPacketStoredPusC(uint16_t apid, uint8_t service, From ffa38a81b7d0dde82afb66001a007b1a9d7f4042 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 5 Oct 2021 13:13:36 +0200 Subject: [PATCH 342/389] using pus version enum now --- src/fsfw/tmtcpacket/pus/definitions.h | 16 ++++++++++++++++ src/fsfw/tmtcpacket/pus/tc/TcPacketPus.cpp | 11 +++++------ src/fsfw/tmtcpacket/pus/tc/TcPacketPus.h | 4 +++- src/fsfw/tmtcpacket/pus/tc/TcPacketStoredPus.cpp | 7 ++++++- src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.cpp | 7 ++++--- src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h | 3 --- src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.cpp | 8 +++++--- 7 files changed, 39 insertions(+), 17 deletions(-) create mode 100644 src/fsfw/tmtcpacket/pus/definitions.h diff --git a/src/fsfw/tmtcpacket/pus/definitions.h b/src/fsfw/tmtcpacket/pus/definitions.h new file mode 100644 index 00000000..d92ab312 --- /dev/null +++ b/src/fsfw/tmtcpacket/pus/definitions.h @@ -0,0 +1,16 @@ +#ifndef FSFW_SRC_FSFW_TMTCPACKET_PUS_TM_DEFINITIONS_H_ +#define FSFW_SRC_FSFW_TMTCPACKET_PUS_TM_DEFINITIONS_H_ + +#include + +namespace pus { + +//! Version numbers according to ECSS-E-ST-70-41C p.439 +enum PusVersion: uint8_t { + PUS_A_VERSION = 1, + PUS_C_VERSION = 2 +}; + +} + +#endif /* FSFW_SRC_FSFW_TMTCPACKET_PUS_TM_DEFINITIONS_H_ */ diff --git a/src/fsfw/tmtcpacket/pus/tc/TcPacketPus.cpp b/src/fsfw/tmtcpacket/pus/tc/TcPacketPus.cpp index 28533754..2b97b0d2 100644 --- a/src/fsfw/tmtcpacket/pus/tc/TcPacketPus.cpp +++ b/src/fsfw/tmtcpacket/pus/tc/TcPacketPus.cpp @@ -1,4 +1,4 @@ -#include "fsfw/tmtcpacket/pus/tc/TcPacketPus.h" +#include "TcPacketPus.h" #include "fsfw/globalfunctions/CRC.h" #include @@ -8,14 +8,13 @@ TcPacketPus::TcPacketPus(const uint8_t *setData): TcPacketBase(setData) { } void TcPacketPus::initializeTcPacket(uint16_t apid, uint16_t sequenceCount, - uint8_t ack, uint8_t service, uint8_t subservice, uint16_t sourceId) { + uint8_t ack, uint8_t service, uint8_t subservice, pus::PusVersion pusVersion, + uint16_t sourceId) { initSpacePacketHeader(true, true, apid, sequenceCount); std::memset(&tcData->dataField, 0, sizeof(tcData->dataField)); setPacketDataLength(sizeof(PUSTcDataFieldHeader) + CRC_SIZE - 1); - // Data Field Header: - // Set CCSDS_secondary_header_flag to 0 and version number to 001 - tcData->dataField.versionTypeAck = 0b00010000; - tcData->dataField.versionTypeAck |= (ack & 0x0F); + // Data Field Header. For PUS A, the first bit (CCSDS Secondary Header Flag) is zero + tcData->dataField.versionTypeAck = pusVersion << 4 | (ack & 0x0F); tcData->dataField.serviceType = service; tcData->dataField.serviceSubtype = subservice; #if FSFW_USE_PUS_C_TELECOMMANDS == 1 diff --git a/src/fsfw/tmtcpacket/pus/tc/TcPacketPus.h b/src/fsfw/tmtcpacket/pus/tc/TcPacketPus.h index 082541ba..1bacc3a7 100644 --- a/src/fsfw/tmtcpacket/pus/tc/TcPacketPus.h +++ b/src/fsfw/tmtcpacket/pus/tc/TcPacketPus.h @@ -2,6 +2,7 @@ #define FSFW_TMTCPACKET_PUS_TCPACKETPUSA_H_ #include "fsfw/FSFW.h" +#include "../definitions.h" #include "fsfw/tmtcpacket/ccsds_header.h" #include "TcPacketBase.h" @@ -75,7 +76,8 @@ protected: * @param subservice PUS Subservice */ void initializeTcPacket(uint16_t apid, uint16_t sequenceCount, uint8_t ack, - uint8_t service, uint8_t subservice, uint16_t sourceId = 0); + uint8_t service, uint8_t subservice, pus::PusVersion pusVersion, + uint16_t sourceId = 0); /** * A pointer to a structure which defines the data structure of diff --git a/src/fsfw/tmtcpacket/pus/tc/TcPacketStoredPus.cpp b/src/fsfw/tmtcpacket/pus/tc/TcPacketStoredPus.cpp index 5ea9f5b1..7f8f4ac8 100644 --- a/src/fsfw/tmtcpacket/pus/tc/TcPacketStoredPus.cpp +++ b/src/fsfw/tmtcpacket/pus/tc/TcPacketStoredPus.cpp @@ -23,7 +23,12 @@ TcPacketStoredPus::TcPacketStoredPus(uint16_t apid, uint8_t service, return; } this->setData(pData); - initializeTcPacket(apid, sequenceCount, ack, service, subservice); +#if FSFW_USE_PUS_C_TELECOMMANDS == 1 + pus::PusVersion pusVersion = pus::PusVersion::PUS_C_VERSION; +#else + pus::PusVersion pusVersion = pus::PusVersion::PUS_A_VERSION; +#endif + initializeTcPacket(apid, sequenceCount, ack, service, subservice, pusVersion); std::memcpy(&tcData->appData, data, size); this->setPacketDataLength( size + sizeof(PUSTcDataFieldHeader) + CRC_SIZE - 1); diff --git a/src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.cpp index a70fc45e..ccf5a8ac 100644 --- a/src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.cpp +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.cpp @@ -1,5 +1,6 @@ -#include "fsfw/tmtcpacket/pus/tm/TmPacketPusA.h" -#include "fsfw/tmtcpacket/pus/tm/TmPacketBase.h" +#include "../definitions.h" +#include "TmPacketPusA.h" +#include "TmPacketBase.h" #include "fsfw/globalfunctions/CRC.h" #include "fsfw/globalfunctions/arrayprinter.h" @@ -62,7 +63,7 @@ void TmPacketPusA::initializeTmPacket(uint16_t apid, uint8_t service, //First, set to zero. memset(&tmData->data_field, 0, sizeof(tmData->data_field)); - tmData->data_field.version_type_ack = TM_PUS_VERSION_NUMBER << 4; + tmData->data_field.version_type_ack = pus::PusVersion::PUS_A_VERSION << 4; tmData->data_field.service_type = service; tmData->data_field.service_subtype = subservice; tmData->data_field.subcounter = packetSubcounter; diff --git a/src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h index 839a6302..3856c779 100644 --- a/src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusA.h @@ -52,9 +52,6 @@ public: sizeof(PUSTmDataFieldHeaderPusA) + 2); //! Maximum size of a TM Packet in this mission. static const uint32_t MISSION_TM_PACKET_MAX_SIZE = fsfwconfig::FSFW_MAX_TM_PACKET_SIZE; - //! First four bits of first byte of secondary header. Set to 1 according - //! to ECSS-E-ST-70-41C p.439 - static constexpr uint8_t TM_PUS_VERSION_NUMBER = 1; /** * This is the default constructor. diff --git a/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.cpp index 1921a154..8defb883 100644 --- a/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.cpp +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.cpp @@ -1,5 +1,6 @@ -#include "fsfw/tmtcpacket/pus/tm/TmPacketPusC.h" -#include "fsfw/tmtcpacket/pus/tm/TmPacketBase.h" +#include "../definitions.h" +#include "TmPacketPusC.h" +#include "TmPacketBase.h" #include "fsfw/globalfunctions/CRC.h" #include "fsfw/globalfunctions/arrayprinter.h" @@ -64,7 +65,8 @@ void TmPacketPusC::initializeTmPacket(uint16_t apid, uint8_t service, /* Only account for last 4 bytes for time reference field */ timeRefField &= 0b1111; - tmData->dataField.versionTimeReferenceField = (TM_PUS_VERSION_NUMBER << 4) | timeRefField; + tmData->dataField.versionTimeReferenceField = + (pus::PusVersion::PUS_C_VERSION << 4) | timeRefField; tmData->dataField.serviceType = service; tmData->dataField.serviceSubtype = subservice; tmData->dataField.subcounterMsb = packetSubcounter << 8 & 0xff; From d2371b3e715055e62f6713e4bb457cc7cd25f8c8 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 5 Oct 2021 13:17:12 +0200 Subject: [PATCH 343/389] removed unneeded static constexpr --- src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h index 5e48445e..fe373c6f 100644 --- a/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketPusC.h @@ -54,9 +54,6 @@ public: sizeof(PUSTmDataFieldHeaderPusC) + 2); //! Maximum size of a TM Packet in this mission. static const uint32_t MISSION_TM_PACKET_MAX_SIZE = fsfwconfig::FSFW_MAX_TM_PACKET_SIZE; - //! First four bits of first byte of secondary header. Set to 2 according - //! to ECSS-E-ST-70-41C p.439 - static constexpr uint8_t TM_PUS_VERSION_NUMBER = 2; /** * This is the default constructor. From fc9101cd8f8e926ea41e87849cfc4a20dee3b226 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 17:12:42 +0200 Subject: [PATCH 344/389] deleted unrequired files, common include deleted --- .../unit/testcfg/devices/logicalAddresses.h | 1 - .../unit/testcfg/events/translateEvents.cpp | 15 --------------- .../unit/testcfg/events/translateEvents.h | 8 -------- .../unit/testcfg/objects/translateObjects.cpp | 19 ------------------- .../unit/testcfg/objects/translateObjects.h | 8 -------- 5 files changed, 51 deletions(-) delete mode 100644 tests/src/fsfw_tests/unit/testcfg/events/translateEvents.cpp delete mode 100644 tests/src/fsfw_tests/unit/testcfg/events/translateEvents.h delete mode 100644 tests/src/fsfw_tests/unit/testcfg/objects/translateObjects.cpp delete mode 100644 tests/src/fsfw_tests/unit/testcfg/objects/translateObjects.h diff --git a/tests/src/fsfw_tests/unit/testcfg/devices/logicalAddresses.h b/tests/src/fsfw_tests/unit/testcfg/devices/logicalAddresses.h index a0240037..d7b73e15 100644 --- a/tests/src/fsfw_tests/unit/testcfg/devices/logicalAddresses.h +++ b/tests/src/fsfw_tests/unit/testcfg/devices/logicalAddresses.h @@ -2,7 +2,6 @@ #define CONFIG_DEVICES_LOGICALADDRESSES_H_ #include -#include "common/devices/commonAddresses.h" #include diff --git a/tests/src/fsfw_tests/unit/testcfg/events/translateEvents.cpp b/tests/src/fsfw_tests/unit/testcfg/events/translateEvents.cpp deleted file mode 100644 index 47186727..00000000 --- a/tests/src/fsfw_tests/unit/testcfg/events/translateEvents.cpp +++ /dev/null @@ -1,15 +0,0 @@ -/** - * @brief Auto-generated event translation file. Contains 81 translations. - * @details - * Generated on: 2021-05-18 16:28:16 - */ -#include "translateEvents.h" - - -const char * translateEvents(Event event) { - switch( (event & 0xffff) ) { - default: - return "UNKNOWN_EVENT"; - } - return 0; -} diff --git a/tests/src/fsfw_tests/unit/testcfg/events/translateEvents.h b/tests/src/fsfw_tests/unit/testcfg/events/translateEvents.h deleted file mode 100644 index 9034dcf2..00000000 --- a/tests/src/fsfw_tests/unit/testcfg/events/translateEvents.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_ -#define FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_ - -#include - -const char * translateEvents(Event event); - -#endif /* FSFWCONFIG_EVENTS_TRANSLATEEVENTS_H_ */ diff --git a/tests/src/fsfw_tests/unit/testcfg/objects/translateObjects.cpp b/tests/src/fsfw_tests/unit/testcfg/objects/translateObjects.cpp deleted file mode 100644 index 63636ced..00000000 --- a/tests/src/fsfw_tests/unit/testcfg/objects/translateObjects.cpp +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @brief Auto-generated object translation file. - * @details - * Contains 69 translations. - * Generated on: 2021-05-18 16:37:37 - */ -#include "translateObjects.h" - -const char *NO_OBJECT_STRING = "NO_OBJECT"; - -const char* translateObject(object_id_t object) { - switch( (object & 0xFFFFFFFF) ) { - case 0xFFFFFFFF: - return NO_OBJECT_STRING; - default: - return "UNKNOWN_OBJECT"; - } - return 0; -} diff --git a/tests/src/fsfw_tests/unit/testcfg/objects/translateObjects.h b/tests/src/fsfw_tests/unit/testcfg/objects/translateObjects.h deleted file mode 100644 index dbf5b468..00000000 --- a/tests/src/fsfw_tests/unit/testcfg/objects/translateObjects.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_ -#define FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_ - -#include - -const char* translateObject(object_id_t object); - -#endif /* FSFWCONFIG_OBJECTS_TRANSLATEOBJECTS_H_ */ From b2b648c4aa1f1f3cd50f23a61d01979c861b64ad Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 17:14:30 +0200 Subject: [PATCH 345/389] removed obsolete comment --- tests/src/fsfw_tests/unit/testcfg/CMakeLists.txt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/src/fsfw_tests/unit/testcfg/CMakeLists.txt b/tests/src/fsfw_tests/unit/testcfg/CMakeLists.txt index 531972ac..f840e38b 100644 --- a/tests/src/fsfw_tests/unit/testcfg/CMakeLists.txt +++ b/tests/src/fsfw_tests/unit/testcfg/CMakeLists.txt @@ -8,11 +8,6 @@ target_include_directories(${FSFW_TEST_TGT} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ) -# These translation files are actually not that relevant for the tests. However, the FSFW tests -# compile against a user-configured variant of the FSFW, which might be configured to include -# translation information. Therefore, empty dummy translation files are compiled here -# so the tests compile in any case. - # If a special translation file for object IDs exists, compile it. if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp") target_sources(${FSFW_TEST_TGT} PRIVATE From e8927d6aa888b78aa7db68daa277eb693913c74a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 17:22:29 +0200 Subject: [PATCH 346/389] moved testtemplate and removed user folder --- .../unit}/testtemplate/TestTemplate.cpp | 5 +- tests/user/CMakeLists.txt | 261 ------------------ tests/user/lcov.sh | 3 - 3 files changed, 2 insertions(+), 267 deletions(-) rename tests/{user => src/fsfw_tests/unit}/testtemplate/TestTemplate.cpp (90%) delete mode 100644 tests/user/CMakeLists.txt delete mode 100644 tests/user/lcov.sh diff --git a/tests/user/testtemplate/TestTemplate.cpp b/tests/src/fsfw_tests/unit/testtemplate/TestTemplate.cpp similarity index 90% rename from tests/user/testtemplate/TestTemplate.cpp rename to tests/src/fsfw_tests/unit/testtemplate/TestTemplate.cpp index 6b5fc3d2..a779d80c 100644 --- a/tests/user/testtemplate/TestTemplate.cpp +++ b/tests/src/fsfw_tests/unit/testtemplate/TestTemplate.cpp @@ -1,6 +1,5 @@ -#include -#include - +#include "fsfw_tests/unit/CatchDefinitions.h" +#include /** * @brief Template test file diff --git a/tests/user/CMakeLists.txt b/tests/user/CMakeLists.txt deleted file mode 100644 index 2e1fdee3..00000000 --- a/tests/user/CMakeLists.txt +++ /dev/null @@ -1,261 +0,0 @@ -################################################################################ -# CMake support for the Flight Software Framework Tests -# Author: R. Mueller -################################################################################ - -################################################################################ -# Pre-Project preparation -################################################################################ -cmake_minimum_required(VERSION 3.13) - -# set(CMAKE_VERBOSE TRUE) -# set(CODE_COVERAGE_VERBOSE TRUE) - -set(CMAKE_SCRIPT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") - -option(TMTC_TEST "Build binary for manual or automatic TMTC tests" FALSE) -option(GENERATE_COVERAGE - "Specify whether coverage data is generated with GCOV" - TRUE -) - -set(FSFW_ADD_UNITTESTS ON) - -if(TMTC_TEST) - set(LINK_CATCH2 FALSE) -else() - set(LINK_CATCH2 TRUE) -endif() - -# Tests can be built with the Host OSAL or with the Linux OSAL. -if(NOT FSFW_OSAL) - set(FSFW_OSAL host CACHE STRING "OS for the FSFW.") -endif() - -option(FSFW_CUSTOM_UNITTEST_RUNNER - "Specify whether custom main or Catch2 main is used" TRUE -) - -# Project Name -project(fsfw-tests C CXX) - -################################################################################ -# Pre-Sources preparation -################################################################################ - -# Specify the C++ standard -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED True) - -# Set names and variables -set(TARGET_NAME ${CMAKE_PROJECT_NAME}) -if(FSFW_CUSTOM_UNITTEST_RUNNER) - set(CATCH2_TARGET Catch2) -else() - set(CATCH2_TARGET Catch2WithMain) -endif() -set(LIB_FSFW_NAME fsfw) - -# Set path names -set(FSFW_PATH fsfw) -set(CATCH2_PATH Catch2) -set(FSFW_TESTS_PATH fsfw/unittest) -set(TEST_SETUP_PATH unittest) -set(TMTC_TEST_PATH tests) - -# Analyse different OS and architecture/target options and -# determine BSP_PATH - -# FreeRTOS -if(FSFW_OSAL STREQUAL linux) - add_definitions(-DUNIX -DLINUX) - find_package(Threads REQUIRED) -# Hosted -else() - if(WIN32) - add_definitions(-DWIN32) - elseif(UNIX) - find_package(Threads REQUIRED) - add_definitions(-DUNIX -DLINUX) - endif() -endif() - -if(GENERATE_COVERAGE) - list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/cmake-modules) - if(CMAKE_COMPILER_IS_GNUCXX) - include(CodeCoverage) - # Add compile options on target base, we don't want coverage for Catch2 - # append_coverage_compiler_flags() - endif() -endif() - -set(FSFW_CONFIG_PATH testcfg) -set(FSFW_ADDITIONAL_INC_PATHS ${CMAKE_CURRENT_BINARY_DIR}) - -configure_file(${FSFW_CONFIG_PATH}/FSFWConfig.h.in FSFWConfig.h) -configure_file(${FSFW_CONFIG_PATH}/OBSWConfig.h.in OBSWConfig.h) -configure_file(${FSFW_CONFIG_PATH}/TestsConfig.h.in TestsConfig.h) - -################################################################################ -# Executable and Sources -################################################################################ - -# Add executable -add_executable(${TARGET_NAME}) - -# Add subdirectories -add_subdirectory(${FSFW_PATH}) -add_subdirectory(${FSFW_CONFIG_PATH}) - -if(LINK_CATCH2) - add_subdirectory(${CATCH2_PATH}) - add_subdirectory(${TEST_SETUP_PATH}) -else() - target_compile_definitions(${TARGET_NAME} PRIVATE - FSFW_DISABLE_PRINTOUT=0 - ) - target_compile_definitions(${LIB_FSFW_NAME} PRIVATE - FSFW_DISABLE_PRINTOUT=0 - ) - add_subdirectory(${TMTC_TEST_PATH}) - add_subdirectory(${FSFW_TESTS_PATH}) -endif() - - -################################################################################ -# Post-Sources preparation -################################################################################ - -# Add libraries for all sources. -target_link_libraries(${TARGET_NAME} PRIVATE - ${LIB_FSFW_NAME} -) - -if(LINK_CATCH2) - target_link_libraries(${TARGET_NAME} PRIVATE - ${CATCH2_TARGET} - ) -endif() - -if(GENERATE_COVERAGE) - if(CMAKE_COMPILER_IS_GNUCXX) - # set(CODE_COVERAGE_VERBOSE TRUE) - include(CodeCoverage) - - # Remove quotes. - separate_arguments(COVERAGE_COMPILER_FLAGS - NATIVE_COMMAND "${COVERAGE_COMPILER_FLAGS}" - ) - - # Add compile options manually, we don't want coverage for Catch2 - target_compile_options(${TARGET_NAME} PRIVATE - "${COVERAGE_COMPILER_FLAGS}" - ) - target_compile_options(${LIB_FSFW_NAME} PRIVATE - "${COVERAGE_COMPILER_FLAGS}" - ) - - # Exclude internal unittest from coverage for now. - if(WIN32) - set(GCOVR_ADDITIONAL_ARGS - "--exclude-throw-branches" - "--exclude-unreachable-branches" - ) - set(COVERAGE_EXCLUDES - "/c/msys64/mingw64/*" "Catch2" - "${CMAKE_CURRENT_SOURCE_DIR}/fsfw/unittest/internal" - ) - elseif(UNIX) - set(COVERAGE_EXCLUDES - "/usr/include/*" "/usr/bin/*" "Catch2/*" - "fsfw/unittest/internal/*" - ) - endif() - - target_link_options(${TARGET_NAME} PRIVATE - -fprofile-arcs - -ftest-coverage - ) - target_link_options(${LIB_FSFW_NAME} PRIVATE - -fprofile-arcs - -ftest-coverage - ) - - if(WIN32) - setup_target_for_coverage_gcovr_html( - NAME ${TARGET_NAME}_coverage - EXECUTABLE ${TARGET_NAME} - DEPENDENCIES ${TARGET_NAME} - ) - else() - setup_target_for_coverage_lcov( - NAME ${TARGET_NAME}_coverage - EXECUTABLE ${TARGET_NAME} - DEPENDENCIES ${TARGET_NAME} - ) - endif() - endif() -endif() - -# Add include paths for all sources. -target_include_directories(${TARGET_NAME} PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR} - ${FSFW_CONFIG_PATH} - ${CMAKE_CURRENT_BINARY_DIR} -) - -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set(WARNING_FLAGS - -Wall - -Wextra - -Wshadow=local - -Wimplicit-fallthrough=1 - -Wno-unused-parameter - -Wno-psabi - ) - - # Remove unused sections. - target_compile_options(${TARGET_NAME} PRIVATE - "-ffunction-sections" - "-fdata-sections" - ) - - # Removed unused sections. - target_link_options(${TARGET_NAME} PRIVATE - "-Wl,--gc-sections" - ) - -elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") - set(COMPILER_FLAGS "/permissive-") -endif() - -if(CMAKE_VERBOSE) - message(STATUS "Warning flags: ${WARNING_FLAGS}") -endif() - -# Compile options for all sources. -target_compile_options(${TARGET_NAME} PRIVATE - ${WARNING_FLAGS} -) - -if(NOT CMAKE_SIZE) - set(CMAKE_SIZE size) - if(WIN32) - set(FILE_SUFFIX ".exe") - endif() -endif() - -string(CONCAT POST_BUILD_COMMENT - "Build directory: ${CMAKE_BINARY_DIR}\n" - "Target OSAL: ${FSFW_OSAL}\n" - "Target Build Type: ${CMAKE_BUILD_TYPE}" -) - -add_custom_command(TARGET ${TARGET_NAME} - POST_BUILD - COMMAND ${CMAKE_SIZE} ${TARGET_NAME}${FILE_SUFFIX} - COMMENT ${POST_BUILD_COMMENT} -) - -include (${CMAKE_SCRIPT_PATH}/BuildType.cmake) -set_build_type() diff --git a/tests/user/lcov.sh b/tests/user/lcov.sh deleted file mode 100644 index 4db16e5f..00000000 --- a/tests/user/lcov.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -lcov --capture --directory . --output-file coverage.info -genhtml coverage.info --output-directory _coverage From 348975ba5f80bb95383c9d7618b172cc0e99a827 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 17:28:07 +0200 Subject: [PATCH 347/389] additional coverage excludes --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index e0a0bfb0..0f45de01 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -194,6 +194,8 @@ if(FSFW_BUILD_UNITTESTS) elseif(UNIX) set(COVERAGE_EXCLUDES "/usr/include/*" "/usr/bin/*" "Catch2/*" + "/usr/local/include/*" "*/fsfw_tests/*" + "/catch2-src/*" ) endif() From 060b3a3b2c4814e04a3122a4fff124850fecccc0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 17:51:13 +0200 Subject: [PATCH 348/389] added missing leading * --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f45de01..923d5cc5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -195,7 +195,7 @@ if(FSFW_BUILD_UNITTESTS) set(COVERAGE_EXCLUDES "/usr/include/*" "/usr/bin/*" "Catch2/*" "/usr/local/include/*" "*/fsfw_tests/*" - "/catch2-src/*" + "*/catch2-src/*" ) endif() From c46bde417e7b56b39bab50a1faa2688b3e65eff4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 19:37:23 +0200 Subject: [PATCH 349/389] small bugfix for LIS3 handler --- hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp b/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp index 804e83f2..1a61bfe2 100644 --- a/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp +++ b/hal/src/fsfw_hal/devicehandlers/MgmLIS3MDLHandler.cpp @@ -73,7 +73,7 @@ ReturnValue_t MgmLIS3MDLHandler::buildTransitionDeviceCommand( switch (internalState) { case(InternalState::STATE_NONE): case(InternalState::STATE_NORMAL): { - return HasReturnvaluesIF::RETURN_OK; + return DeviceHandlerBase::NOTHING_TO_SEND; } case(InternalState::STATE_FIRST_CONTACT): { *id = MGMLIS3MDL::IDENTIFY_DEVICE; From 2180c47f4fc40786af594c2df7d30492edb5c87e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 19:47:41 +0200 Subject: [PATCH 350/389] more printouts for rejected packet --- src/fsfw/tcdistribution/PUSDistributor.cpp | 27 ++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/fsfw/tcdistribution/PUSDistributor.cpp b/src/fsfw/tcdistribution/PUSDistributor.cpp index eec02429..1a5f713d 100644 --- a/src/fsfw/tcdistribution/PUSDistributor.cpp +++ b/src/fsfw/tcdistribution/PUSDistributor.cpp @@ -29,12 +29,31 @@ PUSDistributor::TcMqMapIter PUSDistributor::selectDestination() { tcStatus = checker.checkPacket(currentPacket); if(tcStatus != HasReturnvaluesIF::RETURN_OK) { #if FSFW_VERBOSE_LEVEL >= 1 + std::string keyword; + if(tcStatus == TcPacketCheck::INCORRECT_CHECKSUM) { + keyword = "checksum"; + } + else if(tcStatus == TcPacketCheck::INCORRECT_PRIMARY_HEADER) { + keyword = "incorrect primary header"; + } + else if(tcStatus == TcPacketCheck::ILLEGAL_APID) { + keyword = "illegal APID"; + } + else if(tcStatus == TcPacketCheck::INCORRECT_SECONDARY_HEADER) { + keyword = "incorrect secondary header"; + } + else if(tcStatus == TcPacketCheck::INCOMPLETE_PACKET) { + keyword = "incomplete packet"; + } + else { + keyword = "unnamed error"; + } #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::debug << "PUSDistributor::handlePacket: Packet format invalid, code " << - static_cast(tcStatus) << std::endl; + sif::warning << "PUSDistributor::handlePacket: Packet format invalid, " + << keyword << " error" << std::endl; #else - sif::printDebug("PUSDistributor::handlePacket: Packet format invalid, code %d\n", - static_cast(tcStatus)); + sif::printWarning("PUSDistributor::handlePacket: Packet format invalid, " + "%s error\n", keyword); #endif #endif } From cae3feb5da403405c241690220b316ef17d1892f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 11 Oct 2021 19:55:37 +0200 Subject: [PATCH 351/389] Add feature to open GPIO by line name This features was provided by Jakob Meier as part of https://egit.irs.uni-stuttgart.de/eive/fsfw/pulls/19 . It adds the feature to open GPIOs supplying their line names. --- .../fsfw_hal/common/gpio/gpioDefinitions.h | 54 +++- .../fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp | 242 ++++++++++++------ hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h | 37 ++- 3 files changed, 235 insertions(+), 98 deletions(-) diff --git a/hal/src/fsfw_hal/common/gpio/gpioDefinitions.h b/hal/src/fsfw_hal/common/gpio/gpioDefinitions.h index 688d9c9b..c6f21195 100644 --- a/hal/src/fsfw_hal/common/gpio/gpioDefinitions.h +++ b/hal/src/fsfw_hal/common/gpio/gpioDefinitions.h @@ -9,12 +9,13 @@ using gpioId_t = uint16_t; namespace gpio { -enum Levels { +enum Levels: uint8_t { LOW = 0, - HIGH = 1 + HIGH = 1, + NONE = 99 }; -enum Direction { +enum Direction: uint8_t { IN = 0, OUT = 1 }; @@ -24,16 +25,18 @@ enum GpioOperation { WRITE }; -enum GpioTypes { +enum class GpioTypes { NONE, GPIO_REGULAR_BY_CHIP, GPIO_REGULAR_BY_LABEL, + GPIO_REGULAR_BY_LINE_NAME, CALLBACK }; static constexpr gpioId_t NO_GPIO = -1; -using gpio_cb_t = void (*) (gpioId_t gpioId, gpio::GpioOperation gpioOp, int value, void* args); +using gpio_cb_t = void (*) (gpioId_t gpioId, gpio::GpioOperation gpioOp, gpio::Levels value, + void* args); } @@ -57,7 +60,7 @@ public: GpioBase() = default; GpioBase(gpio::GpioTypes gpioType, std::string consumer, gpio::Direction direction, - int initValue): + gpio::Levels initValue): gpioType(gpioType), consumer(consumer),direction(direction), initValue(initValue) {} virtual~ GpioBase() {}; @@ -66,15 +69,21 @@ public: gpio::GpioTypes gpioType = gpio::GpioTypes::NONE; std::string consumer; gpio::Direction direction = gpio::Direction::IN; - int initValue = 0; + gpio::Levels initValue = gpio::Levels::NONE; }; class GpiodRegularBase: public GpioBase { public: GpiodRegularBase(gpio::GpioTypes gpioType, std::string consumer, gpio::Direction direction, - int initValue, int lineNum): GpioBase(gpioType, consumer, direction, initValue), - lineNum(lineNum) { + gpio::Levels initValue, int lineNum): + GpioBase(gpioType, consumer, direction, initValue), lineNum(lineNum) { } + + // line number will be configured at a later point for the open by line name configuration + GpiodRegularBase(gpio::GpioTypes gpioType, std::string consumer, gpio::Direction direction, + gpio::Levels initValue): GpioBase(gpioType, consumer, direction, initValue) { + } + int lineNum = 0; struct gpiod_line* lineHandle = nullptr; }; @@ -87,7 +96,7 @@ public: } GpiodRegularByChip(std::string chipname_, int lineNum_, std::string consumer_, - gpio::Direction direction_, int initValue_) : + gpio::Direction direction_, gpio::Levels initValue_) : GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_CHIP, consumer_, direction_, initValue_, lineNum_), chipname(chipname_){ @@ -105,7 +114,7 @@ public: class GpiodRegularByLabel: public GpiodRegularBase { public: GpiodRegularByLabel(std::string label_, int lineNum_, std::string consumer_, - gpio::Direction direction_, int initValue_) : + gpio::Direction direction_, gpio::Levels initValue_) : GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_LABEL, consumer_, direction_, initValue_, lineNum_), label(label_) { @@ -120,9 +129,30 @@ public: std::string label; }; +/** + * @brief Passing this GPIO configuration to the GPIO IF object will try to open the GPIO by its + * line name. This line name can be set in the device tree and must be unique. Otherwise + * the driver will open the first line with the given name. + */ +class GpiodRegularByLineName: public GpiodRegularBase { +public: + GpiodRegularByLineName(std::string lineName_, std::string consumer_, gpio::Direction direction_, + gpio::Levels initValue_) : + GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_LINE_NAME, consumer_, direction_, + initValue_), lineName(lineName_) { + } + + GpiodRegularByLineName(std::string lineName_, std::string consumer_) : + GpiodRegularBase(gpio::GpioTypes::GPIO_REGULAR_BY_LINE_NAME, consumer_, + gpio::Direction::IN, gpio::LOW), lineName(lineName_) { + } + + std::string lineName; +}; + class GpioCallback: public GpioBase { public: - GpioCallback(std::string consumer, gpio::Direction direction_, int initValue_, + GpioCallback(std::string consumer, gpio::Direction direction_, gpio::Levels initValue_, gpio::gpio_cb_t callback, void* callbackArgs): GpioBase(gpio::GpioTypes::CALLBACK, consumer, direction_, initValue_), callback(callback), callbackArgs(callbackArgs) {} diff --git a/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp b/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp index 15c3d118..020ba964 100644 --- a/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp +++ b/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.cpp @@ -1,8 +1,9 @@ -#include "fsfw_hal/linux/gpio/LinuxLibgpioIF.h" +#include "LinuxLibgpioIF.h" + #include "fsfw_hal/common/gpio/gpioDefinitions.h" #include "fsfw_hal/common/gpio/GpioCookie.h" -#include +#include "fsfw/serviceinterface/ServiceInterface.h" #include #include @@ -66,6 +67,14 @@ ReturnValue_t LinuxLibgpioIF::configureGpios(GpioMap& mapToAdd) { configureGpioByLabel(gpioConfig.first, *regularGpio); break; } + case(gpio::GpioTypes::GPIO_REGULAR_BY_LINE_NAME):{ + auto regularGpio = dynamic_cast(gpioConfig.second); + if(regularGpio == nullptr) { + return GPIO_INVALID_INSTANCE; + } + configureGpioByLineName(gpioConfig.first, *regularGpio); + break; + } case(gpio::GpioTypes::CALLBACK): { auto gpioCallback = dynamic_cast(gpioConfig.second); if(gpioCallback->callback == nullptr) { @@ -84,13 +93,13 @@ ReturnValue_t LinuxLibgpioIF::configureGpioByLabel(gpioId_t gpioId, std::string& label = gpioByLabel.label; struct gpiod_chip* chip = gpiod_chip_open_by_label(label.c_str()); if (chip == nullptr) { - sif::warning << "LinuxLibgpioIF::configureRegularGpio: Failed to open gpio from gpio " + sif::warning << "LinuxLibgpioIF::configureGpioByLabel: Failed to open gpio from gpio " << "group with label " << label << ". Gpio ID: " << gpioId << std::endl; return RETURN_FAILED; } std::string failOutput = "label: " + label; - return configureRegularGpio(gpioId, gpioByLabel.gpioType, chip, gpioByLabel, failOutput); + return configureRegularGpio(gpioId, chip, gpioByLabel, failOutput); } ReturnValue_t LinuxLibgpioIF::configureGpioByChip(gpioId_t gpioId, @@ -98,16 +107,41 @@ ReturnValue_t LinuxLibgpioIF::configureGpioByChip(gpioId_t gpioId, std::string& chipname = gpioByChip.chipname; struct gpiod_chip* chip = gpiod_chip_open_by_name(chipname.c_str()); if (chip == nullptr) { - sif::warning << "LinuxLibgpioIF::configureRegularGpio: Failed to open chip " + sif::warning << "LinuxLibgpioIF::configureGpioByChip: Failed to open chip " << chipname << ". Gpio ID: " << gpioId << std::endl; return RETURN_FAILED; } std::string failOutput = "chipname: " + chipname; - return configureRegularGpio(gpioId, gpioByChip.gpioType, chip, gpioByChip, failOutput); + return configureRegularGpio(gpioId, chip, gpioByChip, failOutput); } -ReturnValue_t LinuxLibgpioIF::configureRegularGpio(gpioId_t gpioId, gpio::GpioTypes gpioType, - struct gpiod_chip* chip, GpiodRegularBase& regularGpio, std::string failOutput) { +ReturnValue_t LinuxLibgpioIF::configureGpioByLineName(gpioId_t gpioId, + GpiodRegularByLineName &gpioByLineName) { + std::string& lineName = gpioByLineName.lineName; + char chipname[MAX_CHIPNAME_LENGTH]; + unsigned int lineOffset; + + int result = gpiod_ctxless_find_line(lineName.c_str(), chipname, MAX_CHIPNAME_LENGTH, + &lineOffset); + if (result != LINE_FOUND) { + parseFindeLineResult(result, lineName); + return RETURN_FAILED; + } + + gpioByLineName.lineNum = static_cast(lineOffset); + + struct gpiod_chip* chip = gpiod_chip_open_by_name(chipname); + if (chip == nullptr) { + sif::warning << "LinuxLibgpioIF::configureGpioByLineName: Failed to open chip " + << chipname << ". second->gpioType; - if(gpioType == gpio::GpioTypes::GPIO_REGULAR_BY_CHIP or - gpioType == gpio::GpioTypes::GPIO_REGULAR_BY_LABEL) { + if (gpioType == gpio::GpioTypes::GPIO_REGULAR_BY_CHIP + or gpioType == gpio::GpioTypes::GPIO_REGULAR_BY_LABEL + or gpioType == gpio::GpioTypes::GPIO_REGULAR_BY_LINE_NAME) { auto regularGpio = dynamic_cast(gpioMapIter->second); if(regularGpio == nullptr) { return GPIO_TYPE_FAILURE; @@ -187,7 +222,7 @@ ReturnValue_t LinuxLibgpioIF::pullHigh(gpioId_t gpioId) { return GPIO_INVALID_INSTANCE; } gpioCallback->callback(gpioMapIter->first, gpio::GpioOperation::WRITE, - 1, gpioCallback->callbackArgs); + gpio::Levels::HIGH, gpioCallback->callbackArgs); return RETURN_OK; } return GPIO_TYPE_FAILURE; @@ -196,13 +231,18 @@ ReturnValue_t LinuxLibgpioIF::pullHigh(gpioId_t gpioId) { ReturnValue_t LinuxLibgpioIF::pullLow(gpioId_t gpioId) { gpioMapIter = gpioMap.find(gpioId); if (gpioMapIter == gpioMap.end()) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 sif::warning << "LinuxLibgpioIF::pullLow: Unknown GPIO ID " << gpioId << std::endl; +#else + sif::printWarning("LinuxLibgpioIF::pullLow: Unknown GPIO ID %d\n", gpioId); +#endif return UNKNOWN_GPIO_ID; } auto& gpioType = gpioMapIter->second->gpioType; - if(gpioType == gpio::GpioTypes::GPIO_REGULAR_BY_CHIP or - gpioType == gpio::GpioTypes::GPIO_REGULAR_BY_LABEL) { + if (gpioType == gpio::GpioTypes::GPIO_REGULAR_BY_CHIP + or gpioType == gpio::GpioTypes::GPIO_REGULAR_BY_LABEL + or gpioType == gpio::GpioTypes::GPIO_REGULAR_BY_LINE_NAME) { auto regularGpio = dynamic_cast(gpioMapIter->second); if(regularGpio == nullptr) { return GPIO_TYPE_FAILURE; @@ -215,7 +255,7 @@ ReturnValue_t LinuxLibgpioIF::pullLow(gpioId_t gpioId) { return GPIO_INVALID_INSTANCE; } gpioCallback->callback(gpioMapIter->first, gpio::GpioOperation::WRITE, - 0, gpioCallback->callbackArgs); + gpio::Levels::LOW, gpioCallback->callbackArgs); return RETURN_OK; } return GPIO_TYPE_FAILURE; @@ -225,8 +265,13 @@ ReturnValue_t LinuxLibgpioIF::driveGpio(gpioId_t gpioId, GpiodRegularBase& regularGpio, gpio::Levels logicLevel) { int result = gpiod_line_set_value(regularGpio.lineHandle, logicLevel); if (result < 0) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 sif::warning << "LinuxLibgpioIF::driveGpio: Failed to pull GPIO with ID " << gpioId << " to logic level " << logicLevel << std::endl; +#else + sif::printWarning("LinuxLibgpioIF::driveGpio: Failed to pull GPIO with ID %d to " + "logic level %d\n", gpioId, logicLevel); +#endif return DRIVE_GPIO_FAILURE; } @@ -236,12 +281,18 @@ ReturnValue_t LinuxLibgpioIF::driveGpio(gpioId_t gpioId, ReturnValue_t LinuxLibgpioIF::readGpio(gpioId_t gpioId, int* gpioState) { gpioMapIter = gpioMap.find(gpioId); if (gpioMapIter == gpioMap.end()){ +#if FSFW_CPP_OSTREAM_ENABLED == 1 sif::warning << "LinuxLibgpioIF::readGpio: Unknown GPIOD ID " << gpioId << std::endl; +#else + sif::printWarning("LinuxLibgpioIF::readGpio: Unknown GPIOD ID %d\n", gpioId); +#endif return UNKNOWN_GPIO_ID; } + auto gpioType = gpioMapIter->second->gpioType; - if(gpioType == gpio::GpioTypes::GPIO_REGULAR_BY_CHIP or - gpioType == gpio::GpioTypes::GPIO_REGULAR_BY_LABEL) { + if (gpioType == gpio::GpioTypes::GPIO_REGULAR_BY_CHIP + or gpioType == gpio::GpioTypes::GPIO_REGULAR_BY_LABEL + or gpioType == gpio::GpioTypes::GPIO_REGULAR_BY_LINE_NAME) { auto regularGpio = dynamic_cast(gpioMapIter->second); if(regularGpio == nullptr) { return GPIO_TYPE_FAILURE; @@ -249,10 +300,14 @@ ReturnValue_t LinuxLibgpioIF::readGpio(gpioId_t gpioId, int* gpioState) { *gpioState = gpiod_line_get_value(regularGpio->lineHandle); } else { - + auto gpioCallback = dynamic_cast(gpioMapIter->second); + if(gpioCallback->callback == nullptr) { + return GPIO_INVALID_INSTANCE; + } + gpioCallback->callback(gpioMapIter->first, gpio::GpioOperation::READ, + gpio::Levels::NONE, gpioCallback->callbackArgs); + return RETURN_OK; } - - return RETURN_OK; } @@ -262,13 +317,14 @@ ReturnValue_t LinuxLibgpioIF::checkForConflicts(GpioMap& mapToAdd){ for(auto& gpioConfig: mapToAdd) { switch(gpioConfig.second->gpioType) { case(gpio::GpioTypes::GPIO_REGULAR_BY_CHIP): - case(gpio::GpioTypes::GPIO_REGULAR_BY_LABEL): { + case(gpio::GpioTypes::GPIO_REGULAR_BY_LABEL): + case(gpio::GpioTypes::GPIO_REGULAR_BY_LINE_NAME): { auto regularGpio = dynamic_cast(gpioConfig.second); if(regularGpio == nullptr) { return GPIO_TYPE_FAILURE; } - /* Check for conflicts and remove duplicates if necessary */ - result = checkForConflictsRegularGpio(gpioConfig.first, *regularGpio, mapToAdd); + // Check for conflicts and remove duplicates if necessary + result = checkForConflictsById(gpioConfig.first, gpioConfig.second->gpioType, mapToAdd); if(result != HasReturnvaluesIF::RETURN_OK) { status = result; } @@ -279,66 +335,108 @@ ReturnValue_t LinuxLibgpioIF::checkForConflicts(GpioMap& mapToAdd){ if(callbackGpio == nullptr) { return GPIO_TYPE_FAILURE; } - /* Check for conflicts and remove duplicates if necessary */ - result = checkForConflictsCallbackGpio(gpioConfig.first, callbackGpio, mapToAdd); + // Check for conflicts and remove duplicates if necessary + result = checkForConflictsById(gpioConfig.first, + gpioConfig.second->gpioType, mapToAdd); if(result != HasReturnvaluesIF::RETURN_OK) { status = result; } break; } default: { - +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "Invalid GPIO type detected for GPIO ID " << gpioConfig.first + << std::endl; +#else + sif::printWarning("Invalid GPIO type detected for GPIO ID %d\n", gpioConfig.first); +#endif + status = GPIO_TYPE_FAILURE; } } } return status; } - -ReturnValue_t LinuxLibgpioIF::checkForConflictsRegularGpio(gpioId_t gpioIdToCheck, - GpiodRegularBase& gpioToCheck, GpioMap& mapToAdd) { - /* Cross check with private map */ +ReturnValue_t LinuxLibgpioIF::checkForConflictsById(gpioId_t gpioIdToCheck, + gpio::GpioTypes expectedType, GpioMap& mapToAdd) { + // Cross check with private map gpioMapIter = gpioMap.find(gpioIdToCheck); if(gpioMapIter != gpioMap.end()) { auto& gpioType = gpioMapIter->second->gpioType; - if(gpioType != gpio::GpioTypes::GPIO_REGULAR_BY_CHIP and - gpioType != gpio::GpioTypes::GPIO_REGULAR_BY_LABEL) { - sif::warning << "LinuxLibgpioIF::checkForConflicts: ID already exists for different " - "GPIO type" << gpioIdToCheck << ". Removing duplicate." << std::endl; - mapToAdd.erase(gpioIdToCheck); - return HasReturnvaluesIF::RETURN_OK; + bool eraseDuplicateDifferentType = false; + switch(expectedType) { + case(gpio::GpioTypes::NONE): { + break; } - auto ownRegularGpio = dynamic_cast(gpioMapIter->second); - if(ownRegularGpio == nullptr) { - return GPIO_TYPE_FAILURE; + case(gpio::GpioTypes::GPIO_REGULAR_BY_CHIP): + case(gpio::GpioTypes::GPIO_REGULAR_BY_LABEL): + case(gpio::GpioTypes::GPIO_REGULAR_BY_LINE_NAME): { + if(gpioType == gpio::GpioTypes::NONE or gpioType == gpio::GpioTypes::CALLBACK) { + eraseDuplicateDifferentType = true; + } + break; + } + case(gpio::GpioTypes::CALLBACK): { + if(gpioType != gpio::GpioTypes::CALLBACK) { + eraseDuplicateDifferentType = true; + } + } + } + if(eraseDuplicateDifferentType) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "LinuxLibgpioIF::checkForConflicts: ID already exists for " + "different GPIO type " << gpioIdToCheck << + ". Removing duplicate from map to add" << std::endl; +#else + sif::printWarning("LinuxLibgpioIF::checkForConflicts: ID already exists for " + "different GPIO type %d. Removing duplicate from map to add\n", gpioIdToCheck); +#endif + mapToAdd.erase(gpioIdToCheck); + return GPIO_DUPLICATE_DETECTED; } - /* Remove element from map to add because a entry for this GPIO - already exists */ - sif::warning << "LinuxLibgpioIF::checkForConflictsRegularGpio: Duplicate GPIO definition" - << " detected. Duplicate will be removed from map to add." << std::endl; + // Remove element from map to add because a entry for this GPIO already exists +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "LinuxLibgpioIF::checkForConflictsRegularGpio: Duplicate GPIO " + "definition with ID " << gpioIdToCheck << " detected. " << + "Duplicate will be removed from map to add" << std::endl; +#else + sif::printWarning("LinuxLibgpioIF::checkForConflictsRegularGpio: Duplicate GPIO definition " + "with ID %d detected. Duplicate will be removed from map to add\n", gpioIdToCheck); +#endif mapToAdd.erase(gpioIdToCheck); + return GPIO_DUPLICATE_DETECTED; } return HasReturnvaluesIF::RETURN_OK; } -ReturnValue_t LinuxLibgpioIF::checkForConflictsCallbackGpio(gpioId_t gpioIdToCheck, - GpioCallback *callbackGpio, GpioMap& mapToAdd) { - /* Cross check with private map */ - gpioMapIter = gpioMap.find(gpioIdToCheck); - if(gpioMapIter != gpioMap.end()) { - if(gpioMapIter->second->gpioType != gpio::GpioTypes::CALLBACK) { - sif::warning << "LinuxLibgpioIF::checkForConflicts: ID already exists for different " - "GPIO type" << gpioIdToCheck << ". Removing duplicate." << std::endl; - mapToAdd.erase(gpioIdToCheck); - return HasReturnvaluesIF::RETURN_OK; - } - - /* Remove element from map to add because a entry for this GPIO - already exists */ - sif::warning << "LinuxLibgpioIF::checkForConflictsRegularGpio: Duplicate GPIO definition" - << " detected. Duplicate will be removed from map to add." << std::endl; - mapToAdd.erase(gpioIdToCheck); +void LinuxLibgpioIF::parseFindeLineResult(int result, std::string& lineName) { + switch (result) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + case LINE_NOT_EXISTS: + case LINE_ERROR: { + sif::warning << "LinuxLibgpioIF::parseFindeLineResult: Line with name " << lineName << + " does not exist" << std::endl; + break; } - return HasReturnvaluesIF::RETURN_OK; + default: { + sif::warning << "LinuxLibgpioIF::parseFindeLineResult: Unknown return code for line " + "with name " << lineName << std::endl; + break; + } +#else + case LINE_NOT_EXISTS: + case LINE_ERROR: { + sif::printWarning("LinuxLibgpioIF::parseFindeLineResult: Line with name %s " + "does not exist\n", lineName); + break; + } + default: { + sif::printWarning("LinuxLibgpioIF::parseFindeLineResult: Unknown return code for line " + "with name %s\n", lineName); + break; + } +#endif + } + } diff --git a/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h b/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h index 31e4a7e8..cc32bd70 100644 --- a/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h +++ b/hal/src/fsfw_hal/linux/gpio/LinuxLibgpioIF.h @@ -1,19 +1,19 @@ #ifndef LINUX_GPIO_LINUXLIBGPIOIF_H_ #define LINUX_GPIO_LINUXLIBGPIOIF_H_ -#include "../../common/gpio/GpioIF.h" -#include -#include +#include "fsfw/returnvalues/FwClassIds.h" +#include "fsfw_hal/common/gpio/GpioIF.h" +#include "fsfw/objectmanager/SystemObject.h" class GpioCookie; class GpiodRegularIF; /** - * @brief This class implements the GpioIF for a linux based system. The - * implementation is based on the libgpiod lib which requires linux 4.8 - * or higher. - * @note The Petalinux SDK from Xilinx supports libgpiod since Petalinux - * 2019.1. + * @brief This class implements the GpioIF for a linux based system. + * @details + * This implementation is based on the libgpiod lib which requires Linux 4.8 or higher. + * @note + * The Petalinux SDK from Xilinx supports libgpiod since Petalinux 2019.1. */ class LinuxLibgpioIF : public GpioIF, public SystemObject { public: @@ -28,6 +28,8 @@ public: HasReturnvaluesIF::makeReturnCode(gpioRetvalId, 3); static constexpr ReturnValue_t GPIO_INVALID_INSTANCE = HasReturnvaluesIF::makeReturnCode(gpioRetvalId, 4); + static constexpr ReturnValue_t GPIO_DUPLICATE_DETECTED = + HasReturnvaluesIF::makeReturnCode(gpioRetvalId, 5); LinuxLibgpioIF(object_id_t objectId); virtual ~LinuxLibgpioIF(); @@ -38,7 +40,13 @@ public: ReturnValue_t readGpio(gpioId_t gpioId, int* gpioState) override; private: - /* Holds the information and configuration of all used GPIOs */ + + static const size_t MAX_CHIPNAME_LENGTH = 11; + static const int LINE_NOT_EXISTS = 0; + static const int LINE_ERROR = -1; + static const int LINE_FOUND = 1; + + // Holds the information and configuration of all used GPIOs GpioUnorderedMap gpioMap; GpioUnorderedMapIter gpioMapIter; @@ -53,8 +61,10 @@ private: ReturnValue_t configureGpioByLabel(gpioId_t gpioId, GpiodRegularByLabel& gpioByLabel); ReturnValue_t configureGpioByChip(gpioId_t gpioId, GpiodRegularByChip& gpioByChip); - ReturnValue_t configureRegularGpio(gpioId_t gpioId, gpio::GpioTypes gpioType, - struct gpiod_chip* chip, GpiodRegularBase& regularGpio, std::string failOutput); + ReturnValue_t configureGpioByLineName(gpioId_t gpioId, + GpiodRegularByLineName &gpioByLineName); + ReturnValue_t configureRegularGpio(gpioId_t gpioId, struct gpiod_chip* chip, + GpiodRegularBase& regularGpio, std::string failOutput); /** * @brief This function checks if GPIOs are already registered and whether @@ -67,16 +77,15 @@ private: */ ReturnValue_t checkForConflicts(GpioMap& mapToAdd); - ReturnValue_t checkForConflictsRegularGpio(gpioId_t gpiodId, GpiodRegularBase& regularGpio, + ReturnValue_t checkForConflictsById(gpioId_t gpiodId, gpio::GpioTypes type, GpioMap& mapToAdd); - ReturnValue_t checkForConflictsCallbackGpio(gpioId_t gpiodId, GpioCallback* regularGpio, - GpioMap& mapToAdd); /** * @brief Performs the initial configuration of all GPIOs specified in the GpioMap mapToAdd. */ ReturnValue_t configureGpios(GpioMap& mapToAdd); + void parseFindeLineResult(int result, std::string& lineName); }; #endif /* LINUX_GPIO_LINUXLIBGPIOIF_H_ */ From 113c992f999681bc973dd4b5ac867dd737b27db4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 17 Oct 2021 22:56:00 +0200 Subject: [PATCH 352/389] use char* instead --- src/fsfw/tcdistribution/PUSDistributor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsfw/tcdistribution/PUSDistributor.cpp b/src/fsfw/tcdistribution/PUSDistributor.cpp index 1a5f713d..284a14c9 100644 --- a/src/fsfw/tcdistribution/PUSDistributor.cpp +++ b/src/fsfw/tcdistribution/PUSDistributor.cpp @@ -29,7 +29,7 @@ PUSDistributor::TcMqMapIter PUSDistributor::selectDestination() { tcStatus = checker.checkPacket(currentPacket); if(tcStatus != HasReturnvaluesIF::RETURN_OK) { #if FSFW_VERBOSE_LEVEL >= 1 - std::string keyword; + const char* keyword = nullptr; if(tcStatus == TcPacketCheck::INCORRECT_CHECKSUM) { keyword = "checksum"; } From 6e97bd4db4a51db75c6b5f4fc8998dcc3a731191 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Sun, 17 Oct 2021 23:27:31 +0200 Subject: [PATCH 353/389] added integration test code --- tests/src/fsfw_tests/CMakeLists.txt | 1 + .../src/fsfw_tests/integration/CMakeLists.txt | 4 + .../integration/assemblies/CMakeLists.txt | 3 + .../integration/assemblies/TestAssembly.cpp | 201 +++++ .../integration/assemblies/TestAssembly.h | 56 ++ .../integration/controller/CMakeLists.txt | 3 + .../integration/controller/TestController.cpp | 214 +++++ .../integration/controller/TestController.h | 50 ++ .../ctrldefinitions/testCtrlDefinitions.h | 18 + .../integration/devices/CMakeLists.txt | 5 + .../integration/devices/TestCookie.cpp | 14 + .../integration/devices/TestCookie.h | 22 + .../integration/devices/TestDeviceHandler.cpp | 804 ++++++++++++++++++ .../integration/devices/TestDeviceHandler.h | 142 ++++ .../integration/devices/TestEchoComIF.cpp | 86 ++ .../integration/devices/TestEchoComIF.h | 56 ++ .../devicedefinitions/testDeviceDefinitions.h | 100 +++ .../integration/task/CMakeLists.txt | 3 + .../fsfw_tests/integration/task/TestTask.cpp | 80 ++ .../fsfw_tests/integration/task/TestTask.h | 56 ++ 20 files changed, 1918 insertions(+) create mode 100644 tests/src/fsfw_tests/integration/CMakeLists.txt create mode 100644 tests/src/fsfw_tests/integration/assemblies/CMakeLists.txt create mode 100644 tests/src/fsfw_tests/integration/assemblies/TestAssembly.cpp create mode 100644 tests/src/fsfw_tests/integration/assemblies/TestAssembly.h create mode 100644 tests/src/fsfw_tests/integration/controller/CMakeLists.txt create mode 100644 tests/src/fsfw_tests/integration/controller/TestController.cpp create mode 100644 tests/src/fsfw_tests/integration/controller/TestController.h create mode 100644 tests/src/fsfw_tests/integration/controller/ctrldefinitions/testCtrlDefinitions.h create mode 100644 tests/src/fsfw_tests/integration/devices/CMakeLists.txt create mode 100644 tests/src/fsfw_tests/integration/devices/TestCookie.cpp create mode 100644 tests/src/fsfw_tests/integration/devices/TestCookie.h create mode 100644 tests/src/fsfw_tests/integration/devices/TestDeviceHandler.cpp create mode 100644 tests/src/fsfw_tests/integration/devices/TestDeviceHandler.h create mode 100644 tests/src/fsfw_tests/integration/devices/TestEchoComIF.cpp create mode 100644 tests/src/fsfw_tests/integration/devices/TestEchoComIF.h create mode 100644 tests/src/fsfw_tests/integration/devices/devicedefinitions/testDeviceDefinitions.h create mode 100644 tests/src/fsfw_tests/integration/task/CMakeLists.txt create mode 100644 tests/src/fsfw_tests/integration/task/TestTask.cpp create mode 100644 tests/src/fsfw_tests/integration/task/TestTask.h diff --git a/tests/src/fsfw_tests/CMakeLists.txt b/tests/src/fsfw_tests/CMakeLists.txt index e4a6be80..a06bf3fe 100644 --- a/tests/src/fsfw_tests/CMakeLists.txt +++ b/tests/src/fsfw_tests/CMakeLists.txt @@ -1,3 +1,4 @@ +add_subdirectory(integration) if(FSFW_ADD_INTERNAL_TESTS) add_subdirectory(internal) diff --git a/tests/src/fsfw_tests/integration/CMakeLists.txt b/tests/src/fsfw_tests/integration/CMakeLists.txt new file mode 100644 index 00000000..e44fbee7 --- /dev/null +++ b/tests/src/fsfw_tests/integration/CMakeLists.txt @@ -0,0 +1,4 @@ +add_subdirectory(assemblies) +add_subdirectory(controller) +add_subdirectory(devices) +add_subdirectory(task) diff --git a/tests/src/fsfw_tests/integration/assemblies/CMakeLists.txt b/tests/src/fsfw_tests/integration/assemblies/CMakeLists.txt new file mode 100644 index 00000000..22c06600 --- /dev/null +++ b/tests/src/fsfw_tests/integration/assemblies/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${LIB_FSFW_NAME} PRIVATE + TestAssembly.cpp +) \ No newline at end of file diff --git a/tests/src/fsfw_tests/integration/assemblies/TestAssembly.cpp b/tests/src/fsfw_tests/integration/assemblies/TestAssembly.cpp new file mode 100644 index 00000000..1c497ebd --- /dev/null +++ b/tests/src/fsfw_tests/integration/assemblies/TestAssembly.cpp @@ -0,0 +1,201 @@ +#include "TestAssembly.h" + +#include + + +TestAssembly::TestAssembly(object_id_t objectId, object_id_t parentId, object_id_t testDevice0, + object_id_t testDevice1): + AssemblyBase(objectId, parentId), deviceHandler0Id(testDevice0), + deviceHandler1Id(testDevice1) { + ModeListEntry newModeListEntry; + newModeListEntry.setObject(testDevice0); + newModeListEntry.setMode(MODE_OFF); + newModeListEntry.setSubmode(SUBMODE_NONE); + + commandTable.insert(newModeListEntry); + + newModeListEntry.setObject(testDevice1); + newModeListEntry.setMode(MODE_OFF); + newModeListEntry.setSubmode(SUBMODE_NONE); + + commandTable.insert(newModeListEntry); + +} + +TestAssembly::~TestAssembly() { +} + +ReturnValue_t TestAssembly::commandChildren(Mode_t mode, + Submode_t submode) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TestAssembly: Received command to go to mode " << mode << + " submode " << (int) submode << std::endl; +#else + sif::printInfo("TestAssembly: Received command to go to mode %d submode %d\n", mode, submode); +#endif + ReturnValue_t result = RETURN_OK; + if(mode == MODE_OFF){ + commandTable[0].setMode(MODE_OFF); + commandTable[0].setSubmode(SUBMODE_NONE); + commandTable[1].setMode(MODE_OFF); + commandTable[1].setSubmode(SUBMODE_NONE); + } + else if(mode == DeviceHandlerIF::MODE_NORMAL) { + if(submode == submodes::SINGLE){ + commandTable[0].setMode(MODE_OFF); + commandTable[0].setSubmode(SUBMODE_NONE); + commandTable[1].setMode(MODE_OFF); + commandTable[1].setSubmode(SUBMODE_NONE); + // We try to prefer 0 here but we try to switch to 1 even if it might fail + if(isDeviceAvailable(deviceHandler0Id)) { + if (childrenMap[deviceHandler0Id].mode == MODE_ON) { + commandTable[0].setMode(mode); + commandTable[0].setSubmode(SUBMODE_NONE); + } + else { + commandTable[0].setMode(MODE_ON); + commandTable[0].setSubmode(SUBMODE_NONE); + result = NEED_SECOND_STEP; + } + } + else { + if (childrenMap[deviceHandler1Id].mode == MODE_ON) { + commandTable[1].setMode(mode); + commandTable[1].setSubmode(SUBMODE_NONE); + } + else{ + commandTable[1].setMode(MODE_ON); + commandTable[1].setSubmode(SUBMODE_NONE); + result = NEED_SECOND_STEP; + } + } + } + else{ + // Dual Mode Normal + if (childrenMap[deviceHandler0Id].mode == MODE_ON) { + commandTable[0].setMode(mode); + commandTable[0].setSubmode(SUBMODE_NONE); + } + else{ + commandTable[0].setMode(MODE_ON); + commandTable[0].setSubmode(SUBMODE_NONE); + result = NEED_SECOND_STEP; + } + if (childrenMap[deviceHandler1Id].mode == MODE_ON) { + commandTable[1].setMode(mode); + commandTable[1].setSubmode(SUBMODE_NONE); + } + else{ + commandTable[1].setMode(MODE_ON); + commandTable[1].setSubmode(SUBMODE_NONE); + result = NEED_SECOND_STEP; + } + } + } + else{ + //Mode ON + if(submode == submodes::SINGLE){ + commandTable[0].setMode(MODE_OFF); + commandTable[0].setSubmode(SUBMODE_NONE); + commandTable[1].setMode(MODE_OFF); + commandTable[1].setSubmode(SUBMODE_NONE); + // We try to prefer 0 here but we try to switch to 1 even if it might fail + if(isDeviceAvailable(deviceHandler0Id)){ + commandTable[0].setMode(MODE_ON); + commandTable[0].setSubmode(SUBMODE_NONE); + } + else{ + commandTable[1].setMode(MODE_ON); + commandTable[1].setSubmode(SUBMODE_NONE); + } + } + else{ + commandTable[0].setMode(MODE_ON); + commandTable[0].setSubmode(SUBMODE_NONE); + commandTable[1].setMode(MODE_ON); + commandTable[1].setSubmode(SUBMODE_NONE); + } + } + + + + HybridIterator iter(commandTable.begin(), + commandTable.end()); + executeTable(iter); + return result; +} + +ReturnValue_t TestAssembly::isModeCombinationValid(Mode_t mode, + Submode_t submode) { + switch (mode) { + case MODE_OFF: + if (submode == SUBMODE_NONE) { + return RETURN_OK; + } else { + return INVALID_SUBMODE; + } + case DeviceHandlerIF::MODE_NORMAL: + case MODE_ON: + if (submode < 3) { + return RETURN_OK; + } else { + return INVALID_SUBMODE; + } + } + return INVALID_MODE; +} + +ReturnValue_t TestAssembly::initialize() { + ReturnValue_t result = AssemblyBase::initialize(); + if(result != RETURN_OK){ + return result; + } + handler0 = ObjectManager::instance()->get(deviceHandler0Id); + handler1 = ObjectManager::instance()->get(deviceHandler1Id); + if((handler0 == nullptr) or (handler1 == nullptr)){ + return HasReturnvaluesIF::RETURN_FAILED; + } + + handler0->setParentQueue(this->getCommandQueue()); + handler1->setParentQueue(this->getCommandQueue()); + + + result = registerChild(objects::TEST_DEVICE_HANDLER_0); + if (result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + result = registerChild(objects::TEST_DEVICE_HANDLER_1); + if (result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + return result; +} + +ReturnValue_t TestAssembly::checkChildrenStateOn( + Mode_t wantedMode, Submode_t wantedSubmode) { + if(submode == submodes::DUAL){ + for(const auto& info:childrenMap) { + if(info.second.mode != wantedMode or info.second.mode != wantedSubmode){ + return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE; + } + } + return RETURN_OK; + } + else if(submode == submodes::SINGLE) { + for(const auto& info:childrenMap) { + if(info.second.mode == wantedMode and info.second.mode != wantedSubmode){ + return RETURN_OK; + } + } + } + return INVALID_SUBMODE; +} + +bool TestAssembly::isDeviceAvailable(object_id_t object) { + if(healthHelper.healthTable->getHealth(object) == HasHealthIF::HEALTHY){ + return true; + } + else{ + return false; + } +} diff --git a/tests/src/fsfw_tests/integration/assemblies/TestAssembly.h b/tests/src/fsfw_tests/integration/assemblies/TestAssembly.h new file mode 100644 index 00000000..3cc6f450 --- /dev/null +++ b/tests/src/fsfw_tests/integration/assemblies/TestAssembly.h @@ -0,0 +1,56 @@ +#ifndef MISSION_ASSEMBLIES_TESTASSEMBLY_H_ +#define MISSION_ASSEMBLIES_TESTASSEMBLY_H_ + +#include +#include "../devices/TestDeviceHandler.h" + +class TestAssembly: public AssemblyBase { +public: + TestAssembly(object_id_t objectId, object_id_t parentId, object_id_t testDevice0, + object_id_t testDevice1); + virtual ~TestAssembly(); + ReturnValue_t initialize() override; + + enum submodes: Submode_t{ + SINGLE = 0, + DUAL = 1 + }; + +protected: + /** + * Command children to reach [mode,submode] combination + * Can be done by setting #commandsOutstanding correctly, + * or using executeTable() + * @param mode + * @param submode + * @return + * - @c RETURN_OK if ok + * - @c NEED_SECOND_STEP if children need to be commanded again + */ + ReturnValue_t commandChildren(Mode_t mode, Submode_t submode) override; + /** + * Check whether desired assembly mode was achieved by checking the modes + * or/and health states of child device handlers. + * The assembly template class will also call this function if a health + * or mode change of a child device handler was detected. + * @param wantedMode + * @param wantedSubmode + * @return + */ + ReturnValue_t isModeCombinationValid(Mode_t mode, Submode_t submode) + override; + + ReturnValue_t checkChildrenStateOn(Mode_t wantedMode, + Submode_t wantedSubmode) override; +private: + FixedArrayList commandTable; + object_id_t deviceHandler0Id = 0; + object_id_t deviceHandler1Id = 0; + TestDevice* handler0 = nullptr; + TestDevice* handler1 = nullptr; + + + bool isDeviceAvailable(object_id_t object); +}; + +#endif /* MISSION_ASSEMBLIES_TESTASSEMBLY_H_ */ diff --git a/tests/src/fsfw_tests/integration/controller/CMakeLists.txt b/tests/src/fsfw_tests/integration/controller/CMakeLists.txt new file mode 100644 index 00000000..f5655b71 --- /dev/null +++ b/tests/src/fsfw_tests/integration/controller/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${LIB_FSFW_NAME} PRIVATE + TestController.cpp +) \ No newline at end of file diff --git a/tests/src/fsfw_tests/integration/controller/TestController.cpp b/tests/src/fsfw_tests/integration/controller/TestController.cpp new file mode 100644 index 00000000..385d07bd --- /dev/null +++ b/tests/src/fsfw_tests/integration/controller/TestController.cpp @@ -0,0 +1,214 @@ +#include "TestController.h" +#include "OBSWConfig.h" + +#include +#include +#include + +TestController::TestController(object_id_t objectId, size_t commandQueueDepth): + ExtendedControllerBase(objectId, objects::NO_OBJECT, commandQueueDepth), + deviceDataset0(objects::TEST_DEVICE_HANDLER_0), + deviceDataset1(objects::TEST_DEVICE_HANDLER_1) { +} + +TestController::~TestController() { +} + +ReturnValue_t TestController::handleCommandMessage(CommandMessage *message) { + return HasReturnvaluesIF::RETURN_OK; +} + +void TestController::performControlOperation() { + /* We will trace vaiables if we received an update notification or snapshots */ +#if OBSW_CONTROLLER_PRINTOUT == 1 + if(not traceVariable) { + return; + } + + switch(currentTraceType) { + case(NONE): { + break; + } + case(TRACE_DEV_0_UINT8): { + if(traceCounter == 0) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "Tracing finished" << std::endl; +#else + sif::printInfo("Tracing finished\n"); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ + traceVariable = false; + traceCounter = traceCycles; + currentTraceType = TraceTypes::NONE; + break; + } + + PoolReadGuard readHelper(&deviceDataset0.testUint8Var); +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "Tracing device 0 variable 0 (UINT8), current value: " << + static_cast(deviceDataset0.testUint8Var.value) << std::endl; +#else + sif::printInfo("Tracing device 0 variable 0 (UINT8), current value: %d\n", + deviceDataset0.testUint8Var.value); +#endif + traceCounter--; + break; + } + case(TRACE_DEV_0_VECTOR): { + break; + } + + } +#endif /* OBSW_CONTROLLER_PRINTOUT == 1 */ +} + +void TestController::handleChangedDataset(sid_t sid, store_address_t storeId, bool* clearMessage) { + using namespace std; + +#if OBSW_CONTROLLER_PRINTOUT == 1 + char const* printout = nullptr; + if(storeId == storeId::INVALID_STORE_ADDRESS) { + printout = "Notification"; + } + else { + printout = "Snapshot"; + } +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TestController::handleChangedDataset: " << printout << " update from object " + "ID " << setw(8) << setfill('0') << hex << sid.objectId << + " and set ID " << sid.ownerSetId << dec << setfill(' ') << endl; +#else + sif::printInfo("TestController::handleChangedPoolVariable: %s update from object ID 0x%08x and " + "set ID %lu\n", printout, sid.objectId, sid.ownerSetId); +#endif + + if (storeId == storeId::INVALID_STORE_ADDRESS) { + if(sid.objectId == objects::TEST_DEVICE_HANDLER_0) { + PoolReadGuard readHelper(&deviceDataset0.testFloat3Vec); + float floatVec[3]; + floatVec[0] = deviceDataset0.testFloat3Vec.value[0]; + floatVec[1] = deviceDataset0.testFloat3Vec.value[1]; + floatVec[2] = deviceDataset0.testFloat3Vec.value[2]; +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "Current float vector (3) values: [" << floatVec[0] << ", " << + floatVec[1] << ", " << floatVec[2] << "]" << std::endl; +#else + sif::printInfo("Current float vector (3) values: [%f, %f, %f]\n", + floatVec[0], floatVec[1], floatVec[2]); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ + } + } +#endif /* OBSW_CONTROLLER_PRINTOUT == 1 */ + + /* We will trace the variables for snapshots and update notifications */ + if(not traceVariable) { + traceVariable = true; + traceCounter = traceCycles; + currentTraceType = TraceTypes::TRACE_DEV_0_VECTOR; + } +} + +void TestController::handleChangedPoolVariable(gp_id_t globPoolId, store_address_t storeId, + bool* clearMessage) { + using namespace std; + +#if OBSW_CONTROLLER_PRINTOUT == 1 + char const* printout = nullptr; + if (storeId == storeId::INVALID_STORE_ADDRESS) { + printout = "Notification"; + } + else { + printout = "Snapshot"; + } + +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TestController::handleChangedPoolVariable: " << printout << " update from object " + "ID 0x" << setw(8) << setfill('0') << hex << globPoolId.objectId << + " and local pool ID " << globPoolId.localPoolId << dec << setfill(' ') << endl; +#else + sif::printInfo("TestController::handleChangedPoolVariable: %s update from object ID 0x%08x and " + "local pool ID %lu\n", printout, globPoolId.objectId, globPoolId.localPoolId); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ + + if (storeId == storeId::INVALID_STORE_ADDRESS) { + if(globPoolId.objectId == objects::TEST_DEVICE_HANDLER_0) { + PoolReadGuard readHelper(&deviceDataset0.testUint8Var); +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "Current test variable 0 (UINT8) value: " << static_cast( + deviceDataset0.testUint8Var.value) << std::endl; +#else + sif::printInfo("Current test variable 0 (UINT8) value %d\n", + deviceDataset0.testUint8Var.value); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ + } + } +#endif /* OBSW_CONTROLLER_PRINTOUT == 1 */ + + /* We will trace the variables for snapshots and update notifications */ + if(not traceVariable) { + traceVariable = true; + traceCounter = traceCycles; + currentTraceType = TraceTypes::TRACE_DEV_0_UINT8; + } +} + +LocalPoolDataSetBase* TestController::getDataSetHandle(sid_t sid) { + return nullptr; +} + +ReturnValue_t TestController::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, + LocalDataPoolManager &poolManager) { + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t TestController::initializeAfterTaskCreation() { + namespace td = testdevice; + HasLocalDataPoolIF* device0 = ObjectManager::instance()->get( + objects::TEST_DEVICE_HANDLER_0); + if(device0 == nullptr) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "TestController::initializeAfterTaskCreation: Test device handler 0 " + "handle invalid!" << std::endl; +#else + sif::printWarning("TestController::initializeAfterTaskCreation: Test device handler 0 " + "handle invalid!"); +#endif + return ObjectManagerIF::CHILD_INIT_FAILED; + } + ProvidesDataPoolSubscriptionIF* subscriptionIF = device0->getSubscriptionInterface(); + if(subscriptionIF != nullptr) { + /* For DEVICE_0, we only subscribe for notifications */ + subscriptionIF->subscribeForSetUpdateMessage(td::TEST_SET_ID, getObjectId(), + getCommandQueue(), false); + subscriptionIF->subscribeForVariableUpdateMessage(td::PoolIds::TEST_UINT8_ID, + getObjectId(), getCommandQueue(), false); + } + + + HasLocalDataPoolIF* device1 = ObjectManager::instance()->get( + objects::TEST_DEVICE_HANDLER_1); + if(device1 == nullptr) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "TestController::initializeAfterTaskCreation: Test device handler 1 " + "handle invalid!" << std::endl; +#else + sif::printWarning("TestController::initializeAfterTaskCreation: Test device handler 1 " + "handle invalid!"); +#endif + } + + subscriptionIF = device1->getSubscriptionInterface(); + if(subscriptionIF != nullptr) { + /* For DEVICE_1, we will subscribe for snapshots */ + subscriptionIF->subscribeForSetUpdateMessage(td::TEST_SET_ID, getObjectId(), + getCommandQueue(), true); + subscriptionIF->subscribeForVariableUpdateMessage(td::PoolIds::TEST_UINT8_ID, + getObjectId(), getCommandQueue(), true); + } + return HasReturnvaluesIF::RETURN_OK; +} + +ReturnValue_t TestController::checkModeCommand(Mode_t mode, Submode_t submode, + uint32_t *msToReachTheMode) { + return HasReturnvaluesIF::RETURN_OK; +} + diff --git a/tests/src/fsfw_tests/integration/controller/TestController.h b/tests/src/fsfw_tests/integration/controller/TestController.h new file mode 100644 index 00000000..8092f945 --- /dev/null +++ b/tests/src/fsfw_tests/integration/controller/TestController.h @@ -0,0 +1,50 @@ +#ifndef MISSION_CONTROLLER_TESTCONTROLLER_H_ +#define MISSION_CONTROLLER_TESTCONTROLLER_H_ + +#include "../devices/devicedefinitions/testDeviceDefinitions.h" +#include + + +class TestController: + public ExtendedControllerBase { +public: + TestController(object_id_t objectId, size_t commandQueueDepth = 10); + virtual~ TestController(); +protected: + testdevice::TestDataSet deviceDataset0; + testdevice::TestDataSet deviceDataset1; + + /* Extended Controller Base overrides */ + ReturnValue_t handleCommandMessage(CommandMessage *message) override; + void performControlOperation() override; + + /* HasLocalDatapoolIF callbacks */ + void handleChangedDataset(sid_t sid, store_address_t storeId, bool* clearMessage) override; + void handleChangedPoolVariable(gp_id_t globPoolId, store_address_t storeId, + bool* clearMessage) override; + + LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override; + ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, + LocalDataPoolManager& poolManager) override; + + ReturnValue_t checkModeCommand(Mode_t mode, Submode_t submode, + uint32_t *msToReachTheMode) override; + + ReturnValue_t initializeAfterTaskCreation() override; + +private: + + bool traceVariable = false; + uint8_t traceCycles = 5; + uint8_t traceCounter = traceCycles; + + enum TraceTypes { + NONE, + TRACE_DEV_0_UINT8, + TRACE_DEV_0_VECTOR + }; + TraceTypes currentTraceType = TraceTypes::NONE; +}; + + +#endif /* MISSION_CONTROLLER_TESTCONTROLLER_H_ */ diff --git a/tests/src/fsfw_tests/integration/controller/ctrldefinitions/testCtrlDefinitions.h b/tests/src/fsfw_tests/integration/controller/ctrldefinitions/testCtrlDefinitions.h new file mode 100644 index 00000000..7bf045df --- /dev/null +++ b/tests/src/fsfw_tests/integration/controller/ctrldefinitions/testCtrlDefinitions.h @@ -0,0 +1,18 @@ +#ifndef MISSION_CONTROLLER_CTRLDEFINITIONS_TESTCTRLDEFINITIONS_H_ +#define MISSION_CONTROLLER_CTRLDEFINITIONS_TESTCTRLDEFINITIONS_H_ + +#include +#include + +namespace testcontroller { + +enum sourceObjectIds: object_id_t { + DEVICE_0_ID = objects::TEST_DEVICE_HANDLER_0, + DEVICE_1_ID = objects::TEST_DEVICE_HANDLER_1, +}; + +} + + + +#endif /* MISSION_CONTROLLER_CTRLDEFINITIONS_TESTCTRLDEFINITIONS_H_ */ diff --git a/tests/src/fsfw_tests/integration/devices/CMakeLists.txt b/tests/src/fsfw_tests/integration/devices/CMakeLists.txt new file mode 100644 index 00000000..cfd238d2 --- /dev/null +++ b/tests/src/fsfw_tests/integration/devices/CMakeLists.txt @@ -0,0 +1,5 @@ +target_sources(${LIB_FSFW_NAME} PRIVATE + TestCookie.cpp + TestDeviceHandler.cpp + TestEchoComIF.cpp +) diff --git a/tests/src/fsfw_tests/integration/devices/TestCookie.cpp b/tests/src/fsfw_tests/integration/devices/TestCookie.cpp new file mode 100644 index 00000000..91098f80 --- /dev/null +++ b/tests/src/fsfw_tests/integration/devices/TestCookie.cpp @@ -0,0 +1,14 @@ +#include "TestCookie.h" + +TestCookie::TestCookie(address_t address, size_t replyMaxLen): + address(address), replyMaxLen(replyMaxLen) {} + +TestCookie::~TestCookie() {} + +address_t TestCookie::getAddress() const { + return address; +} + +size_t TestCookie::getReplyMaxLen() const { + return replyMaxLen; +} diff --git a/tests/src/fsfw_tests/integration/devices/TestCookie.h b/tests/src/fsfw_tests/integration/devices/TestCookie.h new file mode 100644 index 00000000..5dac3f25 --- /dev/null +++ b/tests/src/fsfw_tests/integration/devices/TestCookie.h @@ -0,0 +1,22 @@ +#ifndef MISSION_DEVICES_TESTCOOKIE_H_ +#define MISSION_DEVICES_TESTCOOKIE_H_ + +#include +#include + +/** + * @brief Really simple cookie which does not do a lot. + */ +class TestCookie: public CookieIF { +public: + TestCookie(address_t address, size_t maxReplyLen); + virtual ~TestCookie(); + + address_t getAddress() const; + size_t getReplyMaxLen() const; +private: + address_t address = 0; + size_t replyMaxLen = 0; +}; + +#endif /* MISSION_DEVICES_TESTCOOKIE_H_ */ diff --git a/tests/src/fsfw_tests/integration/devices/TestDeviceHandler.cpp b/tests/src/fsfw_tests/integration/devices/TestDeviceHandler.cpp new file mode 100644 index 00000000..91019487 --- /dev/null +++ b/tests/src/fsfw_tests/integration/devices/TestDeviceHandler.cpp @@ -0,0 +1,804 @@ +#include "TestDeviceHandler.h" +#include "FSFWConfig.h" + +#include "fsfw/datapool/PoolReadGuard.h" + +#include + +TestDevice::TestDevice(object_id_t objectId, object_id_t comIF, + CookieIF * cookie, testdevice::DeviceIndex deviceIdx, bool fullInfoPrintout, + bool changingDataset): + DeviceHandlerBase(objectId, comIF, cookie), deviceIdx(deviceIdx), + dataset(this), fullInfoPrintout(fullInfoPrintout) { +} + +TestDevice::~TestDevice() {} + +void TestDevice::performOperationHook() { + if(periodicPrintout) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TestDevice" << deviceIdx << "::performOperationHook: Alive!" << std::endl; +#else + sif::printInfo("TestDevice%d::performOperationHook: Alive!", deviceIdx); +#endif + } + + if(oneShot) { + oneShot = false; + } +} + + +void TestDevice::doStartUp() { + if(fullInfoPrintout) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TestDevice" << deviceIdx << "::doStartUp: Switching On" << std::endl; +#else + sif::printInfo("TestDevice%d::doStartUp: Switching On\n", static_cast(deviceIdx)); +#endif + } + + setMode(_MODE_TO_ON); + return; +} + + +void TestDevice::doShutDown() { + if(fullInfoPrintout) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TestDevice" << deviceIdx << "::doShutDown: Switching Off" << std::endl; +#else + sif::printInfo("TestDevice%d::doShutDown: Switching Off\n", static_cast(deviceIdx)); +#endif + } + + setMode(_MODE_SHUT_DOWN); + return; +} + + +ReturnValue_t TestDevice::buildNormalDeviceCommand(DeviceCommandId_t* id) { + using namespace testdevice; + *id = TEST_NORMAL_MODE_CMD; + if(DeviceHandlerBase::isAwaitingReply()) { + return NOTHING_TO_SEND; + } + return buildCommandFromCommand(*id, nullptr, 0); +} + +ReturnValue_t TestDevice::buildTransitionDeviceCommand(DeviceCommandId_t* id) { + if(mode == _MODE_TO_ON) { + if(fullInfoPrintout) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TestDevice" << deviceIdx << "::buildTransitionDeviceCommand: Was called" + " from _MODE_TO_ON mode" << std::endl; +#else + sif::printInfo("TestDevice%d::buildTransitionDeviceCommand: " + "Was called from _MODE_TO_ON mode\n", deviceIdx); +#endif + } + + } + if(mode == _MODE_TO_NORMAL) { + if(fullInfoPrintout) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TestDevice" << deviceIdx << "::buildTransitionDeviceCommand: Was called " + "from _MODE_TO_NORMAL mode" << std::endl; +#else + sif::printInfo("TestDevice%d::buildTransitionDeviceCommand: Was called from " + " _MODE_TO_NORMAL mode\n", deviceIdx); +#endif + } + + setMode(MODE_NORMAL); + } + if(mode == _MODE_SHUT_DOWN) { + if(fullInfoPrintout) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TestDevice" << deviceIdx << "::buildTransitionDeviceCommand: Was called " + "from _MODE_SHUT_DOWN mode" << std::endl; +#else + sif::printInfo("TestDevice%d::buildTransitionDeviceCommand: Was called from " + "_MODE_SHUT_DOWN mode\n", deviceIdx); +#endif + } + + setMode(MODE_OFF); + } + return NOTHING_TO_SEND; +} + +void TestDevice::doTransition(Mode_t modeFrom, Submode_t submodeFrom) { + if(mode == _MODE_TO_NORMAL) { + if(fullInfoPrintout) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TestDevice" << deviceIdx << "::doTransition: Custom transition to " + "normal mode" << std::endl; +#else + sif::printInfo("TestDevice%d::doTransition: Custom transition to normal mode\n", + deviceIdx); +#endif + } + + } + else { + DeviceHandlerBase::doTransition(modeFrom, submodeFrom); + } +} + +ReturnValue_t TestDevice::buildCommandFromCommand( + DeviceCommandId_t deviceCommand, const uint8_t* commandData, + size_t commandDataLen) { + using namespace testdevice; + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + switch(deviceCommand) { + case(TEST_NORMAL_MODE_CMD): { + commandSent = true; + result = buildNormalModeCommand(deviceCommand, commandData, commandDataLen); + break; + } + + case(TEST_COMMAND_0): { + commandSent = true; + result = buildTestCommand0(deviceCommand, commandData, commandDataLen); + break; + } + + case(TEST_COMMAND_1): { + commandSent = true; + result = buildTestCommand1(deviceCommand, commandData, commandDataLen); + break; + } + case(TEST_NOTIF_SNAPSHOT_VAR): { + if(changingDatasets) { + changingDatasets = false; + } + + PoolReadGuard readHelper(&dataset.testUint8Var); + if(deviceIdx == testdevice::DeviceIndex::DEVICE_0) { + /* This will trigger a variable notification to the demo controller */ + dataset.testUint8Var = 220; + dataset.testUint8Var.setValid(true); + } + else if(deviceIdx == testdevice::DeviceIndex::DEVICE_1) { + /* This will trigger a variable snapshot to the demo controller */ + dataset.testUint8Var = 30; + dataset.testUint8Var.setValid(true); + } + + break; + } + case(TEST_NOTIF_SNAPSHOT_SET): { + if(changingDatasets) { + changingDatasets = false; + } + + PoolReadGuard readHelper(&dataset.testFloat3Vec); + + if(deviceIdx == testdevice::DeviceIndex::DEVICE_0) { + /* This will trigger a variable notification to the demo controller */ + dataset.testFloat3Vec.value[0] = 60; + dataset.testFloat3Vec.value[1] = 70; + dataset.testFloat3Vec.value[2] = 55; + dataset.testFloat3Vec.setValid(true); + } + else if(deviceIdx == testdevice::DeviceIndex::DEVICE_1) { + /* This will trigger a variable notification to the demo controller */ + dataset.testFloat3Vec.value[0] = -60; + dataset.testFloat3Vec.value[1] = -70; + dataset.testFloat3Vec.value[2] = -55; + dataset.testFloat3Vec.setValid(true); + } + break; + } + default: + result = DeviceHandlerIF::COMMAND_NOT_SUPPORTED; + } + return result; +} + + +ReturnValue_t TestDevice::buildNormalModeCommand(DeviceCommandId_t deviceCommand, + const uint8_t* commandData, size_t commandDataLen) { + if(fullInfoPrintout) { +#if OBSW_VERBOSE_LEVEL >= 3 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TestDevice::buildTestCommand1: Building normal command" << std::endl; +#else + sif::printInfo("TestDevice::buildTestCommand1: Building command from TEST_COMMAND_1\n"); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* OBSW_VERBOSE_LEVEL >= 3 */ + } + + if(commandDataLen > MAX_BUFFER_SIZE - sizeof(DeviceCommandId_t)) { + return DeviceHandlerIF::INVALID_NUMBER_OR_LENGTH_OF_PARAMETERS; + } + /* The command is passed on in the command buffer as it is */ + passOnCommand(deviceCommand, commandData, commandDataLen); + return RETURN_OK; +} + +ReturnValue_t TestDevice::buildTestCommand0(DeviceCommandId_t deviceCommand, + const uint8_t* commandData, size_t commandDataLen) { + using namespace testdevice; + if(fullInfoPrintout) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TestDevice" << deviceIdx << "::buildTestCommand0: Executing simple command " + " with completion reply" << std::endl; +#else + sif::printInfo("TestDevice%d::buildTestCommand0: Executing simple command with " + "completion reply\n", deviceIdx); +#endif + } + + if(commandDataLen > MAX_BUFFER_SIZE - sizeof(DeviceCommandId_t)) { + return DeviceHandlerIF::INVALID_NUMBER_OR_LENGTH_OF_PARAMETERS; + } + + /* The command is passed on in the command buffer as it is */ + passOnCommand(deviceCommand, commandData, commandDataLen); + return RETURN_OK; +} + +ReturnValue_t TestDevice::buildTestCommand1(DeviceCommandId_t deviceCommand, + const uint8_t* commandData, + size_t commandDataLen) { + using namespace testdevice; + if(commandDataLen < 7) { + return DeviceHandlerIF::INVALID_NUMBER_OR_LENGTH_OF_PARAMETERS; + } + if(fullInfoPrintout) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TestDevice" << deviceIdx << "::buildTestCommand1: Executing command with " + "data reply" << std::endl; +#else + sif::printInfo("TestDevice%d:buildTestCommand1: Executing command with data reply\n", + deviceIdx); +#endif + } + + deviceCommand = EndianConverter::convertBigEndian(deviceCommand); + memcpy(commandBuffer, &deviceCommand, sizeof(deviceCommand)); + + /* Assign and check parameters */ + uint16_t parameter1 = 0; + size_t size = commandDataLen; + ReturnValue_t result = SerializeAdapter::deSerialize(¶meter1, + &commandData, &size, SerializeIF::Endianness::BIG); + if(result == HasReturnvaluesIF::RETURN_FAILED) { + return result; + } + + /* Parameter 1 needs to be correct */ + if(parameter1 != testdevice::COMMAND_1_PARAM1) { + return DeviceHandlerIF::INVALID_COMMAND_PARAMETER; + } + uint64_t parameter2 = 0; + result = SerializeAdapter::deSerialize(¶meter2, + &commandData, &size, SerializeIF::Endianness::BIG); + if(parameter2!= testdevice::COMMAND_1_PARAM2){ + return DeviceHandlerIF::INVALID_COMMAND_PARAMETER; + } + + /* Pass on the parameters to the Echo IF */ + commandBuffer[4] = (parameter1 & 0xFF00) >> 8; + commandBuffer[5] = (parameter1 & 0xFF); + parameter2 = EndianConverter::convertBigEndian(parameter2); + memcpy(commandBuffer + 6, ¶meter2, sizeof(parameter2)); + rawPacket = commandBuffer; + rawPacketLen = sizeof(deviceCommand) + sizeof(parameter1) + + sizeof(parameter2); + return RETURN_OK; +} + +void TestDevice::passOnCommand(DeviceCommandId_t command, const uint8_t *commandData, + size_t commandDataLen) { + DeviceCommandId_t deviceCommandBe = EndianConverter::convertBigEndian(command); + memcpy(commandBuffer, &deviceCommandBe, sizeof(deviceCommandBe)); + memcpy(commandBuffer + 4, commandData, commandDataLen); + rawPacket = commandBuffer; + rawPacketLen = sizeof(deviceCommandBe) + commandDataLen; +} + +void TestDevice::fillCommandAndReplyMap() { + namespace td = testdevice; + insertInCommandAndReplyMap(testdevice::TEST_NORMAL_MODE_CMD, 5, &dataset); + insertInCommandAndReplyMap(testdevice::TEST_COMMAND_0, 5); + insertInCommandAndReplyMap(testdevice::TEST_COMMAND_1, 5); + + /* No reply expected for these commands */ + insertInCommandMap(td::TEST_NOTIF_SNAPSHOT_SET); + insertInCommandMap(td::TEST_NOTIF_SNAPSHOT_VAR); +} + + +ReturnValue_t TestDevice::scanForReply(const uint8_t *start, size_t len, + DeviceCommandId_t *foundId, size_t *foundLen) { + using namespace testdevice; + + /* Unless a command was sent explicitely, we don't expect any replies and ignore this + the packet. On a real device, there might be replies which are sent without a previous + command. */ + if(not commandSent) { + return DeviceHandlerBase::IGNORE_FULL_PACKET; + } + else { + commandSent = false; + } + + if(len < sizeof(object_id_t)) { + return DeviceHandlerIF::LENGTH_MISSMATCH; + } + + size_t size = len; + ReturnValue_t result = SerializeAdapter::deSerialize(foundId, &start, &size, + SerializeIF::Endianness::BIG); + if (result != RETURN_OK) { + return result; + } + + DeviceCommandId_t pendingCmd = this->getPendingCommand(); + + switch(pendingCmd) { + + case(TEST_NORMAL_MODE_CMD): { + if(fullInfoPrintout) { +#if OBSW_VERBOSE_LEVEL >= 3 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TestDevice::scanForReply: Reply for normal commnand (ID " << + TEST_NORMAL_MODE_CMD << ") received!" << std::endl; +#else + sif::printInfo("TestDevice%d::scanForReply: Reply for normal command (ID %d) " + "received!\n", deviceIdx, TEST_NORMAL_MODE_CMD); +#endif +#endif + } + + *foundLen = len; + *foundId = pendingCmd; + return RETURN_OK; + } + + case(TEST_COMMAND_0): { + if(len < TEST_COMMAND_0_SIZE) { + return DeviceHandlerIF::LENGTH_MISSMATCH; + } + if(fullInfoPrintout) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TestDevice" << deviceIdx << "::scanForReply: Reply for simple command " + "(ID " << TEST_COMMAND_0 << ") received!" << std::endl; +#else + sif::printInfo("TestDevice%d::scanForReply: Reply for simple command (ID %d) " + "received!\n", deviceIdx, TEST_COMMAND_0); +#endif + } + + *foundLen = TEST_COMMAND_0_SIZE; + *foundId = pendingCmd; + return RETURN_OK; + } + + case(TEST_COMMAND_1): { + if(fullInfoPrintout) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TestDevice" << deviceIdx << "::scanForReply: Reply for data command " + "(ID " << TEST_COMMAND_1 << ") received!" << std::endl; +#else + sif::printInfo("TestDevice%d::scanForReply: Reply for data command (ID %d) " + "received\n", deviceIdx, TEST_COMMAND_1); +#endif + } + + *foundLen = len; + *foundId = pendingCmd; + return RETURN_OK; + } + + default: + return DeviceHandlerIF::DEVICE_REPLY_INVALID; + } +} + + +ReturnValue_t TestDevice::interpretDeviceReply(DeviceCommandId_t id, + const uint8_t* packet) { + ReturnValue_t result = HasReturnvaluesIF::RETURN_OK; + switch(id) { + /* Periodic replies */ + case testdevice::TEST_NORMAL_MODE_CMD: { + result = interpretingNormalModeReply(); + break; + } + /* Simple reply */ + case testdevice::TEST_COMMAND_0: { + result = interpretingTestReply0(id, packet); + break; + } + /* Data reply */ + case testdevice::TEST_COMMAND_1: { + result = interpretingTestReply1(id, packet); + break; + } + default: + return DeviceHandlerIF::DEVICE_REPLY_INVALID; + } + return result; +} + +ReturnValue_t TestDevice::interpretingNormalModeReply() { + CommandMessage directReplyMessage; + if(changingDatasets) { + PoolReadGuard readHelper(&dataset); + if(dataset.testUint8Var.value == 0) { + dataset.testUint8Var.value = 10; + dataset.testUint32Var.value = 777; + dataset.testFloat3Vec.value[0] = 2.5; + dataset.testFloat3Vec.value[1] = -2.5; + dataset.testFloat3Vec.value[2] = 2.5; + dataset.setValidity(true, true); + } + else { + dataset.testUint8Var.value = 0; + dataset.testUint32Var.value = 0; + dataset.testFloat3Vec.value[0] = 0.0; + dataset.testFloat3Vec.value[1] = 0.0; + dataset.testFloat3Vec.value[2] = 0.0; + dataset.setValidity(false, true); + } + return RETURN_OK; + } + + PoolReadGuard readHelper(&dataset); + if(dataset.testUint8Var.value == 0) { + /* Reset state */ + dataset.testUint8Var.value = 128; + } + else if(dataset.testUint8Var.value > 200) { + if(not resetAfterChange) { + /* This will trigger an update notification to the controller */ + dataset.testUint8Var.setChanged(true); + resetAfterChange = true; + /* Decrement by 30 automatically. This will prevent any additional notifications. */ + dataset.testUint8Var.value -= 30; + } + } + /* If the value is greater than 0, it will be decremented in a linear way */ + else if(dataset.testUint8Var.value > 128) { + size_t sizeToDecrement = 0; + if(dataset.testUint8Var.value > 128 + 30) { + sizeToDecrement = 30; + } + else { + sizeToDecrement = dataset.testUint8Var.value - 128; + resetAfterChange = false; + } + dataset.testUint8Var.value -= sizeToDecrement; + } + else if(dataset.testUint8Var.value < 50) { + if(not resetAfterChange) { + /* This will trigger an update snapshot to the controller */ + dataset.testUint8Var.setChanged(true); + resetAfterChange = true; + } + else { + /* Increment by 30 automatically. */ + dataset.testUint8Var.value += 30; + } + } + /* Increment in linear way */ + else if(dataset.testUint8Var.value < 128) { + size_t sizeToIncrement = 0; + if(dataset.testUint8Var.value < 128 - 20) { + sizeToIncrement = 20; + } + else { + sizeToIncrement = 128 - dataset.testUint8Var.value; + resetAfterChange = false; + } + dataset.testUint8Var.value += sizeToIncrement; + } + + /* TODO: Same for vector */ + float vectorMean = (dataset.testFloat3Vec.value[0] + dataset.testFloat3Vec.value[1] + + dataset.testFloat3Vec.value[2]) / 3.0; + + /* Lambda (private local function) */ + auto sizeToAdd = [](bool tooHigh, float currentVal) { + if(tooHigh) { + if(currentVal - 20.0 > 10.0) { + return -10.0; + } + else { + return 20.0 - currentVal; + } + } + else { + if(std::abs(currentVal + 20.0) > 10.0) { + return 10.0; + } + else { + return -20.0 - currentVal; + } + } + }; + + if(vectorMean > 20.0 and std::abs(vectorMean - 20.0) > 1.0) { + if(not resetAfterChange) { + dataset.testFloat3Vec.setChanged(true); + resetAfterChange = true; + } + else { + float sizeToDecrementVal0 = 0; + float sizeToDecrementVal1 = 0; + float sizeToDecrementVal2 = 0; + + sizeToDecrementVal0 = sizeToAdd(true, dataset.testFloat3Vec.value[0]); + sizeToDecrementVal1 = sizeToAdd(true, dataset.testFloat3Vec.value[1]); + sizeToDecrementVal2 = sizeToAdd(true, dataset.testFloat3Vec.value[2]); + + dataset.testFloat3Vec.value[0] += sizeToDecrementVal0; + dataset.testFloat3Vec.value[1] += sizeToDecrementVal1; + dataset.testFloat3Vec.value[2] += sizeToDecrementVal2; + } + } + else if (vectorMean < -20.0 and std::abs(vectorMean + 20.0) < 1.0) { + if(not resetAfterChange) { + dataset.testFloat3Vec.setChanged(true); + resetAfterChange = true; + } + else { + float sizeToDecrementVal0 = 0; + float sizeToDecrementVal1 = 0; + float sizeToDecrementVal2 = 0; + + sizeToDecrementVal0 = sizeToAdd(false, dataset.testFloat3Vec.value[0]); + sizeToDecrementVal1 = sizeToAdd(false, dataset.testFloat3Vec.value[1]); + sizeToDecrementVal2 = sizeToAdd(false, dataset.testFloat3Vec.value[2]); + + dataset.testFloat3Vec.value[0] += sizeToDecrementVal0; + dataset.testFloat3Vec.value[1] += sizeToDecrementVal1; + dataset.testFloat3Vec.value[2] += sizeToDecrementVal2; + } + } + else { + if(resetAfterChange) { + resetAfterChange = false; + } + } + + return RETURN_OK; +} + +ReturnValue_t TestDevice::interpretingTestReply0(DeviceCommandId_t id, const uint8_t* packet) { + CommandMessage commandMessage; + if(fullInfoPrintout) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TestDevice::interpretingTestReply0: Generating step and finish reply" << + std::endl; +#else + sif::printInfo("TestDevice::interpretingTestReply0: Generating step and finish reply\n"); +#endif + } + + MessageQueueId_t commander = getCommanderQueueId(id); + /* Generate one step reply and the finish reply */ + actionHelper.step(1, commander, id); + actionHelper.finish(true, commander, id); + + return RETURN_OK; +} + +ReturnValue_t TestDevice::interpretingTestReply1(DeviceCommandId_t id, + const uint8_t* packet) { + CommandMessage directReplyMessage; + if(fullInfoPrintout) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TestDevice" << deviceIdx << "::interpretingReply1: Setting data reply" << + std::endl; +#else + sif::printInfo("TestDevice%d::interpretingReply1: Setting data reply\n", deviceIdx); +#endif + } + + MessageQueueId_t commander = getCommanderQueueId(id); + /* Send reply with data */ + ReturnValue_t result = actionHelper.reportData(commander, id, packet, + testdevice::TEST_COMMAND_1_SIZE, false); + + if (result != RETURN_OK) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::error << "TestDevice" << deviceIdx << "::interpretingReply1: Sending data " + "reply failed!" << std::endl; +#else + sif::printError("TestDevice%d::interpretingReply1: Sending data reply failed!\n", + deviceIdx); +#endif + return result; + } + + if(result == HasReturnvaluesIF::RETURN_OK) { + /* Finish reply */ + actionHelper.finish(true, commander, id); + } + else { + /* Finish reply */ + actionHelper.finish(false, commander, id, result); + } + + return RETURN_OK; +} + +uint32_t TestDevice::getTransitionDelayMs(Mode_t modeFrom, Mode_t modeTo) { + return 5000; +} + +void TestDevice::enableFullDebugOutput(bool enable) { + this->fullInfoPrintout = enable; +} + +ReturnValue_t TestDevice::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, + LocalDataPoolManager &poolManager) { + namespace td = testdevice; + localDataPoolMap.emplace(td::PoolIds::TEST_UINT8_ID, new PoolEntry({0})); + localDataPoolMap.emplace(td::PoolIds::TEST_UINT32_ID, new PoolEntry({0})); + localDataPoolMap.emplace(td::PoolIds::TEST_FLOAT_VEC_3_ID, + new PoolEntry({0.0, 0.0, 0.0})); + + sid_t sid; + if(deviceIdx == td::DeviceIndex::DEVICE_0) { + sid = td::TEST_SET_DEV_0_SID; + } + else { + sid = td::TEST_SET_DEV_1_SID; + } + /* Subscribe for periodic HK packets but do not enable reporting for now. + Non-diangostic with a period of one second */ + poolManager.subscribeForPeriodicPacket(sid, false, 1.0, false); + return HasReturnvaluesIF::RETURN_OK; +} + + +ReturnValue_t TestDevice::getParameter(uint8_t domainId, uint8_t uniqueId, + ParameterWrapper* parameterWrapper, const ParameterWrapper* newValues, + uint16_t startAtIndex) { + using namespace testdevice; + switch (uniqueId) { + case ParameterUniqueIds::TEST_UINT32_0: { + if(fullInfoPrintout) { + uint32_t newValue = 0; + ReturnValue_t result = newValues->getElement(&newValue, 0, 0); + if(result == HasReturnvaluesIF::RETURN_OK) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TestDevice" << deviceIdx << "::getParameter: Setting parameter 0 to " + "new value " << newValue << std::endl; +#else + sif::printInfo("TestDevice%d::getParameter: Setting parameter 0 to new value %lu\n", + deviceIdx, static_cast(newValue)); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ + } + } + parameterWrapper->set(testParameter0); + break; + } + case ParameterUniqueIds::TEST_INT32_1: { + if(fullInfoPrintout) { + int32_t newValue = 0; + ReturnValue_t result = newValues->getElement(&newValue, 0, 0); + if(result == HasReturnvaluesIF::RETURN_OK) { +#if OBSW_DEVICE_HANDLER_PRINTOUT == 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TestDevice" << deviceIdx << "::getParameter: Setting parameter 1 to " + "new value " << newValue << std::endl; +#else + sif::printInfo("TestDevice%d::getParameter: Setting parameter 1 to new value %lu\n", + deviceIdx, static_cast(newValue)); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* OBSW_DEVICE_HANDLER_PRINTOUT == 1 */ + } + } + parameterWrapper->set(testParameter1); + break; + } + case ParameterUniqueIds::TEST_FLOAT_VEC3_2: { + if(fullInfoPrintout) { + float newVector[3]; + if(newValues->getElement(newVector, 0, 0) != RETURN_OK or + newValues->getElement(newVector + 1, 0, 1) != RETURN_OK or + newValues->getElement(newVector + 2, 0, 2) != RETURN_OK) { + return HasReturnvaluesIF::RETURN_FAILED; + } +#if OBSW_DEVICE_HANDLER_PRINTOUT == 1 +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TestDevice" << deviceIdx << "::getParameter: Setting parameter 3 to " + "(float vector with 3 entries) to new values [" << newVector[0] << ", " << + newVector[1] << ", " << newVector[2] << "]" << std::endl; +#else + sif::printInfo("TestDevice%d::getParameter: Setting parameter 3 to new values " + "[%f, %f, %f]\n", deviceIdx, newVector[0], newVector[1], newVector[2]); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ +#endif /* OBSW_DEVICE_HANDLER_PRINTOUT == 1 */ + } + parameterWrapper->setVector(vectorFloatParams2); + break; + } + case(ParameterUniqueIds::PERIODIC_PRINT_ENABLED): { + if(fullInfoPrintout) { + uint8_t enabled = 0; + ReturnValue_t result = newValues->getElement(&enabled, 0, 0); + if(result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + char const* printout = nullptr; + if (enabled) { + printout = "enabled"; + } + else { + printout = "disabled"; + } +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TestDevice" << deviceIdx << "::getParameter: Periodic printout " << + printout << std::endl; +#else + sif::printInfo("TestDevice%d::getParameter: Periodic printout %s", printout); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ + } + + parameterWrapper->set(periodicPrintout); + break; + } + case(ParameterUniqueIds::CHANGING_DATASETS): { + + uint8_t enabled = 0; + ReturnValue_t result = newValues->getElement(&enabled, 0, 0); + if(result != HasReturnvaluesIF::RETURN_OK) { + return result; + } + if(not enabled) { + PoolReadGuard readHelper(&dataset); + dataset.testUint8Var.value = 0; + dataset.testUint32Var.value = 0; + dataset.testFloat3Vec.value[0] = 0.0; + dataset.testFloat3Vec.value[0] = 0.0; + dataset.testFloat3Vec.value[1] = 0.0; + } + + if(fullInfoPrintout) { + char const* printout = nullptr; + if (enabled) { + printout = "enabled"; + } + else { + printout = "disabled"; + } +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TestDevice" << deviceIdx << "::getParameter: Changing datasets " << + printout << std::endl; +#else + sif::printInfo("TestDevice%d::getParameter: Changing datasets %s", printout); +#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ + } + + parameterWrapper->set(changingDatasets); + break; + } + default: + return INVALID_IDENTIFIER_ID; + } + return HasReturnvaluesIF::RETURN_OK; +} + +LocalPoolObjectBase* TestDevice::getPoolObjectHandle(lp_id_t localPoolId) { + namespace td = testdevice; + if (localPoolId == td::PoolIds::TEST_UINT8_ID) { + return &dataset.testUint8Var; + } + else if (localPoolId == td::PoolIds::TEST_UINT32_ID) { + return &dataset.testUint32Var; + } + else if(localPoolId == td::PoolIds::TEST_FLOAT_VEC_3_ID) { + return &dataset.testFloat3Vec; + } + else { + return nullptr; + } +} diff --git a/tests/src/fsfw_tests/integration/devices/TestDeviceHandler.h b/tests/src/fsfw_tests/integration/devices/TestDeviceHandler.h new file mode 100644 index 00000000..0eb47731 --- /dev/null +++ b/tests/src/fsfw_tests/integration/devices/TestDeviceHandler.h @@ -0,0 +1,142 @@ +#ifndef TEST_TESTDEVICES_TESTDEVICEHANDLER_H_ +#define TEST_TESTDEVICES_TESTDEVICEHANDLER_H_ + +#include "devicedefinitions/testDeviceDefinitions.h" + +#include "fsfw/devicehandlers/DeviceHandlerBase.h" +#include "fsfw/globalfunctions/PeriodicOperationDivider.h" +#include "fsfw/timemanager/Countdown.h" + +/** + * @brief Basic dummy device handler to test device commanding without a physical device. + * @details + * This test device handler provided a basic demo for the device handler object. + * It can also be commanded with the following PUS services, using + * the specified object ID of the test device handler. + * + * 1. PUS Service 8 - Functional commanding + * 2. PUS Service 2 - Device access, raw commanding + * 3. PUS Service 20 - Parameter Management + * 4. PUS Service 3 - Housekeeping + + * @author R. Mueller + * @ingroup devices + */ +class TestDevice: public DeviceHandlerBase { +public: + /** + * Build the test device in the factory. + * @param objectId This ID will be assigned to the test device handler. + * @param comIF The ID of the Communication IF used by test device handler. + * @param cookie Cookie object used by the test device handler. This is + * also used and passed to the comIF object. + * @param onImmediately This will start a transition to MODE_ON immediately + * so the device handler jumps into #doStartUp. Should only be used + * in development to reduce need of commanding while debugging. + * @param changingDataset + * Will be used later to change the local datasets containeds in the device. + */ + TestDevice(object_id_t objectId, object_id_t comIF, CookieIF * cookie, + testdevice::DeviceIndex deviceIdx = testdevice::DeviceIndex::DEVICE_0, + bool fullInfoPrintout = false, bool changingDataset = true); + + /** + * This can be used to enable and disable a lot of demo print output. + * @param enable + */ + void enableFullDebugOutput(bool enable); + + virtual ~ TestDevice(); + + //! Size of internal buffer used for communication. + static constexpr uint8_t MAX_BUFFER_SIZE = 255; + + //! Unique index if the device handler is created multiple times. + testdevice::DeviceIndex deviceIdx = testdevice::DeviceIndex::DEVICE_0; + +protected: + testdevice::TestDataSet dataset; + //! This is used to reset the dataset after a commanded change has been made. + bool resetAfterChange = false; + bool commandSent = false; + + /** DeviceHandlerBase overrides (see DHB documentation) */ + + /** + * Hook into the DHB #performOperation call which is executed + * periodically. + */ + void performOperationHook() override; + + virtual void doStartUp() override; + virtual void doShutDown() override; + + virtual ReturnValue_t buildNormalDeviceCommand( + DeviceCommandId_t * id) override; + virtual ReturnValue_t buildTransitionDeviceCommand( + DeviceCommandId_t * id) override; + virtual ReturnValue_t buildCommandFromCommand(DeviceCommandId_t + deviceCommand, const uint8_t * commandData, + size_t commandDataLen) override; + + virtual void fillCommandAndReplyMap() override; + + virtual ReturnValue_t scanForReply(const uint8_t *start, size_t len, + DeviceCommandId_t *foundId, size_t *foundLen) override; + virtual ReturnValue_t interpretDeviceReply(DeviceCommandId_t id, + const uint8_t *packet) override; + virtual uint32_t getTransitionDelayMs(Mode_t modeFrom, + Mode_t modeTo) override; + + virtual void doTransition(Mode_t modeFrom, Submode_t subModeFrom) override; + + virtual ReturnValue_t initializeLocalDataPool(localpool::DataPool& localDataPoolMap, + LocalDataPoolManager& poolManager) override; + virtual LocalPoolObjectBase* getPoolObjectHandle(lp_id_t localPoolId) override; + + /* HasParametersIF overrides */ + virtual ReturnValue_t getParameter(uint8_t domainId, uint8_t uniqueId, + ParameterWrapper *parameterWrapper, + const ParameterWrapper *newValues, uint16_t startAtIndex) override; + + uint8_t commandBuffer[MAX_BUFFER_SIZE]; + + bool fullInfoPrintout = false; + bool oneShot = true; + + /* Variables for parameter service */ + uint32_t testParameter0 = 0; + int32_t testParameter1 = -2; + float vectorFloatParams2[3] = {}; + + /* Change device handler functionality, changeable via parameter service */ + uint8_t periodicPrintout = false; + uint8_t changingDatasets = false; + + ReturnValue_t buildNormalModeCommand(DeviceCommandId_t deviceCommand, + const uint8_t* commandData, size_t commandDataLen); + ReturnValue_t buildTestCommand0(DeviceCommandId_t deviceCommand, const uint8_t* commandData, + size_t commandDataLen); + ReturnValue_t buildTestCommand1(DeviceCommandId_t deviceCommand, const uint8_t* commandData, + size_t commandDataLen); + void passOnCommand(DeviceCommandId_t command, const uint8_t* commandData, + size_t commandDataLen); + + ReturnValue_t interpretingNormalModeReply(); + ReturnValue_t interpretingTestReply0(DeviceCommandId_t id, + const uint8_t* packet); + ReturnValue_t interpretingTestReply1(DeviceCommandId_t id, + const uint8_t* packet); + ReturnValue_t interpretingTestReply2(DeviceCommandId_t id, const uint8_t* packet); + + /* Some timer utilities */ + uint8_t divider1 = 2; + PeriodicOperationDivider opDivider1 = PeriodicOperationDivider(divider1); + uint8_t divider2 = 10; + PeriodicOperationDivider opDivider2 = PeriodicOperationDivider(divider2); + static constexpr uint32_t initTimeout = 2000; + Countdown countdown1 = Countdown(initTimeout); +}; + + +#endif /* TEST_TESTDEVICES_TESTDEVICEHANDLER_H_ */ diff --git a/tests/src/fsfw_tests/integration/devices/TestEchoComIF.cpp b/tests/src/fsfw_tests/integration/devices/TestEchoComIF.cpp new file mode 100644 index 00000000..afb23a06 --- /dev/null +++ b/tests/src/fsfw_tests/integration/devices/TestEchoComIF.cpp @@ -0,0 +1,86 @@ +#include "TestEchoComIF.h" +#include "TestCookie.h" + +#include +#include +#include +#include + + +TestEchoComIF::TestEchoComIF(object_id_t objectId): + SystemObject(objectId) { +} + +TestEchoComIF::~TestEchoComIF() {} + +ReturnValue_t TestEchoComIF::initializeInterface(CookieIF * cookie) { + TestCookie* dummyCookie = dynamic_cast(cookie); + if(dummyCookie == nullptr) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "TestEchoComIF::initializeInterface: Invalid cookie!" << std::endl; +#else + sif::printWarning("TestEchoComIF::initializeInterface: Invalid cookie!\n"); +#endif + return NULLPOINTER; + } + + auto resultPair = replyMap.emplace( + dummyCookie->getAddress(), ReplyBuffer(dummyCookie->getReplyMaxLen())); + if(not resultPair.second) { + return HasReturnvaluesIF::RETURN_FAILED; + } + return RETURN_OK; +} + +ReturnValue_t TestEchoComIF::sendMessage(CookieIF *cookie, + const uint8_t * sendData, size_t sendLen) { + TestCookie* dummyCookie = dynamic_cast(cookie); + if(dummyCookie == nullptr) { + return NULLPOINTER; + } + + ReplyBuffer& replyBuffer = replyMap.find(dummyCookie->getAddress())->second; + if(sendLen > replyBuffer.capacity()) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::warning << "TestEchoComIF::sendMessage: Send length " << sendLen << " larger than " + "current reply buffer length!" << std::endl; +#else + sif::printWarning("TestEchoComIF::sendMessage: Send length %d larger than current " + "reply buffer length!\n", sendLen); +#endif + return HasReturnvaluesIF::RETURN_FAILED; + } + replyBuffer.resize(sendLen); + memcpy(replyBuffer.data(), sendData, sendLen); + return RETURN_OK; +} + +ReturnValue_t TestEchoComIF::getSendSuccess(CookieIF *cookie) { + return RETURN_OK; +} + +ReturnValue_t TestEchoComIF::requestReceiveMessage(CookieIF *cookie, + size_t requestLen) { + return RETURN_OK; +} + +ReturnValue_t TestEchoComIF::readReceivedMessage(CookieIF *cookie, + uint8_t **buffer, size_t *size) { + TestCookie* dummyCookie = dynamic_cast(cookie); + if(dummyCookie == nullptr) { + return NULLPOINTER; + } + + ReplyBuffer& replyBuffer = replyMap.find(dummyCookie->getAddress())->second; + *buffer = replyBuffer.data(); + *size = replyBuffer.size(); + + dummyReplyCounter ++; + if(dummyReplyCounter == 10) { + // add anything that needs to be read periodically by dummy handler + dummyReplyCounter = 0; + } + return RETURN_OK; + +} + diff --git a/tests/src/fsfw_tests/integration/devices/TestEchoComIF.h b/tests/src/fsfw_tests/integration/devices/TestEchoComIF.h new file mode 100644 index 00000000..38270cfe --- /dev/null +++ b/tests/src/fsfw_tests/integration/devices/TestEchoComIF.h @@ -0,0 +1,56 @@ +#ifndef TEST_TESTDEVICES_TESTECHOCOMIF_H_ +#define TEST_TESTDEVICES_TESTECHOCOMIF_H_ + +#include +#include +#include +#include + +#include + +/** + * @brief Used to simply returned sent data from device handler + * @details Assign this com IF in the factory when creating the device handler + * @ingroup test + */ +class TestEchoComIF: public DeviceCommunicationIF, public SystemObject { +public: + TestEchoComIF(object_id_t objectId); + virtual ~TestEchoComIF(); + + /** + * DeviceCommunicationIF overrides + * (see DeviceCommunicationIF documentation + */ + ReturnValue_t initializeInterface(CookieIF * cookie) override; + ReturnValue_t sendMessage(CookieIF *cookie, const uint8_t * sendData, + size_t sendLen) override; + ReturnValue_t getSendSuccess(CookieIF *cookie) override; + ReturnValue_t requestReceiveMessage(CookieIF *cookie, + size_t requestLen) override; + ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer, + size_t *size) override; + +private: + + /** + * Send TM packet which contains received data as TM[17,130]. + * Wiretapping will do the same. + * @param data + * @param len + */ + void sendTmPacket(const uint8_t *data,uint32_t len); + + AcceptsTelemetryIF* funnel = nullptr; + MessageQueueIF* tmQueue = nullptr; + size_t replyMaxLen = 0; + + using ReplyBuffer = std::vector; + std::map replyMap; + + uint8_t dummyReplyCounter = 0; + + uint16_t packetSubCounter = 0; +}; + +#endif /* TEST_TESTDEVICES_TESTECHOCOMIF_H_ */ diff --git a/tests/src/fsfw_tests/integration/devices/devicedefinitions/testDeviceDefinitions.h b/tests/src/fsfw_tests/integration/devices/devicedefinitions/testDeviceDefinitions.h new file mode 100644 index 00000000..10668b94 --- /dev/null +++ b/tests/src/fsfw_tests/integration/devices/devicedefinitions/testDeviceDefinitions.h @@ -0,0 +1,100 @@ +#ifndef MISSION_DEVICES_DEVICEDEFINITIONS_TESTDEVICEDEFINITIONS_H_ +#define MISSION_DEVICES_DEVICEDEFINITIONS_TESTDEVICEDEFINITIONS_H_ + +#include +#include +#include + +namespace testdevice { + +enum ParameterUniqueIds: uint8_t { + TEST_UINT32_0, + TEST_INT32_1, + TEST_FLOAT_VEC3_2, + PERIODIC_PRINT_ENABLED, + CHANGING_DATASETS +}; + +enum DeviceIndex: uint32_t { + DEVICE_0, + DEVICE_1 +}; + +/** Normal mode command. This ID is also used to access the set variable via the housekeeping +service */ +static constexpr DeviceCommandId_t TEST_NORMAL_MODE_CMD = 0; + +//! Test completion reply +static constexpr DeviceCommandId_t TEST_COMMAND_0 = 1; +//! Test data reply +static constexpr DeviceCommandId_t TEST_COMMAND_1 = 2; + +/** + * Can be used to trigger a notification to the demo controller. For DEVICE_0, only notifications + * messages will be generated while for DEVICE_1, snapshot messages will be generated. + * + * DEVICE_0 VAR: Sets the set variable 0 above a treshold (200) to trigger a variable + * notification. + * DEVICE_0 SET: Sets the vector mean values above a treshold (mean larger than 20) to trigger a + * set notification. + * + * DEVICE_1 VAR: Sets the set variable 0 below a treshold (less than 50 but not 0) to trigger a + * variable snapshot. + * DEVICE_1 SET: Sets the set vector mean values below a treshold (mean smaller than -20) to + * trigger a set snapshot message. + */ +static constexpr DeviceCommandId_t TEST_NOTIF_SNAPSHOT_VAR = 3; +static constexpr DeviceCommandId_t TEST_NOTIF_SNAPSHOT_SET = 4; + +/** + * Can be used to trigger a snapshot message to the demo controller. + * Depending on the device index, a notification will be triggered for different set variables. + * + * DEVICE_0: Sets the set variable 0 below a treshold (below 50 but not 0) to trigger + * a variable snapshot + * DEVICE_1: Sets the vector mean values below a treshold (mean less than -20) to trigger a + * set snapshot + */ +static constexpr DeviceCommandId_t TEST_SNAPSHOT = 5; + +//! Generates a random value for variable 1 of the dataset. +static constexpr DeviceCommandId_t GENERATE_SET_VAR_1_RNG_VALUE = 6; + + +/** + * These parameters are sent back with the command ID as a data reply + */ +static constexpr uint16_t COMMAND_1_PARAM1 = 0xBAB0; //!< param1, 2 bytes +//! param2, 8 bytes +static constexpr uint64_t COMMAND_1_PARAM2 = 0x000000524F42494E; + +static constexpr size_t TEST_COMMAND_0_SIZE = sizeof(TEST_COMMAND_0); +static constexpr size_t TEST_COMMAND_1_SIZE = sizeof(TEST_COMMAND_1) + sizeof(COMMAND_1_PARAM1) + + sizeof(COMMAND_1_PARAM2); + +enum PoolIds: lp_id_t { + TEST_UINT8_ID = 0, + TEST_UINT32_ID = 1, + TEST_FLOAT_VEC_3_ID = 2 +}; + +static constexpr uint8_t TEST_SET_ID = TEST_NORMAL_MODE_CMD; +static const sid_t TEST_SET_DEV_0_SID = sid_t(objects::TEST_DEVICE_HANDLER_0, TEST_SET_ID); +static const sid_t TEST_SET_DEV_1_SID = sid_t(objects::TEST_DEVICE_HANDLER_1, TEST_SET_ID); + +class TestDataSet: public StaticLocalDataSet<3> { +public: + TestDataSet(HasLocalDataPoolIF* owner): StaticLocalDataSet(owner, TEST_SET_ID) {} + TestDataSet(object_id_t owner): StaticLocalDataSet(sid_t(owner, TEST_SET_ID)) {} + + lp_var_t testUint8Var = lp_var_t( + gp_id_t(this->getCreatorObjectId(), PoolIds::TEST_UINT8_ID), this); + lp_var_t testUint32Var = lp_var_t( + gp_id_t(this->getCreatorObjectId(), PoolIds::TEST_UINT32_ID), this); + lp_vec_t testFloat3Vec = lp_vec_t( + gp_id_t(this->getCreatorObjectId(), PoolIds::TEST_FLOAT_VEC_3_ID), this); +}; + +} + +#endif /* MISSION_DEVICES_DEVICEDEFINITIONS_TESTDEVICEDEFINITIONS_H_ */ diff --git a/tests/src/fsfw_tests/integration/task/CMakeLists.txt b/tests/src/fsfw_tests/integration/task/CMakeLists.txt new file mode 100644 index 00000000..0402d093 --- /dev/null +++ b/tests/src/fsfw_tests/integration/task/CMakeLists.txt @@ -0,0 +1,3 @@ +target_sources(${TARGET_NAME} PRIVATE + TestTask.cpp +) \ No newline at end of file diff --git a/tests/src/fsfw_tests/integration/task/TestTask.cpp b/tests/src/fsfw_tests/integration/task/TestTask.cpp new file mode 100644 index 00000000..c9910e90 --- /dev/null +++ b/tests/src/fsfw_tests/integration/task/TestTask.cpp @@ -0,0 +1,80 @@ +#include "TestTask.h" + +#include +#include + +bool TestTask::oneShotAction = true; +MutexIF* TestTask::testLock = nullptr; + +TestTask::TestTask(object_id_t objectId, bool periodicPrintout, bool periodicEvent): + SystemObject(objectId), testMode(testModes::A), + periodicPrinout(periodicPrintout), periodicEvent(periodicEvent) { + if(testLock == nullptr) { + testLock = MutexFactory::instance()->createMutex(); + } + IPCStore = ObjectManager::instance()->get(objects::IPC_STORE); +} + +TestTask::~TestTask() { +} + +ReturnValue_t TestTask::performOperation(uint8_t operationCode) { + ReturnValue_t result = RETURN_OK; + testLock->lockMutex(MutexIF::TimeoutType::WAITING, 20); + if(oneShotAction) { + // Add code here which should only be run once + performOneShotAction(); + oneShotAction = false; + } + testLock->unlockMutex(); + + // Add code here which should only be run once per performOperation + performPeriodicAction(); + + // Add code here which should only be run on alternating cycles. + if(testMode == testModes::A) { + performActionA(); + testMode = testModes::B; + } + else if(testMode == testModes::B) { + performActionB(); + testMode = testModes::A; + } + return result; +} + +ReturnValue_t TestTask::performOneShotAction() { + /* Everything here will only be performed once. */ + return HasReturnvaluesIF::RETURN_OK; +} + + +ReturnValue_t TestTask::performPeriodicAction() { + /* This is performed each task cycle */ + ReturnValue_t result = RETURN_OK; + + if(periodicPrinout) { +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "TestTask::performPeriodicAction: Hello World!" << std::endl; +#else + sif::printInfo("TestTask::performPeriodicAction: Hello World!\n"); +#endif + } + if(periodicEvent) { + triggerEvent(TEST_EVENT, 0x1234, 0x4321); + } + return result; +} + +ReturnValue_t TestTask::performActionA() { + /* This is performed each alternating task cycle */ + ReturnValue_t result = RETURN_OK; + return result; +} + +ReturnValue_t TestTask::performActionB() { + /* This is performed each alternating task cycle */ + ReturnValue_t result = RETURN_OK; + return result; +} + diff --git a/tests/src/fsfw_tests/integration/task/TestTask.h b/tests/src/fsfw_tests/integration/task/TestTask.h new file mode 100644 index 00000000..95f27bec --- /dev/null +++ b/tests/src/fsfw_tests/integration/task/TestTask.h @@ -0,0 +1,56 @@ +#ifndef MISSION_DEMO_TESTTASK_H_ +#define MISSION_DEMO_TESTTASK_H_ + +#include +#include +#include + +#include "fsfw/events/Event.h" +#include "events/subsystemIdRanges.h" + +/** + * @brief Test class for general C++ testing and any other code which will not be part of the + * primary mission software. + * @details + * Should not be used for board specific tests. Instead, a derived board test class should be used. + */ +class TestTask : + public SystemObject, + public ExecutableObjectIF, + public HasReturnvaluesIF { +public: + TestTask(object_id_t objectId, bool periodicPrintout = false, bool periodicEvent = false); + virtual ~TestTask(); + virtual ReturnValue_t performOperation(uint8_t operationCode = 0); + + static constexpr uint8_t subsystemId = SUBSYSTEM_ID::TEST_TASK_ID; + static constexpr Event TEST_EVENT = event::makeEvent(subsystemId, 0, severity::INFO); + +protected: + virtual ReturnValue_t performOneShotAction(); + virtual ReturnValue_t performPeriodicAction(); + virtual ReturnValue_t performActionA(); + virtual ReturnValue_t performActionB(); + + enum testModes: uint8_t { + A, + B + }; + + testModes testMode; + bool periodicPrinout = false; + bool periodicEvent = false; + + bool testFlag = false; + uint8_t counter { 1 }; + uint8_t counterTrigger { 3 }; + + void performPusInjectorTest(); + void examplePacketTest(); +private: + static bool oneShotAction; + static MutexIF* testLock; + StorageManagerIF* IPCStore; +}; + +#endif /* TESTTASK_H_ */ From afe8fe6605d81b7d597e802b1b1ac980c3642014 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 18 Oct 2021 13:58:18 +0200 Subject: [PATCH 354/389] assign correct init value --- src/fsfw/tcdistribution/PUSDistributor.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/fsfw/tcdistribution/PUSDistributor.cpp b/src/fsfw/tcdistribution/PUSDistributor.cpp index 284a14c9..adab58c8 100644 --- a/src/fsfw/tcdistribution/PUSDistributor.cpp +++ b/src/fsfw/tcdistribution/PUSDistributor.cpp @@ -29,7 +29,7 @@ PUSDistributor::TcMqMapIter PUSDistributor::selectDestination() { tcStatus = checker.checkPacket(currentPacket); if(tcStatus != HasReturnvaluesIF::RETURN_OK) { #if FSFW_VERBOSE_LEVEL >= 1 - const char* keyword = nullptr; + const char* keyword = "unnamed error"; if(tcStatus == TcPacketCheck::INCORRECT_CHECKSUM) { keyword = "checksum"; } @@ -45,9 +45,6 @@ PUSDistributor::TcMqMapIter PUSDistributor::selectDestination() { else if(tcStatus == TcPacketCheck::INCOMPLETE_PACKET) { keyword = "incomplete packet"; } - else { - keyword = "unnamed error"; - } #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::warning << "PUSDistributor::handlePacket: Packet format invalid, " << keyword << " error" << std::endl; From cee42f9b70a4fc8b2bf2b593a0de6118a7173505 Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Mon, 18 Oct 2021 14:34:11 +0200 Subject: [PATCH 355/389] one } was on the wrong side of an #endif --- src/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.cpp b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.cpp index 20a8ed89..523fb619 100644 --- a/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.cpp +++ b/src/fsfw/tmtcpacket/pus/tm/TmPacketStoredBase.cpp @@ -118,7 +118,7 @@ void TmPacketStoredBase::handleStoreFailure(const char *const packetType, Return "%d too large\n", packetType, sizeToReserve); break; } -#endif #endif } +#endif } From a077a1b5877032bedabe931ecdbc1a1048c3e333 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 18 Oct 2021 15:07:00 +0200 Subject: [PATCH 356/389] improved constexpr macros --- src/fsfw/tmtcpacket/SpacePacket.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/fsfw/tmtcpacket/SpacePacket.h b/src/fsfw/tmtcpacket/SpacePacket.h index dad8b95e..677ba023 100644 --- a/src/fsfw/tmtcpacket/SpacePacket.h +++ b/src/fsfw/tmtcpacket/SpacePacket.h @@ -71,12 +71,20 @@ protected: namespace spacepacket { -constexpr uint16_t getTcSpacePacketIdFromApid(uint16_t apid) { - return (0x18 << 8) | (((apid >> 8) & 0x07) << 8) | (apid & 0x00ff); +constexpr uint16_t getSpacePacketIdFromApid(bool isTc, uint16_t apid, + bool secondaryHeaderFlag = true) { + return (((isTc << 5) & 0x10) | ((secondaryHeaderFlag << 4) & 0x08) | + ((apid >> 8) & 0x07)) << 8 | (apid & 0x00ff); } -constexpr uint16_t getTmSpacePacketIdFromApid(uint16_t apid) { - return (0x08 << 8) | (((apid >> 8) & 0x07) << 8) | (apid & 0x00ff); +constexpr uint16_t getTcSpacketIdFromApid(uint16_t apid, + bool secondaryHeaderFlag = true) { + return getSpacePacketIdFromApid(true, apid, secondaryHeaderFlag); +} + +constexpr uint16_t getTmSpacketIdFromApid(uint16_t apid, + bool secondaryHeaderFlag = true) { + return getSpacePacketIdFromApid(false, apid, secondaryHeaderFlag); } } From 7122c37511ebea8e6c586556db6195cf2d91f636 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 18 Oct 2021 18:26:03 +0200 Subject: [PATCH 357/389] updated function names --- src/fsfw/tmtcpacket/SpacePacket.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fsfw/tmtcpacket/SpacePacket.h b/src/fsfw/tmtcpacket/SpacePacket.h index 677ba023..16673319 100644 --- a/src/fsfw/tmtcpacket/SpacePacket.h +++ b/src/fsfw/tmtcpacket/SpacePacket.h @@ -77,12 +77,12 @@ constexpr uint16_t getSpacePacketIdFromApid(bool isTc, uint16_t apid, ((apid >> 8) & 0x07)) << 8 | (apid & 0x00ff); } -constexpr uint16_t getTcSpacketIdFromApid(uint16_t apid, +constexpr uint16_t getTcSpacePacketIdFromApid(uint16_t apid, bool secondaryHeaderFlag = true) { return getSpacePacketIdFromApid(true, apid, secondaryHeaderFlag); } -constexpr uint16_t getTmSpacketIdFromApid(uint16_t apid, +constexpr uint16_t getTmSpacePacketIdFromApid(uint16_t apid, bool secondaryHeaderFlag = true) { return getSpacePacketIdFromApid(false, apid, secondaryHeaderFlag); } From a5a306ff66afad64b19f9e96ecd9ced815b378b6 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 21 Oct 2021 22:36:54 +0200 Subject: [PATCH 358/389] arrayprinter format improvements --- src/fsfw/globalfunctions/arrayprinter.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/fsfw/globalfunctions/arrayprinter.cpp b/src/fsfw/globalfunctions/arrayprinter.cpp index 45a1cb38..82b2a6f5 100644 --- a/src/fsfw/globalfunctions/arrayprinter.cpp +++ b/src/fsfw/globalfunctions/arrayprinter.cpp @@ -45,11 +45,11 @@ void arrayprinter::printHex(const uint8_t *data, size_t size, std::cout << "\r" << std::endl; } - std::cout << "[" << std::hex; + std::cout << "hex [" << std::hex; for(size_t i = 0; i < size; i++) { - std::cout << "0x" << static_cast(data[i]); + std::cout << "" << static_cast(data[i]); if(i < size - 1) { - std::cout << " , "; + std::cout << ","; if(i > 0 and (i + 1) % maxCharPerLine == 0) { std::cout << std::endl; @@ -69,16 +69,16 @@ void arrayprinter::printHex(const uint8_t *data, size_t size, break; } - currentPos += snprintf(printBuffer + currentPos, 6, "0x%02x", data[i]); + currentPos += snprintf(printBuffer + currentPos, 6, "%02x", data[i]); if(i < size - 1) { - currentPos += sprintf(printBuffer + currentPos, ", "); + currentPos += sprintf(printBuffer + currentPos, ","); if(i > 0 and (i + 1) % maxCharPerLine == 0) { currentPos += sprintf(printBuffer + currentPos, "\n"); } } } #if FSFW_DISABLE_PRINTOUT == 0 - printf("[%s]\n", printBuffer); + printf("hex [%s]\n", printBuffer); #endif /* FSFW_DISABLE_PRINTOUT == 0 */ #endif } @@ -90,11 +90,11 @@ void arrayprinter::printDec(const uint8_t *data, size_t size, std::cout << "\r" << std::endl; } - std::cout << "[" << std::dec; + std::cout << "dec [" << std::dec; for(size_t i = 0; i < size; i++) { std::cout << static_cast(data[i]); if(i < size - 1){ - std::cout << " , "; + std::cout << ","; if(i > 0 and (i + 1) % maxCharPerLine == 0) { std::cout << std::endl; } @@ -114,14 +114,14 @@ void arrayprinter::printDec(const uint8_t *data, size_t size, currentPos += snprintf(printBuffer + currentPos, 3, "%d", data[i]); if(i < size - 1) { - currentPos += sprintf(printBuffer + currentPos, ", "); + currentPos += sprintf(printBuffer + currentPos, ","); if(i > 0 and (i + 1) % maxCharPerLine == 0) { currentPos += sprintf(printBuffer + currentPos, "\n"); } } } #if FSFW_DISABLE_PRINTOUT == 0 - printf("[%s]\n", printBuffer); + printf("dec [%s]\n", printBuffer); #endif /* FSFW_DISABLE_PRINTOUT == 0 */ #endif } From dc6ed40bfb7ff6ecbb472ae09ccf9ca38167c563 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 22 Oct 2021 11:30:00 +0200 Subject: [PATCH 359/389] arrayprinter format improvements --- src/fsfw/globalfunctions/arrayprinter.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/fsfw/globalfunctions/arrayprinter.cpp b/src/fsfw/globalfunctions/arrayprinter.cpp index 82b2a6f5..45a1cb38 100644 --- a/src/fsfw/globalfunctions/arrayprinter.cpp +++ b/src/fsfw/globalfunctions/arrayprinter.cpp @@ -45,11 +45,11 @@ void arrayprinter::printHex(const uint8_t *data, size_t size, std::cout << "\r" << std::endl; } - std::cout << "hex [" << std::hex; + std::cout << "[" << std::hex; for(size_t i = 0; i < size; i++) { - std::cout << "" << static_cast(data[i]); + std::cout << "0x" << static_cast(data[i]); if(i < size - 1) { - std::cout << ","; + std::cout << " , "; if(i > 0 and (i + 1) % maxCharPerLine == 0) { std::cout << std::endl; @@ -69,16 +69,16 @@ void arrayprinter::printHex(const uint8_t *data, size_t size, break; } - currentPos += snprintf(printBuffer + currentPos, 6, "%02x", data[i]); + currentPos += snprintf(printBuffer + currentPos, 6, "0x%02x", data[i]); if(i < size - 1) { - currentPos += sprintf(printBuffer + currentPos, ","); + currentPos += sprintf(printBuffer + currentPos, ", "); if(i > 0 and (i + 1) % maxCharPerLine == 0) { currentPos += sprintf(printBuffer + currentPos, "\n"); } } } #if FSFW_DISABLE_PRINTOUT == 0 - printf("hex [%s]\n", printBuffer); + printf("[%s]\n", printBuffer); #endif /* FSFW_DISABLE_PRINTOUT == 0 */ #endif } @@ -90,11 +90,11 @@ void arrayprinter::printDec(const uint8_t *data, size_t size, std::cout << "\r" << std::endl; } - std::cout << "dec [" << std::dec; + std::cout << "[" << std::dec; for(size_t i = 0; i < size; i++) { std::cout << static_cast(data[i]); if(i < size - 1){ - std::cout << ","; + std::cout << " , "; if(i > 0 and (i + 1) % maxCharPerLine == 0) { std::cout << std::endl; } @@ -114,14 +114,14 @@ void arrayprinter::printDec(const uint8_t *data, size_t size, currentPos += snprintf(printBuffer + currentPos, 3, "%d", data[i]); if(i < size - 1) { - currentPos += sprintf(printBuffer + currentPos, ","); + currentPos += sprintf(printBuffer + currentPos, ", "); if(i > 0 and (i + 1) % maxCharPerLine == 0) { currentPos += sprintf(printBuffer + currentPos, "\n"); } } } #if FSFW_DISABLE_PRINTOUT == 0 - printf("dec [%s]\n", printBuffer); + printf("[%s]\n", printBuffer); #endif /* FSFW_DISABLE_PRINTOUT == 0 */ #endif } From 07a0dd5331072c536cd30fd0505bfc1b38cc813b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 22 Oct 2021 11:32:28 +0200 Subject: [PATCH 360/389] this is the correct file --- src/fsfw/globalfunctions/arrayprinter.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/fsfw/globalfunctions/arrayprinter.cpp b/src/fsfw/globalfunctions/arrayprinter.cpp index 45a1cb38..964b9d04 100644 --- a/src/fsfw/globalfunctions/arrayprinter.cpp +++ b/src/fsfw/globalfunctions/arrayprinter.cpp @@ -45,18 +45,18 @@ void arrayprinter::printHex(const uint8_t *data, size_t size, std::cout << "\r" << std::endl; } - std::cout << "[" << std::hex; + std::cout << "hex [" << std::setfill('0') << std::hex; for(size_t i = 0; i < size; i++) { - std::cout << "0x" << static_cast(data[i]); + std::cout << std::setw(2) << static_cast(data[i]); if(i < size - 1) { - std::cout << " , "; + std::cout << ","; if(i > 0 and (i + 1) % maxCharPerLine == 0) { std::cout << std::endl; } } } - std::cout << std::dec; + std::cout << std::dec << std::setfill(' '); std::cout << "]" << std::endl; #else // General format: 0x01, 0x02, 0x03 so it is number of chars times 6 @@ -69,16 +69,16 @@ void arrayprinter::printHex(const uint8_t *data, size_t size, break; } - currentPos += snprintf(printBuffer + currentPos, 6, "0x%02x", data[i]); + currentPos += snprintf(printBuffer + currentPos, 6, "%02x", data[i]); if(i < size - 1) { - currentPos += sprintf(printBuffer + currentPos, ", "); + currentPos += sprintf(printBuffer + currentPos, ","); if(i > 0 and (i + 1) % maxCharPerLine == 0) { currentPos += sprintf(printBuffer + currentPos, "\n"); } } } #if FSFW_DISABLE_PRINTOUT == 0 - printf("[%s]\n", printBuffer); + printf("hex [%s]\n", printBuffer); #endif /* FSFW_DISABLE_PRINTOUT == 0 */ #endif } @@ -90,11 +90,11 @@ void arrayprinter::printDec(const uint8_t *data, size_t size, std::cout << "\r" << std::endl; } - std::cout << "[" << std::dec; + std::cout << "dec [" << std::dec; for(size_t i = 0; i < size; i++) { std::cout << static_cast(data[i]); if(i < size - 1){ - std::cout << " , "; + std::cout << ","; if(i > 0 and (i + 1) % maxCharPerLine == 0) { std::cout << std::endl; } @@ -114,14 +114,14 @@ void arrayprinter::printDec(const uint8_t *data, size_t size, currentPos += snprintf(printBuffer + currentPos, 3, "%d", data[i]); if(i < size - 1) { - currentPos += sprintf(printBuffer + currentPos, ", "); + currentPos += sprintf(printBuffer + currentPos, ","); if(i > 0 and (i + 1) % maxCharPerLine == 0) { currentPos += sprintf(printBuffer + currentPos, "\n"); } } } #if FSFW_DISABLE_PRINTOUT == 0 - printf("[%s]\n", printBuffer); + printf("dec [%s]\n", printBuffer); #endif /* FSFW_DISABLE_PRINTOUT == 0 */ #endif } From 19f9b0280c2ae45b4f029d9d852a8fb8631e79c8 Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Mon, 25 Oct 2021 14:59:16 +0200 Subject: [PATCH 361/389] added jenkins integration --- automation/Dockerfile | 8 ++++++++ automation/Jenkinsfile | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 automation/Dockerfile create mode 100644 automation/Jenkinsfile diff --git a/automation/Dockerfile b/automation/Dockerfile new file mode 100644 index 00000000..0526d8f0 --- /dev/null +++ b/automation/Dockerfile @@ -0,0 +1,8 @@ +FROM ubuntu:focal + +RUN apt-get update +RUN apt-get --yes upgrade + +#tzdata is a dependency, won't install otherwise +ARG DEBIAN_FRONTEND=noninteractive +RUN apt-get --yes install gcc g++ cmake lcov git nano diff --git a/automation/Jenkinsfile b/automation/Jenkinsfile new file mode 100644 index 00000000..a90037f8 --- /dev/null +++ b/automation/Jenkinsfile @@ -0,0 +1,38 @@ +pipeline { + agent any + stages { + stage('Clean') { + steps { + sh 'rm -rf build-unittests' + } + } + stage('Build') { + agent { + dockerfile { + dir 'automation' + additionalBuildArgs '--no-cache' + reuseNode true + } + } + steps { + dir('build-unittests') { + sh 'cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON ..' + sh 'cmake --build . -j' + } + } + } + stage('Unittests') { + agent { + dockerfile { + dir 'automation' + reuseNode true + } + } + steps { + dir('build-unittests') { + sh 'cmake --build . -- fsfw-tests_coverage -j' + } + } + } + } +} From 81bae858254d496da5e48d734e8218218cd11eaa Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 26 Oct 2021 17:10:15 +0200 Subject: [PATCH 362/389] hotfix for unittests --- tests/src/fsfw_tests/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/src/fsfw_tests/CMakeLists.txt b/tests/src/fsfw_tests/CMakeLists.txt index fb03f562..f6e1b8ab 100644 --- a/tests/src/fsfw_tests/CMakeLists.txt +++ b/tests/src/fsfw_tests/CMakeLists.txt @@ -1,9 +1,9 @@ -add_subdirectory(integration) - if(FSFW_ADD_INTERNAL_TESTS) add_subdirectory(internal) endif() if(FSFW_BUILD_UNITTESTS) add_subdirectory(unit) +else() + add_subdirectory(integration) endif() From 5f8adc63b70298c0d6163219ad8782de76c22460 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 26 Oct 2021 17:16:21 +0200 Subject: [PATCH 363/389] some more fixes for integration tests --- .../integration/assemblies/TestAssembly.cpp | 4 ++-- .../integration/controller/TestController.cpp | 11 ++++++----- .../integration/controller/TestController.h | 3 ++- .../integration/devices/TestDeviceHandler.cpp | 8 +------- .../devices/devicedefinitions/testDeviceDefinitions.h | 3 --- 5 files changed, 11 insertions(+), 18 deletions(-) diff --git a/tests/src/fsfw_tests/integration/assemblies/TestAssembly.cpp b/tests/src/fsfw_tests/integration/assemblies/TestAssembly.cpp index 1c497ebd..0ead4bfd 100644 --- a/tests/src/fsfw_tests/integration/assemblies/TestAssembly.cpp +++ b/tests/src/fsfw_tests/integration/assemblies/TestAssembly.cpp @@ -160,11 +160,11 @@ ReturnValue_t TestAssembly::initialize() { handler1->setParentQueue(this->getCommandQueue()); - result = registerChild(objects::TEST_DEVICE_HANDLER_0); + result = registerChild(deviceHandler0Id); if (result != HasReturnvaluesIF::RETURN_OK) { return result; } - result = registerChild(objects::TEST_DEVICE_HANDLER_1); + result = registerChild(deviceHandler1Id); if (result != HasReturnvaluesIF::RETURN_OK) { return result; } diff --git a/tests/src/fsfw_tests/integration/controller/TestController.cpp b/tests/src/fsfw_tests/integration/controller/TestController.cpp index 385d07bd..96da5fe3 100644 --- a/tests/src/fsfw_tests/integration/controller/TestController.cpp +++ b/tests/src/fsfw_tests/integration/controller/TestController.cpp @@ -5,10 +5,11 @@ #include #include -TestController::TestController(object_id_t objectId, size_t commandQueueDepth): +TestController::TestController(object_id_t objectId, object_id_t device0, object_id_t device1, + size_t commandQueueDepth): ExtendedControllerBase(objectId, objects::NO_OBJECT, commandQueueDepth), - deviceDataset0(objects::TEST_DEVICE_HANDLER_0), - deviceDataset1(objects::TEST_DEVICE_HANDLER_1) { + deviceDataset0(device0), + deviceDataset1(device1) { } TestController::~TestController() { @@ -163,7 +164,7 @@ ReturnValue_t TestController::initializeLocalDataPool(localpool::DataPool &local ReturnValue_t TestController::initializeAfterTaskCreation() { namespace td = testdevice; HasLocalDataPoolIF* device0 = ObjectManager::instance()->get( - objects::TEST_DEVICE_HANDLER_0); + deviceDataset0.getCreatorObjectId()); if(device0 == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::warning << "TestController::initializeAfterTaskCreation: Test device handler 0 " @@ -185,7 +186,7 @@ ReturnValue_t TestController::initializeAfterTaskCreation() { HasLocalDataPoolIF* device1 = ObjectManager::instance()->get( - objects::TEST_DEVICE_HANDLER_1); + deviceDataset0.getCreatorObjectId()); if(device1 == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::warning << "TestController::initializeAfterTaskCreation: Test device handler 1 " diff --git a/tests/src/fsfw_tests/integration/controller/TestController.h b/tests/src/fsfw_tests/integration/controller/TestController.h index 8092f945..475d8703 100644 --- a/tests/src/fsfw_tests/integration/controller/TestController.h +++ b/tests/src/fsfw_tests/integration/controller/TestController.h @@ -8,7 +8,8 @@ class TestController: public ExtendedControllerBase { public: - TestController(object_id_t objectId, size_t commandQueueDepth = 10); + TestController(object_id_t objectId, object_id_t device0, object_id_t device1, + size_t commandQueueDepth = 10); virtual~ TestController(); protected: testdevice::TestDataSet deviceDataset0; diff --git a/tests/src/fsfw_tests/integration/devices/TestDeviceHandler.cpp b/tests/src/fsfw_tests/integration/devices/TestDeviceHandler.cpp index 91019487..46138c56 100644 --- a/tests/src/fsfw_tests/integration/devices/TestDeviceHandler.cpp +++ b/tests/src/fsfw_tests/integration/devices/TestDeviceHandler.cpp @@ -644,13 +644,7 @@ ReturnValue_t TestDevice::initializeLocalDataPool(localpool::DataPool &localData localDataPoolMap.emplace(td::PoolIds::TEST_FLOAT_VEC_3_ID, new PoolEntry({0.0, 0.0, 0.0})); - sid_t sid; - if(deviceIdx == td::DeviceIndex::DEVICE_0) { - sid = td::TEST_SET_DEV_0_SID; - } - else { - sid = td::TEST_SET_DEV_1_SID; - } + sid_t sid(this->getObjectId(), td::TEST_SET_ID); /* Subscribe for periodic HK packets but do not enable reporting for now. Non-diangostic with a period of one second */ poolManager.subscribeForPeriodicPacket(sid, false, 1.0, false); diff --git a/tests/src/fsfw_tests/integration/devices/devicedefinitions/testDeviceDefinitions.h b/tests/src/fsfw_tests/integration/devices/devicedefinitions/testDeviceDefinitions.h index 10668b94..1c112e3f 100644 --- a/tests/src/fsfw_tests/integration/devices/devicedefinitions/testDeviceDefinitions.h +++ b/tests/src/fsfw_tests/integration/devices/devicedefinitions/testDeviceDefinitions.h @@ -3,7 +3,6 @@ #include #include -#include namespace testdevice { @@ -79,8 +78,6 @@ enum PoolIds: lp_id_t { }; static constexpr uint8_t TEST_SET_ID = TEST_NORMAL_MODE_CMD; -static const sid_t TEST_SET_DEV_0_SID = sid_t(objects::TEST_DEVICE_HANDLER_0, TEST_SET_ID); -static const sid_t TEST_SET_DEV_1_SID = sid_t(objects::TEST_DEVICE_HANDLER_1, TEST_SET_ID); class TestDataSet: public StaticLocalDataSet<3> { public: From 2126e6e3754a45f09bc9c557f1703821d7e68789 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 26 Oct 2021 17:24:28 +0200 Subject: [PATCH 364/389] simplified test task --- .../fsfw_tests/integration/task/TestTask.cpp | 16 ++-------------- .../src/fsfw_tests/integration/task/TestTask.h | 17 ++--------------- 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/tests/src/fsfw_tests/integration/task/TestTask.cpp b/tests/src/fsfw_tests/integration/task/TestTask.cpp index c9910e90..b33bd51c 100644 --- a/tests/src/fsfw_tests/integration/task/TestTask.cpp +++ b/tests/src/fsfw_tests/integration/task/TestTask.cpp @@ -6,9 +6,8 @@ bool TestTask::oneShotAction = true; MutexIF* TestTask::testLock = nullptr; -TestTask::TestTask(object_id_t objectId, bool periodicPrintout, bool periodicEvent): - SystemObject(objectId), testMode(testModes::A), - periodicPrinout(periodicPrintout), periodicEvent(periodicEvent) { +TestTask::TestTask(object_id_t objectId): + SystemObject(objectId), testMode(testModes::A) { if(testLock == nullptr) { testLock = MutexFactory::instance()->createMutex(); } @@ -52,17 +51,6 @@ ReturnValue_t TestTask::performOneShotAction() { ReturnValue_t TestTask::performPeriodicAction() { /* This is performed each task cycle */ ReturnValue_t result = RETURN_OK; - - if(periodicPrinout) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::info << "TestTask::performPeriodicAction: Hello World!" << std::endl; -#else - sif::printInfo("TestTask::performPeriodicAction: Hello World!\n"); -#endif - } - if(periodicEvent) { - triggerEvent(TEST_EVENT, 0x1234, 0x4321); - } return result; } diff --git a/tests/src/fsfw_tests/integration/task/TestTask.h b/tests/src/fsfw_tests/integration/task/TestTask.h index 95f27bec..e56b5581 100644 --- a/tests/src/fsfw_tests/integration/task/TestTask.h +++ b/tests/src/fsfw_tests/integration/task/TestTask.h @@ -5,9 +5,6 @@ #include #include -#include "fsfw/events/Event.h" -#include "events/subsystemIdRanges.h" - /** * @brief Test class for general C++ testing and any other code which will not be part of the * primary mission software. @@ -19,12 +16,9 @@ class TestTask : public ExecutableObjectIF, public HasReturnvaluesIF { public: - TestTask(object_id_t objectId, bool periodicPrintout = false, bool periodicEvent = false); + TestTask(object_id_t objectId); virtual ~TestTask(); - virtual ReturnValue_t performOperation(uint8_t operationCode = 0); - - static constexpr uint8_t subsystemId = SUBSYSTEM_ID::TEST_TASK_ID; - static constexpr Event TEST_EVENT = event::makeEvent(subsystemId, 0, severity::INFO); + virtual ReturnValue_t performOperation(uint8_t operationCode = 0) override; protected: virtual ReturnValue_t performOneShotAction(); @@ -38,15 +32,8 @@ protected: }; testModes testMode; - bool periodicPrinout = false; - bool periodicEvent = false; - bool testFlag = false; - uint8_t counter { 1 }; - uint8_t counterTrigger { 3 }; - void performPusInjectorTest(); - void examplePacketTest(); private: static bool oneShotAction; static MutexIF* testLock; From 3c414726499e5729667e6f62a67ad5dd9d5bc7e9 Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Tue, 26 Oct 2021 20:30:22 +0200 Subject: [PATCH 365/389] tweaking Jenkinsfile --- automation/Jenkinsfile | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/automation/Jenkinsfile b/automation/Jenkinsfile index a90037f8..e5b5ecda 100644 --- a/automation/Jenkinsfile +++ b/automation/Jenkinsfile @@ -1,12 +1,10 @@ pipeline { agent any + environment { + BUILDDIR = 'build-unittests' + } stages { - stage('Clean') { - steps { - sh 'rm -rf build-unittests' - } - } - stage('Build') { + stage('Configure') { agent { dockerfile { dir 'automation' @@ -15,8 +13,21 @@ pipeline { } } steps { - dir('build-unittests') { + sh 'rm -rf $BUILDDIR' + dir($BUILDDIR) { sh 'cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON ..' + } + } + } + stage('Build') { + agent { + dockerfile { + dir 'automation' + reuseNode true + } + } + steps { + dir($BUILDDIR) { sh 'cmake --build . -j' } } @@ -29,7 +40,7 @@ pipeline { } } steps { - dir('build-unittests') { + dir($BUILDDIR) { sh 'cmake --build . -- fsfw-tests_coverage -j' } } From 1923b339e92772f3f43cbc7942d3c75baca35e02 Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Tue, 26 Oct 2021 20:47:53 +0200 Subject: [PATCH 366/389] I can not jenkins --- automation/Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/automation/Jenkinsfile b/automation/Jenkinsfile index e5b5ecda..9dc716a6 100644 --- a/automation/Jenkinsfile +++ b/automation/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { } steps { sh 'rm -rf $BUILDDIR' - dir($BUILDDIR) { + dir(env.BUILDDIR) { sh 'cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON ..' } } @@ -27,7 +27,7 @@ pipeline { } } steps { - dir($BUILDDIR) { + dir(BUILDDIR) { sh 'cmake --build . -j' } } @@ -40,7 +40,7 @@ pipeline { } } steps { - dir($BUILDDIR) { + dir(BUILDDIR) { sh 'cmake --build . -- fsfw-tests_coverage -j' } } From b02f737418b59c1724b9ee8b64defff1f5d19623 Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Tue, 26 Oct 2021 20:53:08 +0200 Subject: [PATCH 367/389] jenkins cosmetics --- automation/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/automation/Jenkinsfile b/automation/Jenkinsfile index 9dc716a6..6a5d94b5 100644 --- a/automation/Jenkinsfile +++ b/automation/Jenkinsfile @@ -14,7 +14,7 @@ pipeline { } steps { sh 'rm -rf $BUILDDIR' - dir(env.BUILDDIR) { + dir(BUILDDIR) { sh 'cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON ..' } } From da42edcc0cc49a81d1dca5a897aa2ab73accd600 Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Tue, 26 Oct 2021 20:58:34 +0200 Subject: [PATCH 368/389] Jenkinsfile: added stage to be more verbose --- automation/Jenkinsfile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/automation/Jenkinsfile b/automation/Jenkinsfile index 6a5d94b5..0cb973bd 100644 --- a/automation/Jenkinsfile +++ b/automation/Jenkinsfile @@ -4,7 +4,7 @@ pipeline { BUILDDIR = 'build-unittests' } stages { - stage('Configure') { + stage('Create Docker') { agent { dockerfile { dir 'automation' @@ -14,6 +14,16 @@ pipeline { } steps { sh 'rm -rf $BUILDDIR' + } + } + stage('Configure') { + agent { + dockerfile { + dir 'automation' + reuseNode true + } + } + steps { dir(BUILDDIR) { sh 'cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON ..' } From cc7250fcf5fb5e9ca890b3688d47d22a8956b14e Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 27 Oct 2021 17:08:59 +0200 Subject: [PATCH 369/389] second cmake fix --- src/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5a8f139b..e4670807 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,5 +16,3 @@ target_include_directories(${LIB_FSFW_NAME} PRIVATE target_include_directories(${LIB_FSFW_NAME} INTERFACE ${CMAKE_CURRENT_BINARY_DIR} ) - -configure_file(fsfw/FSFW.h.in fsfw/FSFW.h) From 42458725e86352e1fc38b806235ea5e8eb2b318c Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 27 Oct 2021 17:10:37 +0200 Subject: [PATCH 370/389] more important fix --- CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 923d5cc5..e78e8929 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,14 +93,6 @@ target_include_directories(${LIB_FSFW_NAME} INTERFACE ${CMAKE_CURRENT_BINARY_DIR} ) -if(FSFW_BUILD_UNITTESTS) - configure_file(src/fsfw/FSFW.h.in fsfw/FSFW.h) - configure_file(src/fsfw/FSFWVersion.h.in fsfw/FSFWVersion.h) -else() - configure_file(src/fsfw/FSFW.h.in FSFW.h) - configure_file(src/fsfw/FSFWVersion.h.in FSFWVersion.h) -endif() - if(NOT CMAKE_CXX_STANDARD) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED True) @@ -155,6 +147,14 @@ else() set(OS_FSFW "host") endif() +if(FSFW_BUILD_UNITTESTS) + configure_file(src/fsfw/FSFW.h.in fsfw/FSFW.h) + configure_file(src/fsfw/FSFWVersion.h.in fsfw/FSFWVersion.h) +else() + configure_file(src/fsfw/FSFW.h.in FSFW.h) + configure_file(src/fsfw/FSFWVersion.h.in FSFWVersion.h) +endif() + message(STATUS "Compiling FSFW for the ${FSFW_OS_NAME} operating system.") add_subdirectory(src) From 3448a8c01b4e1cc3171e93f68b600dbfa9501962 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 27 Oct 2021 17:23:14 +0200 Subject: [PATCH 371/389] SPI ComIF updates 1. Make setting a chip select pin optional 2. Make ComIF member functions public --- hal/src/fsfw_hal/stm32h7/spi/SpiComIF.cpp | 38 +++++++++++++++-------- hal/src/fsfw_hal/stm32h7/spi/SpiComIF.h | 3 +- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/hal/src/fsfw_hal/stm32h7/spi/SpiComIF.cpp b/hal/src/fsfw_hal/stm32h7/spi/SpiComIF.cpp index 1813aac0..4c4f7744 100644 --- a/hal/src/fsfw_hal/stm32h7/spi/SpiComIF.cpp +++ b/hal/src/fsfw_hal/stm32h7/spi/SpiComIF.cpp @@ -138,12 +138,14 @@ ReturnValue_t SpiComIF::initializeInterface(CookieIF *cookie) { spi::setSpiDmaMspFunctions(typedCfg); } - gpio::initializeGpioClock(gpioPort); - GPIO_InitTypeDef chipSelect = {}; - chipSelect.Pin = gpioPin; - chipSelect.Mode = GPIO_MODE_OUTPUT_PP; - HAL_GPIO_Init(gpioPort, &chipSelect); - HAL_GPIO_WritePin(gpioPort, gpioPin, GPIO_PIN_SET); + if(gpioPort != nullptr) { + gpio::initializeGpioClock(gpioPort); + GPIO_InitTypeDef chipSelect = {}; + chipSelect.Pin = gpioPin; + chipSelect.Mode = GPIO_MODE_OUTPUT_PP; + HAL_GPIO_Init(gpioPort, &chipSelect); + HAL_GPIO_WritePin(gpioPort, gpioPin, GPIO_PIN_SET); + } if(HAL_SPI_Init(&spiHandle) != HAL_OK) { sif::printWarning("SpiComIF::initialize: Error initializing SPI\n"); @@ -259,10 +261,15 @@ ReturnValue_t SpiComIF::handlePollingSendOperation(uint8_t* recvPtr, SPI_HandleT return returnval; } spiCookie.setTransferState(spi::TransferStates::WAIT); - HAL_GPIO_WritePin(gpioPort, gpioPin, GPIO_PIN_RESET); + if(gpioPort != nullptr) { + HAL_GPIO_WritePin(gpioPort, gpioPin, GPIO_PIN_RESET); + } + auto result = HAL_SPI_TransmitReceive(&spiHandle, const_cast(sendData), recvPtr, sendLen, defaultPollingTimeout); - HAL_GPIO_WritePin(gpioPort, gpioPin, GPIO_PIN_SET); + if(gpioPort != nullptr) { + HAL_GPIO_WritePin(gpioPort, gpioPin, GPIO_PIN_SET); + } spiSemaphore->release(); switch(result) { case(HAL_OK): { @@ -392,8 +399,10 @@ ReturnValue_t SpiComIF::genericIrqSendSetup(uint8_t *recvPtr, SPI_HandleTypeDef& // The SPI handle is passed to the default SPI callback as a void argument. This callback // is different from the user callbacks specified above! spi::assignSpiUserArgs(spiCookie.getSpiIdx(), reinterpret_cast(&spiHandle)); - HAL_GPIO_WritePin(spiCookie.getChipSelectGpioPort(), spiCookie.getChipSelectGpioPin(), - GPIO_PIN_RESET); + if(spiCookie.getChipSelectGpioPort() != nullptr) { + HAL_GPIO_WritePin(spiCookie.getChipSelectGpioPort(), spiCookie.getChipSelectGpioPin(), + GPIO_PIN_RESET); + } return HasReturnvaluesIF::RETURN_OK; } @@ -426,9 +435,12 @@ void SpiComIF::genericIrqHandler(void *irqArgsVoid, spi::TransferStates targetSt spiCookie->setTransferState(targetState); - // Pull CS pin high again - HAL_GPIO_WritePin(spiCookie->getChipSelectGpioPort(), spiCookie->getChipSelectGpioPin(), - GPIO_PIN_SET); + if(spiCookie->getChipSelectGpioPort() != nullptr) { + // Pull CS pin high again + HAL_GPIO_WritePin(spiCookie->getChipSelectGpioPort(), spiCookie->getChipSelectGpioPin(), + GPIO_PIN_SET); + } + #if defined FSFW_OSAL_FREERTOS // Release the task semaphore diff --git a/hal/src/fsfw_hal/stm32h7/spi/SpiComIF.h b/hal/src/fsfw_hal/stm32h7/spi/SpiComIF.h index 9548e102..cb6c4cf8 100644 --- a/hal/src/fsfw_hal/stm32h7/spi/SpiComIF.h +++ b/hal/src/fsfw_hal/stm32h7/spi/SpiComIF.h @@ -60,7 +60,6 @@ public: void addDmaHandles(DMA_HandleTypeDef* txHandle, DMA_HandleTypeDef* rxHandle); ReturnValue_t initialize() override; -protected: // DeviceCommunicationIF overrides virtual ReturnValue_t initializeInterface(CookieIF * cookie) override; @@ -72,7 +71,7 @@ protected: virtual ReturnValue_t readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) override; -private: +protected: struct SpiInstance { SpiInstance(size_t maxRecvSize): replyBuffer(std::vector(maxRecvSize)) {} From d675621b73e86449ffe88298bcc09d5582b1c5c9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 27 Oct 2021 17:31:04 +0200 Subject: [PATCH 372/389] grouping CS gpio definition --- hal/src/fsfw_hal/stm32h7/spi/SpiCookie.cpp | 10 +++++----- hal/src/fsfw_hal/stm32h7/spi/SpiCookie.h | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/hal/src/fsfw_hal/stm32h7/spi/SpiCookie.cpp b/hal/src/fsfw_hal/stm32h7/spi/SpiCookie.cpp index 88f1e1f1..e9cbac8e 100644 --- a/hal/src/fsfw_hal/stm32h7/spi/SpiCookie.cpp +++ b/hal/src/fsfw_hal/stm32h7/spi/SpiCookie.cpp @@ -3,10 +3,10 @@ SpiCookie::SpiCookie(address_t deviceAddress, spi::SpiBus spiIdx, spi::TransferModes transferMode, spi::MspCfgBase* mspCfg, uint32_t spiSpeed, spi::SpiModes spiMode, - uint16_t chipSelectGpioPin, GPIO_TypeDef* chipSelectGpioPort, size_t maxRecvSize): + size_t maxRecvSize, GpioPair csGpio): deviceAddress(deviceAddress), spiIdx(spiIdx), spiSpeed(spiSpeed), spiMode(spiMode), - transferMode(transferMode), chipSelectGpioPin(chipSelectGpioPin), - chipSelectGpioPort(chipSelectGpioPort), mspCfg(mspCfg), maxRecvSize(maxRecvSize) { + transferMode(transferMode), csGpio(csGpio), + mspCfg(mspCfg), maxRecvSize(maxRecvSize) { spiHandle.Init.DataSize = SPI_DATASIZE_8BIT; spiHandle.Init.FirstBit = SPI_FIRSTBIT_MSB; spiHandle.Init.TIMode = SPI_TIMODE_DISABLE; @@ -24,11 +24,11 @@ SpiCookie::SpiCookie(address_t deviceAddress, spi::SpiBus spiIdx, spi::TransferM } uint16_t SpiCookie::getChipSelectGpioPin() const { - return chipSelectGpioPin; + return csGpio.second; } GPIO_TypeDef* SpiCookie::getChipSelectGpioPort() { - return chipSelectGpioPort; + return csGpio.first; } address_t SpiCookie::getDeviceAddress() const { diff --git a/hal/src/fsfw_hal/stm32h7/spi/SpiCookie.h b/hal/src/fsfw_hal/stm32h7/spi/SpiCookie.h index 45226b4a..f5698999 100644 --- a/hal/src/fsfw_hal/stm32h7/spi/SpiCookie.h +++ b/hal/src/fsfw_hal/stm32h7/spi/SpiCookie.h @@ -8,6 +8,8 @@ #include "stm32h743xx.h" +#include + /** * @brief SPI cookie implementation for the STM32H7 device family * @details @@ -18,6 +20,12 @@ class SpiCookie: public CookieIF { friend class SpiComIF; public: + /** + * Typedef for STM32 GPIO pair where the first entry is the port used (e.g. GPIOA) + * and the second entry is the pin number + */ + using GpioPair = std::pair; + /** * Allows construction of a SPI cookie for a connected SPI device * @param deviceAddress @@ -32,10 +40,11 @@ public: * definitions supplied in the MCU header file! (e.g. GPIO_PIN_X) * @param chipSelectGpioPort GPIO port (e.g. GPIOA) * @param maxRecvSize Maximum expected receive size. Chose as small as possible. + * @param csGpio Optional CS GPIO definition. */ SpiCookie(address_t deviceAddress, spi::SpiBus spiIdx, spi::TransferModes transferMode, spi::MspCfgBase* mspCfg, uint32_t spiSpeed, spi::SpiModes spiMode, - uint16_t chipSelectGpioPin, GPIO_TypeDef* chipSelectGpioPort, size_t maxRecvSize); + size_t maxRecvSize, GpioPair csGpio = GpioPair(nullptr, 0)); uint16_t getChipSelectGpioPin() const; GPIO_TypeDef* getChipSelectGpioPort(); @@ -55,8 +64,8 @@ private: spi::SpiModes spiMode; spi::TransferModes transferMode; volatile spi::TransferStates transferState = spi::TransferStates::IDLE; - uint16_t chipSelectGpioPin; - GPIO_TypeDef* chipSelectGpioPort; + GpioPair csGpio; + // The MSP configuration is cached here. Be careful when using this, it is automatically // deleted by the SPI communication interface if it is not required anymore! spi::MspCfgBase* mspCfg = nullptr; From cb7399b9998e9ec2d6439c5eb75c8312641770a4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 27 Oct 2021 18:05:18 +0200 Subject: [PATCH 373/389] msp init improvements --- hal/src/fsfw_hal/stm32h7/definitions.h | 25 ++++++++++ hal/src/fsfw_hal/stm32h7/spi/SpiCookie.cpp | 6 +-- hal/src/fsfw_hal/stm32h7/spi/SpiCookie.h | 10 ++-- hal/src/fsfw_hal/stm32h7/spi/mspInit.cpp | 28 +++++------ hal/src/fsfw_hal/stm32h7/spi/mspInit.h | 50 +++++++++++++------ .../fsfw_hal/stm32h7/spi/stm32h743ziSpi.cpp | 22 ++++---- 6 files changed, 90 insertions(+), 51 deletions(-) create mode 100644 hal/src/fsfw_hal/stm32h7/definitions.h diff --git a/hal/src/fsfw_hal/stm32h7/definitions.h b/hal/src/fsfw_hal/stm32h7/definitions.h new file mode 100644 index 00000000..af63a541 --- /dev/null +++ b/hal/src/fsfw_hal/stm32h7/definitions.h @@ -0,0 +1,25 @@ +#ifndef FSFW_HAL_STM32H7_DEFINITIONS_H_ +#define FSFW_HAL_STM32H7_DEFINITIONS_H_ + +#include +#include "stm32h7xx.h" + +namespace stm32h7 { + +/** + * Typedef for STM32 GPIO pair where the first entry is the port used (e.g. GPIOA) + * and the second entry is the pin number + */ +struct GpioCfg { + GpioCfg(): port(nullptr), pin(0), altFnc(0) {}; + + GpioCfg(GPIO_TypeDef* port, uint16_t pin, uint8_t altFnc = 0): + port(port), pin(pin), altFnc(altFnc) {}; + GPIO_TypeDef* port; + uint16_t pin; + uint8_t altFnc; +}; + +} + +#endif /* #ifndef FSFW_HAL_STM32H7_DEFINITIONS_H_ */ diff --git a/hal/src/fsfw_hal/stm32h7/spi/SpiCookie.cpp b/hal/src/fsfw_hal/stm32h7/spi/SpiCookie.cpp index e9cbac8e..200d4651 100644 --- a/hal/src/fsfw_hal/stm32h7/spi/SpiCookie.cpp +++ b/hal/src/fsfw_hal/stm32h7/spi/SpiCookie.cpp @@ -3,7 +3,7 @@ SpiCookie::SpiCookie(address_t deviceAddress, spi::SpiBus spiIdx, spi::TransferModes transferMode, spi::MspCfgBase* mspCfg, uint32_t spiSpeed, spi::SpiModes spiMode, - size_t maxRecvSize, GpioPair csGpio): + size_t maxRecvSize, stm32h7::GpioCfg csGpio): deviceAddress(deviceAddress), spiIdx(spiIdx), spiSpeed(spiSpeed), spiMode(spiMode), transferMode(transferMode), csGpio(csGpio), mspCfg(mspCfg), maxRecvSize(maxRecvSize) { @@ -24,11 +24,11 @@ SpiCookie::SpiCookie(address_t deviceAddress, spi::SpiBus spiIdx, spi::TransferM } uint16_t SpiCookie::getChipSelectGpioPin() const { - return csGpio.second; + return csGpio.pin; } GPIO_TypeDef* SpiCookie::getChipSelectGpioPort() { - return csGpio.first; + return csGpio.port; } address_t SpiCookie::getDeviceAddress() const { diff --git a/hal/src/fsfw_hal/stm32h7/spi/SpiCookie.h b/hal/src/fsfw_hal/stm32h7/spi/SpiCookie.h index f5698999..56c6e800 100644 --- a/hal/src/fsfw_hal/stm32h7/spi/SpiCookie.h +++ b/hal/src/fsfw_hal/stm32h7/spi/SpiCookie.h @@ -3,6 +3,7 @@ #include "spiDefinitions.h" #include "mspInit.h" +#include "../definitions.h" #include "fsfw/devicehandlers/CookieIF.h" @@ -20,11 +21,6 @@ class SpiCookie: public CookieIF { friend class SpiComIF; public: - /** - * Typedef for STM32 GPIO pair where the first entry is the port used (e.g. GPIOA) - * and the second entry is the pin number - */ - using GpioPair = std::pair; /** * Allows construction of a SPI cookie for a connected SPI device @@ -44,7 +40,7 @@ public: */ SpiCookie(address_t deviceAddress, spi::SpiBus spiIdx, spi::TransferModes transferMode, spi::MspCfgBase* mspCfg, uint32_t spiSpeed, spi::SpiModes spiMode, - size_t maxRecvSize, GpioPair csGpio = GpioPair(nullptr, 0)); + size_t maxRecvSize, stm32h7::GpioCfg csGpio = stm32h7::GpioCfg(nullptr, 0, 0)); uint16_t getChipSelectGpioPin() const; GPIO_TypeDef* getChipSelectGpioPort(); @@ -64,7 +60,7 @@ private: spi::SpiModes spiMode; spi::TransferModes transferMode; volatile spi::TransferStates transferState = spi::TransferStates::IDLE; - GpioPair csGpio; + stm32h7::GpioCfg csGpio; // The MSP configuration is cached here. Be careful when using this, it is automatically // deleted by the SPI communication interface if it is not required anymore! diff --git a/hal/src/fsfw_hal/stm32h7/spi/mspInit.cpp b/hal/src/fsfw_hal/stm32h7/spi/mspInit.cpp index 4df61f9b..b7ff2f70 100644 --- a/hal/src/fsfw_hal/stm32h7/spi/mspInit.cpp +++ b/hal/src/fsfw_hal/stm32h7/spi/mspInit.cpp @@ -118,40 +118,40 @@ void spi::halMspInitPolling(SPI_HandleTypeDef* hspi, MspCfgBase* cfgBase) { GPIO_InitTypeDef GPIO_InitStruct = {}; /*##-1- Enable peripherals and GPIO Clocks #################################*/ /* Enable GPIO TX/RX clock */ - cfg->setupMacroWrapper(); + cfg->setupCb(); /*##-2- Configure peripheral GPIO ##########################################*/ /* SPI SCK GPIO pin configuration */ - GPIO_InitStruct.Pin = cfg->sckPin; + GPIO_InitStruct.Pin = cfg->sck.pin; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_PULLDOWN; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; - GPIO_InitStruct.Alternate = cfg->sckAlternateFunction; - HAL_GPIO_Init(cfg->sckPort, &GPIO_InitStruct); + GPIO_InitStruct.Alternate = cfg->sck.altFnc; + HAL_GPIO_Init(cfg->sck.port, &GPIO_InitStruct); /* SPI MISO GPIO pin configuration */ - GPIO_InitStruct.Pin = cfg->misoPin; - GPIO_InitStruct.Alternate = cfg->misoAlternateFunction; - HAL_GPIO_Init(cfg->misoPort, &GPIO_InitStruct); + GPIO_InitStruct.Pin = cfg->miso.pin; + GPIO_InitStruct.Alternate = cfg->miso.altFnc; + HAL_GPIO_Init(cfg->miso.port, &GPIO_InitStruct); /* SPI MOSI GPIO pin configuration */ - GPIO_InitStruct.Pin = cfg->mosiPin; - GPIO_InitStruct.Alternate = cfg->mosiAlternateFunction; - HAL_GPIO_Init(cfg->mosiPort, &GPIO_InitStruct); + GPIO_InitStruct.Pin = cfg->mosi.pin; + GPIO_InitStruct.Alternate = cfg->mosi.altFnc; + HAL_GPIO_Init(cfg->mosi.port, &GPIO_InitStruct); } void spi::halMspDeinitPolling(SPI_HandleTypeDef* hspi, MspCfgBase* cfgBase) { auto cfg = reinterpret_cast(cfgBase); // Reset peripherals - cfg->cleanUpMacroWrapper(); + cfg->cleanupCb(); // Disable peripherals and GPIO Clocks /* Configure SPI SCK as alternate function */ - HAL_GPIO_DeInit(cfg->sckPort, cfg->sckPin); + HAL_GPIO_DeInit(cfg->sck.port, cfg->sck.pin); /* Configure SPI MISO as alternate function */ - HAL_GPIO_DeInit(cfg->misoPort, cfg->misoPin); + HAL_GPIO_DeInit(cfg->miso.port, cfg->miso.pin); /* Configure SPI MOSI as alternate function */ - HAL_GPIO_DeInit(cfg->mosiPort, cfg->mosiPin); + HAL_GPIO_DeInit(cfg->mosi.port, cfg->mosi.pin); } void spi::halMspInitInterrupt(SPI_HandleTypeDef* hspi, MspCfgBase* cfgBase) { diff --git a/hal/src/fsfw_hal/stm32h7/spi/mspInit.h b/hal/src/fsfw_hal/stm32h7/spi/mspInit.h index e6de2f8e..0fb553f7 100644 --- a/hal/src/fsfw_hal/stm32h7/spi/mspInit.h +++ b/hal/src/fsfw_hal/stm32h7/spi/mspInit.h @@ -2,6 +2,7 @@ #define FSFW_HAL_STM32H7_SPI_MSPINIT_H_ #include "spiDefinitions.h" +#include "../definitions.h" #include "../dma.h" #include "stm32h7xx_hal_spi.h" @@ -12,6 +13,8 @@ extern "C" { #endif +using mspCb = void (*) (void); + /** * @brief This file provides MSP implementation for DMA, IRQ and Polling mode for the * SPI peripheral. This configuration is required for the SPI communication to work. @@ -19,27 +22,37 @@ extern "C" { namespace spi { struct MspCfgBase { + MspCfgBase(); + MspCfgBase(stm32h7::GpioCfg sck, stm32h7::GpioCfg mosi, stm32h7::GpioCfg miso, + mspCb cleanupCb = nullptr, mspCb setupCb = nullptr): + sck(sck), mosi(mosi), miso(miso), cleanupCb(cleanupCb), + setupCb(setupCb) {} + virtual ~MspCfgBase() = default; - void (* cleanUpMacroWrapper) (void) = nullptr; - void (* setupMacroWrapper) (void) = nullptr; + stm32h7::GpioCfg sck; + stm32h7::GpioCfg mosi; + stm32h7::GpioCfg miso; - GPIO_TypeDef* sckPort = nullptr; - uint32_t sckPin = 0; - uint8_t sckAlternateFunction = 0; - GPIO_TypeDef* mosiPort = nullptr; - uint32_t mosiPin = 0; - uint8_t mosiAlternateFunction = 0; - GPIO_TypeDef* misoPort = nullptr; - uint32_t misoPin = 0; - uint8_t misoAlternateFunction = 0; + mspCb cleanupCb = nullptr; + mspCb setupCb = nullptr; }; -struct MspPollingConfigStruct: public MspCfgBase {}; +struct MspPollingConfigStruct: public MspCfgBase { + MspPollingConfigStruct(): MspCfgBase() {}; + MspPollingConfigStruct(stm32h7::GpioCfg sck, stm32h7::GpioCfg mosi, stm32h7::GpioCfg miso, + mspCb cleanupCb = nullptr, mspCb setupCb = nullptr): + MspCfgBase(sck, mosi, miso, cleanupCb, setupCb) {} +}; /* A valid instance of this struct must be passed to the MSP initialization function as a void* argument */ struct MspIrqConfigStruct: public MspPollingConfigStruct { + MspIrqConfigStruct(): MspPollingConfigStruct() {}; + MspIrqConfigStruct(stm32h7::GpioCfg sck, stm32h7::GpioCfg mosi, stm32h7::GpioCfg miso, + mspCb cleanupCb = nullptr, mspCb setupCb = nullptr): + MspPollingConfigStruct(sck, mosi, miso, cleanupCb, setupCb) {} + SpiBus spiBus = SpiBus::SPI_1; user_handler_t spiIrqHandler = nullptr; user_args_t spiUserArgs = nullptr; @@ -53,11 +66,16 @@ struct MspIrqConfigStruct: public MspPollingConfigStruct { /* A valid instance of this struct must be passed to the MSP initialization function as a void* argument */ struct MspDmaConfigStruct: public MspIrqConfigStruct { + MspDmaConfigStruct(): MspIrqConfigStruct() {}; + MspDmaConfigStruct(stm32h7::GpioCfg sck, stm32h7::GpioCfg mosi, stm32h7::GpioCfg miso, + mspCb cleanupCb = nullptr, mspCb setupCb = nullptr): + MspIrqConfigStruct(sck, mosi, miso, cleanupCb, setupCb) {} void (* dmaClkEnableWrapper) (void) = nullptr; - dma::DMAIndexes txDmaIndex; - dma::DMAIndexes rxDmaIndex; - dma::DMAStreams txDmaStream; - dma::DMAStreams rxDmaStream; + + dma::DMAIndexes txDmaIndex = dma::DMAIndexes::DMA_1; + dma::DMAIndexes rxDmaIndex = dma::DMAIndexes::DMA_1; + dma::DMAStreams txDmaStream = dma::DMAStreams::STREAM_0; + dma::DMAStreams rxDmaStream = dma::DMAStreams::STREAM_0; IRQn_Type txDmaIrqNumber = DMA1_Stream0_IRQn; IRQn_Type rxDmaIrqNumber = DMA1_Stream1_IRQn; // Priorities for NVIC diff --git a/hal/src/fsfw_hal/stm32h7/spi/stm32h743ziSpi.cpp b/hal/src/fsfw_hal/stm32h7/spi/stm32h743ziSpi.cpp index 43194704..8247d002 100644 --- a/hal/src/fsfw_hal/stm32h7/spi/stm32h743ziSpi.cpp +++ b/hal/src/fsfw_hal/stm32h7/spi/stm32h743ziSpi.cpp @@ -23,17 +23,17 @@ void spiDmaClockEnableWrapper() { } void spi::h743zi::standardPollingCfg(MspPollingConfigStruct& cfg) { - cfg.setupMacroWrapper = &spiSetupWrapper; - cfg.cleanUpMacroWrapper = &spiCleanUpWrapper; - cfg.sckPort = GPIOA; - cfg.sckPin = GPIO_PIN_5; - cfg.misoPort = GPIOA; - cfg.misoPin = GPIO_PIN_6; - cfg.mosiPort = GPIOA; - cfg.mosiPin = GPIO_PIN_7; - cfg.sckAlternateFunction = GPIO_AF5_SPI1; - cfg.mosiAlternateFunction = GPIO_AF5_SPI1; - cfg.misoAlternateFunction = GPIO_AF5_SPI1; + cfg.setupCb = &spiSetupWrapper; + cfg.cleanupCb = &spiCleanUpWrapper; + cfg.sck.port = GPIOA; + cfg.sck.pin = GPIO_PIN_5; + cfg.miso.port = GPIOA; + cfg.miso.pin = GPIO_PIN_6; + cfg.mosi.port = GPIOA; + cfg.mosi.pin = GPIO_PIN_7; + cfg.sck.altFnc = GPIO_AF5_SPI1; + cfg.mosi.altFnc = GPIO_AF5_SPI1; + cfg.miso.altFnc = GPIO_AF5_SPI1; } void spi::h743zi::standardInterruptCfg(MspIrqConfigStruct& cfg, IrqPriorities spiIrqPrio, From 7c855592d05ecfc017e9806f87e40a11f8c75a8a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 27 Oct 2021 18:11:56 +0200 Subject: [PATCH 374/389] more cleaning up --- hal/src/fsfw_hal/stm32h7/devicetest/GyroL3GD20H.cpp | 8 ++++---- hal/src/fsfw_hal/stm32h7/spi/CMakeLists.txt | 2 +- .../spi/{stm32h743ziSpi.cpp => stm32h743zi.cpp} | 10 +++++----- .../stm32h7/spi/{stm32h743ziSpi.h => stm32h743zi.h} | 11 +++++------ 4 files changed, 15 insertions(+), 16 deletions(-) rename hal/src/fsfw_hal/stm32h7/spi/{stm32h743ziSpi.cpp => stm32h743zi.cpp} (88%) rename hal/src/fsfw_hal/stm32h7/spi/{stm32h743ziSpi.h => stm32h743zi.h} (64%) diff --git a/hal/src/fsfw_hal/stm32h7/devicetest/GyroL3GD20H.cpp b/hal/src/fsfw_hal/stm32h7/devicetest/GyroL3GD20H.cpp index 051be344..d1fdd1e5 100644 --- a/hal/src/fsfw_hal/stm32h7/devicetest/GyroL3GD20H.cpp +++ b/hal/src/fsfw_hal/stm32h7/devicetest/GyroL3GD20H.cpp @@ -4,7 +4,7 @@ #include "fsfw_hal/stm32h7/spi/spiDefinitions.h" #include "fsfw_hal/stm32h7/spi/spiCore.h" #include "fsfw_hal/stm32h7/spi/spiInterrupts.h" -#include "fsfw_hal/stm32h7/spi/stm32h743ziSpi.h" +#include "fsfw_hal/stm32h7/spi/stm32h743zi.h" #include "fsfw/tasks/TaskFactory.h" #include "fsfw/serviceinterface/ServiceInterface.h" @@ -33,20 +33,20 @@ GyroL3GD20H::GyroL3GD20H(SPI_HandleTypeDef *spiHandle, spi::TransferModes transf mspCfg = new spi::MspDmaConfigStruct(); auto typedCfg = dynamic_cast(mspCfg); spi::setDmaHandles(txDmaHandle, rxDmaHandle); - spi::h743zi::standardDmaCfg(*typedCfg, IrqPriorities::HIGHEST_FREERTOS, + stm32h7::h743zi::standardDmaCfg(*typedCfg, IrqPriorities::HIGHEST_FREERTOS, IrqPriorities::HIGHEST_FREERTOS, IrqPriorities::HIGHEST_FREERTOS); spi::setSpiDmaMspFunctions(typedCfg); } else if(transferMode == spi::TransferModes::INTERRUPT) { mspCfg = new spi::MspIrqConfigStruct(); auto typedCfg = dynamic_cast(mspCfg); - spi::h743zi::standardInterruptCfg(*typedCfg, IrqPriorities::HIGHEST_FREERTOS); + stm32h7::h743zi::standardInterruptCfg(*typedCfg, IrqPriorities::HIGHEST_FREERTOS); spi::setSpiIrqMspFunctions(typedCfg); } else if(transferMode == spi::TransferModes::POLLING) { mspCfg = new spi::MspPollingConfigStruct(); auto typedCfg = dynamic_cast(mspCfg); - spi::h743zi::standardPollingCfg(*typedCfg); + stm32h7::h743zi::standardPollingCfg(*typedCfg); spi::setSpiPollingMspFunctions(typedCfg); } diff --git a/hal/src/fsfw_hal/stm32h7/spi/CMakeLists.txt b/hal/src/fsfw_hal/stm32h7/spi/CMakeLists.txt index e28c35aa..aa5541bc 100644 --- a/hal/src/fsfw_hal/stm32h7/spi/CMakeLists.txt +++ b/hal/src/fsfw_hal/stm32h7/spi/CMakeLists.txt @@ -5,5 +5,5 @@ target_sources(${LIB_FSFW_NAME} PRIVATE mspInit.cpp SpiCookie.cpp SpiComIF.cpp - stm32h743ziSpi.cpp + stm32h743zi.cpp ) diff --git a/hal/src/fsfw_hal/stm32h7/spi/stm32h743ziSpi.cpp b/hal/src/fsfw_hal/stm32h7/spi/stm32h743zi.cpp similarity index 88% rename from hal/src/fsfw_hal/stm32h7/spi/stm32h743ziSpi.cpp rename to hal/src/fsfw_hal/stm32h7/spi/stm32h743zi.cpp index 8247d002..1bafccd5 100644 --- a/hal/src/fsfw_hal/stm32h7/spi/stm32h743ziSpi.cpp +++ b/hal/src/fsfw_hal/stm32h7/spi/stm32h743zi.cpp @@ -1,4 +1,4 @@ -#include "fsfw_hal/stm32h7/spi/stm32h743ziSpi.h" +#include "fsfw_hal/stm32h7/spi/stm32h743zi.h" #include "fsfw_hal/stm32h7/spi/spiCore.h" #include "fsfw_hal/stm32h7/spi/spiInterrupts.h" @@ -22,7 +22,7 @@ void spiDmaClockEnableWrapper() { __HAL_RCC_DMA2_CLK_ENABLE(); } -void spi::h743zi::standardPollingCfg(MspPollingConfigStruct& cfg) { +void stm32h7::h743zi::standardPollingCfg(spi::MspPollingConfigStruct& cfg) { cfg.setupCb = &spiSetupWrapper; cfg.cleanupCb = &spiCleanUpWrapper; cfg.sck.port = GPIOA; @@ -36,13 +36,13 @@ void spi::h743zi::standardPollingCfg(MspPollingConfigStruct& cfg) { cfg.miso.altFnc = GPIO_AF5_SPI1; } -void spi::h743zi::standardInterruptCfg(MspIrqConfigStruct& cfg, IrqPriorities spiIrqPrio, +void stm32h7::h743zi::standardInterruptCfg(spi::MspIrqConfigStruct& cfg, IrqPriorities spiIrqPrio, IrqPriorities spiSubprio) { // High, but works on FreeRTOS as well (priorities range from 0 to 15) cfg.preEmptPriority = spiIrqPrio; cfg.subpriority = spiSubprio; cfg.spiIrqNumber = SPI1_IRQn; - cfg.spiBus = SpiBus::SPI_1; + cfg.spiBus = spi::SpiBus::SPI_1; user_handler_t spiUserHandler = nullptr; user_args_t spiUserArgs = nullptr; getSpiUserHandler(spi::SpiBus::SPI_1, &spiUserHandler, &spiUserArgs); @@ -55,7 +55,7 @@ void spi::h743zi::standardInterruptCfg(MspIrqConfigStruct& cfg, IrqPriorities sp standardPollingCfg(cfg); } -void spi::h743zi::standardDmaCfg(MspDmaConfigStruct& cfg, IrqPriorities spiIrqPrio, +void stm32h7::h743zi::standardDmaCfg(spi::MspDmaConfigStruct& cfg, IrqPriorities spiIrqPrio, IrqPriorities txIrqPrio, IrqPriorities rxIrqPrio, IrqPriorities spiSubprio, IrqPriorities txSubprio, IrqPriorities rxSubprio) { cfg.dmaClkEnableWrapper = &spiDmaClockEnableWrapper; diff --git a/hal/src/fsfw_hal/stm32h7/spi/stm32h743ziSpi.h b/hal/src/fsfw_hal/stm32h7/spi/stm32h743zi.h similarity index 64% rename from hal/src/fsfw_hal/stm32h7/spi/stm32h743ziSpi.h rename to hal/src/fsfw_hal/stm32h7/spi/stm32h743zi.h index 87689add..daa95554 100644 --- a/hal/src/fsfw_hal/stm32h7/spi/stm32h743ziSpi.h +++ b/hal/src/fsfw_hal/stm32h7/spi/stm32h743zi.h @@ -3,21 +3,20 @@ #include "mspInit.h" -namespace spi { +namespace stm32h7 { namespace h743zi { -void standardPollingCfg(MspPollingConfigStruct& cfg); -void standardInterruptCfg(MspIrqConfigStruct& cfg, IrqPriorities spiIrqPrio, +void standardPollingCfg(spi::MspPollingConfigStruct& cfg); +void standardInterruptCfg(spi::MspIrqConfigStruct& cfg, IrqPriorities spiIrqPrio, IrqPriorities spiSubprio = HIGHEST); -void standardDmaCfg(MspDmaConfigStruct& cfg, IrqPriorities spiIrqPrio, +void standardDmaCfg(spi::MspDmaConfigStruct& cfg, IrqPriorities spiIrqPrio, IrqPriorities txIrqPrio, IrqPriorities rxIrqPrio, IrqPriorities spiSubprio = HIGHEST, IrqPriorities txSubPrio = HIGHEST, IrqPriorities rxSubprio = HIGHEST); + } } - - #endif /* FSFW_HAL_STM32H7_SPI_STM32H743ZISPI_H_ */ From 36aaf3d75800db7e2d9f7229fdd95068fdb17481 Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Wed, 27 Oct 2021 20:41:04 +0200 Subject: [PATCH 375/389] say hi to my new friend valgrind --- tests/src/fsfw_tests/unit/container/RingBufferTest.cpp | 4 ++-- .../fsfw_tests/unit/datapoollocal/LocalPoolManagerTest.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/src/fsfw_tests/unit/container/RingBufferTest.cpp b/tests/src/fsfw_tests/unit/container/RingBufferTest.cpp index 819401ab..0be8b2a7 100644 --- a/tests/src/fsfw_tests/unit/container/RingBufferTest.cpp +++ b/tests/src/fsfw_tests/unit/container/RingBufferTest.cpp @@ -78,7 +78,7 @@ TEST_CASE("Ring Buffer Test" , "[RingBufferTest]") { TEST_CASE("Ring Buffer Test2" , "[RingBufferTest2]") { uint8_t testData[13]= {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; uint8_t readBuffer[10] = {13, 13, 13, 13, 13, 13, 13, 13, 13, 13}; - uint8_t* newBuffer = new uint8_t[10]; + uint8_t* newBuffer = new uint8_t[15]; SimpleRingBuffer ringBuffer(newBuffer, 10, true, 5); SECTION("Simple Test") { @@ -168,7 +168,7 @@ TEST_CASE("Ring Buffer Test2" , "[RingBufferTest2]") { TEST_CASE("Ring Buffer Test3" , "[RingBufferTest3]") { uint8_t testData[13]= {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; uint8_t readBuffer[10] = {13, 13, 13, 13, 13, 13, 13, 13, 13, 13}; - uint8_t* newBuffer = new uint8_t[10]; + uint8_t* newBuffer = new uint8_t[25]; SimpleRingBuffer ringBuffer(newBuffer, 10, true, 15); SECTION("Simple Test") { diff --git a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolManagerTest.cpp b/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolManagerTest.cpp index 7b2f9412..b1160254 100644 --- a/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolManagerTest.cpp +++ b/tests/src/fsfw_tests/unit/datapoollocal/LocalPoolManagerTest.cpp @@ -143,7 +143,7 @@ TEST_CASE("LocalPoolManagerTest" , "[LocManTest]") { CHECK(cdsShort.msDay_h == Catch::Approx(timeCdsNow.msDay_h).margin(1)); CHECK(cdsShort.msDay_hh == Catch::Approx(timeCdsNow.msDay_hh).margin(1)); CHECK(cdsShort.msDay_l == Catch::Approx(timeCdsNow.msDay_l).margin(1)); - CHECK(cdsShort.msDay_ll == Catch::Approx(timeCdsNow.msDay_ll).margin(1)); + CHECK(cdsShort.msDay_ll == Catch::Approx(timeCdsNow.msDay_ll).margin(5)); } SECTION("VariableSnapshotTest") { @@ -205,7 +205,7 @@ TEST_CASE("LocalPoolManagerTest" , "[LocManTest]") { CHECK(cdsShort.msDay_h == Catch::Approx(timeCdsNow.msDay_h).margin(1)); CHECK(cdsShort.msDay_hh == Catch::Approx(timeCdsNow.msDay_hh).margin(1)); CHECK(cdsShort.msDay_l == Catch::Approx(timeCdsNow.msDay_l).margin(1)); - CHECK(cdsShort.msDay_ll == Catch::Approx(timeCdsNow.msDay_ll).margin(1)); + CHECK(cdsShort.msDay_ll == Catch::Approx(timeCdsNow.msDay_ll).margin(5)); } SECTION("VariableNotificationTest") { From a53992fdc9127c435f7bdf1a68cdf1329aab31ff Mon Sep 17 00:00:00 2001 From: Ulrich Mohr Date: Wed, 27 Oct 2021 21:32:40 +0200 Subject: [PATCH 376/389] introducing valgrind --- automation/Dockerfile | 2 +- automation/Jenkinsfile | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/automation/Dockerfile b/automation/Dockerfile index 0526d8f0..93a4fe7d 100644 --- a/automation/Dockerfile +++ b/automation/Dockerfile @@ -5,4 +5,4 @@ RUN apt-get --yes upgrade #tzdata is a dependency, won't install otherwise ARG DEBIAN_FRONTEND=noninteractive -RUN apt-get --yes install gcc g++ cmake lcov git nano +RUN apt-get --yes install gcc g++ cmake make lcov git valgrind nano diff --git a/automation/Jenkinsfile b/automation/Jenkinsfile index 0cb973bd..d4a8e2ab 100644 --- a/automation/Jenkinsfile +++ b/automation/Jenkinsfile @@ -55,5 +55,18 @@ pipeline { } } } + stage('Valgrind') { + agent { + dockerfile { + dir 'automation' + reuseNode true + } + } + steps { + dir(BUILDDIR) { + sh 'valgrind --leak-check=full --error-exitcode=1 ./fsfw-tests' + } + } + } } } From 6d5eb5b387b05c8c9615de0544bd0fc355137a52 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 10 Nov 2021 18:48:02 +0100 Subject: [PATCH 377/389] Op Divider and bitutility updates - Added unittests for `PeriodicOperationDivider` and the `bitutil` helpers - Some API changes: Removed redundant bit part, because these functions are already in a namespace - Some bugfixes for `PeriodicOperationDivider` --- .../devicehandlers/MgmRM3100Handler.cpp | 2 +- .../datapoollocal/LocalPoolDataSetBase.cpp | 6 +- .../PeriodicOperationDivider.cpp | 39 +++++----- .../PeriodicOperationDivider.h | 77 +++++++++---------- src/fsfw/globalfunctions/bitutility.cpp | 11 +-- src/fsfw/globalfunctions/bitutility.h | 37 +++++++-- .../unit/datapoollocal/DataSetTest.cpp | 24 ++++-- .../unit/globalfunctions/CMakeLists.txt | 2 + .../unit/globalfunctions/testBitutil.cpp | 64 +++++++++++++++ .../unit/globalfunctions/testOpDivider.cpp | 64 +++++++++++++++ 10 files changed, 242 insertions(+), 84 deletions(-) create mode 100644 tests/src/fsfw_tests/unit/globalfunctions/testBitutil.cpp create mode 100644 tests/src/fsfw_tests/unit/globalfunctions/testOpDivider.cpp diff --git a/hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp b/hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp index 124eebbc..db4ea607 100644 --- a/hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp +++ b/hal/src/fsfw_hal/devicehandlers/MgmRM3100Handler.cpp @@ -186,7 +186,7 @@ ReturnValue_t MgmRM3100Handler::interpretDeviceReply(DeviceCommandId_t id, const uint8_t cmmValue = packet[1]; // We clear the seventh bit in any case // because this one is zero sometimes for some reason - bitutil::bitClear(&cmmValue, 6); + bitutil::clear(&cmmValue, 6); if(cmmValue == cmmRegValue and internalState == InternalState::READ_CMM) { commandExecuted = true; } diff --git a/src/fsfw/datapoollocal/LocalPoolDataSetBase.cpp b/src/fsfw/datapoollocal/LocalPoolDataSetBase.cpp index 5422c68a..d1ac0c7f 100644 --- a/src/fsfw/datapoollocal/LocalPoolDataSetBase.cpp +++ b/src/fsfw/datapoollocal/LocalPoolDataSetBase.cpp @@ -110,7 +110,7 @@ ReturnValue_t LocalPoolDataSetBase::serializeWithValidityBuffer(uint8_t **buffer for (uint16_t count = 0; count < fillCount; count++) { if(registeredVariables[count]->isValid()) { /* Set bit at correct position */ - bitutil::bitSet(validityPtr + validBufferIndex, validBufferIndexBit); + bitutil::set(validityPtr + validBufferIndex, validBufferIndexBit); } if(validBufferIndexBit == 7) { validBufferIndex ++; @@ -156,8 +156,8 @@ ReturnValue_t LocalPoolDataSetBase::deSerializeWithValidityBuffer( uint8_t validBufferIndexBit = 0; for (uint16_t count = 0; count < fillCount; count++) { // set validity buffer here. - bool nextVarValid = bitutil::bitGet(*buffer + - validBufferIndex, validBufferIndexBit); + bool nextVarValid = false; + bitutil::get(*buffer + validBufferIndex, validBufferIndexBit, nextVarValid); registeredVariables[count]->setValid(nextVarValid); if(validBufferIndexBit == 7) { diff --git a/src/fsfw/globalfunctions/PeriodicOperationDivider.cpp b/src/fsfw/globalfunctions/PeriodicOperationDivider.cpp index 62cc6f4c..ac6a78e4 100644 --- a/src/fsfw/globalfunctions/PeriodicOperationDivider.cpp +++ b/src/fsfw/globalfunctions/PeriodicOperationDivider.cpp @@ -2,43 +2,40 @@ PeriodicOperationDivider::PeriodicOperationDivider(uint32_t divider, - bool resetAutomatically): resetAutomatically(resetAutomatically), - counter(divider), divider(divider) { + bool resetAutomatically): resetAutomatically(resetAutomatically), + divider(divider) { } bool PeriodicOperationDivider::checkAndIncrement() { - bool opNecessary = check(); - if(opNecessary) { - if(resetAutomatically) { - counter = 0; - } - return opNecessary; - } - counter ++; - return opNecessary; + bool opNecessary = check(); + if(opNecessary and resetAutomatically) { + resetCounter(); + } + else { + counter++; + } + return opNecessary; } bool PeriodicOperationDivider::check() { - if(counter >= divider) { - return true; - } - return false; + if(counter >= divider) { + return true; + } + return false; } - - void PeriodicOperationDivider::resetCounter() { - counter = 0; + counter = 1; } void PeriodicOperationDivider::setDivider(uint32_t newDivider) { - divider = newDivider; + divider = newDivider; } uint32_t PeriodicOperationDivider::getCounter() const { - return counter; + return counter; } uint32_t PeriodicOperationDivider::getDivider() const { - return divider; + return divider; } diff --git a/src/fsfw/globalfunctions/PeriodicOperationDivider.h b/src/fsfw/globalfunctions/PeriodicOperationDivider.h index 7f7fb469..636849c0 100644 --- a/src/fsfw/globalfunctions/PeriodicOperationDivider.h +++ b/src/fsfw/globalfunctions/PeriodicOperationDivider.h @@ -13,51 +13,50 @@ */ class PeriodicOperationDivider { public: - /** - * Initialize with the desired divider and specify whether the internal - * counter will be reset automatically. - * @param divider - * @param resetAutomatically - */ - PeriodicOperationDivider(uint32_t divider, bool resetAutomatically = true); + /** + * Initialize with the desired divider and specify whether the internal + * counter will be reset automatically. + * @param divider Value of 0 or 1 will cause #check and #checkAndIncrement to always return + * true + * @param resetAutomatically + */ + PeriodicOperationDivider(uint32_t divider, bool resetAutomatically = true); + /** + * Check whether operation is necessary. If an operation is necessary and the class has been + * configured to be reset automatically, the counter will be reset to 1 automatically + * + * @return + * -@c true if the counter is larger or equal to the divider + * -@c false otherwise + */ + bool checkAndIncrement(); - /** - * Check whether operation is necessary. - * If an operation is necessary and the class has been - * configured to be reset automatically, the counter will be reset. - * - * @return - * -@c true if the counter is larger or equal to the divider - * -@c false otherwise - */ - bool checkAndIncrement(); + /** + * Checks whether an operation is necessary. This function will not increment the counter. + * @return + * -@c true if the counter is larger or equal to the divider + * -@c false otherwise + */ + bool check(); - /** - * Checks whether an operation is necessary. - * This function will not increment the counter! - * @return - * -@c true if the counter is larger or equal to the divider - * -@c false otherwise - */ - bool check(); + /** + * Can be used to reset the counter to 1 manually + */ + void resetCounter(); + uint32_t getCounter() const; - /** - * Can be used to reset the counter to 0 manually. - */ - void resetCounter(); - uint32_t getCounter() const; + /** + * Can be used to set a new divider value. + * @param newDivider + */ + void setDivider(uint32_t newDivider); + uint32_t getDivider() const; - /** - * Can be used to set a new divider value. - * @param newDivider - */ - void setDivider(uint32_t newDivider); - uint32_t getDivider() const; private: - bool resetAutomatically = true; - uint32_t counter = 0; - uint32_t divider = 0; + bool resetAutomatically = true; + uint32_t counter = 1; + uint32_t divider = 0; }; diff --git a/src/fsfw/globalfunctions/bitutility.cpp b/src/fsfw/globalfunctions/bitutility.cpp index 628e30c2..54e94a95 100644 --- a/src/fsfw/globalfunctions/bitutility.cpp +++ b/src/fsfw/globalfunctions/bitutility.cpp @@ -1,6 +1,6 @@ #include "fsfw/globalfunctions/bitutility.h" -void bitutil::bitSet(uint8_t *byte, uint8_t position) { +void bitutil::set(uint8_t *byte, uint8_t position) { if(position > 7) { return; } @@ -8,7 +8,7 @@ void bitutil::bitSet(uint8_t *byte, uint8_t position) { *byte |= 1 << shiftNumber; } -void bitutil::bitToggle(uint8_t *byte, uint8_t position) { +void bitutil::toggle(uint8_t *byte, uint8_t position) { if(position > 7) { return; } @@ -16,7 +16,7 @@ void bitutil::bitToggle(uint8_t *byte, uint8_t position) { *byte ^= 1 << shiftNumber; } -void bitutil::bitClear(uint8_t *byte, uint8_t position) { +void bitutil::clear(uint8_t *byte, uint8_t position) { if(position > 7) { return; } @@ -24,10 +24,11 @@ void bitutil::bitClear(uint8_t *byte, uint8_t position) { *byte &= ~(1 << shiftNumber); } -bool bitutil::bitGet(const uint8_t *byte, uint8_t position) { +bool bitutil::get(const uint8_t *byte, uint8_t position, bool& bit) { if(position > 7) { return false; } uint8_t shiftNumber = position + (7 - 2 * position); - return *byte & (1 << shiftNumber); + bit = *byte & (1 << shiftNumber); + return true; } diff --git a/src/fsfw/globalfunctions/bitutility.h b/src/fsfw/globalfunctions/bitutility.h index 1fc1290d..00f19310 100644 --- a/src/fsfw/globalfunctions/bitutility.h +++ b/src/fsfw/globalfunctions/bitutility.h @@ -5,13 +5,36 @@ namespace bitutil { -/* Helper functions for manipulating the individual bits of a byte. -Position refers to n-th bit of a byte, going from 0 (most significant bit) to -7 (least significant bit) */ -void bitSet(uint8_t* byte, uint8_t position); -void bitToggle(uint8_t* byte, uint8_t position); -void bitClear(uint8_t* byte, uint8_t position); -bool bitGet(const uint8_t* byte, uint8_t position); +// Helper functions for manipulating the individual bits of a byte. +// Position refers to n-th bit of a byte, going from 0 (most significant bit) to +// 7 (least significant bit) + +/** + * @brief Set the bit in a given byte + * @param byte + * @param position + */ +void set(uint8_t* byte, uint8_t position); +/** + * @brief Toggle the bit in a given byte + * @param byte + * @param position + */ +void toggle(uint8_t* byte, uint8_t position); +/** + * @brief Clear the bit in a given byte + * @param byte + * @param position + */ +void clear(uint8_t* byte, uint8_t position); +/** + * @brief Get the bit in a given byte + * @param byte + * @param position + * @param If the input is valid, this will be set to true if the bit is set and false otherwise. + * @return False if position is invalid, True otherwise + */ +bool get(const uint8_t* byte, uint8_t position, bool& bit); } diff --git a/tests/src/fsfw_tests/unit/datapoollocal/DataSetTest.cpp b/tests/src/fsfw_tests/unit/datapoollocal/DataSetTest.cpp index c967b241..e84f07b6 100644 --- a/tests/src/fsfw_tests/unit/datapoollocal/DataSetTest.cpp +++ b/tests/src/fsfw_tests/unit/datapoollocal/DataSetTest.cpp @@ -171,14 +171,19 @@ TEST_CASE("DataSetTest" , "[DataSetTest]") { /* We can do it like this because the buffer only has one byte for less than 8 variables */ uint8_t* validityByte = buffer + sizeof(buffer) - 1; - CHECK(bitutil::bitGet(validityByte, 0) == true); - CHECK(bitutil::bitGet(validityByte, 1) == false); - CHECK(bitutil::bitGet(validityByte, 2) == true); + bool bitSet = false; + bitutil::get(validityByte, 0, bitSet); + + CHECK(bitSet == true); + bitutil::get(validityByte, 1, bitSet); + CHECK(bitSet == false); + bitutil::get(validityByte, 2, bitSet); + CHECK(bitSet == true); /* Now we manipulate the validity buffer for the deserialization */ - bitutil::bitClear(validityByte, 0); - bitutil::bitSet(validityByte, 1); - bitutil::bitClear(validityByte, 2); + bitutil::clear(validityByte, 0); + bitutil::set(validityByte, 1); + bitutil::clear(validityByte, 2); /* Zero out everything except validity buffer */ std::memset(buffer, 0, sizeof(buffer) - 1); sizeToDeserialize = maxSize; @@ -239,8 +244,11 @@ TEST_CASE("DataSetTest" , "[DataSetTest]") { std::memcpy(validityBuffer.data(), buffer + 9 + sizeof(uint16_t) * 3, 2); /* The first 9 variables should be valid */ CHECK(validityBuffer[0] == 0xff); - CHECK(bitutil::bitGet(validityBuffer.data() + 1, 0) == true); - CHECK(bitutil::bitGet(validityBuffer.data() + 1, 1) == false); + bool bitSet = false; + bitutil::get(validityBuffer.data() + 1, 0, bitSet); + CHECK(bitSet == true); + bitutil::get(validityBuffer.data() + 1, 1, bitSet); + CHECK(bitSet == false); /* Now we invert the validity */ validityBuffer[0] = 0; diff --git a/tests/src/fsfw_tests/unit/globalfunctions/CMakeLists.txt b/tests/src/fsfw_tests/unit/globalfunctions/CMakeLists.txt index 209ce75f..3b29f23f 100644 --- a/tests/src/fsfw_tests/unit/globalfunctions/CMakeLists.txt +++ b/tests/src/fsfw_tests/unit/globalfunctions/CMakeLists.txt @@ -1,3 +1,5 @@ target_sources(${FSFW_TEST_TGT} PRIVATE testDleEncoder.cpp + testOpDivider.cpp + testBitutil.cpp ) diff --git a/tests/src/fsfw_tests/unit/globalfunctions/testBitutil.cpp b/tests/src/fsfw_tests/unit/globalfunctions/testBitutil.cpp new file mode 100644 index 00000000..2627adcf --- /dev/null +++ b/tests/src/fsfw_tests/unit/globalfunctions/testBitutil.cpp @@ -0,0 +1,64 @@ +#include "fsfw/globalfunctions/bitutility.h" +#include + +TEST_CASE("Bitutility" , "[Bitutility]") { + uint8_t dummyByte = 0; + bool bitSet = false; + for(uint8_t pos = 0; pos < 8; pos++) { + bitutil::set(&dummyByte, pos); + REQUIRE(dummyByte == (1 << (7 - pos))); + bitutil::get(&dummyByte, pos, bitSet); + REQUIRE(bitSet == 1); + dummyByte = 0; + } + + dummyByte = 0xff; + for(uint8_t pos = 0; pos < 8; pos++) { + bitutil::get(&dummyByte, pos, bitSet); + REQUIRE(bitSet == 1); + bitutil::clear(&dummyByte, pos); + bitutil::get(&dummyByte, pos, bitSet); + REQUIRE(bitSet == 0); + dummyByte = 0xff; + } + + dummyByte = 0xf0; + for(uint8_t pos = 0; pos < 8; pos++) { + if(pos < 4) { + bitutil::get(&dummyByte, pos, bitSet); + REQUIRE(bitSet == 1); + bitutil::toggle(&dummyByte, pos); + bitutil::get(&dummyByte, pos, bitSet); + REQUIRE(bitSet == 0); + } + else { + bitutil::get(&dummyByte, pos, bitSet); + REQUIRE(bitSet == false); + bitutil::toggle(&dummyByte, pos); + bitutil::get(&dummyByte, pos, bitSet); + REQUIRE(bitSet == true); + } + } + REQUIRE(dummyByte == 0x0f); + + dummyByte = 0; + bitutil::set(&dummyByte, 8); + REQUIRE(dummyByte == 0); + bitutil::set(&dummyByte, -1); + REQUIRE(dummyByte == 0); + dummyByte = 0xff; + bitutil::clear(&dummyByte, 8); + REQUIRE(dummyByte == 0xff); + bitutil::clear(&dummyByte, -1); + REQUIRE(dummyByte == 0xff); + dummyByte = 0x00; + bitutil::toggle(&dummyByte, 8); + REQUIRE(dummyByte == 0x00); + bitutil::toggle(&dummyByte, -1); + REQUIRE(dummyByte == 0x00); + + REQUIRE(bitutil::get(&dummyByte, 8, bitSet) == false); +} + + + diff --git a/tests/src/fsfw_tests/unit/globalfunctions/testOpDivider.cpp b/tests/src/fsfw_tests/unit/globalfunctions/testOpDivider.cpp new file mode 100644 index 00000000..c02ada83 --- /dev/null +++ b/tests/src/fsfw_tests/unit/globalfunctions/testOpDivider.cpp @@ -0,0 +1,64 @@ +#include "fsfw/globalfunctions/PeriodicOperationDivider.h" +#include + +TEST_CASE("OpDivider" , "[OpDivider]") { + auto opDivider = PeriodicOperationDivider(1); + REQUIRE(opDivider.getDivider() == 1); + REQUIRE(opDivider.getCounter() == 1); + REQUIRE(opDivider.check() == true); + REQUIRE(opDivider.checkAndIncrement() == true); + REQUIRE(opDivider.getCounter() == 1); + REQUIRE(opDivider.check() == true); + REQUIRE(opDivider.checkAndIncrement() == true); + REQUIRE(opDivider.checkAndIncrement() == true); + + opDivider.setDivider(0); + REQUIRE(opDivider.getCounter() == 1); + REQUIRE(opDivider.checkAndIncrement() == true); + REQUIRE(opDivider.getCounter() == 1); + REQUIRE(opDivider.checkAndIncrement() == true); + REQUIRE(opDivider.checkAndIncrement() == true); + + opDivider.setDivider(2); + opDivider.resetCounter(); + REQUIRE(opDivider.getDivider() == 2); + REQUIRE(opDivider.getCounter() == 1); + REQUIRE(opDivider.check() == false); + REQUIRE(opDivider.checkAndIncrement() == false); + REQUIRE(opDivider.getCounter() == 2); + REQUIRE(opDivider.check() == true); + REQUIRE(opDivider.checkAndIncrement() == true); + REQUIRE(opDivider.getCounter() == 1); + REQUIRE(opDivider.check() == false); + REQUIRE(opDivider.checkAndIncrement() == false); + REQUIRE(opDivider.getCounter() == 2); + REQUIRE(opDivider.checkAndIncrement() == true); + REQUIRE(opDivider.checkAndIncrement() == false); + REQUIRE(opDivider.checkAndIncrement() == true); + REQUIRE(opDivider.checkAndIncrement() == false); + + opDivider.setDivider(3); + opDivider.resetCounter(); + REQUIRE(opDivider.checkAndIncrement() == false); + REQUIRE(opDivider.checkAndIncrement() == false); + REQUIRE(opDivider.getCounter() == 3); + REQUIRE(opDivider.checkAndIncrement() == true); + REQUIRE(opDivider.getCounter() == 1); + REQUIRE(opDivider.checkAndIncrement() == false); + + auto opDividerNonResetting = PeriodicOperationDivider(2, false); + REQUIRE(opDividerNonResetting.getCounter() == 1); + REQUIRE(opDividerNonResetting.check() == false); + REQUIRE(opDividerNonResetting.checkAndIncrement() == false); + REQUIRE(opDividerNonResetting.getCounter() == 2); + REQUIRE(opDividerNonResetting.check() == true); + REQUIRE(opDividerNonResetting.checkAndIncrement() == true); + REQUIRE(opDividerNonResetting.getCounter() == 3); + REQUIRE(opDividerNonResetting.checkAndIncrement() == true); + REQUIRE(opDividerNonResetting.getCounter() == 4); + opDividerNonResetting.resetCounter(); + REQUIRE(opDividerNonResetting.getCounter() == 1); + REQUIRE(opDividerNonResetting.check() == false); + REQUIRE(opDividerNonResetting.checkAndIncrement() == false); + REQUIRE(opDividerNonResetting.getCounter() == 2); +} From 0176c07886822b697496bff1afea906b451ac75a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 10 Nov 2021 18:49:29 +0100 Subject: [PATCH 378/389] use IF instead of void pointer --- src/fsfw/memory/FileSystemArgsIF.h | 13 +++++++++++++ src/fsfw/memory/HasFileSystemIF.h | 27 +++++++++++++++++---------- 2 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 src/fsfw/memory/FileSystemArgsIF.h diff --git a/src/fsfw/memory/FileSystemArgsIF.h b/src/fsfw/memory/FileSystemArgsIF.h new file mode 100644 index 00000000..67d423ff --- /dev/null +++ b/src/fsfw/memory/FileSystemArgsIF.h @@ -0,0 +1,13 @@ +#ifndef FSFW_SRC_FSFW_MEMORY_FILESYSTEMARGS_H_ +#define FSFW_SRC_FSFW_MEMORY_FILESYSTEMARGS_H_ + +/** + * Empty base interface which can be implemented by to pass arguments via the HasFileSystemIF. + * Users can then dynamic_cast the base pointer to the require child pointer. + */ +class FileSystemArgsIF { +public: + virtual~ FileSystemArgsIF() {}; +}; + +#endif /* FSFW_SRC_FSFW_MEMORY_FILESYSTEMARGS_H_ */ diff --git a/src/fsfw/memory/HasFileSystemIF.h b/src/fsfw/memory/HasFileSystemIF.h index ec941f59..be2f8923 100644 --- a/src/fsfw/memory/HasFileSystemIF.h +++ b/src/fsfw/memory/HasFileSystemIF.h @@ -1,9 +1,10 @@ #ifndef FSFW_MEMORY_HASFILESYSTEMIF_H_ #define FSFW_MEMORY_HASFILESYSTEMIF_H_ -#include "../returnvalues/HasReturnvaluesIF.h" -#include "../returnvalues/FwClassIds.h" -#include "../ipc/messageQueueDefinitions.h" +#include "FileSystemArgsIF.h" +#include "fsfw/returnvalues/HasReturnvaluesIF.h" +#include "fsfw/returnvalues/FwClassIds.h" +#include "fsfw/ipc/messageQueueDefinitions.h" #include @@ -59,7 +60,7 @@ public: */ virtual ReturnValue_t appendToFile(const char* repositoryPath, const char* filename, const uint8_t* data, size_t size, - uint16_t packetNumber, void* args = nullptr) = 0; + uint16_t packetNumber, FileSystemArgsIF* args = nullptr) = 0; /** * @brief Generic function to create a new file. @@ -72,7 +73,7 @@ public: */ virtual ReturnValue_t createFile(const char* repositoryPath, const char* filename, const uint8_t* data = nullptr, - size_t size = 0, void* args = nullptr) = 0; + size_t size = 0, FileSystemArgsIF* args = nullptr) = 0; /** * @brief Generic function to delete a file. @@ -81,24 +82,30 @@ public: * @param args Any other arguments which an implementation might require * @return */ - virtual ReturnValue_t deleteFile(const char* repositoryPath, - const char* filename, void* args = nullptr) = 0; + virtual ReturnValue_t removeFile(const char* repositoryPath, + const char* filename, FileSystemArgsIF* args = nullptr) = 0; /** * @brief Generic function to create a directory * @param repositoryPath + * @param Equivalent to the -p flag in Unix systems. If some required parent directories + * do not exist, create them as well * @param args Any other arguments which an implementation might require * @return */ - virtual ReturnValue_t createDirectory(const char* repositoryPath, void* args = nullptr) = 0; + virtual ReturnValue_t createDirectory(const char* repositoryPath, const char* dirname, + bool createParentDirs, FileSystemArgsIF* args = nullptr) = 0; /** * @brief Generic function to remove a directory * @param repositoryPath * @param args Any other arguments which an implementation might require */ - virtual ReturnValue_t removeDirectory(const char* repositoryPath, - bool deleteRecurively = false, void* args = nullptr) = 0; + virtual ReturnValue_t removeDirectory(const char* repositoryPath, const char* dirname, + bool deleteRecurively = false, FileSystemArgsIF* args = nullptr) = 0; + + virtual ReturnValue_t renameFile(const char* repositoryPath, const char* oldFilename, + const char* newFilename, FileSystemArgsIF* args = nullptr) = 0; }; From 30217aa42b9ca23b1a0a8a8a972953277b124c34 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 10 Nov 2021 18:51:56 +0100 Subject: [PATCH 379/389] updated SerializeAdapter.h - Updates `SerializerAdapter` to also take simple pointer and simply assign the serialized and deSerialized size - Added related unittests --- src/fsfw/serialize/SerializeAdapter.h | 400 +++++++++++------- .../unit/serialize/TestSerialization.cpp | 297 ++++++++----- 2 files changed, 429 insertions(+), 268 deletions(-) diff --git a/src/fsfw/serialize/SerializeAdapter.h b/src/fsfw/serialize/SerializeAdapter.h index e6cd247e..2831472c 100644 --- a/src/fsfw/serialize/SerializeAdapter.h +++ b/src/fsfw/serialize/SerializeAdapter.h @@ -7,7 +7,7 @@ #include #include - /** +/** * @brief These adapters provides an interface to use the SerializeIF functions * with arbitrary template objects to facilitate and simplify the * serialization of classes with different multiple different data types @@ -20,174 +20,250 @@ */ class SerializeAdapter { public: - /*** - * This function can be used to serialize a trivial copy-able type or a - * child of SerializeIF. - * The right template to be called is determined in the function itself. - * For objects of non trivial copy-able type this function is almost never - * called by the user directly. Instead helpers for specific types like - * SerialArrayListAdapter or SerialLinkedListAdapter is the right choice here. - * - * @param[in] object Object to serialize, the used type is deduced from this pointer - * @param[in/out] buffer Buffer to serialize into. Will be moved by the function. - * @param[in/out] size Size of current written buffer. Will be incremented by the function. - * @param[in] maxSize Max size of Buffer - * @param[in] streamEndianness Endianness of serialized element as in according to SerializeIF::Endianness - * @return - * - @c BUFFER_TOO_SHORT The given buffer in is too short - * - @c RETURN_FAILED Generic Error - * - @c RETURN_OK Successful serialization - */ - template - static ReturnValue_t serialize(const T *object, uint8_t **buffer, - size_t *size, size_t maxSize, - SerializeIF::Endianness streamEndianness) { - InternalSerializeAdapter::value> adapter; - return adapter.serialize(object, buffer, size, maxSize, - streamEndianness); - } - /** - * Function to return the serialized size of the object in the pointer. - * May be a trivially copy-able object or a Child of SerializeIF - * - * @param object Pointer to Object - * @return Serialized size of object - */ - template - static size_t getSerializedSize(const T *object){ - InternalSerializeAdapter::value> adapter; - return adapter.getSerializedSize(object); - } - /** - * @brief - * Deserializes a object from a given buffer of given size. - * Object Must be trivially copy-able or a child of SerializeIF. - * - * @details - * Buffer will be moved to the current read location. Size will be decreased by the function. - * - * @param[in/out] buffer Buffer to deSerialize from. Will be moved by the function. - * @param[in/out] size Remaining size of the buffer to read from. Will be decreased by function. - * @param[in] streamEndianness Endianness as in according to SerializeIF::Endianness - * @return - * - @c STREAM_TOO_SHORT The input stream is too short to deSerialize the object - * - @c TOO_MANY_ELEMENTS The buffer has more inputs than expected - * - @c RETURN_FAILED Generic Error - * - @c RETURN_OK Successful deserialization - */ - template - static ReturnValue_t deSerialize(T *object, const uint8_t **buffer, - size_t *size, SerializeIF::Endianness streamEndianness) { - InternalSerializeAdapter::value> adapter; - return adapter.deSerialize(object, buffer, size, streamEndianness); - } + /*** + * @brief Serialize a trivial copy-able type or a child of SerializeIF. + * @details + * The right template to be called is determined in the function itself. + * For objects of non trivial copy-able type this function is almost never + * called by the user directly. Instead helpers for specific types like + * SerialArrayListAdapter or SerialLinkedListAdapter are the right choice here. + * + * @param[in] object: Object to serialize, the used type is deduced from this pointer + * @param[in/out] buffer: Pointer to the buffer to serialize into. Buffer position will be + * incremented by the function. + * @param[in/out] size: Pointer to size of current written buffer. + * SIze will be incremented by the function. + * @param[in] maxSize: Max size of Buffer + * @param[in] streamEndianness: Endianness of serialized element as in according to + * SerializeIF::Endianness + * @return + * - @c BUFFER_TOO_SHORT The given buffer in is too short + * - @c RETURN_FAILED Generic Error + * - @c RETURN_OK Successful serialization + */ + template + static ReturnValue_t serialize(const T *object, uint8_t **buffer, + size_t *size, size_t maxSize, + SerializeIF::Endianness streamEndianness) { + InternalSerializeAdapter::value> adapter; + return adapter.serialize(object, buffer, size, maxSize, + streamEndianness); + } + + /*** + * This function can be used to serialize a trivial copy-able type or a child of SerializeIF. + * The right template to be called is determined in the function itself. + * For objects of non trivial copy-able type this function is almost never + * called by the user directly. Instead helpers for specific types like + * SerialArrayListAdapter or SerialLinkedListAdapter are the right choice here. + * + * @param[in] object: Object to serialize, the used type is deduced from this pointer + * @param[in/out] buffer: Buffer to serialize into. + * @param[out] serSize: Serialized size + * @param[in] maxSize: Max size of buffer + * @param[in] streamEndianness: Endianness of serialized element as in according to + * SerializeIF::Endianness + * @return + * - @c BUFFER_TOO_SHORT The given buffer in is too short + * - @c RETURN_FAILED Generic Error + * - @c RETURN_OK Successful serialization + */ + template + static ReturnValue_t serialize(const T *object, uint8_t* const buffer, size_t* serSize, + size_t maxSize, SerializeIF::Endianness streamEndianness) { + if(object == nullptr or buffer == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } + InternalSerializeAdapter::value> adapter; + uint8_t** tempPtr = const_cast(&buffer); + size_t tmpSize = 0; + ReturnValue_t result = adapter.serialize(object, tempPtr, &tmpSize, maxSize, + streamEndianness); + if(serSize != nullptr) { + *serSize = tmpSize; + } + return result; + } + + /** + * @brief Function to return the serialized size of the object in the pointer. + * @details + * May be a trivially copy-able object or a child of SerializeIF. + * + * @param object Pointer to Object + * @return Serialized size of object + */ + template + static size_t getSerializedSize(const T *object){ + InternalSerializeAdapter::value> adapter; + return adapter.getSerializedSize(object); + } + + /** + * @brief Deserializes a object from a given buffer of given size. + * + * @details + * Object Must be trivially copy-able or a child of SerializeIF. + * Buffer will be moved to the current read location. Size will be decreased by the function. + * + * @param[in] object: Pointer to object to deserialize + * @param[in/out] buffer: Pointer to the buffer to deSerialize from. Buffer position will be + * incremented by the function + * @param[in/out] size: Pointer to remaining size of the buffer to read from. + * Will be decreased by function. + * @param[in] streamEndianness: Endianness as in according to SerializeIF::Endianness + * @return + * - @c STREAM_TOO_SHORT The input stream is too short to deSerialize the object + * - @c TOO_MANY_ELEMENTS The buffer has more inputs than expected + * - @c RETURN_FAILED Generic Error + * - @c RETURN_OK Successful deserialization + */ + template + static ReturnValue_t deSerialize(T *object, const uint8_t **buffer, + size_t *size, SerializeIF::Endianness streamEndianness) { + InternalSerializeAdapter::value> adapter; + return adapter.deSerialize(object, buffer, size, streamEndianness); + } + + /** + * @brief Deserializes a object from a given buffer of given size. + * + * @details + * Object Must be trivially copy-able or a child of SerializeIF. + * + * @param[in] object: Pointer to object to deserialize + * @param[in] buffer: Buffer to deSerialize from + * @param[out] deserSize: Deserialized length + * @param[in] streamEndianness: Endianness as in according to SerializeIF::Endianness + * @return + * - @c STREAM_TOO_SHORT The input stream is too short to deSerialize the object + * - @c TOO_MANY_ELEMENTS The buffer has more inputs than expected + * - @c RETURN_FAILED Generic Error + * - @c RETURN_OK Successful deserialization + */ + template + static ReturnValue_t deSerialize(T *object, const uint8_t* buffer, + size_t* deserSize, SerializeIF::Endianness streamEndianness) { + if(object == nullptr or buffer == nullptr) { + return HasReturnvaluesIF::RETURN_FAILED; + } + InternalSerializeAdapter::value> adapter; + const uint8_t** tempPtr = &buffer; + size_t maxVal = -1; + ReturnValue_t result = adapter.deSerialize(object, tempPtr, &maxVal, streamEndianness); + if(deserSize != nullptr) { + *deserSize = -1 - maxVal; + } + return result; + } + private: - /** - * Internal template to deduce the right function calls at compile time - */ - template class InternalSerializeAdapter; + /** + * Internal template to deduce the right function calls at compile time + */ + template class InternalSerializeAdapter; - /** - * Template to be used if T is not a child of SerializeIF - * - * @tparam T T must be trivially_copyable - */ - template - class InternalSerializeAdapter { - static_assert (std::is_trivially_copyable::value, - "If a type needs to be serialized it must be a child of " - "SerializeIF or trivially copy-able"); - public: - static ReturnValue_t serialize(const T *object, uint8_t **buffer, - size_t *size, size_t max_size, - SerializeIF::Endianness streamEndianness) { - size_t ignoredSize = 0; - if (size == nullptr) { - size = &ignoredSize; - } - // Check remaining size is large enough and check integer - // overflow of *size - size_t newSize = sizeof(T) + *size; - if ((newSize <= max_size) and (newSize > *size)) { - T tmp; - switch (streamEndianness) { - case SerializeIF::Endianness::BIG: - tmp = EndianConverter::convertBigEndian(*object); - break; - case SerializeIF::Endianness::LITTLE: - tmp = EndianConverter::convertLittleEndian(*object); - break; - default: - case SerializeIF::Endianness::MACHINE: - tmp = *object; - break; - } - std::memcpy(*buffer, &tmp, sizeof(T)); - *size += sizeof(T); - (*buffer) += sizeof(T); - return HasReturnvaluesIF::RETURN_OK; - } else { - return SerializeIF::BUFFER_TOO_SHORT; - } - } + /** + * Template to be used if T is not a child of SerializeIF + * + * @tparam T T must be trivially_copyable + */ + template + class InternalSerializeAdapter { + static_assert (std::is_trivially_copyable::value, + "If a type needs to be serialized it must be a child of " + "SerializeIF or trivially copy-able"); + public: + static ReturnValue_t serialize(const T *object, uint8_t **buffer, + size_t *size, size_t max_size, + SerializeIF::Endianness streamEndianness) { + size_t ignoredSize = 0; + if (size == nullptr) { + size = &ignoredSize; + } + // Check remaining size is large enough and check integer + // overflow of *size + size_t newSize = sizeof(T) + *size; + if ((newSize <= max_size) and (newSize > *size)) { + T tmp; + switch (streamEndianness) { + case SerializeIF::Endianness::BIG: + tmp = EndianConverter::convertBigEndian(*object); + break; + case SerializeIF::Endianness::LITTLE: + tmp = EndianConverter::convertLittleEndian(*object); + break; + default: + case SerializeIF::Endianness::MACHINE: + tmp = *object; + break; + } + std::memcpy(*buffer, &tmp, sizeof(T)); + *size += sizeof(T); + (*buffer) += sizeof(T); + return HasReturnvaluesIF::RETURN_OK; + } else { + return SerializeIF::BUFFER_TOO_SHORT; + } + } - ReturnValue_t deSerialize(T *object, const uint8_t **buffer, - size_t *size, SerializeIF::Endianness streamEndianness) { - T tmp; - if (*size >= sizeof(T)) { - *size -= sizeof(T); - std::memcpy(&tmp, *buffer, sizeof(T)); - switch (streamEndianness) { - case SerializeIF::Endianness::BIG: - *object = EndianConverter::convertBigEndian(tmp); - break; - case SerializeIF::Endianness::LITTLE: - *object = EndianConverter::convertLittleEndian(tmp); - break; - default: - case SerializeIF::Endianness::MACHINE: - *object = tmp; - break; - } + ReturnValue_t deSerialize(T *object, const uint8_t **buffer, + size_t *size, SerializeIF::Endianness streamEndianness) { + T tmp; + if (*size >= sizeof(T)) { + *size -= sizeof(T); + std::memcpy(&tmp, *buffer, sizeof(T)); + switch (streamEndianness) { + case SerializeIF::Endianness::BIG: + *object = EndianConverter::convertBigEndian(tmp); + break; + case SerializeIF::Endianness::LITTLE: + *object = EndianConverter::convertLittleEndian(tmp); + break; + default: + case SerializeIF::Endianness::MACHINE: + *object = tmp; + break; + } - *buffer += sizeof(T); - return HasReturnvaluesIF::RETURN_OK; - } else { - return SerializeIF::STREAM_TOO_SHORT; - } - } + *buffer += sizeof(T); + return HasReturnvaluesIF::RETURN_OK; + } else { + return SerializeIF::STREAM_TOO_SHORT; + } + } - uint32_t getSerializedSize(const T *object) { - return sizeof(T); - } - }; + uint32_t getSerializedSize(const T *object) { + return sizeof(T); + } + }; - /** - * Template for objects that inherit from SerializeIF - * - * @tparam T A child of SerializeIF - */ - template - class InternalSerializeAdapter { - public: - ReturnValue_t serialize(const T *object, uint8_t **buffer, size_t *size, - size_t max_size, - SerializeIF::Endianness streamEndianness) const { - size_t ignoredSize = 0; - if (size == nullptr) { - size = &ignoredSize; - } - return object->serialize(buffer, size, max_size, streamEndianness); - } - size_t getSerializedSize(const T *object) const { - return object->getSerializedSize(); - } + /** + * Template for objects that inherit from SerializeIF + * + * @tparam T A child of SerializeIF + */ + template + class InternalSerializeAdapter { + public: + ReturnValue_t serialize(const T *object, uint8_t **buffer, size_t *size, + size_t max_size, + SerializeIF::Endianness streamEndianness) const { + size_t ignoredSize = 0; + if (size == nullptr) { + size = &ignoredSize; + } + return object->serialize(buffer, size, max_size, streamEndianness); + } + size_t getSerializedSize(const T *object) const { + return object->getSerializedSize(); + } - ReturnValue_t deSerialize(T *object, const uint8_t **buffer, - size_t *size, SerializeIF::Endianness streamEndianness) { - return object->deSerialize(buffer, size, streamEndianness); - } - }; + ReturnValue_t deSerialize(T *object, const uint8_t **buffer, + size_t *size, SerializeIF::Endianness streamEndianness) { + return object->deSerialize(buffer, size, streamEndianness); + } + }; }; #endif /* _FSFW_SERIALIZE_SERIALIZEADAPTER_H_ */ diff --git a/tests/src/fsfw_tests/unit/serialize/TestSerialization.cpp b/tests/src/fsfw_tests/unit/serialize/TestSerialization.cpp index 64deae3b..f883fe78 100644 --- a/tests/src/fsfw_tests/unit/serialize/TestSerialization.cpp +++ b/tests/src/fsfw_tests/unit/serialize/TestSerialization.cpp @@ -3,128 +3,213 @@ #include #include +#include #include -static bool test_value_bool = true; -static uint8_t tv_uint8 {5}; -static uint16_t tv_uint16 {283}; -static uint32_t tv_uint32 {929221}; -static uint64_t tv_uint64 {2929329429}; +static bool testBool = true; +static uint8_t tvUint8 {5}; +static uint16_t tvUint16 {283}; +static uint32_t tvUint32 {929221}; +static uint64_t tvUint64 {2929329429}; -static int8_t tv_int8 {-16}; -static int16_t tv_int16 {-829}; -static int32_t tv_int32 {-2312}; +static int8_t tvInt8 {-16}; +static int16_t tvInt16 {-829}; +static int32_t tvInt32 {-2312}; -static float tv_float {8.2149214}; -static float tv_sfloat = {-922.2321321}; -static double tv_double {9.2132142141e8}; -static double tv_sdouble {-2.2421e19}; +static float tvFloat {8.2149214}; +static float tvSfloat = {-922.2321321}; +static double tvDouble {9.2132142141e8}; +static double tvSdouble {-2.2421e19}; -static std::array test_array; +static std::array TEST_ARRAY; -TEST_CASE( "Serialization size tests", "[TestSerialization]") { +TEST_CASE( "Serialization size tests", "[SerSizeTest]") { //REQUIRE(unitTestClass.test_autoserialization() == 0); - REQUIRE(SerializeAdapter::getSerializedSize(&test_value_bool) == - sizeof(test_value_bool)); - REQUIRE(SerializeAdapter::getSerializedSize(&tv_uint8) == - sizeof(tv_uint8)); - REQUIRE(SerializeAdapter::getSerializedSize(&tv_uint16) == - sizeof(tv_uint16)); - REQUIRE(SerializeAdapter::getSerializedSize(&tv_uint32 ) == - sizeof(tv_uint32)); - REQUIRE(SerializeAdapter::getSerializedSize(&tv_uint64) == - sizeof(tv_uint64)); - REQUIRE(SerializeAdapter::getSerializedSize(&tv_int8) == - sizeof(tv_int8)); - REQUIRE(SerializeAdapter::getSerializedSize(&tv_int16) == - sizeof(tv_int16)); - REQUIRE(SerializeAdapter::getSerializedSize(&tv_int32) == - sizeof(tv_int32)); - REQUIRE(SerializeAdapter::getSerializedSize(&tv_float) == - sizeof(tv_float)); - REQUIRE(SerializeAdapter::getSerializedSize(&tv_sfloat) == - sizeof(tv_sfloat )); - REQUIRE(SerializeAdapter::getSerializedSize(&tv_double) == - sizeof(tv_double)); - REQUIRE(SerializeAdapter::getSerializedSize(&tv_sdouble) == - sizeof(tv_sdouble)); + REQUIRE(SerializeAdapter::getSerializedSize(&testBool) == + sizeof(testBool)); + REQUIRE(SerializeAdapter::getSerializedSize(&tvUint8) == + sizeof(tvUint8)); + REQUIRE(SerializeAdapter::getSerializedSize(&tvUint16) == + sizeof(tvUint16)); + REQUIRE(SerializeAdapter::getSerializedSize(&tvUint32 ) == + sizeof(tvUint32)); + REQUIRE(SerializeAdapter::getSerializedSize(&tvUint64) == + sizeof(tvUint64)); + REQUIRE(SerializeAdapter::getSerializedSize(&tvInt8) == + sizeof(tvInt8)); + REQUIRE(SerializeAdapter::getSerializedSize(&tvInt16) == + sizeof(tvInt16)); + REQUIRE(SerializeAdapter::getSerializedSize(&tvInt32) == + sizeof(tvInt32)); + REQUIRE(SerializeAdapter::getSerializedSize(&tvFloat) == + sizeof(tvFloat)); + REQUIRE(SerializeAdapter::getSerializedSize(&tvSfloat) == + sizeof(tvSfloat )); + REQUIRE(SerializeAdapter::getSerializedSize(&tvDouble) == + sizeof(tvDouble)); + REQUIRE(SerializeAdapter::getSerializedSize(&tvSdouble) == + sizeof(tvSdouble)); } +TEST_CASE("Auto Serialize Adapter", "[SerAdapter]") { + size_t serializedSize = 0; + uint8_t * pArray = TEST_ARRAY.data(); -TEST_CASE("Auto Serialize Adapter testing", "[single-file]") { - size_t serialized_size = 0; - uint8_t * p_array = test_array.data(); + SECTION("SerDe") { + size_t deserSize = 0; + SerializeAdapter::serialize(&testBool, TEST_ARRAY.data(), &deserSize, TEST_ARRAY.size(), + SerializeIF::Endianness::MACHINE); + REQUIRE(deserSize == 1); + REQUIRE(TEST_ARRAY[0] == true); + bool readBack = false; + SerializeAdapter::deSerialize(&readBack, TEST_ARRAY.data(), &deserSize, + SerializeIF::Endianness::MACHINE); + REQUIRE(deserSize == 1); + REQUIRE(readBack == true); + SerializeAdapter::serialize(&tvUint8, TEST_ARRAY.data(), &deserSize, TEST_ARRAY.size(), + SerializeIF::Endianness::MACHINE); + REQUIRE(deserSize == 1); + REQUIRE(TEST_ARRAY[0] == 5); + uint8_t readBackUint8 = 0; + uint8_t* const testPtr = TEST_ARRAY.data(); + uint8_t* const shouldStayConst = testPtr; + SerializeAdapter::deSerialize(&readBackUint8, testPtr, &deserSize, + SerializeIF::Endianness::MACHINE); + REQUIRE(testPtr == shouldStayConst); + REQUIRE(deserSize == 1); + REQUIRE(readBackUint8 == 5); + SerializeAdapter::serialize(&tvUint16, TEST_ARRAY.data(), &deserSize, TEST_ARRAY.size(), + SerializeIF::Endianness::MACHINE); + REQUIRE(deserSize == 2); + deserSize = 0; + uint16_t readBackUint16 = 0; + SerializeAdapter::deSerialize(&readBackUint16, TEST_ARRAY.data(), &deserSize, + SerializeIF::Endianness::MACHINE); + REQUIRE(deserSize == 2); + REQUIRE(readBackUint16 == 283); - SECTION("Serializing...") { - SerializeAdapter::serialize(&test_value_bool, &p_array, - &serialized_size, test_array.size(), SerializeIF::Endianness::MACHINE); - SerializeAdapter::serialize(&tv_uint8, &p_array, - &serialized_size, test_array.size(), SerializeIF::Endianness::MACHINE); - SerializeAdapter::serialize(&tv_uint16, &p_array, - &serialized_size, test_array.size(), SerializeIF::Endianness::MACHINE); - SerializeAdapter::serialize(&tv_uint32, &p_array, - &serialized_size, test_array.size(), SerializeIF::Endianness::MACHINE); - SerializeAdapter::serialize(&tv_int8, &p_array, - &serialized_size, test_array.size(), SerializeIF::Endianness::MACHINE); - SerializeAdapter::serialize(&tv_int16, &p_array, - &serialized_size, test_array.size(), SerializeIF::Endianness::MACHINE); - SerializeAdapter::serialize(&tv_int32, &p_array, - &serialized_size, test_array.size(), SerializeIF::Endianness::MACHINE); - SerializeAdapter::serialize(&tv_uint64, &p_array, - &serialized_size, test_array.size(), SerializeIF::Endianness::MACHINE); - SerializeAdapter::serialize(&tv_float, &p_array, - &serialized_size, test_array.size(), SerializeIF::Endianness::MACHINE); - SerializeAdapter::serialize(&tv_double, &p_array, - &serialized_size, test_array.size(), SerializeIF::Endianness::MACHINE); - SerializeAdapter::serialize(&tv_sfloat, &p_array, - &serialized_size, test_array.size(), SerializeIF::Endianness::MACHINE); - SerializeAdapter::serialize(&tv_sdouble, &p_array, - &serialized_size, test_array.size(), SerializeIF::Endianness::MACHINE); - REQUIRE (serialized_size == 47); + SerializeAdapter::serialize(&tvUint32, TEST_ARRAY.data(), &deserSize, TEST_ARRAY.size(), + SerializeIF::Endianness::MACHINE); + REQUIRE(deserSize == 4); + uint32_t readBackUint32 = 0; + deserSize = 0; + SerializeAdapter::deSerialize(&readBackUint32, TEST_ARRAY.data(), &deserSize, + SerializeIF::Endianness::MACHINE); + REQUIRE(deserSize == 4); + REQUIRE(readBackUint32 == 929221); + + SerializeAdapter::serialize(&tvInt16, TEST_ARRAY.data(), &deserSize, TEST_ARRAY.size(), + SerializeIF::Endianness::MACHINE); + REQUIRE(deserSize == 2); + int16_t readBackInt16 = 0; + SerializeAdapter::deSerialize(&readBackInt16, TEST_ARRAY.data(), &deserSize, + SerializeIF::Endianness::MACHINE); + REQUIRE(readBackInt16 == -829); + REQUIRE(deserSize == 2); + + SerializeAdapter::serialize(&tvFloat, TEST_ARRAY.data(), &deserSize, TEST_ARRAY.size(), + SerializeIF::Endianness::MACHINE); + float readBackFloat = 0.0; + SerializeAdapter::deSerialize(&readBackFloat, TEST_ARRAY.data(), &deserSize, + SerializeIF::Endianness::MACHINE); + REQUIRE(readBackFloat == Catch::Approx(8.214921)); + + SerializeAdapter::serialize(&tvSdouble, TEST_ARRAY.data(), &deserSize, TEST_ARRAY.size(), + SerializeIF::Endianness::MACHINE); + double readBackSignedDouble = 0.0; + SerializeAdapter::deSerialize(&readBackSignedDouble, TEST_ARRAY.data(), &deserSize, + SerializeIF::Endianness::MACHINE); + REQUIRE(readBackSignedDouble == Catch::Approx(-2.2421e19)); + + uint8_t testBuf[4] = {1, 2, 3, 4}; + SerialBufferAdapter bufferAdapter(testBuf, sizeof(testBuf)); + SerializeAdapter::serialize(&bufferAdapter, TEST_ARRAY.data(), &deserSize, + TEST_ARRAY.size(), SerializeIF::Endianness::MACHINE); + REQUIRE(deserSize == 4); + for(uint8_t idx = 0; idx < 4; idx++) { + REQUIRE(TEST_ARRAY[idx] == idx + 1); + } + deserSize = 0; + testBuf[0] = 0; + testBuf[1] = 12; + SerializeAdapter::deSerialize(&bufferAdapter, TEST_ARRAY.data(), &deserSize, + SerializeIF::Endianness::MACHINE); + REQUIRE(deserSize == 4); + for(uint8_t idx = 0; idx < 4; idx++) { + REQUIRE(testBuf[idx] == idx + 1); + } + } + + SECTION("Serialize incrementing") { + SerializeAdapter::serialize(&testBool, &pArray, &serializedSize, + TEST_ARRAY.size(), SerializeIF::Endianness::MACHINE); + SerializeAdapter::serialize(&tvUint8, &pArray, &serializedSize, + TEST_ARRAY.size(), SerializeIF::Endianness::MACHINE); + SerializeAdapter::serialize(&tvUint16, &pArray, &serializedSize, + TEST_ARRAY.size(), SerializeIF::Endianness::MACHINE); + SerializeAdapter::serialize(&tvUint32, &pArray, &serializedSize, + TEST_ARRAY.size(), SerializeIF::Endianness::MACHINE); + SerializeAdapter::serialize(&tvInt8, &pArray, &serializedSize, + TEST_ARRAY.size(), SerializeIF::Endianness::MACHINE); + SerializeAdapter::serialize(&tvInt16, &pArray, &serializedSize, + TEST_ARRAY.size(), SerializeIF::Endianness::MACHINE); + SerializeAdapter::serialize(&tvInt32, &pArray, &serializedSize, + TEST_ARRAY.size(), SerializeIF::Endianness::MACHINE); + SerializeAdapter::serialize(&tvUint64, &pArray, &serializedSize, + TEST_ARRAY.size(), SerializeIF::Endianness::MACHINE); + SerializeAdapter::serialize(&tvFloat, &pArray, &serializedSize, + TEST_ARRAY.size(), SerializeIF::Endianness::MACHINE); + SerializeAdapter::serialize(&tvDouble, &pArray, &serializedSize, TEST_ARRAY.size(), + SerializeIF::Endianness::MACHINE); + SerializeAdapter::serialize(&tvSfloat, &pArray, &serializedSize, TEST_ARRAY.size(), + SerializeIF::Endianness::MACHINE); + SerializeAdapter::serialize(&tvSdouble, &pArray, &serializedSize, TEST_ARRAY.size(), + SerializeIF::Endianness::MACHINE); + REQUIRE (serializedSize == 47); } - SECTION("Deserializing") { - p_array = test_array.data(); - size_t remaining_size = serialized_size; - SerializeAdapter::deSerialize(&test_value_bool, - const_cast(&p_array), &remaining_size, SerializeIF::Endianness::MACHINE); - SerializeAdapter::deSerialize(&tv_uint8, - const_cast(&p_array), &remaining_size, SerializeIF::Endianness::MACHINE); - SerializeAdapter::deSerialize(&tv_uint16, - const_cast(&p_array), &remaining_size, SerializeIF::Endianness::MACHINE); - SerializeAdapter::deSerialize(&tv_uint32, - const_cast(&p_array), &remaining_size, SerializeIF::Endianness::MACHINE); - SerializeAdapter::deSerialize(&tv_int8, - const_cast(&p_array), &remaining_size, SerializeIF::Endianness::MACHINE); - SerializeAdapter::deSerialize(&tv_int16, - const_cast(&p_array), &remaining_size, SerializeIF::Endianness::MACHINE); - SerializeAdapter::deSerialize(&tv_int32, - const_cast(&p_array), &remaining_size, SerializeIF::Endianness::MACHINE); - SerializeAdapter::deSerialize(&tv_uint64, - const_cast(&p_array), &remaining_size, SerializeIF::Endianness::MACHINE); - SerializeAdapter::deSerialize(&tv_float, - const_cast(&p_array), &remaining_size, SerializeIF::Endianness::MACHINE); - SerializeAdapter::deSerialize(&tv_double, - const_cast(&p_array), &remaining_size, SerializeIF::Endianness::MACHINE); - SerializeAdapter::deSerialize(&tv_sfloat, - const_cast(&p_array), &remaining_size, SerializeIF::Endianness::MACHINE); - SerializeAdapter::deSerialize(&tv_sdouble, - const_cast(&p_array), &remaining_size, SerializeIF::Endianness::MACHINE); + SECTION("Deserialize decrementing") { + pArray = TEST_ARRAY.data(); + size_t remaining_size = serializedSize; + SerializeAdapter::deSerialize(&testBool, const_cast(&pArray), + &remaining_size, SerializeIF::Endianness::MACHINE); + SerializeAdapter::deSerialize(&tvUint8, const_cast(&pArray), + &remaining_size, SerializeIF::Endianness::MACHINE); + SerializeAdapter::deSerialize(&tvUint16, const_cast(&pArray), + &remaining_size, SerializeIF::Endianness::MACHINE); + SerializeAdapter::deSerialize(&tvUint32, const_cast(&pArray), + &remaining_size, SerializeIF::Endianness::MACHINE); + SerializeAdapter::deSerialize(&tvInt8, const_cast(&pArray), + &remaining_size, SerializeIF::Endianness::MACHINE); + SerializeAdapter::deSerialize(&tvInt16, const_cast(&pArray), + &remaining_size, SerializeIF::Endianness::MACHINE); + SerializeAdapter::deSerialize(&tvInt32, const_cast(&pArray), + &remaining_size, SerializeIF::Endianness::MACHINE); + SerializeAdapter::deSerialize(&tvUint64, + const_cast(&pArray), &remaining_size, SerializeIF::Endianness::MACHINE); + SerializeAdapter::deSerialize(&tvFloat, + const_cast(&pArray), &remaining_size, SerializeIF::Endianness::MACHINE); + SerializeAdapter::deSerialize(&tvDouble, + const_cast(&pArray), &remaining_size, SerializeIF::Endianness::MACHINE); + SerializeAdapter::deSerialize(&tvSfloat, + const_cast(&pArray), &remaining_size, SerializeIF::Endianness::MACHINE); + SerializeAdapter::deSerialize(&tvSdouble, + const_cast(&pArray), &remaining_size, SerializeIF::Endianness::MACHINE); - REQUIRE(test_value_bool == true); - REQUIRE(tv_uint8 == 5); - REQUIRE(tv_uint16 == 283); - REQUIRE(tv_uint32 == 929221); - REQUIRE(tv_uint64 == 2929329429); - REQUIRE(tv_int8 == -16); - REQUIRE(tv_int16 == -829); - REQUIRE(tv_int32 == -2312); + REQUIRE(testBool == true); + REQUIRE(tvUint8 == 5); + REQUIRE(tvUint16 == 283); + REQUIRE(tvUint32 == 929221); + REQUIRE(tvUint64 == 2929329429); + REQUIRE(tvInt8 == -16); + REQUIRE(tvInt16 == -829); + REQUIRE(tvInt32 == -2312); - REQUIRE(tv_float == Catch::Approx(8.214921)); - REQUIRE(tv_double == Catch::Approx(9.2132142141e8)); - REQUIRE(tv_sfloat == Catch::Approx(-922.2321321)); - REQUIRE(tv_sdouble == Catch::Approx(-2.2421e19)); + REQUIRE(tvFloat == Catch::Approx(8.214921)); + REQUIRE(tvDouble == Catch::Approx(9.2132142141e8)); + REQUIRE(tvSfloat == Catch::Approx(-922.2321321)); + REQUIRE(tvSdouble == Catch::Approx(-2.2421e19)); } } From 05c4f4fadca0ba73f1e51bd4ac50d278df11aabd Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 18 Nov 2021 19:56:24 +0100 Subject: [PATCH 380/389] Bugfix for Packet ID getters - Also added related unittests --- src/fsfw/tmtcpacket/SpacePacket.h | 2 +- tests/src/fsfw_tests/unit/tmtcpacket/CMakeLists.txt | 2 +- tests/src/fsfw_tests/unit/tmtcpacket/testCcsds.cpp | 11 +++++++++++ 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 tests/src/fsfw_tests/unit/tmtcpacket/testCcsds.cpp diff --git a/src/fsfw/tmtcpacket/SpacePacket.h b/src/fsfw/tmtcpacket/SpacePacket.h index 16673319..a092712c 100644 --- a/src/fsfw/tmtcpacket/SpacePacket.h +++ b/src/fsfw/tmtcpacket/SpacePacket.h @@ -73,7 +73,7 @@ namespace spacepacket { constexpr uint16_t getSpacePacketIdFromApid(bool isTc, uint16_t apid, bool secondaryHeaderFlag = true) { - return (((isTc << 5) & 0x10) | ((secondaryHeaderFlag << 4) & 0x08) | + return ((isTc << 4) | (secondaryHeaderFlag << 3) | ((apid >> 8) & 0x07)) << 8 | (apid & 0x00ff); } diff --git a/tests/src/fsfw_tests/unit/tmtcpacket/CMakeLists.txt b/tests/src/fsfw_tests/unit/tmtcpacket/CMakeLists.txt index 36838b24..958bda40 100644 --- a/tests/src/fsfw_tests/unit/tmtcpacket/CMakeLists.txt +++ b/tests/src/fsfw_tests/unit/tmtcpacket/CMakeLists.txt @@ -1,3 +1,3 @@ target_sources(${FSFW_TEST_TGT} PRIVATE - PusTmTest.cpp + testCcsds.cpp ) diff --git a/tests/src/fsfw_tests/unit/tmtcpacket/testCcsds.cpp b/tests/src/fsfw_tests/unit/tmtcpacket/testCcsds.cpp new file mode 100644 index 00000000..8f531805 --- /dev/null +++ b/tests/src/fsfw_tests/unit/tmtcpacket/testCcsds.cpp @@ -0,0 +1,11 @@ +#include + +#include "fsfw/tmtcpacket/SpacePacket.h" + +TEST_CASE( "CCSDS Test" , "[ccsds]") { + REQUIRE(spacepacket::getTcSpacePacketIdFromApid(0x22) == 0x1822); + REQUIRE(spacepacket::getTmSpacePacketIdFromApid(0x22) == 0x0822); + + REQUIRE(spacepacket::getTcSpacePacketIdFromApid(0x7ff) == 0x1fff); + REQUIRE(spacepacket::getTmSpacePacketIdFromApid(0x7ff) == 0xfff); +} From 00dced31ee17f06a112b473b4b54fea8982c5f92 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 19 Nov 2021 13:50:46 +0100 Subject: [PATCH 381/389] update unittest helper scripts - Added functionality to open HTML report immediately - Added another helper script to automatically generate unittest build folder --- scripts/coverage.py | 7 +++++++ scripts/gen-unittest.sh | 3 +++ 2 files changed, 10 insertions(+) create mode 100755 scripts/gen-unittest.sh diff --git a/scripts/coverage.py b/scripts/coverage.py index 71b6fb03..b5bd7745 100755 --- a/scripts/coverage.py +++ b/scripts/coverage.py @@ -6,6 +6,7 @@ import platform import sys import time import argparse +import webbrowser from typing import List @@ -18,6 +19,10 @@ information how to set up the build folder. def main(): parser = argparse.ArgumentParser(description="Processing arguments for LCOV helper script.") + parser.add_argument( + '-o', '--open', action='store_true', help='Open coverage data in webbrowser' + ) + args = parser.parse_args() build_dir_list = [] if not os.path.isfile('README.md'): @@ -41,6 +46,8 @@ def main(): print("Multiple build directories found!") build_directory = determine_build_dir(build_dir_list) perform_lcov_operation(build_directory) + if os.path.isdir('fsfw-tests_coverage') and args.open: + webbrowser.open('fsfw-tests_coverage/index.html') def check_for_cmake_build_dir(build_dir_dict: list): diff --git a/scripts/gen-unittest.sh b/scripts/gen-unittest.sh new file mode 100755 index 00000000..9ca8c399 --- /dev/null +++ b/scripts/gen-unittest.sh @@ -0,0 +1,3 @@ +#!/bin/sh +mkdir build-Unittest && cd build-Unittest +cmake -DFSFW_BUILD_UNITTESTS=ON -DFSFW_OSAL=host -DCMAKE_BUILD_TYPE=Debug .. From c2bf09d506899d3ef893c0d8932898b158eef23d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 1 Dec 2021 11:04:24 +0100 Subject: [PATCH 382/389] Introducing documentation with Sphinx This PR introduces the generation of documentation based on this excellent blog post: https://devblogs.microsoft.com/cppblog/clear-functional-c-documentation-with-sphinx-breathe-doxygen-cmake/ It combines the tools Sphinx, Doxygen and Breathe to generate good looking HTML documentation conveniently which can be hosted easily. The helper scripts were unified and there is now one helper.py script which can be used to create, build and open both tests and documentation. "./helper.py -h" can be used to get the different options. This PR also contains some smaller fixes which were necessary for the docs to build --- CMakeLists.txt | 18 +- README.md | 18 +- cmake/FindSphinx.cmake | 13 ++ docs/CMakeLists.txt | 66 +++++++ docs/Doxyfile.in | 7 + docs/Makefile | 20 ++ {doc => docs}/README-config.md | 0 {doc => docs}/README-controllers.md | 0 {doc => docs}/README-core.md | 0 {doc => docs}/README-devicehandlers.md | 0 {doc => docs}/README-highlevel.md | 0 {doc => docs}/README-localpools.md | 4 +- {doc => docs}/README-osal.md | 0 {doc => docs}/README-pus.md | 0 docs/api.rst | 16 ++ docs/api/action.rst | 15 ++ docs/api/controller.rst | 16 ++ docs/api/devicehandler.rst | 16 ++ docs/api/event.rst | 6 + docs/api/health.rst | 9 + docs/api/ipc.rst | 9 + docs/api/modes.rst | 10 + docs/api/objectmanager.rst | 30 +++ docs/api/returnvalue.rst | 10 + docs/api/task.rst | 8 + docs/conf.py | 56 ++++++ docs/config.rst | 41 ++++ docs/controllers.rst | 2 + docs/core.rst | 70 +++++++ docs/devicehandlers.rst | 3 + {doc => docs}/doxy/.gitignore | 0 {doc => docs}/doxy/OPUS.doxyfile | 0 docs/getting_started.rst | 115 +++++++++++ docs/highlevel.rst | 149 ++++++++++++++ {doc => docs}/images/PoolArchitecture.png | Bin docs/index.rst | 69 +++++++ docs/localpools.rst | 181 ++++++++++++++++++ docs/make.bat | 35 ++++ docs/osal.rst | 63 ++++++ docs/pus.rst | 2 + misc/defaultcfg/fsfwconfig/CMakeLists.txt | 60 ++++-- .../fsfwconfig/objects/FsfwFactory.cpp | 4 +- scripts/coverage.py | 83 -------- scripts/gen-unittest.sh | 3 - scripts/helper.py | 181 ++++++++++++++++++ .../integration/task/CMakeLists.txt | 2 +- 46 files changed, 1290 insertions(+), 120 deletions(-) create mode 100644 cmake/FindSphinx.cmake create mode 100644 docs/CMakeLists.txt create mode 100644 docs/Doxyfile.in create mode 100644 docs/Makefile rename {doc => docs}/README-config.md (100%) rename {doc => docs}/README-controllers.md (100%) rename {doc => docs}/README-core.md (100%) rename {doc => docs}/README-devicehandlers.md (100%) rename {doc => docs}/README-highlevel.md (100%) rename {doc => docs}/README-localpools.md (98%) rename {doc => docs}/README-osal.md (100%) rename {doc => docs}/README-pus.md (100%) create mode 100644 docs/api.rst create mode 100644 docs/api/action.rst create mode 100644 docs/api/controller.rst create mode 100644 docs/api/devicehandler.rst create mode 100644 docs/api/event.rst create mode 100644 docs/api/health.rst create mode 100644 docs/api/ipc.rst create mode 100644 docs/api/modes.rst create mode 100644 docs/api/objectmanager.rst create mode 100644 docs/api/returnvalue.rst create mode 100644 docs/api/task.rst create mode 100644 docs/conf.py create mode 100644 docs/config.rst create mode 100644 docs/controllers.rst create mode 100644 docs/core.rst create mode 100644 docs/devicehandlers.rst rename {doc => docs}/doxy/.gitignore (100%) rename {doc => docs}/doxy/OPUS.doxyfile (100%) create mode 100644 docs/getting_started.rst create mode 100644 docs/highlevel.rst rename {doc => docs}/images/PoolArchitecture.png (100%) create mode 100644 docs/index.rst create mode 100644 docs/localpools.rst create mode 100644 docs/make.bat create mode 100644 docs/osal.rst create mode 100644 docs/pus.rst delete mode 100755 scripts/coverage.py delete mode 100755 scripts/gen-unittest.sh create mode 100755 scripts/helper.py diff --git a/CMakeLists.txt b/CMakeLists.txt index e78e8929..bb3d48b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,9 @@ set(FSFW_VERSION 2) set(FSFW_SUBVERSION 0) set(FSFW_REVISION 0) +# Add the cmake folder so the FindSphinx module is found +set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) + option(FSFW_GENERATE_SECTIONS "Generate function and data sections. Required to remove unused code" ON ) @@ -12,6 +15,7 @@ if(FSFW_GENERATE_SECTIONS) endif() option(FSFW_BUILD_UNITTESTS "Build unittest binary in addition to static library" OFF) +option(FSFW_BUILD_DOCS "Build documentation with Sphinx and Doxygen" OFF) if(FSFW_BUILD_UNITTESTS) option(FSFW_TESTS_GEN_COV "Generate coverage data for unittests" ON) endif() @@ -36,7 +40,9 @@ option(FSFW_ADD_SGP4_PROPAGATOR "Add SGP4 propagator code" OFF) set(LIB_FSFW_NAME fsfw) set(FSFW_TEST_TGT fsfw-tests) +set(FSFW_DUMMY_TGT fsfw-dummy) +project(${LIB_FSFW_NAME}) add_library(${LIB_FSFW_NAME}) if(FSFW_BUILD_UNITTESTS) @@ -59,7 +65,6 @@ if(FSFW_BUILD_UNITTESTS) set(FSFW_CONFIG_PATH tests/src/fsfw_tests/unit/testcfg) configure_file(tests/src/fsfw_tests/unit/testcfg/FSFWConfig.h.in FSFWConfig.h) configure_file(tests/src/fsfw_tests/unit/testcfg/TestsConfig.h.in tests/TestsConfig.h) - configure_file(tests/src/fsfw_tests/unit/testcfg/OBSWConfig.h.in OBSWConfig.h) project(${FSFW_TEST_TGT} CXX C) add_executable(${FSFW_TEST_TGT}) @@ -147,7 +152,7 @@ else() set(OS_FSFW "host") endif() -if(FSFW_BUILD_UNITTESTS) +if(FSFW_BUILD_UNITTESTS OR FSFW_BUILD_DOCS) configure_file(src/fsfw/FSFW.h.in fsfw/FSFW.h) configure_file(src/fsfw/FSFWVersion.h.in fsfw/FSFWVersion.h) else() @@ -163,6 +168,9 @@ if(FSFW_ADD_HAL) add_subdirectory(hal) endif() add_subdirectory(contrib) +if(FSFW_BUILD_DOCS) + add_subdirectory(docs) +endif() if(FSFW_BUILD_UNITTESTS) if(FSFW_TESTS_GEN_COV) @@ -234,9 +242,11 @@ endif() # The project CMakeLists file has to set the FSFW_CONFIG_PATH and add it. # If this is not given, we include the default configuration and emit a warning. if(NOT FSFW_CONFIG_PATH) - message(WARNING "Flight Software Framework configuration path not set!") set(DEF_CONF_PATH misc/defaultcfg/fsfwconfig) - message(WARNING "Setting default configuration from ${DEF_CONF_PATH} ..") + if(NOT FSFW_BUILD_DOCS) + message(WARNING "Flight Software Framework configuration path not set!") + message(WARNING "Setting default configuration from ${DEF_CONF_PATH} ..") + endif() add_subdirectory(${DEF_CONF_PATH}) set(FSFW_CONFIG_PATH ${DEF_CONF_PATH}) endif() diff --git a/README.md b/README.md index 312bc077..0facfc9a 100644 --- a/README.md +++ b/README.md @@ -42,7 +42,7 @@ There are some functions like `printChar` which are different depending on the t and need to be implemented by the mission developer. A template configuration folder was provided and can be copied into the project root to have -a starting point. The [configuration section](doc/README-config.md#top) provides more specific +a starting point. The [configuration section](docs/README-config.md#top) provides more specific information about the possible options. ## Adding the library @@ -109,14 +109,14 @@ The `coverage.py` script located in the `script` folder can also be used to do t ## Index -[1. High-level overview](doc/README-highlevel.md#top)
-[2. Core components](doc/README-core.md#top)
-[3. Configuration](doc/README-config.md#top)
-[4. OSAL overview](doc/README-osal.md#top)
-[5. PUS services](doc/README-pus.md#top)
-[6. Device Handler overview](doc/README-devicehandlers.md#top)
-[7. Controller overview](doc/README-controllers.md#top)
-[8. Local Data Pools](doc/README-localpools.md#top)
+[1. High-level overview](docs/README-highlevel.md#top)
+[2. Core components](docs/README-core.md#top)
+[3. Configuration](docs/README-config.md#top)
+[4. OSAL overview](docs/README-osal.md#top)
+[5. PUS services](docs/README-pus.md#top)
+[6. Device Handler overview](docs/README-devicehandlers.md#top)
+[7. Controller overview](docs/README-controllers.md#top)
+[8. Local Data Pools](docs/README-localpools.md#top)
diff --git a/cmake/FindSphinx.cmake b/cmake/FindSphinx.cmake new file mode 100644 index 00000000..4a5b0700 --- /dev/null +++ b/cmake/FindSphinx.cmake @@ -0,0 +1,13 @@ +# Look for an executable called sphinx-build +find_program(SPHINX_EXECUTABLE + NAMES sphinx-build + DOC "Path to sphinx-build executable") + +include(FindPackageHandleStandardArgs) + +# Handle standard arguments to find_package like REQUIRED and QUIET +find_package_handle_standard_args( + Sphinx + "Failed to find sphinx-build executable" + SPHINX_EXECUTABLE +) \ No newline at end of file diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt new file mode 100644 index 00000000..fa5790db --- /dev/null +++ b/docs/CMakeLists.txt @@ -0,0 +1,66 @@ +# This is based on this excellent posting provided by Sy: +# https://devblogs.microsoft.com/cppblog/clear-functional-c-documentation-with-sphinx-breathe-doxygen-cmake/ +find_package(Doxygen REQUIRED) +find_package(Sphinx REQUIRED) + +get_target_property(LIB_FSFW_PUBLIC_HEADER_DIRS ${LIB_FSFW_NAME} INTERFACE_INCLUDE_DIRECTORIES) +# TODO: Add HAL as well +file(GLOB_RECURSE LIB_FSFW_PUBLIC_HEADERS ${PROJECT_SOURCE_DIR}/src/*.h) +file(GLOB_RECURSE RST_DOC_FILES ${PROJECT_SOURCE_DIR}/docs/*.rst) + +set(DOXYGEN_INPUT_DIR ${PROJECT_SOURCE_DIR}/src) +set(DOXYGEN_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/doxygen) +set(DOXYGEN_INDEX_FILE ${DOXYGEN_OUTPUT_DIR}/xml/index.xml) +set(DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in) +set(DOXYFILE_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) + +# Replace variables inside @@ with the current values +configure_file(${DOXYFILE_IN} ${DOXYFILE_OUT} @ONLY) + +# Doxygen won't create this for us +file(MAKE_DIRECTORY ${DOXYGEN_OUTPUT_DIR}) + +# Only regenerate Doxygen when the Doxyfile or public headers change +add_custom_command( + OUTPUT ${DOXYGEN_INDEX_FILE} + DEPENDS ${LIB_FSFW_PUBLIC_HEADERS} + COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE_OUT} + MAIN_DEPENDENCY ${DOXYFILE_OUT} ${DOXYFILE_IN} + COMMENT "Generating docs" + VERBATIM +) + +# Nice named target so we can run the job easily +add_custom_target(Doxygen ALL DEPENDS ${DOXYGEN_INDEX_FILE}) + +set(SPHINX_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}) +set(SPHINX_BUILD ${CMAKE_CURRENT_BINARY_DIR}/sphinx) +set(SPHINX_INDEX_FILE ${SPHINX_BUILD}/index.html) + +# Only regenerate Sphinx when: +# - Doxygen has rerun +# - Our doc files have been updated +# - The Sphinx config has been updated +add_custom_command( + OUTPUT ${SPHINX_INDEX_FILE} + COMMAND + ${SPHINX_EXECUTABLE} -b html + # Tell Breathe where to find the Doxygen output + -Dbreathe_projects.fsfw=${DOXYGEN_OUTPUT_DIR}/xml + ${SPHINX_SOURCE} ${SPHINX_BUILD} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + DEPENDS + # Other docs files you want to track should go here (or in some variable) + ${RST_DOC_FILES} + ${DOXYGEN_INDEX_FILE} + MAIN_DEPENDENCY ${SPHINX_SOURCE}/conf.py + COMMENT "Generating documentation with Sphinx" +) + +# Nice named target so we can run the job easily +add_custom_target(Sphinx ALL DEPENDS ${SPHINX_INDEX_FILE}) + +# Add an install target to install the docs +include(GNUInstallDirs) +install(DIRECTORY ${SPHINX_BUILD} +DESTINATION ${CMAKE_INSTALL_DOCDIR}) diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in new file mode 100644 index 00000000..3d01d126 --- /dev/null +++ b/docs/Doxyfile.in @@ -0,0 +1,7 @@ +INPUT = "@DOXYGEN_INPUT_DIR@" + +RECURSIVE = YES + +OUTPUT_DIRECTORY = "@DOXYGEN_OUTPUT_DIR@" + +GENERATE_XML = YES diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 00000000..d4bb2cbb --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/doc/README-config.md b/docs/README-config.md similarity index 100% rename from doc/README-config.md rename to docs/README-config.md diff --git a/doc/README-controllers.md b/docs/README-controllers.md similarity index 100% rename from doc/README-controllers.md rename to docs/README-controllers.md diff --git a/doc/README-core.md b/docs/README-core.md similarity index 100% rename from doc/README-core.md rename to docs/README-core.md diff --git a/doc/README-devicehandlers.md b/docs/README-devicehandlers.md similarity index 100% rename from doc/README-devicehandlers.md rename to docs/README-devicehandlers.md diff --git a/doc/README-highlevel.md b/docs/README-highlevel.md similarity index 100% rename from doc/README-highlevel.md rename to docs/README-highlevel.md diff --git a/doc/README-localpools.md b/docs/README-localpools.md similarity index 98% rename from doc/README-localpools.md rename to docs/README-localpools.md index 96ae2d0a..2ee75189 100644 --- a/doc/README-localpools.md +++ b/docs/README-localpools.md @@ -31,7 +31,9 @@ cohesive pool variables. These sets simply iterator over the list of variables a `read` and `commit` functions of each variable. The following diagram shows the high-level architecture of the local data pools. -
+.. image:: ../misc/logo/FSFW_Logo_V3_bw.png + :alt: FSFW Logo + An example is shown for using the local data pools with a Gyroscope. For example, the following code shows an implementation to access data from a Gyroscope taken diff --git a/doc/README-osal.md b/docs/README-osal.md similarity index 100% rename from doc/README-osal.md rename to docs/README-osal.md diff --git a/doc/README-pus.md b/docs/README-pus.md similarity index 100% rename from doc/README-pus.md rename to docs/README-pus.md diff --git a/docs/api.rst b/docs/api.rst new file mode 100644 index 00000000..d2ee6c69 --- /dev/null +++ b/docs/api.rst @@ -0,0 +1,16 @@ +API +==== + +.. toctree:: + :maxdepth: 4 + + api/objectmanager + api/task + api/ipc + api/returnvalue + api/event + api/modes + api/health + api/action + api/devicehandler + api/controller diff --git a/docs/api/action.rst b/docs/api/action.rst new file mode 100644 index 00000000..31825b89 --- /dev/null +++ b/docs/api/action.rst @@ -0,0 +1,15 @@ +Action Module API +================= + +``ActionHelper`` +----------------- + +.. doxygenclass:: ActionHelper + :members: + +``HasActionsIF`` +----------------- + +.. doxygenclass:: HasActionsIF + :members: + :protected-members: diff --git a/docs/api/controller.rst b/docs/api/controller.rst new file mode 100644 index 00000000..27136be6 --- /dev/null +++ b/docs/api/controller.rst @@ -0,0 +1,16 @@ +Controller API +================= + +``ControllerBase`` +------------------------- + +.. doxygenclass:: ControllerBase + :members: + :protected-members: + +``ExtendedControllerBase`` +----------------------------- + +.. doxygenclass:: ExtendedControllerBase + :members: + :protected-members: diff --git a/docs/api/devicehandler.rst b/docs/api/devicehandler.rst new file mode 100644 index 00000000..f709b640 --- /dev/null +++ b/docs/api/devicehandler.rst @@ -0,0 +1,16 @@ +Device Handler Base API +========================= + +``DeviceHandlerBase`` +----------------------- + +.. doxygenclass:: DeviceHandlerBase + :members: + :protected-members: + +``DeviceHandlerIF`` +----------------------- + +.. doxygenclass:: DeviceHandlerIF + :members: + :protected-members: diff --git a/docs/api/event.rst b/docs/api/event.rst new file mode 100644 index 00000000..7553c963 --- /dev/null +++ b/docs/api/event.rst @@ -0,0 +1,6 @@ +.. _eventapi: + +Event API +============ + +.. doxygenfile:: Event.h diff --git a/docs/api/health.rst b/docs/api/health.rst new file mode 100644 index 00000000..b1d4c1b2 --- /dev/null +++ b/docs/api/health.rst @@ -0,0 +1,9 @@ +Health API +=========== + +``HasHealthIF`` +------------------ + +.. doxygenclass:: HasHealthIF + :members: + :protected-members: diff --git a/docs/api/ipc.rst b/docs/api/ipc.rst new file mode 100644 index 00000000..17a91f00 --- /dev/null +++ b/docs/api/ipc.rst @@ -0,0 +1,9 @@ +IPC Module API +================= + +``MessageQueueIF`` +------------------- + +.. doxygenclass:: MessageQueueIF + :members: + :protected-members: diff --git a/docs/api/modes.rst b/docs/api/modes.rst new file mode 100644 index 00000000..7b6b0dca --- /dev/null +++ b/docs/api/modes.rst @@ -0,0 +1,10 @@ +Modes API +========= + + +``HasModesIF`` +--------------- + +.. doxygenclass:: HasModesIF + :members: + :protected-members: diff --git a/docs/api/objectmanager.rst b/docs/api/objectmanager.rst new file mode 100644 index 00000000..e90deb57 --- /dev/null +++ b/docs/api/objectmanager.rst @@ -0,0 +1,30 @@ +Object Manager API +========================= + +``SystemObject`` +-------------------- + +.. doxygenclass:: SystemObject + :members: + :protected-members: + +``ObjectManager`` +----------------------- + +.. doxygenclass:: ObjectManager + :members: + :protected-members: + +``SystemObjectIF`` +-------------------- + +.. doxygenclass:: SystemObjectIF + :members: + :protected-members: + +``ObjectManagerIF`` +----------------------- + +.. doxygenclass:: ObjectManagerIF + :members: + :protected-members: diff --git a/docs/api/returnvalue.rst b/docs/api/returnvalue.rst new file mode 100644 index 00000000..b0d43916 --- /dev/null +++ b/docs/api/returnvalue.rst @@ -0,0 +1,10 @@ +.. _retvalapi: + +Returnvalue API +================== + +.. doxygenfile:: HasReturnvaluesIF.h + +.. _fwclassids: + +.. doxygenfile:: FwClassIds.h diff --git a/docs/api/task.rst b/docs/api/task.rst new file mode 100644 index 00000000..b218dac1 --- /dev/null +++ b/docs/api/task.rst @@ -0,0 +1,8 @@ +Task API +========= + +``ExecutableObjectIF`` +----------------------- + +.. doxygenclass:: ExecutableObjectIF + :members: diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 00000000..44fd90c4 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,56 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- Project information ----------------------------------------------------- + +project = 'Flight Software Framework' +copyright = '2021, Institute of Space Systems (IRS)' +author = 'Institute of Space Systems (IRS)' + +# The full version, including alpha/beta/rc tags +release = '2.0.1' + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ "breathe" ] + +breathe_default_project = "fsfw" + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'alabaster' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] \ No newline at end of file diff --git a/docs/config.rst b/docs/config.rst new file mode 100644 index 00000000..ed317aed --- /dev/null +++ b/docs/config.rst @@ -0,0 +1,41 @@ +Configuring the FSFW +===================== + +The FSFW can be configured via the ``fsfwconfig`` folder. A template folder has been provided in +``misc/defaultcfg`` to have a starting point for this. The folder should be added +to the include path. The primary configuration file is the ``FSFWConfig.h`` folder. Some +of the available options will be explained in more detail here. + +Auto-Translation of Events +---------------------------- + +The FSFW allows the automatic translation of events, which allows developers to track triggered +events directly via console output. Using this feature requires: + +1. ``FSFW_OBJ_EVENT_TRANSLATION`` set to 1 in the configuration file. +2. Special auto-generated translation files which translate event IDs and object IDs into + human readable strings. These files can be generated using the + `fsfwgen Python scripts `_. +3. The generated translation files for the object IDs should be named ``translatesObjects.cpp`` + and ``translateObjects.h`` and should be copied to the ``fsfwconfig/objects`` folder +4. The generated translation files for the event IDs should be named ``translateEvents.cpp`` and + ``translateEvents.h`` and should be copied to the ``fsfwconfig/events`` folder + +An example implementations of these translation file generators can be found as part +of the `SOURCE project here `_ +or the `FSFW example `_ + +Configuring the Event Manager +---------------------------------- + +The number of allowed subscriptions can be modified with the following +parameters: + +.. code-block:: cpp + + namespace fsfwconfig { + //! Configure the allocated pool sizes for the event manager. + static constexpr size_t FSFW_EVENTMGMR_MATCHTREE_NODES = 240; + static constexpr size_t FSFW_EVENTMGMT_EVENTIDMATCHERS = 120; + static constexpr size_t FSFW_EVENTMGMR_RANGEMATCHERS = 120; + } diff --git a/docs/controllers.rst b/docs/controllers.rst new file mode 100644 index 00000000..28f57393 --- /dev/null +++ b/docs/controllers.rst @@ -0,0 +1,2 @@ +Controllers +============= diff --git a/docs/core.rst b/docs/core.rst new file mode 100644 index 00000000..ef6f6165 --- /dev/null +++ b/docs/core.rst @@ -0,0 +1,70 @@ +.. _core: + +Core Modules +============= + +The core modules provide the most important functionalities of the Flight Software Framework. + +Clock +------ + +- This is a class of static functions that can be used at anytime +- Leap Seconds must be set if any time conversions from UTC to other times is used + +Object Manager +--------------- + +- Must be created during program startup +- The component which handles all references. All :cpp:class:`SystemObject`\s register at this + component. +- All :cpp:class:`SystemObject`\s needs to have a unique Object ID. Those can be managed like + framework objects. +- A reference to an object can be retrieved by calling the ``get`` function of + :cpp:class:`ObjectManagerIF`. The target type must be specified as a template argument. + A ``nullptr`` check of the returning pointer must be done. This function is based on + run-time type information. + + .. code-block:: cpp + + template T* ObjectManagerIF::get(object_id_t id); + +- A typical way to create all objects on startup is a handing a static produce function to the + ObjectManager on creation. By calling ``ObjectManager::instance()->initialize(produceFunc)`` the + produce function will be called and all :cpp:class:`SystemObject`\s will be initialized + afterwards. + +Event Manager +--------------- + +- Component which allows routing of events +- Other objects can subscribe to specific events, ranges of events or all events of an object. +- Subscriptions can be done during runtime but should be done during initialization +- Amounts of allowed subscriptions can be configured in ``FSFWConfig.h`` + +Health Table +--------------- + +- A component which holds every health state +- Provides a thread safe way to access all health states without the need of message exchanges + +Stores +-------------- + +- The message based communication can only exchange a few bytes of information inside the message + itself. Therefore, additional information can be exchanged with Stores. With this, only the + store address must be exchanged in the message. +- Internally, the FSFW uses an IPC Store to exchange data between processes. For incoming TCs a TC + Store is used. For outgoing TM a TM store is used. +- All of them should use the Thread Safe Class storagemanager/PoolManager + +Tasks +--------- + +There are two different types of tasks: + +- The PeriodicTask just executes objects that are of type ExecutableObjectIF in the order of the + insertion to the Tasks. +- FixedTimeslotTask executes a list of calls in the order of the given list. This is intended for + DeviceHandlers, where polling should be in a defined order. An example can be found in + ``defaultcfg/fsfwconfig/pollingSequence`` folder + diff --git a/docs/devicehandlers.rst b/docs/devicehandlers.rst new file mode 100644 index 00000000..58c2df78 --- /dev/null +++ b/docs/devicehandlers.rst @@ -0,0 +1,3 @@ +Device Handlers +================== + diff --git a/doc/doxy/.gitignore b/docs/doxy/.gitignore similarity index 100% rename from doc/doxy/.gitignore rename to docs/doxy/.gitignore diff --git a/doc/doxy/OPUS.doxyfile b/docs/doxy/OPUS.doxyfile similarity index 100% rename from doc/doxy/OPUS.doxyfile rename to docs/doxy/OPUS.doxyfile diff --git a/docs/getting_started.rst b/docs/getting_started.rst new file mode 100644 index 00000000..069e98cd --- /dev/null +++ b/docs/getting_started.rst @@ -0,0 +1,115 @@ +Getting Started +================ + + +Getting started +---------------- + +The `Hosted FSFW example`_ provides a good starting point and a demo to see the FSFW capabilities. +It is recommended to get started by building and playing around with the demo application. +There are also other examples provided for all OSALs using the popular embedded platforms +Raspberry Pi, Beagle Bone Black and STM32H7. + +Generally, the FSFW is included in a project by providing +a configuration folder, building the static library and linking against it. +There are some functions like ``printChar`` which are different depending on the target architecture +and need to be implemented by the mission developer. + +A template configuration folder was provided and can be copied into the project root to have +a starting point. The [configuration section](docs/README-config.md#top) provides more specific +information about the possible options. + +Adding the library +------------------- + +The following steps show how to add and use FSFW components. It is still recommended to +try out the example mentioned above to get started, but the following steps show how to +add and link against the FSFW library in general. + +1. Add this repository as a submodule + + .. code-block:: console + + git submodule add https://egit.irs.uni-stuttgart.de/fsfw/fsfw.git fsfw + +2. Add the following directive inside the uppermost ``CMakeLists.txt`` file of your project + + .. code-block:: cmake + + add_subdirectory(fsfw) + +3. Make sure to provide a configuration folder and supply the path to that folder with + the `FSFW_CONFIG_PATH` CMake variable from the uppermost `CMakeLists.txt` file. + It is also necessary to provide the `printChar` function. You can find an example + implementation for a hosted build + `here `_. + +4. Link against the FSFW library + + .. code-block:: cmake + + target_link_libraries( PRIVATE fsfw) + + +5. It should now be possible use the FSFW as a static library from the user code. + +Building the unittests +------------------------- + +The FSFW also has unittests which use the `Catch2 library`_. +These are built by setting the CMake option ``FSFW_BUILD_UNITTESTS`` to ``ON`` or `TRUE` +from your project `CMakeLists.txt` file or from the command line. + +The fsfw-tests binary will be built as part of the static library and dropped alongside it. +If the unittests are built, the library and the tests will be built with coverage information by +default. This can be disabled by setting the `FSFW_TESTS_COV_GEN` option to `OFF` or `FALSE`. + +You can use the following commands inside the ``fsfw`` folder to set up the build system + +.. code-block:: console + + mkdir build-tests && cd build-tests + cmake -DFSFW_BUILD_UNITTESTS=ON -DFSFW_OSAL=host .. + + +You can also use ``-DFSFW_OSAL=linux`` on Linux systems. + +Coverage data in HTML format can be generated using the `Code coverage`_ CMake module. +To build the unittests, run them and then generare the coverage data in this format, +the following command can be used inside the build directory after the build system was set up + +.. code-block:: console + + cmake --build . -- fsfw-tests_coverage -j + + +The ``helper.py`` script located in the ``script`` folder can also be used to create, build +and open the unittests conveniently. Try ``helper.py -h`` for more information. + +Building the documentation +---------------------------- + +The FSFW documentation is built using the tools Sphinx, doxygen and breathe based on the +instructions provided in `this blogpost `_. You can set up a +documentation build system using the following commands + +.. code-block:: bash + + mkdir build-docs && cd build-docs + cmake -DFSFW_BUILD_DOCS=ON -DFSFW_OSAL=host .. + +Then you can generate the documentation using + +.. code-block:: bash + + cmake --build . -j + +You can find the generated documentation inside the ``docs/sphinx`` folder inside the build +folder. Simply open the ``index.html`` in the webbrowser of your choice. + +The ``helper.py`` script located in the ``script`` folder can also be used to create, build +and open the documentation conveniently. Try ``helper.py -h`` for more information. + +.. _`Hosted FSFW example`: https://egit.irs.uni-stuttgart.de/fsfw/fsfw-example-hosted +.. _`Catch2 library`: https://github.com/catchorg/Catch2 +.. _`Code coverage`: https://github.com/bilke/cmake-modules/tree/master diff --git a/docs/highlevel.rst b/docs/highlevel.rst new file mode 100644 index 00000000..08f44777 --- /dev/null +++ b/docs/highlevel.rst @@ -0,0 +1,149 @@ +.. _highlevel: + +High-level overview +=================== + +Structure +---------- + +The general structure is driven by the usage of interfaces provided by objects. +The FSFW uses C++11 as baseline. The intention behind this is that this C++ Standard should be +widely available, even with older compilers. +The FSFW uses dynamic allocation during the initialization but provides static containers during runtime. +This simplifies the instantiation of objects and allows the usage of some standard containers. +Dynamic Allocation after initialization is discouraged and different solutions are provided in the +FSFW to achieve that. The fsfw uses run-time type information but exceptions are not allowed. + +Failure Handling +----------------- + +Functions should return a defined :cpp:type:`ReturnValue_t` to signal to the caller that something has +gone wrong. Returnvalues must be unique. For this the function :cpp:func:`HasReturnvaluesIF::makeReturnCode` +or the :ref:`macro MAKE_RETURN_CODE ` can be used. The ``CLASS_ID`` is a unique ID for that type of object. +See the :ref:`FSFW Class IDs file `. The user can add custom ``CLASS_ID``\s via the +``fsfwconfig`` folder. + +OSAL +------------ + +The FSFW provides operation system abstraction layers for Linux, FreeRTOS and RTEMS. +The OSAL provides periodic tasks, message queues, clocks and semaphores as well as mutexes. +The :ref:`OSAL README ` provides more detailed information on provided components +and how to use them. + +Core Components +---------------- + +The FSFW has following core components. More detailed informations can be found in the +:ref:`core component section `: + +1. Tasks: Abstraction for different (periodic) task types like periodic tasks or tasks + with fixed timeslots +2. ObjectManager: This module stores all `SystemObjects` by mapping a provided unique object ID + to the object handles. +3. Static Stores: Different stores are provided to store data of variable size (like telecommands + or small telemetry) in a pool structure without using dynamic memory allocation. + These pools are allocated up front. +4. Clock: This module provided common time related functions +5. EventManager: This module allows routing of events generated by `SystemObjects` +6. HealthTable: A component which stores the health states of objects + +Static IDs in the framework +-------------------------------- + +Some parts of the framework use a static routing address for communication. +An example setup of IDs can be found in the example config in ``misc/defaultcfg/fsfwconfig/objects`` +inside the function ``Factory::setStaticFrameworkObjectIds``. + +Events +---------------- + +Events are tied to objects. EventIds can be generated by calling the +:ref:`macro MAKE_EVENT ` or the function :cpp:func:`event::makeEvent`. +This works analog to the returnvalues. Every object that needs own Event IDs has to get a +unique ``SUBSYSTEM_ID``. Every :cpp:class:`SystemObject` can call +:cpp:func:`SystemObject::triggerEvent` from the parent class. +Therefore, event messages contain the specific EventId and the objectId of the object that +has triggered. + +Internal Communication +------------------------- + +Components communicate mostly via Messages through Queues. +Those queues are created by calling the singleton ``QueueFactory::instance()->create`` which +will create `MessageQueue` instances for the used OSAL. + +External Communication +-------------------------- + +The external communication with the mission control system is mostly up to the user implementation. +The FSFW provides PUS Services which can be used to but don't need to be used. +The services can be seen as a conversion from a TC to a message based communication and back. + +TMTC Communication +~~~~~~~~~~~~~~~~~~~ + +The FSFW provides some components to facilitate TMTC handling via the PUS commands. +For example, a UDP or TCP PUS server socket can be opened on a specific port using the +files located in ``osal/common``. The FSFW example uses this functionality to allow sending +telecommands and receiving telemetry using the +`TMTC commander application `_. + +Simple commands like the PUS Service 17 ping service can be tested by simply running the +``tmtc_client_cli.py`` or ``tmtc_client_gui.py`` utility in +the `example tmtc folder `_ +while the `fsfw_example` application is running. + +More generally, any class responsible for handling incoming telecommands and sending telemetry +can implement the generic ``TmTcBridge`` class located in ``tmtcservices``. Many applications +also use a dedicated polling task for reading telecommands which passes telecommands +to the ``TmTcBridge`` implementation. + +CCSDS Frames, CCSDS Space Packets and PUS +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If the communication is based on CCSDS Frames and Space Packets, several classes can be used to +distributed the packets to the corresponding services. Those can be found in ``tcdistribution``. +If Space Packets are used, a timestamper has to be provided by the user. +An example can be found in the ``timemanager`` folder, which uses ``CCSDSTime::CDS_short``. + +Device Handlers +-------------------------- + +DeviceHandlers are another important component of the FSFW. The idea is, to have a software +counterpart of every physical device to provide a simple mode, health and commanding interface. +By separating the underlying Communication Interface with +``DeviceCommunicationIF``, a device handler (DH) can be tested on different hardware. +The DH has mechanisms to monitor the communication with the physical device which allow +for FDIR reaction. Device Handlers can be created by implementing ``DeviceHandlerBase``. +A standard FDIR component for the DH will be created automatically but can +be overwritten by the user. More information on DeviceHandlers can be found in the +related [documentation section](doc/README-devicehandlers.md#top). + +Modes and Health +-------------------- + +The two interfaces ``HasModesIF`` and ``HasHealthIF`` provide access for commanding and monitoring +of components. On-board mode management is implement in hierarchy system. + +- Device handlers and controllers are the lowest part of the hierarchy. +- The next layer are assemblies. Those assemblies act as a component which handle + redundancies of handlers. Assemblies share a common core with the top level subsystem components +- The top level subsystem components are used to group assemblies, controllers and device handlers. + For example, a spacecraft can have a atttitude control subsystem and a power subsystem. + +Those assemblies are intended to act as auto-generated components from a database which describes +the subsystem modes. The definitions contain transition and target tables which contain the DH, +Assembly and Controller Modes to be commanded. +Transition tables contain as many steps as needed to reach the mode from any other mode, e.g. a +switch into any higher AOCS mode might first turn on the sensors, than the actuators and the +controller as last component. +The target table is used to describe the state that is checked continuously by the subsystem. +All of this allows System Modes to be generated as Subsystem object as well from the same database. +This System contains list of subsystem modes in the transition and target tables. +Therefore, it allows a modular system to create system modes and easy commanding of those, because +only the highest components must be commanded. + +The health state represents if the component is able to perform its tasks. +This can be used to signal the system to avoid using this component instead of a redundant one. +The on-board FDIR uses the health state for isolation and recovery. diff --git a/doc/images/PoolArchitecture.png b/docs/images/PoolArchitecture.png similarity index 100% rename from doc/images/PoolArchitecture.png rename to docs/images/PoolArchitecture.png diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 00000000..b37c0904 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,69 @@ +.. Flight Software Framework documentation master file, created by + sphinx-quickstart on Tue Nov 30 10:56:03 2021. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Flight Software Framework (FSFW) documentation +================================================ + +.. image:: ../misc/logo/FSFW_Logo_V3_bw.png + :alt: FSFW Logo + +The Flight Software Framework is a C++ Object Oriented Framework for unmanned, +automated systems like Satellites. + +The initial version of the Flight Software Framework was developed during +the Flying Laptop Project by the University of Stuttgart in cooperation +with Airbus Defence and Space GmbH. + +Quick facts +--------------- + +The framework is designed for systems, which communicate with external devices, perform control +loops, receive telecommands and send telemetry, and need to maintain a high level of availability. +Therefore, a mode and health system provides control over the states of the software and the +controlled devices. In addition, a simple mechanism of event based fault detection, isolation and +recovery is implemented as well. + +The FSFW provides abstraction layers for operating systems to provide a uniform operating system +abstraction layer (OSAL). Some components of this OSAL are required internally by the FSFW but is +also very useful for developers to implement the same application logic on different operating +systems with a uniform interface. + +Currently, the FSFW provides the following OSALs: + +- Linux +- Host +- FreeRTOS +- RTEMS + +The recommended hardware is a microprocessor with more than 1 MB of RAM and 1 MB of non-volatile +memory. For reference, current applications use a Cobham Gaisler UT699 (LEON3FT), a +ISISPACE IOBC or a Zynq-7020 SoC. The ``fsfw`` was also successfully run on the +STM32H743ZI-Nucleo board and on a Raspberry Pi and is currently running on the active +satellite mission Flying Laptop. + +Index +------- + +.. toctree:: + :maxdepth: 2 + :caption: Contents: + + getting_started + highlevel + core + config + osal + pus + devicehandlers + controllers + localpools + api + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/localpools.rst b/docs/localpools.rst new file mode 100644 index 00000000..d2afd0a0 --- /dev/null +++ b/docs/localpools.rst @@ -0,0 +1,181 @@ +Local Data Pools +========================================= + +The following text is targeted towards mission software developers which would like +to use the local data pools provided by the FSFW to store data like sensor values so they can be +used by other software objects like controllers as well. If a custom class should have a local +pool which can be used by other software objects as well, following steps have to be performed: + +1. Create a ``LocalDataPoolManager`` member object in the custom class +2. Implement the ``HasLocalDataPoolIF`` with specifies the interface between the local pool + manager and the class owning the local pool. + +The local data pool manager is also able to process housekeeping service requests in form +of messages, generate periodic housekeeping packet, generate notification and snapshots of changed +variables and datasets and process notifications and snapshots coming from other objects. +The two former tasks are related to the external interface using telemetry and telecommands (TMTC) +while the later two are related to data consumers like controllers only acting on data change +detected by the data creator instead of checking the data manually each cycle. Two important +framework classes ``DeviceHandlerBase`` and ``ExtendedControllerBase`` already perform the two steps +shown above so the steps required are altered slightly. + +Storing and Accessing pool data +------------------------------------- + +The pool manager is responsible for thread-safe access of the pool data, but the actual +access to the pool data from the point of view of a mission software developer happens via proxy +classes like pool variable classes. These classes store a copy +of the pool variable with the matching datatype and copy the actual data from the local pool +on a ``read`` call. Changed variables can then be written to the local pool with a ``commit`` call. +The ``read`` and ``commit`` calls are thread-safe and can be called concurrently from data creators +and data consumers. Generally, a user will create a dataset class which in turn groups all +cohesive pool variables. These sets simply iterator over the list of variables and call the +``read`` and ``commit`` functions of each variable. The following diagram shows the +high-level architecture of the local data pools. + +.. image:: ../docs/images/PoolArchitecture.png + :alt: Pool Architecture + +An example is shown for using the local data pools with a Gyroscope. +For example, the following code shows an implementation to access data from a Gyroscope taken +from the SOURCE CubeSat project: + +.. code-block:: cpp + + class GyroPrimaryDataset: public StaticLocalDataSet<3 * sizeof(float)> { + public: + /** + * Constructor for data users + * @param gyroId + */ + GyroPrimaryDataset(object_id_t gyroId): + StaticLocalDataSet(sid_t(gyroId, gyrodefs::GYRO_DATA_SET_ID)) { + setAllVariablesReadOnly(); + } + + lp_var_t angVelocityX = lp_var_t(sid.objectId, + gyrodefs::ANGULAR_VELOCITY_X, this); + lp_var_t angVelocityY = lp_var_t(sid.objectId, + gyrodefs::ANGULAR_VELOCITY_Y, this); + lp_var_t angVelocityZ = lp_var_t(sid.objectId, + gyrodefs::ANGULAR_VELOCITY_Z, this); + private: + + friend class GyroHandler; + /** + * Constructor for data creator + * @param hkOwner + */ + GyroPrimaryDataset(HasLocalDataPoolIF* hkOwner): + StaticLocalDataSet(hkOwner, gyrodefs::GYRO_DATA_SET_ID) {} + }; + +There is a public constructor for users which sets all variables to read-only and there is a +constructor for the GyroHandler data creator by marking it private and declaring the ``GyroHandler`` +as a friend class. Both the atittude controller and the ``GyroHandler`` can now +use the same class definition to access the pool variables with ``read`` and ``commit`` semantics +in a thread-safe way. Generally, each class requiring access will have the set class as a member +class. The data creator will also be generally a ``DeviceHandlerBase`` subclass and some additional +steps are necessary to expose the set for housekeeping purposes. + +Using the local data pools in a ``DeviceHandlerBase`` subclass +-------------------------------------------------------------- + +It is very common to store data generated by devices like a sensor into a pool which can +then be used by other objects. Therefore, the ``DeviceHandlerBase`` already has a +local pool. Using the aforementioned example, the ``GyroHandler`` will now have the set class +as a member: + +.. code-block:: cpp + + class GyroHandler: ... { + + public: + ... + private: + ... + GyroPrimaryDataset gyroData; + ... + }; + + +The constructor used for the creators expects the owner class as a parameter, so we initialize +the object in the `GyroHandler` constructor like this: + +.. code-block:: cpp + + GyroHandler::GyroHandler(object_id_t objectId, object_id_t comIF, + CookieIF *comCookie, uint8_t switchId): + DeviceHandlerBase(objectId, comIF, comCookie), switchId(switchId), + gyroData(this) {} + + +We need to assign the set to a reply ID used in the ``DeviceHandlerBase``. +The combination of the ``GyroHandler`` object ID and the reply ID will be the 64-bit structure ID +``sid_t`` and is used to globally identify the set, for example when requesting housekeeping data or +generating update messages. We need to assign our custom set class in some way so that the local +pool manager can access the custom data sets as well. +By default, the ``getDataSetHandle`` will take care of this tasks. The default implementation for a +``DeviceHandlerBase`` subclass will use the internal command map to retrieve +a handle to a dataset from a given reply ID. Therefore, +we assign the set in the ``fillCommandAndReplyMap`` function: + +.. code-block:: cpp + + void GyroHandler::fillCommandAndReplyMap() { + ... + this->insertInCommandAndReplyMap(gyrodefs::GYRO_DATA, 3, &gyroData); + ... + } + + +Now, we need to create the actual pool entries as well, using the ``initializeLocalDataPool`` +function. Here, we also immediately subscribe for periodic housekeeping packets +with an interval of 4 seconds. They are still disabled in this example and can be enabled +with a housekeeping service command. + +.. code-block:: cpp + + ReturnValue_t GyroHandler::initializeLocalDataPool(localpool::DataPool &localDataPoolMap, + LocalDataPoolManager &poolManager) { + localDataPoolMap.emplace(gyrodefs::ANGULAR_VELOCITY_X, + new PoolEntry({0.0})); + localDataPoolMap.emplace(gyrodefs::ANGULAR_VELOCITY_Y, + new PoolEntry({0.0})); + localDataPoolMap.emplace(gyrodefs::ANGULAR_VELOCITY_Z, + new PoolEntry({0.0})); + localDataPoolMap.emplace(gyrodefs::GENERAL_CONFIG_REG42, + new PoolEntry({0})); + localDataPoolMap.emplace(gyrodefs::RANGE_CONFIG_REG43, + new PoolEntry({0})); + + poolManager.subscribeForPeriodicPacket(gyroData.getSid(), false, 4.0, false); + return HasReturnvaluesIF::RETURN_OK; + } + +Now, if we receive some sensor data and converted them into the right format, +we can write it into the pool like this, using a guard class to ensure the set is commited back +in any case: + +.. code-block:: cpp + + PoolReadGuard readHelper(&gyroData); + if(readHelper.getReadResult() == HasReturnvaluesIF::RETURN_OK) { + if(not gyroData.isValid()) { + gyroData.setValidity(true, true); + } + + gyroData.angVelocityX = angularVelocityX; + gyroData.angVelocityY = angularVelocityY; + gyroData.angVelocityZ = angularVelocityZ; + } + + +The guard class will commit the changed data on destruction automatically. + +Using the local data pools in a ``ExtendedControllerBase`` subclass +---------------------------------------------------------------------- + +Coming soon + + diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 00000000..922152e9 --- /dev/null +++ b/docs/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/docs/osal.rst b/docs/osal.rst new file mode 100644 index 00000000..7ac66e47 --- /dev/null +++ b/docs/osal.rst @@ -0,0 +1,63 @@ +.. _osal: + +Operating System Abstraction Layer (OSAL) +============================================ + +Some specific information on the provided OSALs are provided. + +Linux +------- + +This OSAL can be used to compile for Linux host systems like Ubuntu 20.04 or for +embedded Linux targets like the Raspberry Pi. This OSAL generally requires threading support +and real-time functionalities. For most UNIX systems, this is done by adding ``-lrt`` and +``-lpthread`` to the linked libraries in the compilation process. The CMake build support provided +will do this automatically for the ``fsfw`` target. It should be noted that most UNIX systems need +to be configured specifically to allow the real-time functionalities required by the FSFW. + +Hosted OSAL +------------------- + +This is the newest OSAL. Support for Semaphores has not been implemented yet and will propably be +implemented as soon as C++20 with Semaphore support has matured. This OSAL can be used to run the +FSFW on any host system, but currently has only been tested on Windows 10 and Ubuntu 20.04. Unlike +the other OSALs, it uses dynamic memory allocation (e.g. for the message queue implementation). +Cross-platform serial port (USB) support might be added soon. + +FreeRTOS OSAL +------------------ + +FreeRTOS is not included and the developer needs to take care of compiling the FreeRTOS sources and +adding the ``FreeRTOSConfig.h`` file location to the include path. This OSAL has only been tested +extensively with the pre-emptive scheduler configuration so far but it should in principle also be +possible to use a cooperative scheduler. It is recommended to use the `heap_4` allocation scheme. +When using newlib (nano), it is also recommended to add ``#define configUSE_NEWLIB_REENTRANT`` to +the FreeRTOS configuration file to ensure thread-safety. + +When using this OSAL, developers also need to provide an implementation for the +``vRequestContextSwitchFromISR`` function. This has been done because the call to request a context +switch from an ISR is generally located in the ``portmacro.h`` header and is different depending on +the target architecture or device. + +RTEMS OSAL +--------------- + +The RTEMS OSAL was the first implemented OSAL which is also used on the active satellite Flying Laptop. + +TCP/IP socket abstraction +------------------------------ + +The Linux and Host OSAL provide abstraction layers for the socket API. Currently, only UDP sockets +have been imlemented. This is very useful to test TMTC handling either on the host computer +directly (targeting localhost with a TMTC application) or on embedded Linux devices, sending +TMTC packets via Ethernet. + +Example Applications +---------------------- + +There are example applications available for each OSAL + +- `Hosted OSAL `_ +- `Linux OSAL for MCUs `_ +- `FreeRTOS OSAL on the STM32H743ZIT `_ +- `RTEMS OSAL on the STM32H743ZIT `_ diff --git a/docs/pus.rst b/docs/pus.rst new file mode 100644 index 00000000..8dbb2104 --- /dev/null +++ b/docs/pus.rst @@ -0,0 +1,2 @@ +PUS Services +============== diff --git a/misc/defaultcfg/fsfwconfig/CMakeLists.txt b/misc/defaultcfg/fsfwconfig/CMakeLists.txt index 178fc273..3b2064ba 100644 --- a/misc/defaultcfg/fsfwconfig/CMakeLists.txt +++ b/misc/defaultcfg/fsfwconfig/CMakeLists.txt @@ -1,23 +1,49 @@ -target_include_directories(${TARGET_NAME} PRIVATE +if(DEFINED TARGET_NAME) + target_include_directories(${TARGET_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} -) - -target_sources(${TARGET_NAME} PRIVATE - ipc/missionMessageTypes.cpp - pollingsequence/PollingSequenceFactory.cpp - objects/FsfwFactory.cpp -) - -# If a special translation file for object IDs exists, compile it. -if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp") - target_sources(${TARGET_NAME} PRIVATE - objects/translateObjects.cpp ) -endif() -# If a special translation file for events exists, compile it. -if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp") target_sources(${TARGET_NAME} PRIVATE - events/translateEvents.cpp + ipc/missionMessageTypes.cpp + pollingsequence/PollingSequenceFactory.cpp + objects/FsfwFactory.cpp ) + + # If a special translation file for object IDs exists, compile it. + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp") + target_sources(${TARGET_NAME} PRIVATE + objects/translateObjects.cpp + ) + endif() + + # If a special translation file for events exists, compile it. + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp") + target_sources(${TARGET_NAME} PRIVATE + events/translateEvents.cpp + ) + endif() +else() + target_include_directories(${LIB_FSFW_NAME} PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + ) + + target_sources(${LIB_FSFW_NAME} PRIVATE + ipc/missionMessageTypes.cpp + pollingsequence/PollingSequenceFactory.cpp + objects/FsfwFactory.cpp + ) + + # If a special translation file for object IDs exists, compile it. + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp") + target_sources(${LIB_FSFW_NAME} PRIVATE + objects/translateObjects.cpp + ) + endif() + + # If a special translation file for events exists, compile it. + if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/objects/translateObjects.cpp") + target_sources(${LIB_FSFW_NAME} PRIVATE + events/translateEvents.cpp + ) + endif() endif() diff --git a/misc/defaultcfg/fsfwconfig/objects/FsfwFactory.cpp b/misc/defaultcfg/fsfwconfig/objects/FsfwFactory.cpp index 08ad41ec..5aef4980 100644 --- a/misc/defaultcfg/fsfwconfig/objects/FsfwFactory.cpp +++ b/misc/defaultcfg/fsfwconfig/objects/FsfwFactory.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include @@ -48,6 +48,6 @@ void Factory::setStaticFrameworkObjectIds() { DeviceHandlerFailureIsolation::powerConfirmationId = objects::NO_OBJECT; - TmPacketStored::timeStamperId = objects::NO_OBJECT; + TmPacketBase::timeStamperId = objects::NO_OBJECT; } diff --git a/scripts/coverage.py b/scripts/coverage.py deleted file mode 100755 index b5bd7745..00000000 --- a/scripts/coverage.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -* -"""Small portable helper script to generate LCOV HTML coverage data""" -import os -import platform -import sys -import time -import argparse -import webbrowser -from typing import List - - -"""Copy this helper script into your project folder. It will try to determine a CMake build folder -and then attempt to build your project with coverage information. - -See Unittest documentation at https://egit.irs.uni-stuttgart.de/fsfw/fsfw for more -information how to set up the build folder. -""" -def main(): - - parser = argparse.ArgumentParser(description="Processing arguments for LCOV helper script.") - parser.add_argument( - '-o', '--open', action='store_true', help='Open coverage data in webbrowser' - ) - args = parser.parse_args() - - build_dir_list = [] - if not os.path.isfile('README.md'): - os.chdir('..') - for directory in os.listdir("."): - if os.path.isdir(directory): - os.chdir(directory) - check_for_cmake_build_dir(build_dir_list) - os.chdir("..") - - if len(build_dir_list) == 0: - print("No valid CMake build directory found. Trying to set up hosted build") - build_directory = 'build-Debug-Host' - os.mkdir(build_directory) - os.chdir(build_directory) - os.system('cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON ..') - os.chdir('..') - elif len(build_dir_list) == 1: - build_directory = build_dir_list[0] - else: - print("Multiple build directories found!") - build_directory = determine_build_dir(build_dir_list) - perform_lcov_operation(build_directory) - if os.path.isdir('fsfw-tests_coverage') and args.open: - webbrowser.open('fsfw-tests_coverage/index.html') - - -def check_for_cmake_build_dir(build_dir_dict: list): - if os.path.isfile("CMakeCache.txt"): - build_dir_dict.append(os.getcwd()) - - -def perform_lcov_operation(directory): - os.chdir(directory) - os.system("cmake --build . -- fsfw-tests_coverage -j") - - -def determine_build_dir(build_dir_list: List[str]): - build_directory = "" - for idx, directory in enumerate(build_dir_list): - print(f"{idx + 1}: {directory}") - while True: - idx = input("Pick the directory to perform LCOV HTML generation by index: ") - if not idx.isdigit(): - print("Invalid input!") - continue - - idx = int(idx) - if idx > len(build_dir_list) or idx < 1: - print("Invalid input!") - continue - build_directory = build_dir_list[idx - 1] - break - return build_directory - - -if __name__ == "__main__": - main() diff --git a/scripts/gen-unittest.sh b/scripts/gen-unittest.sh deleted file mode 100755 index 9ca8c399..00000000 --- a/scripts/gen-unittest.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/sh -mkdir build-Unittest && cd build-Unittest -cmake -DFSFW_BUILD_UNITTESTS=ON -DFSFW_OSAL=host -DCMAKE_BUILD_TYPE=Debug .. diff --git a/scripts/helper.py b/scripts/helper.py new file mode 100755 index 00000000..5ceff8c4 --- /dev/null +++ b/scripts/helper.py @@ -0,0 +1,181 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -* +"""Small portable helper script to generate test or doc configuration for the +flight software framework +""" +import os +import argparse +import webbrowser +import shutil +import sys +from typing import List + + +UNITTEST_FOLDER_NAME = 'build-tests' +DOCS_FOLDER_NAME = 'build-docs' + + +def main(): + + parser = argparse.ArgumentParser(description="FSFW helper script") + choices = ('docs', 'tests') + parser.add_argument( + 'type', metavar='type', choices=choices, + help=f'Target type. Choices: {choices}' + ) + parser.add_argument( + '-a', '--all', action='store_true', + help='Create, build and open specified type' + ) + parser.add_argument( + '-c', '--create', action='store_true', + help='Create docs or test build configuration' + ) + parser.add_argument( + '-b', '--build', action='store_true', + help='Build the specified type' + ) + parser.add_argument( + '-o', '--open', action='store_true', + help='Open test or documentation data in webbrowser' + ) + + args = parser.parse_args() + if args.all: + args.build = True + args.create = True + args.open = True + elif not args.build and not args.create and not args.open: + print( + 'Please select at least one operation to perform. ' + 'Use helper.py -h for more information' + ) + sys.exit(1) + + # This script can be called from root and from script folder + if not os.path.isfile('README.md'): + os.chdir('..') + build_dir_list = [] + if not args.create: + build_dir_list = build_build_dir_list() + + if args.type == 'tests': + handle_tests_type(args, build_dir_list) + elif args.type == 'docs': + handle_docs_type(args, build_dir_list) + else: + print('Invalid or unknown type') + sys.exit(1) + + +def handle_docs_type(args, build_dir_list: list): + if args.create: + shutil.rmtree(DOCS_FOLDER_NAME) + create_docs_build_cfg() + build_directory = DOCS_FOLDER_NAME + elif len(build_dir_list) == 0: + print('No valid CMake docs build directory found. Trying to set up docs build system') + shutil.rmtree(DOCS_FOLDER_NAME) + create_docs_build_cfg() + build_directory = DOCS_FOLDER_NAME + elif len(build_dir_list) == 1: + build_directory = build_dir_list[0] + else: + print("Multiple build directories found!") + build_directory = determine_build_dir(build_dir_list) + os.chdir(build_directory) + if args.build: + os.system('cmake --build . -j') + if args.open: + if not os.path.isfile('docs/sphinx/index.html'): + print( + "No Sphinx documentation file detected. " + "Try to build it first with the -b argument" + ) + sys.exit(1) + webbrowser.open('docs/sphinx/index.html') + + +def handle_tests_type(args, build_dir_list: list): + if args.create: + shutil.rmtree(UNITTEST_FOLDER_NAME) + create_tests_build_cfg() + build_directory = UNITTEST_FOLDER_NAME + elif len(build_dir_list) == 0: + print( + 'No valid CMake tests build directory found. ' + 'Trying to set up test build system' + ) + create_tests_build_cfg() + build_directory = UNITTEST_FOLDER_NAME + elif len(build_dir_list) == 1: + build_directory = build_dir_list[0] + else: + print("Multiple build directories found!") + build_directory = determine_build_dir(build_dir_list) + os.chdir(build_directory) + if args.build: + perform_lcov_operation(build_directory) + if args.open: + if not os.path.isdir('fsfw-tests_coverage'): + print("No Unittest folder detected. Try to build them first with the -b argument") + sys.exit(1) + webbrowser.open('fsfw-tests_coverage/index.html') + + +def create_tests_build_cfg(): + os.mkdir(UNITTEST_FOLDER_NAME) + os.chdir(UNITTEST_FOLDER_NAME) + os.system('cmake -DFSFW_OSAL=host -DFSFW_BUILD_UNITTESTS=ON ..') + os.chdir('..') + + +def create_docs_build_cfg(): + os.mkdir(DOCS_FOLDER_NAME) + os.chdir(DOCS_FOLDER_NAME) + os.system('cmake -DFSFW_OSAL=host -DFSFW_BUILD_DOCS=ON ..') + os.chdir('..') + + +def build_build_dir_list() -> list: + build_dir_list = [] + for directory in os.listdir("."): + if os.path.isdir(directory): + os.chdir(directory) + build_dir_list = check_for_cmake_build_dir(build_dir_list) + os.chdir("..") + return build_dir_list + + +def check_for_cmake_build_dir(build_dir_list: list) -> list: + if os.path.isfile("CMakeCache.txt"): + build_dir_list.append(os.getcwd()) + return build_dir_list + + +def perform_lcov_operation(directory): + os.chdir(directory) + os.system("cmake --build . -- fsfw-tests_coverage -j") + + +def determine_build_dir(build_dir_list: List[str]): + build_directory = "" + for idx, directory in enumerate(build_dir_list): + print(f"{idx + 1}: {directory}") + while True: + idx = input("Pick the directory: ") + if not idx.isdigit(): + print("Invalid input!") + continue + + idx = int(idx) + if idx > len(build_dir_list) or idx < 1: + print("Invalid input!") + continue + build_directory = build_dir_list[idx - 1] + break + return build_directory + + +if __name__ == "__main__": + main() diff --git a/tests/src/fsfw_tests/integration/task/CMakeLists.txt b/tests/src/fsfw_tests/integration/task/CMakeLists.txt index 0402d093..4cd481bf 100644 --- a/tests/src/fsfw_tests/integration/task/CMakeLists.txt +++ b/tests/src/fsfw_tests/integration/task/CMakeLists.txt @@ -1,3 +1,3 @@ -target_sources(${TARGET_NAME} PRIVATE +target_sources(${LIB_FSFW_NAME} PRIVATE TestTask.cpp ) \ No newline at end of file From fd7581f8babebdd9eeb13cc4a9800dbb80f893a4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 1 Dec 2021 16:08:28 +0100 Subject: [PATCH 383/389] Added formatting scripts 1. Added .clang-format file which contains information for the clang-format tool on how to format source files 2. Added shell helper script to apply all changes on HAL soures, test sources and primary sources The shell script was not applied yet. This should be done shortly before introducing the release. Also, it might be good idea to provide instructions on how to set up the formatter for Eclipse --- .clang-format | 7 +++++++ scripts/apply-clang-format.sh | 8 ++++++++ 2 files changed, 15 insertions(+) create mode 100644 .clang-format create mode 100755 scripts/apply-clang-format.sh diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..a3cf6a1f --- /dev/null +++ b/.clang-format @@ -0,0 +1,7 @@ +--- +BasedOnStyle: Google +IndentWidth: 2 +--- +Language: Cpp +ColumnWidth: 100 +--- diff --git a/scripts/apply-clang-format.sh b/scripts/apply-clang-format.sh new file mode 100755 index 00000000..36f5ee92 --- /dev/null +++ b/scripts/apply-clang-format.sh @@ -0,0 +1,8 @@ +#!/bin/bash +if [[ ! -f README.md ]]; then + cd .. +fi + +find ./src -iname *.h -o -iname *.cpp | xargs clang-format --style=file -i +find ./hal -iname *.h -o -iname *.cpp | xargs clang-format --style=file -i +find ./tests -iname *.h -o -iname *.cpp | xargs clang-format --style=file -i From 15dddd7fc407fa72d752c76c64279944986b2dc1 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 1 Dec 2021 16:17:27 +0100 Subject: [PATCH 384/389] small README section for formatting --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 312bc077..5feda92c 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,12 @@ cmake --build . -- fsfw-tests_coverage -j The `coverage.py` script located in the `script` folder can also be used to do this conveniently. +## Formatting the sources + +The formatting is done by the `clang-format` tool. The configuration is contained within the +`.clang-format` file in the repository root. As long as `clang-format` is installed, you +can run the `apply-clang-format.sh` helper script to format all source files consistently. + ## Index [1. High-level overview](doc/README-highlevel.md#top)
From df45f02c393bde14b232d1668f6004256615e68a Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Fri, 3 Dec 2021 14:55:00 +0100 Subject: [PATCH 385/389] script fixes, odd behaviour --- docs/conf.py | 2 +- scripts/helper.py | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 44fd90c4..62b17192 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -53,4 +53,4 @@ html_theme = 'alabaster' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] \ No newline at end of file +html_static_path = [] \ No newline at end of file diff --git a/scripts/helper.py b/scripts/helper.py index 5ceff8c4..5c5c202b 100755 --- a/scripts/helper.py +++ b/scripts/helper.py @@ -8,6 +8,7 @@ import argparse import webbrowser import shutil import sys +import time from typing import List @@ -70,7 +71,8 @@ def main(): def handle_docs_type(args, build_dir_list: list): if args.create: - shutil.rmtree(DOCS_FOLDER_NAME) + if os.path.exists(DOCS_FOLDER_NAME): + shutil.rmtree(DOCS_FOLDER_NAME) create_docs_build_cfg() build_directory = DOCS_FOLDER_NAME elif len(build_dir_list) == 0: @@ -88,17 +90,21 @@ def handle_docs_type(args, build_dir_list: list): os.system('cmake --build . -j') if args.open: if not os.path.isfile('docs/sphinx/index.html'): - print( - "No Sphinx documentation file detected. " - "Try to build it first with the -b argument" - ) - sys.exit(1) + # try again.. + os.system('cmake --build . -j') + if not os.path.isfile('docs/sphinx/index.html'): + print( + "No Sphinx documentation file detected. " + "Try to build it first with the -b argument" + ) + sys.exit(1) webbrowser.open('docs/sphinx/index.html') def handle_tests_type(args, build_dir_list: list): if args.create: - shutil.rmtree(UNITTEST_FOLDER_NAME) + if os.path.exists(UNITTEST_FOLDER_NAME): + shutil.rmtree(UNITTEST_FOLDER_NAME) create_tests_build_cfg() build_directory = UNITTEST_FOLDER_NAME elif len(build_dir_list) == 0: From 4a5204d6f614053fea03bc10eea18613222000c0 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 6 Dec 2021 14:46:31 +0100 Subject: [PATCH 386/389] small fix for helper script --- scripts/helper.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/helper.py b/scripts/helper.py index 5c5c202b..0bb430ee 100755 --- a/scripts/helper.py +++ b/scripts/helper.py @@ -121,7 +121,7 @@ def handle_tests_type(args, build_dir_list: list): build_directory = determine_build_dir(build_dir_list) os.chdir(build_directory) if args.build: - perform_lcov_operation(build_directory) + perform_lcov_operation(build_directory, False) if args.open: if not os.path.isdir('fsfw-tests_coverage'): print("No Unittest folder detected. Try to build them first with the -b argument") @@ -159,8 +159,9 @@ def check_for_cmake_build_dir(build_dir_list: list) -> list: return build_dir_list -def perform_lcov_operation(directory): - os.chdir(directory) +def perform_lcov_operation(directory: str, chdir: bool): + if chdir: + os.chdir(directory) os.system("cmake --build . -- fsfw-tests_coverage -j") From e952a82b6565292d649260b1441383b1d484f706 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 7 Dec 2021 13:14:57 +0100 Subject: [PATCH 387/389] small tweaks and fixes --- .clang-format | 2 +- scripts/apply-clang-format.sh | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.clang-format b/.clang-format index a3cf6a1f..ec53b72b 100644 --- a/.clang-format +++ b/.clang-format @@ -3,5 +3,5 @@ BasedOnStyle: Google IndentWidth: 2 --- Language: Cpp -ColumnWidth: 100 +ColumnLimit: 100 --- diff --git a/scripts/apply-clang-format.sh b/scripts/apply-clang-format.sh index 36f5ee92..27202324 100755 --- a/scripts/apply-clang-format.sh +++ b/scripts/apply-clang-format.sh @@ -3,6 +3,6 @@ if [[ ! -f README.md ]]; then cd .. fi -find ./src -iname *.h -o -iname *.cpp | xargs clang-format --style=file -i -find ./hal -iname *.h -o -iname *.cpp | xargs clang-format --style=file -i -find ./tests -iname *.h -o -iname *.cpp | xargs clang-format --style=file -i +find ./src -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i +find ./hal -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i +find ./tests -iname *.h -o -iname *.cpp -o -iname *.c | xargs clang-format --style=file -i From 661b7b44e070f20b0162c530ed315abaa8bcbb41 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 12 Dec 2021 18:53:29 +0100 Subject: [PATCH 388/389] improved win32 define --- src/fsfw/globalfunctions/timevalOperations.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/fsfw/globalfunctions/timevalOperations.h b/src/fsfw/globalfunctions/timevalOperations.h index db68f330..41f4e52f 100644 --- a/src/fsfw/globalfunctions/timevalOperations.h +++ b/src/fsfw/globalfunctions/timevalOperations.h @@ -2,8 +2,9 @@ #define TIMEVALOPERATIONS_H_ #include +#include -#ifdef WIN32 +#ifdef PLATFORM_WIN #include #else #include From d0c7878da4c7591f199d6bda2fac221005b6a74d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Tue, 14 Dec 2021 17:50:23 +0100 Subject: [PATCH 389/389] simplified test controller and added docs gitignore --- docs/.gitignore | 1 + .../integration/controller/TestController.cpp | 173 +----------------- .../integration/controller/TestController.h | 25 +-- 3 files changed, 10 insertions(+), 189 deletions(-) create mode 100644 docs/.gitignore diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 00000000..a485625d --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1 @@ +/_build diff --git a/tests/src/fsfw_tests/integration/controller/TestController.cpp b/tests/src/fsfw_tests/integration/controller/TestController.cpp index 96da5fe3..8c2c9330 100644 --- a/tests/src/fsfw_tests/integration/controller/TestController.cpp +++ b/tests/src/fsfw_tests/integration/controller/TestController.cpp @@ -1,15 +1,12 @@ #include "TestController.h" -#include "OBSWConfig.h" #include #include #include -TestController::TestController(object_id_t objectId, object_id_t device0, object_id_t device1, +TestController::TestController(object_id_t objectId, object_id_t parentId, size_t commandQueueDepth): - ExtendedControllerBase(objectId, objects::NO_OBJECT, commandQueueDepth), - deviceDataset0(device0), - deviceDataset1(device1) { + ExtendedControllerBase(objectId, parentId, commandQueueDepth) { } TestController::~TestController() { @@ -20,136 +17,15 @@ ReturnValue_t TestController::handleCommandMessage(CommandMessage *message) { } void TestController::performControlOperation() { - /* We will trace vaiables if we received an update notification or snapshots */ -#if OBSW_CONTROLLER_PRINTOUT == 1 - if(not traceVariable) { - return; - } - switch(currentTraceType) { - case(NONE): { - break; - } - case(TRACE_DEV_0_UINT8): { - if(traceCounter == 0) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::info << "Tracing finished" << std::endl; -#else - sif::printInfo("Tracing finished\n"); -#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ - traceVariable = false; - traceCounter = traceCycles; - currentTraceType = TraceTypes::NONE; - break; - } - - PoolReadGuard readHelper(&deviceDataset0.testUint8Var); -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::info << "Tracing device 0 variable 0 (UINT8), current value: " << - static_cast(deviceDataset0.testUint8Var.value) << std::endl; -#else - sif::printInfo("Tracing device 0 variable 0 (UINT8), current value: %d\n", - deviceDataset0.testUint8Var.value); -#endif - traceCounter--; - break; - } - case(TRACE_DEV_0_VECTOR): { - break; - } - - } -#endif /* OBSW_CONTROLLER_PRINTOUT == 1 */ } void TestController::handleChangedDataset(sid_t sid, store_address_t storeId, bool* clearMessage) { - using namespace std; -#if OBSW_CONTROLLER_PRINTOUT == 1 - char const* printout = nullptr; - if(storeId == storeId::INVALID_STORE_ADDRESS) { - printout = "Notification"; - } - else { - printout = "Snapshot"; - } -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::info << "TestController::handleChangedDataset: " << printout << " update from object " - "ID " << setw(8) << setfill('0') << hex << sid.objectId << - " and set ID " << sid.ownerSetId << dec << setfill(' ') << endl; -#else - sif::printInfo("TestController::handleChangedPoolVariable: %s update from object ID 0x%08x and " - "set ID %lu\n", printout, sid.objectId, sid.ownerSetId); -#endif - - if (storeId == storeId::INVALID_STORE_ADDRESS) { - if(sid.objectId == objects::TEST_DEVICE_HANDLER_0) { - PoolReadGuard readHelper(&deviceDataset0.testFloat3Vec); - float floatVec[3]; - floatVec[0] = deviceDataset0.testFloat3Vec.value[0]; - floatVec[1] = deviceDataset0.testFloat3Vec.value[1]; - floatVec[2] = deviceDataset0.testFloat3Vec.value[2]; -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::info << "Current float vector (3) values: [" << floatVec[0] << ", " << - floatVec[1] << ", " << floatVec[2] << "]" << std::endl; -#else - sif::printInfo("Current float vector (3) values: [%f, %f, %f]\n", - floatVec[0], floatVec[1], floatVec[2]); -#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ - } - } -#endif /* OBSW_CONTROLLER_PRINTOUT == 1 */ - - /* We will trace the variables for snapshots and update notifications */ - if(not traceVariable) { - traceVariable = true; - traceCounter = traceCycles; - currentTraceType = TraceTypes::TRACE_DEV_0_VECTOR; - } } void TestController::handleChangedPoolVariable(gp_id_t globPoolId, store_address_t storeId, bool* clearMessage) { - using namespace std; - -#if OBSW_CONTROLLER_PRINTOUT == 1 - char const* printout = nullptr; - if (storeId == storeId::INVALID_STORE_ADDRESS) { - printout = "Notification"; - } - else { - printout = "Snapshot"; - } - -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::info << "TestController::handleChangedPoolVariable: " << printout << " update from object " - "ID 0x" << setw(8) << setfill('0') << hex << globPoolId.objectId << - " and local pool ID " << globPoolId.localPoolId << dec << setfill(' ') << endl; -#else - sif::printInfo("TestController::handleChangedPoolVariable: %s update from object ID 0x%08x and " - "local pool ID %lu\n", printout, globPoolId.objectId, globPoolId.localPoolId); -#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ - - if (storeId == storeId::INVALID_STORE_ADDRESS) { - if(globPoolId.objectId == objects::TEST_DEVICE_HANDLER_0) { - PoolReadGuard readHelper(&deviceDataset0.testUint8Var); -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::info << "Current test variable 0 (UINT8) value: " << static_cast( - deviceDataset0.testUint8Var.value) << std::endl; -#else - sif::printInfo("Current test variable 0 (UINT8) value %d\n", - deviceDataset0.testUint8Var.value); -#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */ - } - } -#endif /* OBSW_CONTROLLER_PRINTOUT == 1 */ - - /* We will trace the variables for snapshots and update notifications */ - if(not traceVariable) { - traceVariable = true; - traceCounter = traceCycles; - currentTraceType = TraceTypes::TRACE_DEV_0_UINT8; - } } LocalPoolDataSetBase* TestController::getDataSetHandle(sid_t sid) { @@ -162,50 +38,7 @@ ReturnValue_t TestController::initializeLocalDataPool(localpool::DataPool &local } ReturnValue_t TestController::initializeAfterTaskCreation() { - namespace td = testdevice; - HasLocalDataPoolIF* device0 = ObjectManager::instance()->get( - deviceDataset0.getCreatorObjectId()); - if(device0 == nullptr) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "TestController::initializeAfterTaskCreation: Test device handler 0 " - "handle invalid!" << std::endl; -#else - sif::printWarning("TestController::initializeAfterTaskCreation: Test device handler 0 " - "handle invalid!"); -#endif - return ObjectManagerIF::CHILD_INIT_FAILED; - } - ProvidesDataPoolSubscriptionIF* subscriptionIF = device0->getSubscriptionInterface(); - if(subscriptionIF != nullptr) { - /* For DEVICE_0, we only subscribe for notifications */ - subscriptionIF->subscribeForSetUpdateMessage(td::TEST_SET_ID, getObjectId(), - getCommandQueue(), false); - subscriptionIF->subscribeForVariableUpdateMessage(td::PoolIds::TEST_UINT8_ID, - getObjectId(), getCommandQueue(), false); - } - - - HasLocalDataPoolIF* device1 = ObjectManager::instance()->get( - deviceDataset0.getCreatorObjectId()); - if(device1 == nullptr) { -#if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "TestController::initializeAfterTaskCreation: Test device handler 1 " - "handle invalid!" << std::endl; -#else - sif::printWarning("TestController::initializeAfterTaskCreation: Test device handler 1 " - "handle invalid!"); -#endif - } - - subscriptionIF = device1->getSubscriptionInterface(); - if(subscriptionIF != nullptr) { - /* For DEVICE_1, we will subscribe for snapshots */ - subscriptionIF->subscribeForSetUpdateMessage(td::TEST_SET_ID, getObjectId(), - getCommandQueue(), true); - subscriptionIF->subscribeForVariableUpdateMessage(td::PoolIds::TEST_UINT8_ID, - getObjectId(), getCommandQueue(), true); - } - return HasReturnvaluesIF::RETURN_OK; + return ExtendedControllerBase::initializeAfterTaskCreation(); } ReturnValue_t TestController::checkModeCommand(Mode_t mode, Submode_t submode, diff --git a/tests/src/fsfw_tests/integration/controller/TestController.h b/tests/src/fsfw_tests/integration/controller/TestController.h index 475d8703..7d94367d 100644 --- a/tests/src/fsfw_tests/integration/controller/TestController.h +++ b/tests/src/fsfw_tests/integration/controller/TestController.h @@ -8,20 +8,18 @@ class TestController: public ExtendedControllerBase { public: - TestController(object_id_t objectId, object_id_t device0, object_id_t device1, - size_t commandQueueDepth = 10); + TestController(object_id_t objectId, object_id_t parentId, size_t commandQueueDepth = 10); virtual~ TestController(); protected: - testdevice::TestDataSet deviceDataset0; - testdevice::TestDataSet deviceDataset1; - /* Extended Controller Base overrides */ + // Extended Controller Base overrides ReturnValue_t handleCommandMessage(CommandMessage *message) override; void performControlOperation() override; - /* HasLocalDatapoolIF callbacks */ - void handleChangedDataset(sid_t sid, store_address_t storeId, bool* clearMessage) override; - void handleChangedPoolVariable(gp_id_t globPoolId, store_address_t storeId, + // HasLocalDatapoolIF callbacks + virtual void handleChangedDataset(sid_t sid, store_address_t storeId, + bool* clearMessage) override; + virtual void handleChangedPoolVariable(gp_id_t globPoolId, store_address_t storeId, bool* clearMessage) override; LocalPoolDataSetBase* getDataSetHandle(sid_t sid) override; @@ -34,17 +32,6 @@ protected: ReturnValue_t initializeAfterTaskCreation() override; private: - - bool traceVariable = false; - uint8_t traceCycles = 5; - uint8_t traceCounter = traceCycles; - - enum TraceTypes { - NONE, - TRACE_DEV_0_UINT8, - TRACE_DEV_0_VECTOR - }; - TraceTypes currentTraceType = TraceTypes::NONE; };