]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Source/tasks.c
Core kernel code:
[freertos] / FreeRTOS / Source / tasks.c
index 5300d09a9a92ac1672d15016d457e13274d60282..28d1c96326c9c765fbbc6679faed28a2768350ee 100644 (file)
@@ -553,14 +553,14 @@ TCB_t * pxNewTCB;
                        pxTopOfStack = ( StackType_t * ) ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack ) & ( ( portPOINTER_SIZE_TYPE ) ~portBYTE_ALIGNMENT_MASK  ) ); /*lint !e923 MISRA exception.  Avoiding casts between pointers and integers is not practical.  Size differences accounted for using portPOINTER_SIZE_TYPE type. */\r
 \r
                        /* Check the alignment of the calculated top of stack is correct. */\r
-                       configASSERT( ( ( ( uint32_t ) pxTopOfStack & ( uint32_t ) portBYTE_ALIGNMENT_MASK ) == 0UL ) );\r
+                       configASSERT( ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack & ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) == 0UL ) );\r
                }\r
                #else /* portSTACK_GROWTH */\r
                {\r
                        pxTopOfStack = pxNewTCB->pxStack;\r
 \r
                        /* Check the alignment of the stack buffer is correct. */\r
-                       configASSERT( ( ( ( uint32_t ) pxNewTCB->pxStack & ( uint32_t ) portBYTE_ALIGNMENT_MASK ) == 0UL ) );\r
+                       configASSERT( ( ( ( portPOINTER_SIZE_TYPE ) pxNewTCB->pxStack & ( portPOINTER_SIZE_TYPE ) portBYTE_ALIGNMENT_MASK ) == 0UL ) );\r
 \r
                        /* If we want to use stack checking on architectures that use\r
                        a positive stack growth direction then we also need to store the\r
@@ -3246,6 +3246,9 @@ TCB_t *pxTCB;
 \r
                if( pxMutexHolder != NULL )\r
                {\r
+                       configASSERT( pxTCB->uxMutexesHeld );\r
+                       ( pxTCB->uxMutexesHeld )--;\r
+\r
                        if( pxTCB->uxPriority != pxTCB->uxBasePriority )\r
                        {\r
                                /* Only disinherit if no other mutexes are held. */\r
@@ -3584,7 +3587,7 @@ TickType_t uxReturn;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-void vTaskIncrementMutexHeldCount( void )\r
+void *pvTaskIncrementMutexHeldCount( void )\r
 {\r
        #if ( configUSE_MUTEXES == 1 )\r
        {\r
@@ -3594,25 +3597,12 @@ void vTaskIncrementMutexHeldCount( void )
                {\r
                        ( pxCurrentTCB->uxMutexesHeld )++;\r
                }\r
-       }\r
-       #endif\r
-}\r
-/*-----------------------------------------------------------*/\r
 \r
-void vTaskDecrementMutexHeldCount( void )\r
-{\r
-       #if ( configUSE_MUTEXES == 1 )\r
-       {\r
-               /* If xSemaphoreCreateMutex() is called before any tasks have been created\r
-               then pxCurrentTCB will be NULL. */\r
-               if( pxCurrentTCB != NULL )\r
-               {\r
-                       configASSERT( pxCurrentTCB->uxMutexesHeld );\r
-                       ( pxCurrentTCB->uxMutexesHeld )--;\r
-               }\r
+               return pxCurrentTCB;\r
        }\r
        #endif\r
 }\r
+/*-----------------------------------------------------------*/\r
 \r
 #ifdef FREERTOS_MODULE_TEST\r
        #include "tasks_test_access_functions.h"\r