1
0
forked from fsfw/fsfw

integrated interface into bin semaphore

This commit is contained in:
2020-05-18 19:38:02 +02:00
parent 9ba21b1e28
commit 4dd6594845
3 changed files with 27 additions and 9 deletions

View File

@ -9,10 +9,11 @@
* task synchronization.
*/
class SemaphoreIF {
public:
virtual~ SemaphoreIF() {};
//!< Needs to be defined in implementation.
static const uint32_t NO_TIMEOUT;
static const uint8_t INTERFACE_ID = CLASS_ID::SEMAPHORE_IF;
//! Semaphore timeout
static constexpr ReturnValue_t SEMAPHORE_TIMEOUT = MAKE_RETURN_CODE(1);
//! The current semaphore can not be given, because it is not owned
@ -26,24 +27,23 @@ class SemaphoreIF {
* for a maximum of timeoutMs while trying to acquire the semaphore.
* This can be used to achieve task synchrnization.
* @param timeoutMs
* @return
* @return - c RETURN_OK for successfull acquisition
*/
ReturnValue_t acquire(uint32_t timeoutMs) = 0;
virtual ReturnValue_t acquire(uint32_t timeoutMs) = 0;
/**
* Corrensponding call to release a semaphore.
* @return
* @return -@c RETURN_OK for successfull release
*/
ReturnValue_t release() = 0;
virtual ReturnValue_t release() = 0;
/**
* If the semaphore is a counting semaphore then the semaphores current
* count value is returned. If the semaphore is a binary semaphore then 1
* is returned if the semaphore is available, and 0 is returned if the
* semaphore is not available.
* @return
*/
uint8_t getSemaphoreCounter() = 0;
virtual uint8_t getSemaphoreCounter() = 0;
};
#endif /* FRAMEWORK_TASKS_SEMAPHOREIF_H_ */