49 lines
1.1 KiB
C++
49 lines
1.1 KiB
C++
#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_ */
|