2020-05-27 19:46:56 +02:00
|
|
|
#include <framework/osal/FreeRTOS/CountingSemaphUsingTask.h>
|
|
|
|
#include <framework/osal/FreeRTOS/TaskManagement.h>
|
2020-05-27 21:27:31 +02:00
|
|
|
#include <framework/serviceinterface/ServiceInterfaceStream.h>
|
2020-05-27 19:46:56 +02:00
|
|
|
|
2020-05-27 21:27:31 +02:00
|
|
|
CountingSemaphoreUsingTask::CountingSemaphoreUsingTask(uint8_t maxCount,
|
|
|
|
uint8_t initCount): maxCount(maxCount) {
|
|
|
|
if(initCount > maxCount) {
|
|
|
|
sif::error << "CountingSemaphoreUsingTask: Max count bigger than "
|
|
|
|
"intial cout. Setting initial count to max count." << std::endl;
|
|
|
|
initCount = maxCount;
|
|
|
|
}
|
2020-05-27 19:46:56 +02:00
|
|
|
handle = TaskManagement::getCurrentTaskHandle();
|
2020-05-27 21:27:31 +02:00
|
|
|
while(currentCount != initCount) {
|
|
|
|
xTaskNotifyGive(handle);
|
|
|
|
currentCount++;
|
|
|
|
}
|
2020-05-27 19:46:56 +02:00
|
|
|
}
|
2020-05-27 19:56:02 +02:00
|
|
|
|
2020-05-27 21:33:34 +02:00
|
|
|
ReturnValue_t CountingSemaphoreUsingTask::acquire(uint32_t timeoutMs) {
|
2020-05-27 19:56:02 +02:00
|
|
|
return HasReturnvaluesIF::RETURN_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
ReturnValue_t CountingSemaphoreUsingTask::release() {
|
|
|
|
return HasReturnvaluesIF::RETURN_OK;
|
|
|
|
}
|
|
|
|
|
2020-05-27 21:33:34 +02:00
|
|
|
uint8_t CountingSemaphoreUsingTask::getSemaphoreCounter() const {
|
2020-05-27 19:56:02 +02:00
|
|
|
return 0;
|
|
|
|
}
|