Răsfoiți Sursa

RTX5: minor code improvements (MISRA rules)

Robert Rostohar 8 ani în urmă
părinte
comite
96ac2ec3ca

+ 3 - 3
CMSIS/RTOS2/RTX/Source/rtx_delay.c

@@ -51,7 +51,7 @@ osStatus_t svcRtxDelayUntil (uint32_t ticks) {
 
   ticks -= osRtxInfo.kernel.tick;
   if (ticks == 0xFFFFFFFFU) {
-    EvrRtxThreadError(NULL, osErrorParameter);
+    EvrRtxThreadError(NULL, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
   if (ticks == 0U) {
@@ -70,7 +70,7 @@ osStatus_t svcRtxDelayUntil (uint32_t ticks) {
 osStatus_t osDelay (uint32_t ticks) {
   EvrRtxThreadDelay(ticks);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxThreadError(NULL, osErrorISR);
+    EvrRtxThreadError(NULL, (int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcDelay(ticks);
@@ -80,7 +80,7 @@ osStatus_t osDelay (uint32_t ticks) {
 osStatus_t osDelayUntil (uint32_t ticks) {
   EvrRtxThreadDelayUntil(ticks);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxThreadError(NULL, osErrorISR);
+    EvrRtxThreadError(NULL, (int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcDelayUntil(ticks);

+ 16 - 15
CMSIS/RTOS2/RTX/Source/rtx_evflags.c

@@ -200,7 +200,7 @@ osEventFlagsId_t svcRtxEventFlagsNew (const osEventFlagsAttr_t *attr) {
       ef = osRtxMemoryAlloc(osRtxInfo.mem.common, sizeof(os_event_flags_t), 1U);
     }
     if (ef == NULL) {
-      EvrRtxEventFlagsError(NULL, osErrorNoMemory);
+      EvrRtxEventFlagsError(NULL, (int32_t)osErrorNoMemory);
       return NULL;
     }
     flags = osRtxFlagSystemObject;
@@ -258,13 +258,13 @@ uint32_t svcRtxEventFlagsSet (osEventFlagsId_t ef_id, uint32_t flags) {
   // Check parameters
   if ((ef == NULL) || (ef->id != osRtxIdEventFlags) ||
       (flags & ~((1U << osRtxEventFlagsLimit) - 1U))) {
-    EvrRtxEventFlagsError(ef, osErrorParameter);
+    EvrRtxEventFlagsError(ef, (int32_t)osErrorParameter);
     return ((uint32_t)osErrorParameter);
   }
 
   // Check object state
   if (ef->state == osRtxObjectInactive) {
-    EvrRtxEventFlagsError(ef, osErrorResource);
+    EvrRtxEventFlagsError(ef, (int32_t)osErrorResource);
     return ((uint32_t)osErrorResource);
   }
 
@@ -304,13 +304,13 @@ uint32_t svcRtxEventFlagsClear (osEventFlagsId_t ef_id, uint32_t flags) {
   // Check parameters
   if ((ef == NULL) || (ef->id != osRtxIdEventFlags) ||
       (flags & ~((1U << osRtxEventFlagsLimit) - 1U))) {
-    EvrRtxEventFlagsError(ef, osErrorParameter);
+    EvrRtxEventFlagsError(ef, (int32_t)osErrorParameter);
     return ((uint32_t)osErrorParameter);
   }
 
   // Check object state
   if (ef->state == osRtxObjectInactive) {
-    EvrRtxEventFlagsError(ef, osErrorResource);
+    EvrRtxEventFlagsError(ef, (int32_t)osErrorResource);
     return ((uint32_t)osErrorResource);
   }
 
@@ -351,6 +351,7 @@ uint32_t svcRtxEventFlagsWait (osEventFlagsId_t ef_id, uint32_t flags, uint32_t
   os_thread_t      *running_thread;
   uint32_t          event_flags;
 
+  // Check running thread
   running_thread = osRtxThreadGetRunning();
   if (running_thread == NULL) {
     EvrRtxEventFlagsError(ef, osRtxErrorKernelNotRunning);
@@ -360,13 +361,13 @@ uint32_t svcRtxEventFlagsWait (osEventFlagsId_t ef_id, uint32_t flags, uint32_t
   // Check parameters
   if ((ef == NULL) || (ef->id != osRtxIdEventFlags) ||
       (flags & ~((1U << osRtxEventFlagsLimit) - 1U))) {
-    EvrRtxEventFlagsError(ef, osErrorParameter);
+    EvrRtxEventFlagsError(ef, (int32_t)osErrorParameter);
     return ((uint32_t)osErrorParameter);
   }
 
   // Check object state
   if (ef->state == osRtxObjectInactive) {
-    EvrRtxEventFlagsError(ef, osErrorResource);
+    EvrRtxEventFlagsError(ef, (int32_t)osErrorResource);
     return ((uint32_t)osErrorResource);
   }
 
@@ -402,13 +403,13 @@ osStatus_t svcRtxEventFlagsDelete (osEventFlagsId_t ef_id) {
 
   // Check parameters
   if ((ef == NULL) || (ef->id != osRtxIdEventFlags)) {
-    EvrRtxEventFlagsError(ef, osErrorParameter);
+    EvrRtxEventFlagsError(ef, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
   // Check object state
   if (ef->state == osRtxObjectInactive) {
-    EvrRtxEventFlagsError(ef, osErrorResource);
+    EvrRtxEventFlagsError(ef, (int32_t)osErrorResource);
     return osErrorResource;
   }
 
@@ -451,13 +452,13 @@ uint32_t isrRtxEventFlagsSet (osEventFlagsId_t ef_id, uint32_t flags) {
   // Check parameters
   if ((ef == NULL) || (ef->id != osRtxIdEventFlags) ||
       (flags & ~((1U << osRtxEventFlagsLimit) - 1U))) {
-    EvrRtxEventFlagsError(ef, osErrorParameter);
+    EvrRtxEventFlagsError(ef, (int32_t)osErrorParameter);
     return ((uint32_t)osErrorParameter);
   }
 
   // Check object state
   if (ef->state == osRtxObjectInactive) {
-    EvrRtxEventFlagsError(ef, osErrorResource);
+    EvrRtxEventFlagsError(ef, (int32_t)osErrorResource);
     return ((uint32_t)osErrorResource);
   }
 
@@ -482,13 +483,13 @@ uint32_t isrRtxEventFlagsWait (osEventFlagsId_t ef_id, uint32_t flags, uint32_t
   // Check parameters
   if ((ef == NULL) || (ef->id != osRtxIdEventFlags) || (timeout != 0U) ||
       (flags & ~((1U << osRtxEventFlagsLimit) - 1U))) {
-    EvrRtxEventFlagsError(ef, osErrorParameter);
+    EvrRtxEventFlagsError(ef, (int32_t)osErrorParameter);
     return ((uint32_t)osErrorParameter);
   }
 
   // Check object state
   if (ef->state == osRtxObjectInactive) {
-    EvrRtxEventFlagsError(ef, osErrorResource);
+    EvrRtxEventFlagsError(ef, (int32_t)osErrorResource);
     return ((uint32_t)osErrorResource);
   }
 
@@ -511,7 +512,7 @@ uint32_t isrRtxEventFlagsWait (osEventFlagsId_t ef_id, uint32_t flags, uint32_t
 osEventFlagsId_t osEventFlagsNew (const osEventFlagsAttr_t *attr) {
   EvrRtxEventFlagsNew(attr);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxEventFlagsError(NULL, osErrorISR);
+    EvrRtxEventFlagsError(NULL, (int32_t)osErrorISR);
     return NULL;
   }
   return __svcEventFlagsNew(attr);
@@ -569,7 +570,7 @@ uint32_t osEventFlagsWait (osEventFlagsId_t ef_id, uint32_t flags, uint32_t opti
 osStatus_t osEventFlagsDelete (osEventFlagsId_t ef_id) {
   EvrRtxEventFlagsDelete(ef_id);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxEventFlagsError(ef_id, osErrorISR);
+    EvrRtxEventFlagsError(ef_id, (int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcEventFlagsDelete(ef_id);

+ 15 - 15
CMSIS/RTOS2/RTX/Source/rtx_kernel.c

@@ -88,7 +88,7 @@ osStatus_t svcRtxKernelInitialize (void) {
     return osOK;
   }
   if (osRtxInfo.kernel.state != osKernelInactive) {
-    EvrRtxKernelError(osError);
+    EvrRtxKernelError((int32_t)osError);
     return osError;
   }
 
@@ -101,7 +101,7 @@ osStatus_t svcRtxKernelInitialize (void) {
   }
 
   if ((osRtxConfig.isr_queue.data == NULL) || (osRtxConfig.isr_queue.max == 0U)) {
-    EvrRtxKernelError(osError);
+    EvrRtxKernelError((int32_t)osError);
     return osError;
   }
   osRtxInfo.isr_queue.data = osRtxConfig.isr_queue.data;
@@ -244,7 +244,7 @@ osStatus_t svcRtxKernelStart (void) {
   if (osRtxInfo.thread.idle == NULL) {
     osRtxInfo.thread.idle = svcRtxThreadNew(osRtxIdleThread, NULL, osRtxConfig.idle_thread_attr);
     if (osRtxInfo.thread.idle == NULL) {
-      EvrRtxKernelError(osError);
+      EvrRtxKernelError((int32_t)osError);
       return osError;
     }
   }
@@ -254,7 +254,7 @@ osStatus_t svcRtxKernelStart (void) {
     if (osRtxInfo.timer.thread == NULL) {
       osRtxInfo.timer.thread = svcRtxThreadNew(osRtxTimerThread, NULL, osRtxConfig.timer_thread_attr);
       if (osRtxInfo.timer.thread == NULL) {
-        EvrRtxKernelError(osError);
+        EvrRtxKernelError((int32_t)osError);
         return osError;
       }
     }
@@ -277,7 +277,7 @@ osStatus_t svcRtxKernelStart (void) {
   // Switch to Ready Thread with highest Priority
   thread = osRtxThreadListGet(&osRtxInfo.thread.ready);
   if (thread == NULL) {
-    EvrRtxKernelError(osError);
+    EvrRtxKernelError((int32_t)osError);
     return osError;
   }
   osRtxThreadSwitch(thread);
@@ -311,7 +311,7 @@ int32_t svcRtxKernelLock (void) {
     return 0;
   }
 
-  EvrRtxKernelError(osError);
+  EvrRtxKernelError((int32_t)osError);
   return osError;
 }
  
@@ -329,7 +329,7 @@ int32_t svcRtxKernelUnlock (void) {
     return 0;
   }
 
-  EvrRtxKernelError(osError);
+  EvrRtxKernelError((int32_t)osError);
   return osError;
 }
 
@@ -353,7 +353,7 @@ int32_t svcRtxKernelRestoreLock (int32_t lock) {
     }
   }
 
-  EvrRtxKernelError(osError);
+  EvrRtxKernelError((int32_t)osError);
   return osError;
 }
 
@@ -503,7 +503,7 @@ uint32_t svcRtxKernelGetSysTimerFreq (void) {
 osStatus_t osKernelInitialize (void) {
   EvrRtxKernelInitialize();
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxKernelError(osErrorISR);
+    EvrRtxKernelError((int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcKernelInitialize();
@@ -532,7 +532,7 @@ osKernelState_t osKernelGetState (void) {
 osStatus_t osKernelStart (void) {
   EvrRtxKernelStart();
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxKernelError(osErrorISR);
+    EvrRtxKernelError((int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcKernelStart();
@@ -542,7 +542,7 @@ osStatus_t osKernelStart (void) {
 int32_t osKernelLock (void) {
   EvrRtxKernelLock();
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxKernelError(osErrorISR);
+    EvrRtxKernelError((int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcKernelLock();
@@ -552,7 +552,7 @@ int32_t osKernelLock (void) {
 int32_t osKernelUnlock (void) {
   EvrRtxKernelUnlock();
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxKernelError(osErrorISR);
+    EvrRtxKernelError((int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcKernelUnlock();
@@ -562,7 +562,7 @@ int32_t osKernelUnlock (void) {
 int32_t osKernelRestoreLock (int32_t lock) {
   EvrRtxKernelRestoreLock(lock);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxKernelError(osErrorISR);
+    EvrRtxKernelError((int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcKernelRestoreLock(lock);
@@ -572,7 +572,7 @@ int32_t osKernelRestoreLock (int32_t lock) {
 uint32_t osKernelSuspend (void) {
   EvrRtxKernelSuspend();
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxKernelError(osErrorISR);
+    EvrRtxKernelError((int32_t)osErrorISR);
     return 0U;
   }
   return __svcKernelSuspend();
@@ -582,7 +582,7 @@ uint32_t osKernelSuspend (void) {
 void osKernelResume (uint32_t sleep_ticks) {
   EvrRtxKernelResume(sleep_ticks);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxKernelError(osErrorISR);
+    EvrRtxKernelError((int32_t)osErrorISR);
     return;
   }
   __svcKernelResume(sleep_ticks);

+ 18 - 18
CMSIS/RTOS2/RTX/Source/rtx_mempool.c

@@ -117,7 +117,7 @@ osStatus_t osRtxMemoryPoolFree (os_mp_info_t *mp_info, void *block) {
   osStatus_t status;
 
   if ((mp_info == NULL) || (block < mp_info->block_base) || (block >= mp_info->block_lim)) {
-    EvrRtxMemoryBlockFree(mp_info, block, osErrorParameter);
+    EvrRtxMemoryBlockFree(mp_info, block, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
@@ -145,7 +145,7 @@ osStatus_t osRtxMemoryPoolFree (os_mp_info_t *mp_info, void *block) {
   }
 #endif
 
-  EvrRtxMemoryBlockFree(mp_info, block, status);
+  EvrRtxMemoryBlockFree(mp_info, block, (int32_t)status);
 
   return status;
 }
@@ -199,12 +199,12 @@ osMemoryPoolId_t svcRtxMemoryPoolNew (uint32_t block_count, uint32_t block_size,
 
   // Check parameters
   if ((block_count == 0U) || (block_size  == 0U)) {
-    EvrRtxMemoryPoolError(NULL, osErrorParameter);
+    EvrRtxMemoryPoolError(NULL, (int32_t)osErrorParameter);
     return NULL;
   }
   block_size = (block_size + 3U) & ~3UL;
   if ((__CLZ(block_count) + __CLZ(block_size)) < 32) {
-    EvrRtxMemoryPoolError(NULL, osErrorParameter);
+    EvrRtxMemoryPoolError(NULL, (int32_t)osErrorParameter);
     return NULL;
   }
 
@@ -252,7 +252,7 @@ osMemoryPoolId_t svcRtxMemoryPoolNew (uint32_t block_count, uint32_t block_size,
       mp = osRtxMemoryAlloc(osRtxInfo.mem.common, sizeof(os_memory_pool_t), 1U);
     }
     if (mp == NULL) {
-      EvrRtxMemoryPoolError(NULL, osErrorNoMemory);
+      EvrRtxMemoryPoolError(NULL, (int32_t)osErrorNoMemory);
       return NULL;
     }
     flags = osRtxFlagSystemObject;
@@ -264,7 +264,7 @@ osMemoryPoolId_t svcRtxMemoryPoolNew (uint32_t block_count, uint32_t block_size,
   if (mp_mem == NULL) {
     mp_mem = osRtxMemoryAlloc(osRtxInfo.mem.mp_data, size, 0U);
     if (mp_mem == NULL) {
-      EvrRtxMemoryPoolError(NULL, osErrorNoMemory);
+      EvrRtxMemoryPoolError(NULL, (int32_t)osErrorNoMemory);
       if (flags & osRtxFlagSystemObject) {
         if (osRtxInfo.mpi.memory_pool != NULL) {
           osRtxMemoryPoolFree(osRtxInfo.mpi.memory_pool, mp);
@@ -324,13 +324,13 @@ void *svcRtxMemoryPoolAlloc (osMemoryPoolId_t mp_id, uint32_t timeout) {
 
   // Check parameters
   if ((mp == NULL) || (mp->id != osRtxIdMemoryPool)) {
-    EvrRtxMemoryPoolError(mp, osErrorParameter);
+    EvrRtxMemoryPoolError(mp, (int32_t)osErrorParameter);
     return NULL;
   }
 
   // Check object state
   if (mp->state == osRtxObjectInactive) {
-    EvrRtxMemoryPoolError(mp, osErrorResource);
+    EvrRtxMemoryPoolError(mp, (int32_t)osErrorResource);
     return NULL;
   }
 
@@ -362,13 +362,13 @@ osStatus_t svcRtxMemoryPoolFree (osMemoryPoolId_t mp_id, void *block) {
 
   // Check parameters
   if ((mp == NULL) || (mp->id != osRtxIdMemoryPool)) {
-    EvrRtxMemoryPoolError(mp, osErrorParameter);
+    EvrRtxMemoryPoolError(mp, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
   // Check object state
   if (mp->state == osRtxObjectInactive) {
-    EvrRtxMemoryPoolError(mp, osErrorResource);
+    EvrRtxMemoryPoolError(mp, (int32_t)osErrorResource);
     return osErrorResource;
   }
 
@@ -490,13 +490,13 @@ osStatus_t svcRtxMemoryPoolDelete (osMemoryPoolId_t mp_id) {
 
   // Check parameters
   if ((mp == NULL) || (mp->id != osRtxIdMemoryPool)) {
-    EvrRtxMemoryPoolError(mp, osErrorParameter);
+    EvrRtxMemoryPoolError(mp, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
   // Check object state
   if (mp->state == osRtxObjectInactive) {
-    EvrRtxMemoryPoolError(mp, osErrorResource);
+    EvrRtxMemoryPoolError(mp, (int32_t)osErrorResource);
     return osErrorResource;
   }
 
@@ -543,13 +543,13 @@ void *isrRtxMemoryPoolAlloc (osMemoryPoolId_t mp_id, uint32_t timeout) {
 
   // Check parameters
   if ((mp == NULL) || (mp->id != osRtxIdMemoryPool) || (timeout != 0U)) {
-    EvrRtxMemoryPoolError(mp, osErrorParameter);
+    EvrRtxMemoryPoolError(mp, (int32_t)osErrorParameter);
     return NULL;
   }
 
   // Check object state
   if (mp->state == osRtxObjectInactive) {
-    EvrRtxMemoryPoolError(mp, osErrorResource);
+    EvrRtxMemoryPoolError(mp, (int32_t)osErrorResource);
     return NULL;
   }
 
@@ -573,13 +573,13 @@ osStatus_t isrRtxMemoryPoolFree (osMemoryPoolId_t mp_id, void *block) {
 
   // Check parameters
   if ((mp == NULL) || (mp->id != osRtxIdMemoryPool)) {
-    EvrRtxMemoryPoolError(mp, osErrorParameter);
+    EvrRtxMemoryPoolError(mp, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
   // Check object state
   if (mp->state == osRtxObjectInactive) {
-    EvrRtxMemoryPoolError(mp, osErrorResource);
+    EvrRtxMemoryPoolError(mp, (int32_t)osErrorResource);
     return osErrorResource;
   }
 
@@ -603,7 +603,7 @@ osStatus_t isrRtxMemoryPoolFree (osMemoryPoolId_t mp_id, void *block) {
 osMemoryPoolId_t osMemoryPoolNew (uint32_t block_count, uint32_t block_size, const osMemoryPoolAttr_t *attr) {
   EvrRtxMemoryPoolNew(block_count, block_size, attr);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxMemoryPoolError(NULL, osErrorISR);
+    EvrRtxMemoryPoolError(NULL, (int32_t)osErrorISR);
     return NULL;
   }
   return __svcMemoryPoolNew(block_count, block_size, attr);
@@ -678,7 +678,7 @@ uint32_t osMemoryPoolGetSpace (osMemoryPoolId_t mp_id) {
 osStatus_t osMemoryPoolDelete (osMemoryPoolId_t mp_id) {
   EvrRtxMemoryPoolDelete(mp_id);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxMemoryPoolError(mp_id, osErrorISR);
+    EvrRtxMemoryPoolError(mp_id, (int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcMemoryPoolDelete(mp_id);

+ 20 - 20
CMSIS/RTOS2/RTX/Source/rtx_msgqueue.c

@@ -133,7 +133,7 @@ static os_message_t *MessageQueueGet (os_message_queue_t *mq) {
 /// Remove a Message from Queue
 /// \param[in]  mq              message queue object.
 /// \param[in]  msg             message object.
-static void MessageQueueRemove (os_message_queue_t *mq, os_message_t *msg) {
+static void MessageQueueRemove (os_message_queue_t *mq, const os_message_t *msg) {
 
   if (msg->prev != NULL) {
     msg->prev->next = msg->next;
@@ -249,12 +249,12 @@ osMessageQueueId_t svcRtxMessageQueueNew (uint32_t msg_count, uint32_t msg_size,
 
   // Check parameters
   if ((msg_count == 0U) || (msg_size  == 0U)) {
-    EvrRtxMessageQueueError(NULL, osErrorParameter);
+    EvrRtxMessageQueueError(NULL, (int32_t)osErrorParameter);
     return NULL;
   }
   block_size = ((msg_size + 3U) & ~3UL) + sizeof(os_message_t);
   if ((__CLZ(msg_count) + __CLZ(block_size)) < 32) {
-    EvrRtxMessageQueueError(NULL, osErrorParameter);
+    EvrRtxMessageQueueError(NULL, (int32_t)osErrorParameter);
     return NULL;
   }
 
@@ -302,7 +302,7 @@ osMessageQueueId_t svcRtxMessageQueueNew (uint32_t msg_count, uint32_t msg_size,
       mq = osRtxMemoryAlloc(osRtxInfo.mem.common, sizeof(os_message_queue_t), 1U);
     }
     if (mq == NULL) {
-      EvrRtxMessageQueueError(NULL, osErrorNoMemory);
+      EvrRtxMessageQueueError(NULL, (int32_t)osErrorNoMemory);
       return NULL;
     }
     flags = osRtxFlagSystemObject;
@@ -314,7 +314,7 @@ osMessageQueueId_t svcRtxMessageQueueNew (uint32_t msg_count, uint32_t msg_size,
   if (mq_mem == NULL) {
     mq_mem = osRtxMemoryAlloc(osRtxInfo.mem.mq_data, size, 0U);
     if (mq_mem == NULL) {
-      EvrRtxMessageQueueError(NULL, osErrorNoMemory);
+      EvrRtxMessageQueueError(NULL, (int32_t)osErrorNoMemory);
       if (flags & osRtxFlagSystemObject) {
         if (osRtxInfo.mpi.message_queue != NULL) {
           osRtxMemoryPoolFree(osRtxInfo.mpi.message_queue, mq);
@@ -380,13 +380,13 @@ osStatus_t svcRtxMessageQueuePut (osMessageQueueId_t mq_id, const void *msg_ptr,
 
   // Check parameters
   if ((mq == NULL) || (mq->id != osRtxIdMessageQueue) || (msg_ptr == NULL)) {
-    EvrRtxMessageQueueError(mq, osErrorParameter);
+    EvrRtxMessageQueueError(mq, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
   // Check object state
   if (mq->state == osRtxObjectInactive) {
-    EvrRtxMessageQueueError(mq, osErrorResource);
+    EvrRtxMessageQueueError(mq, (int32_t)osErrorResource);
     return osErrorResource;
   }
 
@@ -450,13 +450,13 @@ osStatus_t svcRtxMessageQueueGet (osMessageQueueId_t mq_id, void *msg_ptr, uint8
 
   // Check parameters
   if ((mq == NULL) || (mq->id != osRtxIdMessageQueue) || (msg_ptr == NULL)) {
-    EvrRtxMessageQueueError(mq, osErrorParameter);
+    EvrRtxMessageQueueError(mq, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
   // Check object state
   if (mq->state == osRtxObjectInactive) {
-    EvrRtxMessageQueueError(mq, osErrorResource);
+    EvrRtxMessageQueueError(mq, (int32_t)osErrorResource);
     return osErrorResource;
   }
 
@@ -613,13 +613,13 @@ osStatus_t svcRtxMessageQueueReset (osMessageQueueId_t mq_id) {
 
   // Check parameters
   if ((mq == NULL) || (mq->id != osRtxIdMessageQueue)) {
-    EvrRtxMessageQueueError(mq, osErrorParameter);
+    EvrRtxMessageQueueError(mq, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
   // Check object state
   if (mq->state == osRtxObjectInactive) {
-    EvrRtxMessageQueueError(mq, osErrorResource);
+    EvrRtxMessageQueueError(mq, (int32_t)osErrorResource);
     return osErrorResource;
   }
 
@@ -674,13 +674,13 @@ osStatus_t svcRtxMessageQueueDelete (osMessageQueueId_t mq_id) {
 
   // Check parameters
   if ((mq == NULL) || (mq->id != osRtxIdMessageQueue)) {
-    EvrRtxMessageQueueError(mq, osErrorParameter);
+    EvrRtxMessageQueueError(mq, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
   // Check object state
   if (mq->state == osRtxObjectInactive) {
-    EvrRtxMessageQueueError(mq, osErrorResource);
+    EvrRtxMessageQueueError(mq, (int32_t)osErrorResource);
     return osErrorResource;
   }
 
@@ -728,13 +728,13 @@ osStatus_t isrRtxMessageQueuePut (osMessageQueueId_t mq_id, const void *msg_ptr,
 
   // Check parameters
   if ((mq == NULL) || (mq->id != osRtxIdMessageQueue) || (msg_ptr == NULL) || (timeout != 0U)) {
-    EvrRtxMessageQueueError(mq, osErrorParameter);
+    EvrRtxMessageQueueError(mq, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
   // Check object state
   if (mq->state == osRtxObjectInactive) {
-    EvrRtxMessageQueueError(mq, osErrorResource);
+    EvrRtxMessageQueueError(mq, (int32_t)osErrorResource);
     return osErrorResource;
   }
 
@@ -774,13 +774,13 @@ osStatus_t isrRtxMessageQueueGet (osMessageQueueId_t mq_id, void *msg_ptr, uint8
 
   // Check parameters
   if ((mq == NULL) || (mq->id != osRtxIdMessageQueue) || (msg_ptr == NULL) || (timeout != 0U)) {
-    EvrRtxMessageQueueError(mq, osErrorParameter);
+    EvrRtxMessageQueueError(mq, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
   // Check object state
   if (mq->state == osRtxObjectInactive) {
-    EvrRtxMessageQueueError(mq, osErrorResource);
+    EvrRtxMessageQueueError(mq, (int32_t)osErrorResource);
     return osErrorResource;
   }
 
@@ -813,7 +813,7 @@ osStatus_t isrRtxMessageQueueGet (osMessageQueueId_t mq_id, void *msg_ptr, uint8
 osMessageQueueId_t osMessageQueueNew (uint32_t msg_count, uint32_t msg_size, const osMessageQueueAttr_t *attr) {
   EvrRtxMessageQueueNew(msg_count, msg_size, attr);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxMessageQueueError(NULL, osErrorISR);
+    EvrRtxMessageQueueError(NULL, (int32_t)osErrorISR);
     return NULL;
   }
   return __svcMessageQueueNew(msg_count, msg_size, attr);
@@ -888,7 +888,7 @@ uint32_t osMessageQueueGetSpace (osMessageQueueId_t mq_id) {
 osStatus_t osMessageQueueReset (osMessageQueueId_t mq_id) {
   EvrRtxMessageQueueReset(mq_id);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxMessageQueueError(mq_id, osErrorISR);
+    EvrRtxMessageQueueError(mq_id, (int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcMessageQueueReset(mq_id);
@@ -898,7 +898,7 @@ osStatus_t osMessageQueueReset (osMessageQueueId_t mq_id) {
 osStatus_t osMessageQueueDelete (osMessageQueueId_t mq_id) {
   EvrRtxMessageQueueDelete(mq_id);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxMessageQueueError(mq_id, osErrorISR);
+    EvrRtxMessageQueueError(mq_id, (int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcMessageQueueDelete(mq_id);

+ 13 - 11
CMSIS/RTOS2/RTX/Source/rtx_mutex.c

@@ -110,7 +110,7 @@ osMutexId_t svcRtxMutexNew (const osMutexAttr_t *attr) {
       mutex = osRtxMemoryAlloc(osRtxInfo.mem.common, sizeof(os_mutex_t), 1U);
     }
     if (mutex == NULL) {
-      EvrRtxMutexError(NULL, osErrorNoMemory);
+      EvrRtxMutexError(NULL, (int32_t)osErrorNoMemory);
       return NULL;
     }
     flags = osRtxFlagSystemObject;
@@ -163,6 +163,7 @@ osStatus_t svcRtxMutexAcquire (osMutexId_t mutex_id, uint32_t timeout) {
   os_mutex_t  *mutex = (os_mutex_t *)mutex_id;
   os_thread_t *runnig_thread;
 
+  // Check running thread
   runnig_thread = osRtxThreadGetRunning();
   if (runnig_thread == NULL) {
     EvrRtxMutexError(mutex, osRtxErrorKernelNotRunning);
@@ -171,13 +172,13 @@ osStatus_t svcRtxMutexAcquire (osMutexId_t mutex_id, uint32_t timeout) {
 
   // Check parameters
   if ((mutex == NULL) || (mutex->id != osRtxIdMutex)) {
-    EvrRtxMutexError(mutex, osErrorParameter);
+    EvrRtxMutexError(mutex, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
   // Check object state
   if (mutex->state == osRtxObjectInactive) {
-    EvrRtxMutexError(mutex, osErrorResource);
+    EvrRtxMutexError(mutex, (int32_t)osErrorResource);
     return osErrorResource;
   }
 
@@ -240,6 +241,7 @@ osStatus_t svcRtxMutexRelease (osMutexId_t mutex_id) {
   os_thread_t *runnig_thread;
   int8_t       priority;
 
+  // Check running thread
   runnig_thread = osRtxThreadGetRunning();
   if (runnig_thread == NULL) {
     EvrRtxMutexError(mutex, osRtxErrorKernelNotRunning);
@@ -248,13 +250,13 @@ osStatus_t svcRtxMutexRelease (osMutexId_t mutex_id) {
 
   // Check parameters
   if ((mutex == NULL) || (mutex->id != osRtxIdMutex)) {
-    EvrRtxMutexError(mutex, osErrorParameter);
+    EvrRtxMutexError(mutex, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
   // Check object state
   if (mutex->state == osRtxObjectInactive) {
-    EvrRtxMutexError(mutex, osErrorResource);
+    EvrRtxMutexError(mutex, (int32_t)osErrorResource);
     return osErrorResource;
   }
 
@@ -361,13 +363,13 @@ osStatus_t svcRtxMutexDelete (osMutexId_t mutex_id) {
 
   // Check parameters
   if ((mutex == NULL) || (mutex->id != osRtxIdMutex)) {
-    EvrRtxMutexError(mutex, osErrorParameter);
+    EvrRtxMutexError(mutex, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
   // Check object state
   if (mutex->state == osRtxObjectInactive) {
-    EvrRtxMutexError(mutex, osErrorResource);
+    EvrRtxMutexError(mutex, (int32_t)osErrorResource);
     return osErrorResource;
   }
 
@@ -439,7 +441,7 @@ osStatus_t svcRtxMutexDelete (osMutexId_t mutex_id) {
 osMutexId_t osMutexNew (const osMutexAttr_t *attr) {
   EvrRtxMutexNew(attr);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxMutexError(NULL, osErrorISR);
+    EvrRtxMutexError(NULL, (int32_t)osErrorISR);
     return NULL;
   }
   return __svcMutexNew(attr);
@@ -458,7 +460,7 @@ const char *osMutexGetName (osMutexId_t mutex_id) {
 osStatus_t osMutexAcquire (osMutexId_t mutex_id, uint32_t timeout) {
   EvrRtxMutexAcquire(mutex_id, timeout);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxMutexError(mutex_id, osErrorISR);
+    EvrRtxMutexError(mutex_id, (int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcMutexAcquire(mutex_id, timeout);
@@ -468,7 +470,7 @@ osStatus_t osMutexAcquire (osMutexId_t mutex_id, uint32_t timeout) {
 osStatus_t osMutexRelease (osMutexId_t mutex_id) {
   EvrRtxMutexRelease(mutex_id);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxMutexError(mutex_id, osErrorISR);
+    EvrRtxMutexError(mutex_id, (int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcMutexRelease(mutex_id);
@@ -487,7 +489,7 @@ osThreadId_t osMutexGetOwner (osMutexId_t mutex_id) {
 osStatus_t osMutexDelete (osMutexId_t mutex_id) {
   EvrRtxMutexDelete(mutex_id);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxMutexError(mutex_id, osErrorISR);
+    EvrRtxMutexError(mutex_id, (int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcMutexDelete(mutex_id);

+ 14 - 14
CMSIS/RTOS2/RTX/Source/rtx_semaphore.c

@@ -138,7 +138,7 @@ osSemaphoreId_t svcRtxSemaphoreNew (uint32_t max_count, uint32_t initial_count,
 
   // Check parameters
   if ((max_count == 0U) || (max_count > osRtxSemaphoreTokenLimit) || (initial_count > max_count)) {
-    EvrRtxSemaphoreError(NULL, osErrorParameter);
+    EvrRtxSemaphoreError(NULL, (int32_t)osErrorParameter);
     return NULL;
   }
 
@@ -170,7 +170,7 @@ osSemaphoreId_t svcRtxSemaphoreNew (uint32_t max_count, uint32_t initial_count,
       semaphore = osRtxMemoryAlloc(osRtxInfo.mem.common, sizeof(os_semaphore_t), 1U);
     }
     if (semaphore == NULL) {
-      EvrRtxSemaphoreError(NULL, osErrorNoMemory);
+      EvrRtxSemaphoreError(NULL,(int32_t)osErrorNoMemory);
       return NULL;
     }
     flags = osRtxFlagSystemObject;
@@ -224,13 +224,13 @@ osStatus_t svcRtxSemaphoreAcquire (osSemaphoreId_t semaphore_id, uint32_t timeou
 
   // Check parameters
   if ((semaphore == NULL) || (semaphore->id != osRtxIdSemaphore)) {
-    EvrRtxSemaphoreError(semaphore, osErrorParameter);
+    EvrRtxSemaphoreError(semaphore, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
   // Check object state
   if (semaphore->state == osRtxObjectInactive) {
-    EvrRtxSemaphoreError(semaphore, osErrorResource);
+    EvrRtxSemaphoreError(semaphore, (int32_t)osErrorResource);
     return osErrorResource;
   }
 
@@ -262,13 +262,13 @@ osStatus_t svcRtxSemaphoreRelease (osSemaphoreId_t semaphore_id) {
 
   // Check parameters
   if ((semaphore == NULL) || (semaphore->id != osRtxIdSemaphore)) {
-    EvrRtxSemaphoreError(semaphore, osErrorParameter);
+    EvrRtxSemaphoreError(semaphore, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
   // Check object state
   if (semaphore->state == osRtxObjectInactive) {
-    EvrRtxSemaphoreError(semaphore, osErrorResource);
+    EvrRtxSemaphoreError(semaphore, (int32_t)osErrorResource);
     return osErrorResource;
   }
 
@@ -321,13 +321,13 @@ osStatus_t svcRtxSemaphoreDelete (osSemaphoreId_t semaphore_id) {
 
   // Check parameters
   if ((semaphore == NULL) || (semaphore->id != osRtxIdSemaphore)) {
-    EvrRtxSemaphoreError(semaphore, osErrorParameter);
+    EvrRtxSemaphoreError(semaphore, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
   // Check object state
   if (semaphore->state == osRtxObjectInactive) {
-    EvrRtxSemaphoreError(semaphore, osErrorResource);
+    EvrRtxSemaphoreError(semaphore, (int32_t)osErrorResource);
     return osErrorResource;
   }
 
@@ -368,13 +368,13 @@ osStatus_t isrRtxSemaphoreAcquire (osSemaphoreId_t semaphore_id, uint32_t timeou
 
   // Check parameters
   if ((semaphore == NULL) || (semaphore->id != osRtxIdSemaphore) || (timeout != 0U)) {
-    EvrRtxSemaphoreError(semaphore, osErrorParameter);
+    EvrRtxSemaphoreError(semaphore, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
   // Check object state
   if (semaphore->state == osRtxObjectInactive) {
-    EvrRtxSemaphoreError(semaphore, osErrorResource);
+    EvrRtxSemaphoreError(semaphore, (int32_t)osErrorResource);
     return osErrorResource;
   }
 
@@ -398,13 +398,13 @@ osStatus_t isrRtxSemaphoreRelease (osSemaphoreId_t semaphore_id) {
 
   // Check parameters
   if ((semaphore == NULL) || (semaphore->id != osRtxIdSemaphore)) {
-    EvrRtxSemaphoreError(semaphore, osErrorParameter);
+    EvrRtxSemaphoreError(semaphore, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
   // Check object state
   if (semaphore->state == osRtxObjectInactive) {
-    EvrRtxSemaphoreError(semaphore, osErrorResource);
+    EvrRtxSemaphoreError(semaphore, (int32_t)osErrorResource);
     return osErrorResource;
   }
 
@@ -429,7 +429,7 @@ osStatus_t isrRtxSemaphoreRelease (osSemaphoreId_t semaphore_id) {
 osSemaphoreId_t osSemaphoreNew (uint32_t max_count, uint32_t initial_count, const osSemaphoreAttr_t *attr) {
   EvrRtxSemaphoreNew(max_count, initial_count, attr);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxSemaphoreError(NULL, osErrorISR);
+    EvrRtxSemaphoreError(NULL, (int32_t)osErrorISR);
     return NULL;
   }
   return __svcSemaphoreNew(max_count, initial_count, attr);
@@ -477,7 +477,7 @@ uint32_t osSemaphoreGetCount (osSemaphoreId_t semaphore_id) {
 osStatus_t osSemaphoreDelete (osSemaphoreId_t semaphore_id) {
   EvrRtxSemaphoreDelete(semaphore_id);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxSemaphoreError(semaphore_id, osErrorISR);
+    EvrRtxSemaphoreError(semaphore_id, (int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcSemaphoreDelete(semaphore_id);

+ 36 - 36
CMSIS/RTOS2/RTX/Source/rtx_thread.c

@@ -585,7 +585,7 @@ osThreadId_t svcRtxThreadNew (osThreadFunc_t func, void *argument, const osThrea
 
   // Check parameters
   if (func == NULL) {
-    EvrRtxThreadError(NULL, osErrorParameter);
+    EvrRtxThreadError(NULL, (int32_t)osErrorParameter);
     return NULL;
   }
 
@@ -651,7 +651,7 @@ osThreadId_t svcRtxThreadNew (osThreadFunc_t func, void *argument, const osThrea
       thread = osRtxMemoryAlloc(osRtxInfo.mem.common, sizeof(os_thread_t), 1U);
     }
     if (thread == NULL) {
-      EvrRtxThreadError(NULL, osErrorNoMemory);
+      EvrRtxThreadError(NULL, (int32_t)osErrorNoMemory);
       return NULL;
     }
     flags = osRtxFlagSystemObject;
@@ -675,7 +675,7 @@ osThreadId_t svcRtxThreadNew (osThreadFunc_t func, void *argument, const osThrea
       stack_mem = osRtxMemoryAlloc(osRtxInfo.mem.stack, stack_size, 0U);
     }
     if (stack_mem == NULL) {
-      EvrRtxThreadError(NULL, osErrorNoMemory);
+      EvrRtxThreadError(NULL, (int32_t)osErrorNoMemory);
       if (flags & osRtxFlagSystemObject) {
         if (osRtxInfo.mpi.thread != NULL) {
           osRtxMemoryPoolFree(osRtxInfo.mpi.thread, thread);
@@ -891,14 +891,14 @@ osStatus_t svcRtxThreadSetPriority (osThreadId_t thread_id, osPriority_t priorit
   // Check parameters
   if ((thread == NULL) || (thread->id != osRtxIdThread) ||
       (priority < osPriorityIdle) || (priority > osPriorityISR)) {
-    EvrRtxThreadError(thread, osErrorParameter);
+    EvrRtxThreadError(thread, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
   // Check object state
   if ((thread->state == osRtxThreadInactive) ||
       (thread->state == osRtxThreadTerminated)) {
-    EvrRtxThreadError(thread, osErrorResource);
+    EvrRtxThreadError(thread, (int32_t)osErrorResource);
     return osErrorResource;
   }
 
@@ -964,7 +964,7 @@ osStatus_t svcRtxThreadSuspend (osThreadId_t thread_id) {
 
   // Check parameters
   if ((thread == NULL) || (thread->id != osRtxIdThread)) {
-    EvrRtxThreadError(thread, osErrorParameter);
+    EvrRtxThreadError(thread, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
@@ -973,7 +973,7 @@ osStatus_t svcRtxThreadSuspend (osThreadId_t thread_id) {
     case osRtxThreadRunning:
       if ((osRtxKernelGetState() != osRtxKernelRunning) ||
           (osRtxInfo.thread.ready.thread_list == NULL)) {
-        EvrRtxThreadError(thread, osErrorResource);
+        EvrRtxThreadError(thread, (int32_t)osErrorResource);
         return osErrorResource;
       }
       break;
@@ -987,7 +987,7 @@ osStatus_t svcRtxThreadSuspend (osThreadId_t thread_id) {
     case osRtxThreadInactive:
     case osRtxThreadTerminated:
     default:
-      EvrRtxThreadError(thread, osErrorResource);
+      EvrRtxThreadError(thread, (int32_t)osErrorResource);
       return osErrorResource;
   }
 
@@ -1013,13 +1013,13 @@ osStatus_t svcRtxThreadResume (osThreadId_t thread_id) {
 
   // Check parameters
   if ((thread == NULL) || (thread->id != osRtxIdThread)) {
-    EvrRtxThreadError(thread, osErrorParameter);
+    EvrRtxThreadError(thread, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
   // Check object state
   if ((thread->state & osRtxThreadStateMask) != osRtxThreadBlocked) {
-    EvrRtxThreadError(thread, osErrorResource);
+    EvrRtxThreadError(thread, (int32_t)osErrorResource);
     return osErrorResource;
   }
 
@@ -1073,7 +1073,7 @@ osStatus_t svcRtxThreadDetach (osThreadId_t thread_id) {
 
   // Check parameters
   if ((thread == NULL) || (thread->id != osRtxIdThread)) {
-    EvrRtxThreadError(thread, osErrorParameter);
+    EvrRtxThreadError(thread, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
@@ -1085,7 +1085,7 @@ osStatus_t svcRtxThreadDetach (osThreadId_t thread_id) {
 
   // Check object state
   if (thread->state == osRtxThreadInactive) {
-    EvrRtxThreadError(thread, osErrorResource);
+    EvrRtxThreadError(thread, (int32_t)osErrorResource);
     return osErrorResource;
   }
 
@@ -1108,7 +1108,7 @@ osStatus_t svcRtxThreadJoin (osThreadId_t thread_id) {
 
   // Check parameters
   if ((thread == NULL) || (thread->id != osRtxIdThread)) {
-    EvrRtxThreadError(thread, osErrorParameter);
+    EvrRtxThreadError(thread, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
@@ -1121,7 +1121,7 @@ osStatus_t svcRtxThreadJoin (osThreadId_t thread_id) {
   // Check object state
   if ((thread->state == osRtxThreadInactive) ||
       (thread->state == osRtxThreadRunning)) {
-    EvrRtxThreadError(thread, osErrorResource);
+    EvrRtxThreadError(thread, (int32_t)osErrorResource);
     return osErrorResource;
   }
 
@@ -1193,7 +1193,7 @@ osStatus_t svcRtxThreadTerminate (osThreadId_t thread_id) {
 
   // Check parameters
   if ((thread == NULL) || (thread->id != osRtxIdThread)) {
-    EvrRtxThreadError(thread, osErrorParameter);
+    EvrRtxThreadError(thread, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
@@ -1211,7 +1211,7 @@ osStatus_t svcRtxThreadTerminate (osThreadId_t thread_id) {
     case osRtxThreadInactive:
     case osRtxThreadTerminated:
     default:
-      EvrRtxThreadError(thread, osErrorResource);
+      EvrRtxThreadError(thread, (int32_t)osErrorResource);
       return osErrorResource;
   }
 
@@ -1228,7 +1228,7 @@ osStatus_t svcRtxThreadTerminate (osThreadId_t thread_id) {
   if (thread->state == osRtxThreadRunning) {
     if ((osRtxKernelGetState() != osRtxKernelRunning) ||
         (osRtxInfo.thread.ready.thread_list == NULL)) {
-      EvrRtxThreadError(thread, osErrorResource);
+      EvrRtxThreadError(thread, (int32_t)osErrorResource);
       return osErrorResource;
     }
     thread->sp = __get_PSP();
@@ -1331,14 +1331,14 @@ uint32_t svcRtxThreadFlagsSet (osThreadId_t thread_id, uint32_t flags) {
   // Check parameters
   if ((thread == NULL) || (thread->id != osRtxIdThread) ||
       (flags & ~((1U << osRtxThreadFlagsLimit) - 1U))) {
-    EvrRtxThreadError(thread, osErrorParameter);
+    EvrRtxThreadError(thread, (int32_t)osErrorParameter);
     return ((uint32_t)osErrorParameter);
   }
 
   // Check object state
   if ((thread->state == osRtxThreadInactive) ||
       (thread->state == osRtxThreadTerminated)) {
-    EvrRtxThreadError(thread, osErrorResource);
+    EvrRtxThreadError(thread, (int32_t)osErrorResource);
     return ((uint32_t)osErrorResource);
   }
 
@@ -1378,14 +1378,14 @@ uint32_t svcRtxThreadFlagsClear (uint32_t flags) {
 
   // Check parameters
   if (flags & ~((1U << osRtxThreadFlagsLimit) - 1U)) {
-    EvrRtxThreadError(thread, osErrorParameter);
+    EvrRtxThreadError(thread, (int32_t)osErrorParameter);
     return ((uint32_t)osErrorParameter);
   }
 
   // Check object state
   if ((thread->state == osRtxThreadInactive) ||
       (thread->state == osRtxThreadTerminated)) {
-    EvrRtxThreadError(thread, osErrorResource);
+    EvrRtxThreadError(thread, (int32_t)osErrorResource);
     return ((uint32_t)osErrorResource);
   }
 
@@ -1434,7 +1434,7 @@ uint32_t svcRtxThreadFlagsWait (uint32_t flags, uint32_t options, uint32_t timeo
 
   // Check parameters
   if (flags & ~((1U << osRtxThreadFlagsLimit) - 1U)) {
-    EvrRtxThreadError(thread, osErrorParameter);
+    EvrRtxThreadError(thread, (int32_t)osErrorParameter);
     return ((uint32_t)osErrorParameter);
   }
 
@@ -1474,14 +1474,14 @@ uint32_t isrRtxThreadFlagsSet (osThreadId_t thread_id, uint32_t flags) {
   // Check parameters
   if ((thread == NULL) || (thread->id != osRtxIdThread) ||
       (flags & ~((1U << osRtxThreadFlagsLimit) - 1U))) {
-    EvrRtxThreadError(thread, osErrorParameter);
+    EvrRtxThreadError(thread, (int32_t)osErrorParameter);
     return ((uint32_t)osErrorParameter);
   }
 
   // Check object state
   if ((thread->state == osRtxThreadInactive) ||
       (thread->state == osRtxThreadTerminated)) {
-    EvrRtxThreadError(thread, osErrorResource);
+    EvrRtxThreadError(thread, (int32_t)osErrorResource);
     return ((uint32_t)osErrorResource);
   }
 
@@ -1503,7 +1503,7 @@ uint32_t isrRtxThreadFlagsSet (osThreadId_t thread_id, uint32_t flags) {
 osThreadId_t osThreadNew (osThreadFunc_t func, void *argument, const osThreadAttr_t *attr) {
   EvrRtxThreadNew(func, argument, attr);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxThreadError(NULL, osErrorISR);
+    EvrRtxThreadError(NULL, (int32_t)osErrorISR);
     return NULL;
   }
   return __svcThreadNew(func, argument, attr);
@@ -1558,7 +1558,7 @@ uint32_t osThreadGetStackSpace (osThreadId_t thread_id) {
 osStatus_t osThreadSetPriority (osThreadId_t thread_id, osPriority_t priority) {
   EvrRtxThreadSetPriority(thread_id, priority);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxThreadError(thread_id, osErrorISR);
+    EvrRtxThreadError(thread_id, (int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcThreadSetPriority(thread_id, priority);
@@ -1577,7 +1577,7 @@ osPriority_t osThreadGetPriority (osThreadId_t thread_id) {
 osStatus_t osThreadYield (void) {
   EvrRtxThreadYield();
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxThreadError(NULL, osErrorISR);
+    EvrRtxThreadError(NULL, (int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcThreadYield();
@@ -1587,7 +1587,7 @@ osStatus_t osThreadYield (void) {
 osStatus_t osThreadSuspend (osThreadId_t thread_id) {
   EvrRtxThreadSuspend(thread_id);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxThreadError(thread_id, osErrorISR);
+    EvrRtxThreadError(thread_id, (int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcThreadSuspend(thread_id);
@@ -1597,7 +1597,7 @@ osStatus_t osThreadSuspend (osThreadId_t thread_id) {
 osStatus_t osThreadResume (osThreadId_t thread_id) {
   EvrRtxThreadResume(thread_id);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxThreadError(thread_id, osErrorISR);
+    EvrRtxThreadError(thread_id, (int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcThreadResume(thread_id);
@@ -1607,7 +1607,7 @@ osStatus_t osThreadResume (osThreadId_t thread_id) {
 osStatus_t osThreadDetach (osThreadId_t thread_id) {
   EvrRtxThreadDetach(thread_id);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxThreadError(thread_id, osErrorISR);
+    EvrRtxThreadError(thread_id, (int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcThreadDetach(thread_id);
@@ -1617,7 +1617,7 @@ osStatus_t osThreadDetach (osThreadId_t thread_id) {
 osStatus_t osThreadJoin (osThreadId_t thread_id) {
   EvrRtxThreadJoin(thread_id);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxThreadError(thread_id, osErrorISR);
+    EvrRtxThreadError(thread_id, (int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcThreadJoin(thread_id);
@@ -1627,15 +1627,15 @@ osStatus_t osThreadJoin (osThreadId_t thread_id) {
 __NO_RETURN void osThreadExit (void) {
   EvrRtxThreadExit();
   __svcThreadExit();
-  EvrRtxThreadError(NULL, osError);
-  for (;;);
+  EvrRtxThreadError(NULL, (int32_t)osError);
+  for (;;) {}
 }
 
 /// Terminate execution of a thread.
 osStatus_t osThreadTerminate (osThreadId_t thread_id) {
   EvrRtxThreadTerminate(thread_id);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxThreadError(thread_id, osErrorISR);
+    EvrRtxThreadError(thread_id, (int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcThreadTerminate(thread_id);
@@ -1673,7 +1673,7 @@ uint32_t osThreadFlagsSet (osThreadId_t thread_id, uint32_t flags) {
 uint32_t osThreadFlagsClear (uint32_t flags) {
   EvrRtxThreadFlagsClear(flags);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxThreadError(NULL, osErrorISR);
+    EvrRtxThreadError(NULL, (int32_t)osErrorISR);
     return ((uint32_t)osErrorISR);
   }
   return __svcThreadFlagsClear(flags);
@@ -1692,7 +1692,7 @@ uint32_t osThreadFlagsGet (void) {
 uint32_t osThreadFlagsWait (uint32_t flags, uint32_t options, uint32_t timeout) {
   EvrRtxThreadFlagsWait(flags, options, timeout);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxThreadError(NULL, osErrorISR);
+    EvrRtxThreadError(NULL, (int32_t)osErrorISR);
     return ((uint32_t)osErrorISR);
   }
   return __svcThreadFlagsWait(flags, options, timeout);

+ 15 - 15
CMSIS/RTOS2/RTX/Source/rtx_timer.c

@@ -57,7 +57,7 @@ static void TimerInsert (os_timer_t *timer, uint32_t tick) {
 
 /// Remove Timer from the Timer List.
 /// \param[in]  timer           timer object.
-static void TimerRemove (os_timer_t *timer) {
+static void TimerRemove (const os_timer_t *timer) {
 
   if (timer->next != NULL) {
     timer->next->tick += timer->tick;
@@ -72,7 +72,7 @@ static void TimerRemove (os_timer_t *timer) {
 
 /// Unlink Timer from the Timer List Head.
 /// \param[in]  timer           timer object.
-static void TimerUnlink (os_timer_t *timer) {
+static void TimerUnlink (const os_timer_t *timer) {
 
   if (timer->next != NULL) {
     timer->next->prev = timer->prev;
@@ -148,7 +148,7 @@ osTimerId_t svcRtxTimerNew (osTimerFunc_t func, osTimerType_t type, void *argume
 
   // Check parameters
   if ((func == NULL) || ((type != osTimerOnce) && (type != osTimerPeriodic))) {
-    EvrRtxTimerError(NULL, osErrorParameter);
+    EvrRtxTimerError(NULL, (int32_t)osErrorParameter);
     return NULL;
   }
 
@@ -180,7 +180,7 @@ osTimerId_t svcRtxTimerNew (osTimerFunc_t func, osTimerType_t type, void *argume
       timer = osRtxMemoryAlloc(osRtxInfo.mem.common, sizeof(os_timer_t), 1U);
     }
     if (timer == NULL) {
-      EvrRtxTimerError(NULL, osErrorNoMemory);
+      EvrRtxTimerError(NULL, (int32_t)osErrorNoMemory);
       return NULL;
     }
     flags = osRtxFlagSystemObject;
@@ -235,7 +235,7 @@ osStatus_t svcRtxTimerStart (osTimerId_t timer_id, uint32_t ticks) {
 
   // Check parameters
   if ((timer == NULL) || (timer->id != osRtxIdTimer) || (ticks == 0U)) {
-    EvrRtxTimerError(timer, osErrorParameter);
+    EvrRtxTimerError(timer, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
@@ -243,7 +243,7 @@ osStatus_t svcRtxTimerStart (osTimerId_t timer_id, uint32_t ticks) {
   switch (timer->state) {
     case osRtxTimerStopped:
       if (osRtxInfo.timer.tick == NULL) {
-        EvrRtxTimerError(timer, osErrorResource);
+        EvrRtxTimerError(timer, (int32_t)osErrorResource);
         return osErrorResource;
       }
       timer->state = osRtxTimerRunning;
@@ -254,7 +254,7 @@ osStatus_t svcRtxTimerStart (osTimerId_t timer_id, uint32_t ticks) {
       break;
     case osRtxTimerInactive:
     default:
-      EvrRtxTimerError(timer, osErrorResource);
+      EvrRtxTimerError(timer, (int32_t)osErrorResource);
       return osErrorResource;
   }
 
@@ -272,13 +272,13 @@ osStatus_t svcRtxTimerStop (osTimerId_t timer_id) {
 
   // Check parameters
   if ((timer == NULL) || (timer->id != osRtxIdTimer)) {
-    EvrRtxTimerError(timer, osErrorParameter);
+    EvrRtxTimerError(timer, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
   // Check object state
   if (timer->state != osRtxTimerRunning) {
-    EvrRtxTimerError(timer, osErrorResource);
+    EvrRtxTimerError(timer, (int32_t)osErrorResource);
     return osErrorResource;
   }
 
@@ -319,7 +319,7 @@ osStatus_t svcRtxTimerDelete (osTimerId_t timer_id) {
 
   // Check parameters
   if ((timer == NULL) || (timer->id != osRtxIdTimer)) {
-    EvrRtxTimerError(timer, osErrorParameter);
+    EvrRtxTimerError(timer, (int32_t)osErrorParameter);
     return osErrorParameter;
   }
 
@@ -332,7 +332,7 @@ osStatus_t svcRtxTimerDelete (osTimerId_t timer_id) {
       break;
     case osRtxTimerInactive:
     default:
-      EvrRtxTimerError(timer, osErrorResource);
+      EvrRtxTimerError(timer, (int32_t)osErrorResource);
       return osErrorResource;
   }
 
@@ -360,7 +360,7 @@ osStatus_t svcRtxTimerDelete (osTimerId_t timer_id) {
 osTimerId_t osTimerNew (osTimerFunc_t func, osTimerType_t type, void *argument, const osTimerAttr_t *attr) {
   EvrRtxTimerNew(func, type, argument, attr);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxTimerError(NULL, osErrorISR);
+    EvrRtxTimerError(NULL, (int32_t)osErrorISR);
     return NULL;
   }
   return __svcTimerNew(func, type, argument, attr);
@@ -379,7 +379,7 @@ const char *osTimerGetName (osTimerId_t timer_id) {
 osStatus_t osTimerStart (osTimerId_t timer_id, uint32_t ticks) {
   EvrRtxTimerStart(timer_id, ticks);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxTimerError(timer_id, osErrorISR);
+    EvrRtxTimerError(timer_id, (int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcTimerStart(timer_id, ticks);
@@ -389,7 +389,7 @@ osStatus_t osTimerStart (osTimerId_t timer_id, uint32_t ticks) {
 osStatus_t osTimerStop (osTimerId_t timer_id) {
   EvrRtxTimerStop(timer_id);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxTimerError(timer_id, osErrorISR);
+    EvrRtxTimerError(timer_id, (int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcTimerStop(timer_id);
@@ -408,7 +408,7 @@ uint32_t osTimerIsRunning (osTimerId_t timer_id) {
 osStatus_t osTimerDelete (osTimerId_t timer_id) {
   EvrRtxTimerDelete(timer_id);
   if (IS_IRQ_MODE() || IS_IRQ_MASKED()) {
-    EvrRtxTimerError(timer_id, osErrorISR);
+    EvrRtxTimerError(timer_id, (int32_t)osErrorISR);
     return osErrorISR;
   }
   return __svcTimerDelete(timer_id);