diff --git a/bsp_q7s/devices/ploc/MPSoCSequenceCount.cpp b/bsp_q7s/devices/ploc/MPSoCSequenceCount.cpp deleted file mode 100644 index 88b66ad0..00000000 --- a/bsp_q7s/devices/ploc/MPSoCSequenceCount.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include "MPSoCSequenceCount.h" - -MPSoCSequenceCount::MPSoCSequenceCount() { -} - -MPSoCSequenceCount::~MPSoCSequenceCount() { -} - -MPSoCSequenceCount::increment() { - ReturnValue_t result = RETURN_OK; - result = spiMutex->lockMutex(timeoutType, timeoutMs); - if (result != RETURN_OK) { - sif::warning << "MPSoCSequenceCount::increment: Failed to lock mutex" << std::endl; - return result; - } - sequenceCount = (sequenceCount + 1) & SEQUENCE_COUNT_MASK; - result = spiMutex->unlockMutex(timeoutType, timeoutMs); - if (result != RETURN_OK) { - sif::warning << "MPSoCSequenceCount::increment: Failed to unlock mutex" << std::endl; - return result; - } -} - -MPSoCSequenceCount::set(uint16_t sequenceCount_) { - ReturnValue_t result = RETURN_OK; - result = spiMutex->lockMutex(timeoutType, timeoutMs); - if (result != RETURN_OK) { - sif::warning << "MPSoCSequenceCount::set: Failed to lock mutex" << std::endl; - return result; - } - sequenceCount = sequenceCount_; - result = spiMutex->unlockMutex(timeoutType, timeoutMs); - if (result != RETURN_OK) { - sif::warning << "MPSoCSequenceCount::set: Failed to unlock mutex" << std::endl; - return result; - } -} - -MPSoCSequenceCount::reset() { - ReturnValue_t result = RETURN_OK; - result = spiMutex->lockMutex(timeoutType, timeoutMs); - if (result != RETURN_OK) { - sif::warning << "MPSoCSequenceCount::reset: Failed to lock mutex" << std::endl; - return result; - } - sequenceCount = 0; - result = spiMutex->unlockMutex(timeoutType, timeoutMs); - if (result != RETURN_OK) { - sif::warning << "MPSoCSequenceCount::reset: Failed to unlock mutex" << std::endl; - return result; - } -} - -uint16_t MPSoCSequenceCount::get() { - return sequenceCount; -} diff --git a/bsp_q7s/devices/ploc/MPSoCSequenceCount.h b/bsp_q7s/devices/ploc/MPSoCSequenceCount.h deleted file mode 100644 index 57587d0a..00000000 --- a/bsp_q7s/devices/ploc/MPSoCSequenceCount.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef BSP_Q7S_DEVICES_PLOC_MPSOCSEQUENCECOUNT_H_ -#define BSP_Q7S_DEVICES_PLOC_MPSOCSEQUENCECOUNT_H_ - -/** - * @brief Manages incrementing, resetting and harmonization of the sequence count in the space - * packet based communication between MPSoC and OBC. - * - * @author J. Meier - */ -class MPSoCSequenceCount { -public: - MPSoCSequenceCount(); - virtual ~MPSoCSequenceCount(); - - /** - * @brief Increments the sequence count. - */ - void increment(); - - /** - * @brief Sets the value of the sequence count - * - * @param sequenceCount The sequence count to set - */ - void set(uint16_t sequenceCount_); - - /** - * @brief Resets the sequence count to zero - */ - void reset(); - - /** - * @brief Returns the current value sequence count - */ - uint16_t get(); - -private: - - MutexIF* spiMutex = nullptr; - MutexIF::TimeoutType timeoutType = MutexIF::TimeoutType::WAITING; - uint32_t timeoutMs = 20; - - static const uint16_t SEQUENCE_COUNT_MASK = 0x3FFF; - - uint16_t sequenceCount = 0x3FFF; -}; - -#endif /* BSP_Q7S_DEVICES_PLOC_MPSOCSEQUENCECOUNT_H_ */