Update cmsis_os function implementation

This commit is contained in:
Tilen Majerle 2020-09-18 19:20:36 +02:00
parent a3ac4c62e8
commit a28203bc5c

View File

@ -40,7 +40,7 @@
uint8_t uint8_t
lwmem_sys_mutex_create(LWMEM_CFG_OS_MUTEX_HANDLE* m) { lwmem_sys_mutex_create(LWMEM_CFG_OS_MUTEX_HANDLE* m) {
*m = osMutexNew(NULL); *m = osMutexNew(NULL);
return 1; return lwmem_sys_mutex_isvalid(m);
} }
uint8_t uint8_t
@ -50,18 +50,12 @@ lwmem_sys_mutex_isvalid(LWMEM_CFG_OS_MUTEX_HANDLE* m) {
uint8_t uint8_t
lwmem_sys_mutex_wait(LWMEM_CFG_OS_MUTEX_HANDLE* m) { lwmem_sys_mutex_wait(LWMEM_CFG_OS_MUTEX_HANDLE* m) {
if (osMutexAcquire(*m, osWaitForever) != osOK) { return osMutexAcquire(*m, osWaitForever) == osOK;
return 0;
}
return 1;
} }
uint8_t uint8_t
lwmem_sys_mutex_release(LWMEM_CFG_OS_MUTEX_HANDLE* m) { lwmem_sys_mutex_release(LWMEM_CFG_OS_MUTEX_HANDLE* m) {
if (osMutexRelease(*m) != osOK) { return osMutexRelease(*m) == osOK;
return 0;
}
return 1;
} }
#endif /* LWMEM_CFG_OS && !__DOXYGEN__ */ #endif /* LWMEM_CFG_OS && !__DOXYGEN__ */