diff --git a/osal/rtems/Mutex.cpp b/osal/rtems/Mutex.cpp index 7dd512fae..f65c1f55b 100644 --- a/osal/rtems/Mutex.cpp +++ b/osal/rtems/Mutex.cpp @@ -1,18 +1,20 @@ #include "Mutex.h" -#include "../../serviceinterface/ServiceInterfaceStream.h" +#include "../../serviceinterface/ServiceInterface.h" uint8_t Mutex::count = 0; -Mutex::Mutex() : - mutexId(0) { +Mutex::Mutex() { rtems_name mutexName = ('M' << 24) + ('T' << 16) + ('X' << 8) + count++; rtems_status_code status = rtems_semaphore_create(mutexName, 1, RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY, 0, &mutexId); if (status != RTEMS_SUCCESSFUL) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "Mutex: creation with name, id " << mutexName << ", " << mutexId - << " failed with " << status << std::endl; + sif::error << "Mutex::Mutex: Creation with name, id " << mutexName << ", " << mutexId << + " failed with " << status << std::endl; +#else + sif::printError("Mutex::Mutex: Creation with name, id %s, %d failed with %d\n", mutexName, + static_cast(mutexId), static_cast(status)); #endif } } diff --git a/osal/rtems/Mutex.h b/osal/rtems/Mutex.h index 4c8613183..c4917e08a 100644 --- a/osal/rtems/Mutex.h +++ b/osal/rtems/Mutex.h @@ -11,7 +11,7 @@ public: ReturnValue_t lockMutex(TimeoutType timeoutType, uint32_t timeoutMs = 0); ReturnValue_t unlockMutex(); private: - rtems_id mutexId; + rtems_id mutexId = 0; static uint8_t count; };