flash write wip
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

This commit is contained in:
Jakob Meier 2022-01-07 09:48:56 +01:00
parent 996a8a226e
commit f8eebe2e7d
2 changed files with 0 additions and 104 deletions

View File

@ -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;
}

View File

@ -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_ */