]> git.sur5r.net Git - freertos/commitdiff
Continue updating to MISRA 2012 from 2004 - currently working on queue.c and committi...
authorrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Mon, 11 Jun 2018 01:56:32 +0000 (01:56 +0000)
committerrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Mon, 11 Jun 2018 01:56:32 +0000 (01:56 +0000)
Change QueueHandle_t to be typesafe from void *.
Change StreamBuffer_t to be typesafe from void *.

git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2544 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

FreeRTOS/Source/include/queue.h
FreeRTOS/Source/include/stream_buffer.h
FreeRTOS/Source/queue.c
FreeRTOS/Source/stream_buffer.c
FreeRTOS/Source/tasks.c

index 4146d9f2d525b31bcae69f94a32b2161dee5a86e..4a55379ce3b43500bf2528a33e9a3c47e32ac7af 100644 (file)
@@ -43,21 +43,22 @@ extern "C" {
  * returns an QueueHandle_t variable that can then be used as a parameter to\r
  * xQueueSend(), xQueueReceive(), etc.\r
  */\r
-typedef void * QueueHandle_t;\r
+struct QueueDef_t;\r
+typedef struct QueueDef_t * QueueHandle_t;\r
 \r
 /**\r
  * Type by which queue sets are referenced.  For example, a call to\r
  * xQueueCreateSet() returns an xQueueSet variable that can then be used as a\r
  * parameter to xQueueSelectFromSet(), xQueueAddToSet(), etc.\r
  */\r
-typedef void * QueueSetHandle_t;\r
+typedef struct QueueDef_t * QueueSetHandle_t;\r
 \r
 /**\r
  * Queue sets can contain both queues and semaphores, so the\r
  * QueueSetMemberHandle_t is defined as a type to be used where a parameter or\r
  * return value can be either an QueueHandle_t or an SemaphoreHandle_t.\r
  */\r
-typedef void * QueueSetMemberHandle_t;\r
+typedef struct QueueDef_t * QueueSetMemberHandle_t;\r
 \r
 /* For internal use only. */\r
 #define        queueSEND_TO_BACK               ( ( BaseType_t ) 0 )\r
@@ -233,7 +234,7 @@ typedef void * QueueSetMemberHandle_t;
 /**\r
  * queue. h\r
  * <pre>\r
- BaseType_t xQueueSendToFront(\r
+ BaseType_t xQueueSendToToFront(\r
                                                                   QueueHandle_t        xQueue,\r
                                                                   const void           *pvItemToQueue,\r
                                                                   TickType_t           xTicksToWait\r
@@ -1422,7 +1423,7 @@ void* xQueueGetMutexHolderFromISR( QueueHandle_t xSemaphore ) PRIVILEGED_FUNCTIO
  * xSemaphoreGiveMutexRecursive() instead of calling these functions directly.\r
  */\r
 BaseType_t xQueueTakeMutexRecursive( QueueHandle_t xMutex, TickType_t xTicksToWait ) PRIVILEGED_FUNCTION;\r
-BaseType_t xQueueGiveMutexRecursive( QueueHandle_t pxMutex ) PRIVILEGED_FUNCTION;\r
+BaseType_t xQueueGiveMutexRecursive( QueueHandle_t xMutex ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
  * Reset a queue back to its original empty state.  The return value is now\r
@@ -1453,7 +1454,7 @@ BaseType_t xQueueGiveMutexRecursive( QueueHandle_t pxMutex ) PRIVILEGED_FUNCTION
  * preferably in ROM/Flash), not on the stack.\r
  */\r
 #if( configQUEUE_REGISTRY_SIZE > 0 )\r
-       void vQueueAddToRegistry( QueueHandle_t xQueue, const char *pcName ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
+       void vQueueAddToRegistry( QueueHandle_t xQueue, const char *pcQueueName ) PRIVILEGED_FUNCTION; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */\r
 #endif\r
 \r
 /*\r
index 560d3d40aa28f72f8c810b293931242c712937d5..083924f823edaab5f94c7e6b8659482126a0740a 100644 (file)
@@ -61,7 +61,8 @@ extern "C" {
  * then be used as a parameter to xStreamBufferSend(), xStreamBufferReceive(),\r
  * etc.\r
  */\r
-typedef void * StreamBufferHandle_t;\r
+struct StreamBufferDef_t;\r
+typedef struct StreamBufferDef_t * StreamBufferHandle_t;\r
 \r
 \r
 /**\r
index a580ae7dcc59e05cfdff49ae6786ce6f27cfae4c..1a7ce1be6de7aa2c96a6eaeb1b46918c33c3dc8d 100644 (file)
@@ -41,11 +41,11 @@ task.h is included from an application file. */
        #include "croutine.h"\r
 #endif\r
 \r
-/* Lint e961 and e750 are suppressed as a MISRA exception justified because the\r
-MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be defined for the\r
-header files above, but not in this file, in order to generate the correct\r
-privileged Vs unprivileged linkage and placement. */\r
-#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750. */\r
+/* Lint e9021, e961 and e750 are suppressed as a MISRA exception justified\r
+because the MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be defined\r
+for the header files above, but not in this file, in order to generate the\r
+correct privileged Vs unprivileged linkage and placement. */\r
+#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750 !e9021. */\r
 \r
 \r
 /* Constants used with the cRxLock and cTxLock structure members. */\r
@@ -83,9 +83,9 @@ zero. */
 /*\r
  * Definition of the queue used by the scheduler.\r
  * Items are queued by copy, not reference.  See the following link for the\r
- * rationale: http://www.freertos.org/Embedded-RTOS-Queues.html\r
+ * rationale: https://www.freertos.org/Embedded-RTOS-Queues.html\r
  */\r
-typedef struct QueueDefinition\r
+typedef struct QueueDef_t\r
 {\r
        int8_t *pcHead;                                 /*< Points to the beginning of the queue storage area. */\r
        int8_t *pcTail;                                 /*< Points to the byte at the end of the queue storage area.  Once more byte is allocated than necessary to store the queue items, this is used as a marker. */\r
@@ -112,7 +112,7 @@ typedef struct QueueDefinition
        #endif\r
 \r
        #if ( configUSE_QUEUE_SETS == 1 )\r
-               struct QueueDefinition *pxQueueSetContainer;\r
+               struct QueueDef_t *pxQueueSetContainer;\r
        #endif\r
 \r
        #if ( configUSE_TRACE_FACILITY == 1 )\r
@@ -246,7 +246,7 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength, const UBaseT
 \r
 BaseType_t xQueueGenericReset( QueueHandle_t xQueue, BaseType_t xNewQueue )\r
 {\r
-Queue_t * const pxQueue = ( Queue_t * ) xQueue;\r
+Queue_t * const pxQueue = xQueue;\r
 \r
        configASSERT( pxQueue );\r
 \r
@@ -255,7 +255,7 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
                pxQueue->pcTail = pxQueue->pcHead + ( pxQueue->uxLength * pxQueue->uxItemSize );\r
                pxQueue->uxMessagesWaiting = ( UBaseType_t ) 0U;\r
                pxQueue->pcWriteTo = pxQueue->pcHead;\r
-               pxQueue->u.pcReadFrom = pxQueue->pcHead + ( ( pxQueue->uxLength - ( UBaseType_t ) 1U ) * pxQueue->uxItemSize );\r
+               pxQueue->u.pcReadFrom = pxQueue->pcHead + ( ( pxQueue->uxLength - 1U ) * pxQueue->uxItemSize );\r
                pxQueue->cRxLock = queueUNLOCKED;\r
                pxQueue->cTxLock = queueUNLOCKED;\r
 \r
@@ -301,7 +301,7 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
 \r
        QueueHandle_t xQueueGenericCreateStatic( const UBaseType_t uxQueueLength, const UBaseType_t uxItemSize, uint8_t *pucQueueStorage, StaticQueue_t *pxStaticQueue, const uint8_t ucQueueType )\r
        {\r
-       Queue_t *pxNewQueue = NULL;\r
+       Queue_t *pxNewQueue;\r
 \r
                configASSERT( uxQueueLength > ( UBaseType_t ) 0 );\r
 \r
@@ -321,13 +321,14 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
                        the real queue and semaphore structures. */\r
                        volatile size_t xSize = sizeof( StaticQueue_t );\r
                        configASSERT( xSize == sizeof( Queue_t ) );\r
+                       ( void ) xSize; /* Keeps lint quiet when configASSERT() is not defined. */\r
                }\r
                #endif /* configASSERT_DEFINED */\r
 \r
                /* The address of a statically allocated queue was passed in, use it.\r
                The address of a statically allocated storage area was also passed in\r
                but is already set. */\r
-               pxNewQueue = ( Queue_t * ) pxStaticQueue; /*lint !e740 Unusual cast is ok as the structures are designed to have the same alignment, and the size is checked by an assert. */\r
+               pxNewQueue = ( Queue_t * ) pxStaticQueue; /*lint !e740 !e9087 Unusual cast is ok as the structures are designed to have the same alignment, and the size is checked by an assert. */\r
 \r
                if( pxNewQueue != NULL )\r
                {\r
@@ -376,7 +377,16 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
                        xQueueSizeInBytes = ( size_t ) ( uxQueueLength * uxItemSize ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */\r
                }\r
 \r
-               pxNewQueue = ( Queue_t * ) pvPortMalloc( sizeof( Queue_t ) + xQueueSizeInBytes );\r
+               /* Allocate the queue and storage area.  Justification for MISRA\r
+               deviation as follows:  pvPortMalloc() always ensures returned memory\r
+               blocks are aligned per the requirements of the MCU stack.  In this case\r
+               pvPortMalloc() must return a pointer that is guaranteed to meet the\r
+               alignment requirements of the Queue_t structure - which in this case\r
+               is an int8_t *.  Therefore, whenever the stack alignment requirements\r
+               are greater than or equal to the pointer to char requirements the cast\r
+               is safe.  In other cases alignment requirements are not strict (one or\r
+               two bytes). */\r
+               pxNewQueue = ( Queue_t * ) pvPortMalloc( sizeof( Queue_t ) + xQueueSizeInBytes ); /*lint !e9087 !e9079 see comment above. */\r
 \r
                if( pxNewQueue != NULL )\r
                {\r
@@ -483,13 +493,13 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength, const UBaseT
 \r
        QueueHandle_t xQueueCreateMutex( const uint8_t ucQueueType )\r
        {\r
-       Queue_t *pxNewQueue;\r
+       QueueHandle_t xNewQueue;\r
        const UBaseType_t uxMutexLength = ( UBaseType_t ) 1, uxMutexSize = ( UBaseType_t ) 0;\r
 \r
-               pxNewQueue = ( Queue_t * ) xQueueGenericCreate( uxMutexLength, uxMutexSize, ucQueueType );\r
-               prvInitialiseMutex( pxNewQueue );\r
+               xNewQueue = xQueueGenericCreate( uxMutexLength, uxMutexSize, ucQueueType );\r
+               prvInitialiseMutex( ( Queue_t * ) xNewQueue );\r
 \r
-               return pxNewQueue;\r
+               return xNewQueue;\r
        }\r
 \r
 #endif /* configUSE_MUTEXES */\r
@@ -499,17 +509,17 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength, const UBaseT
 \r
        QueueHandle_t xQueueCreateMutexStatic( const uint8_t ucQueueType, StaticQueue_t *pxStaticQueue )\r
        {\r
-       Queue_t *pxNewQueue;\r
+       QueueHandle_t xNewQueue;\r
        const UBaseType_t uxMutexLength = ( UBaseType_t ) 1, uxMutexSize = ( UBaseType_t ) 0;\r
 \r
                /* Prevent compiler warnings about unused parameters if\r
                configUSE_TRACE_FACILITY does not equal 1. */\r
                ( void ) ucQueueType;\r
 \r
-               pxNewQueue = ( Queue_t * ) xQueueGenericCreateStatic( uxMutexLength, uxMutexSize, NULL, pxStaticQueue, ucQueueType );\r
-               prvInitialiseMutex( pxNewQueue );\r
+               xNewQueue = xQueueGenericCreateStatic( uxMutexLength, uxMutexSize, NULL, pxStaticQueue, ucQueueType );\r
+               prvInitialiseMutex( ( Queue_t * ) xNewQueue );\r
 \r
-               return pxNewQueue;\r
+               return xNewQueue;\r
        }\r
 \r
 #endif /* configUSE_MUTEXES */\r
@@ -520,6 +530,7 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength, const UBaseT
        void* xQueueGetMutexHolder( QueueHandle_t xSemaphore )\r
        {\r
        void *pxReturn;\r
+       Queue_t * const pxSemaphore = ( Queue_t * ) xSemaphore;\r
 \r
                /* This function is called by xSemaphoreGetMutexHolder(), and should not\r
                be called directly.  Note:  This is a good way of determining if the\r
@@ -528,9 +539,9 @@ static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength, const UBaseT
                following critical section exiting and the function returning. */\r
                taskENTER_CRITICAL();\r
                {\r
-                       if( ( ( Queue_t * ) xSemaphore )->uxQueueType == queueQUEUE_IS_MUTEX )\r
+                       if( pxSemaphore->uxQueueType == queueQUEUE_IS_MUTEX )\r
                        {\r
-                               pxReturn = ( void * ) ( ( Queue_t * ) xSemaphore )->pxMutexHolder;\r
+                               pxReturn = ( void * ) pxSemaphore->pxMutexHolder;\r
                        }\r
                        else\r
                        {\r
@@ -728,7 +739,7 @@ BaseType_t xQueueGenericSend( QueueHandle_t xQueue, const void * const pvItemToQ
 {\r
 BaseType_t xEntryTimeSet = pdFALSE, xYieldRequired;\r
 TimeOut_t xTimeOut;\r
-Queue_t * const pxQueue = ( Queue_t * ) xQueue;\r
+Queue_t * const pxQueue = xQueue;\r
 \r
        configASSERT( pxQueue );\r
        configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) );\r
@@ -740,9 +751,9 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
        #endif\r
 \r
 \r
-       /* This function relaxes the coding standard somewhat to allow return\r
-       statements within the function itself.  This is done in the interest\r
-       of execution time efficiency. */\r
+       /*lint -save -e904 This function relaxes the coding standard somewhat to\r
+       allow return statements within the function itself.  This is done in the\r
+       interest of execution time efficiency. */\r
        for( ;; )\r
        {\r
                taskENTER_CRITICAL();\r
@@ -930,7 +941,7 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
                        traceQUEUE_SEND_FAILED( pxQueue );\r
                        return errQUEUE_FULL;\r
                }\r
-       }\r
+       } /*lint -restore */\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -938,7 +949,7 @@ BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue, const void * const pv
 {\r
 BaseType_t xReturn;\r
 UBaseType_t uxSavedInterruptStatus;\r
-Queue_t * const pxQueue = ( Queue_t * ) xQueue;\r
+Queue_t * const pxQueue = xQueue;\r
 \r
        configASSERT( pxQueue );\r
        configASSERT( !( ( pvItemToQueue == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) );\r
@@ -1089,7 +1100,7 @@ BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue, BaseType_t * const pxHigherP
 {\r
 BaseType_t xReturn;\r
 UBaseType_t uxSavedInterruptStatus;\r
-Queue_t * const pxQueue = ( Queue_t * ) xQueue;\r
+Queue_t * const pxQueue = xQueue;\r
 \r
        /* Similar to xQueueGenericSendFromISR() but used with semaphores where the\r
        item size is 0.  Don't directly wake a task that was blocked on a queue\r
@@ -1254,7 +1265,7 @@ BaseType_t xQueueReceive( QueueHandle_t xQueue, void * const pvBuffer, TickType_
 {\r
 BaseType_t xEntryTimeSet = pdFALSE;\r
 TimeOut_t xTimeOut;\r
-Queue_t * const pxQueue = ( Queue_t * ) xQueue;\r
+Queue_t * const pxQueue = xQueue;\r
 \r
        /* Check the pointer is not NULL. */\r
        configASSERT( ( pxQueue ) );\r
@@ -1271,10 +1282,9 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
        #endif\r
 \r
 \r
-       /* This function relaxes the coding standard somewhat to allow return\r
-       statements within the function itself.  This is done in the interest\r
-       of execution time efficiency. */\r
-\r
+       /*lint -save -e904  This function relaxes the coding standard somewhat to\r
+       allow return statements within the function itself.  This is done in the\r
+       interest of execution time efficiency. */\r
        for( ;; )\r
        {\r
                taskENTER_CRITICAL();\r
@@ -1388,7 +1398,7 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
                                mtCOVERAGE_TEST_MARKER();\r
                        }\r
                }\r
-       }\r
+       } /*lint -restore */\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -1396,7 +1406,7 @@ BaseType_t xQueueSemaphoreTake( QueueHandle_t xQueue, TickType_t xTicksToWait )
 {\r
 BaseType_t xEntryTimeSet = pdFALSE;\r
 TimeOut_t xTimeOut;\r
-Queue_t * const pxQueue = ( Queue_t * ) xQueue;\r
+Queue_t * const pxQueue = xQueue;\r
 \r
 #if( configUSE_MUTEXES == 1 )\r
        BaseType_t xInheritanceOccurred = pdFALSE;\r
@@ -1417,10 +1427,9 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
        #endif\r
 \r
 \r
-       /* This function relaxes the coding standard somewhat to allow return\r
+       /*lint -save -e904 This function relaxes the coding standard somewhat to allow return\r
        statements within the function itself.  This is done in the interest\r
        of execution time efficiency. */\r
-\r
        for( ;; )\r
        {\r
                taskENTER_CRITICAL();\r
@@ -1607,7 +1616,7 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
                                mtCOVERAGE_TEST_MARKER();\r
                        }\r
                }\r
-       }\r
+       } /*lint -restore */\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -1616,7 +1625,7 @@ BaseType_t xQueuePeek( QueueHandle_t xQueue, void * const pvBuffer, TickType_t x
 BaseType_t xEntryTimeSet = pdFALSE;\r
 TimeOut_t xTimeOut;\r
 int8_t *pcOriginalReadPosition;\r
-Queue_t * const pxQueue = ( Queue_t * ) xQueue;\r
+Queue_t * const pxQueue = xQueue;\r
 \r
        /* Check the pointer is not NULL. */\r
        configASSERT( ( pxQueue ) );\r
@@ -1765,7 +1774,7 @@ BaseType_t xQueueReceiveFromISR( QueueHandle_t xQueue, void * const pvBuffer, Ba
 {\r
 BaseType_t xReturn;\r
 UBaseType_t uxSavedInterruptStatus;\r
-Queue_t * const pxQueue = ( Queue_t * ) xQueue;\r
+Queue_t * const pxQueue = xQueue;\r
 \r
        configASSERT( pxQueue );\r
        configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) );\r
@@ -1857,7 +1866,7 @@ BaseType_t xQueuePeekFromISR( QueueHandle_t xQueue,  void * const pvBuffer )
 BaseType_t xReturn;\r
 UBaseType_t uxSavedInterruptStatus;\r
 int8_t *pcOriginalReadPosition;\r
-Queue_t * const pxQueue = ( Queue_t * ) xQueue;\r
+Queue_t * const pxQueue = xQueue;\r
 \r
        configASSERT( pxQueue );\r
        configASSERT( !( ( pvBuffer == NULL ) && ( pxQueue->uxItemSize != ( UBaseType_t ) 0U ) ) );\r
@@ -1925,9 +1934,8 @@ UBaseType_t uxReturn;
 UBaseType_t uxQueueSpacesAvailable( const QueueHandle_t xQueue )\r
 {\r
 UBaseType_t uxReturn;\r
-Queue_t *pxQueue;\r
+Queue_t * const pxQueue = xQueue;\r
 \r
-       pxQueue = ( Queue_t * ) xQueue;\r
        configASSERT( pxQueue );\r
 \r
        taskENTER_CRITICAL();\r
@@ -1943,10 +1951,10 @@ Queue_t *pxQueue;
 UBaseType_t uxQueueMessagesWaitingFromISR( const QueueHandle_t xQueue )\r
 {\r
 UBaseType_t uxReturn;\r
+Queue_t * const pxQueue = xQueue;\r
 \r
-       configASSERT( xQueue );\r
-\r
-       uxReturn = ( ( Queue_t * ) xQueue )->uxMessagesWaiting;\r
+       configASSERT( pxQueue );\r
+       uxReturn = pxQueue->uxMessagesWaiting;\r
 \r
        return uxReturn;\r
 } /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */\r
@@ -1954,7 +1962,7 @@ UBaseType_t uxReturn;
 \r
 void vQueueDelete( QueueHandle_t xQueue )\r
 {\r
-Queue_t * const pxQueue = ( Queue_t * ) xQueue;\r
+Queue_t * const pxQueue = xQueue;\r
 \r
        configASSERT( pxQueue );\r
        traceQUEUE_DELETE( pxQueue );\r
@@ -2036,9 +2044,9 @@ Queue_t * const pxQueue = ( Queue_t * ) xQueue;
                other tasks that are waiting for the same mutex.  For this purpose,\r
                return the priority of the highest priority task that is waiting for the\r
                mutex. */\r
-               if( listCURRENT_LIST_LENGTH( &( pxQueue->xTasksWaitingToReceive ) ) > 0 )\r
+               if( listCURRENT_LIST_LENGTH( &( pxQueue->xTasksWaitingToReceive ) ) > 0U )\r
                {\r
-                       uxHighestPriorityOfWaitingTasks = configMAX_PRIORITIES - listGET_ITEM_VALUE_OF_HEAD_ENTRY( &( pxQueue->xTasksWaitingToReceive ) );\r
+                       uxHighestPriorityOfWaitingTasks = ( UBaseType_t ) configMAX_PRIORITIES - ( UBaseType_t ) listGET_ITEM_VALUE_OF_HEAD_ENTRY( &( pxQueue->xTasksWaitingToReceive ) );\r
                }\r
                else\r
                {\r
@@ -2079,8 +2087,8 @@ UBaseType_t uxMessagesWaiting;
        }\r
        else if( xPosition == queueSEND_TO_BACK )\r
        {\r
-               ( void ) memcpy( ( void * ) pxQueue->pcWriteTo, pvItemToQueue, ( size_t ) pxQueue->uxItemSize ); /*lint !e961 !e418 MISRA exception as the casts are only redundant for some ports, plus previous logic ensures a null pointer can only be passed to memcpy() if the copy size is 0. */\r
-               pxQueue->pcWriteTo += pxQueue->uxItemSize;\r
+               ( void ) memcpy( ( void * ) pxQueue->pcWriteTo, pvItemToQueue, ( size_t ) pxQueue->uxItemSize ); /*lint !e961 !e418 !e9087 MISRA exception as the casts are only redundant for some ports, plus previous logic ensures a null pointer can only be passed to memcpy() if the copy size is 0.  Cast to void required by function signature and safe as no alignment requirement and copy length specified in bytes. */\r
+               pxQueue->pcWriteTo += pxQueue->uxItemSize; /*lint !e9016 Pointer arithmetic on char types ok, especially in this use case where it is the clearest way of conveying intent. */\r
                if( pxQueue->pcWriteTo >= pxQueue->pcTail ) /*lint !e946 MISRA exception justified as comparison of pointers is the cleanest solution. */\r
                {\r
                        pxQueue->pcWriteTo = pxQueue->pcHead;\r
@@ -2092,7 +2100,7 @@ UBaseType_t uxMessagesWaiting;
        }\r
        else\r
        {\r
-               ( void ) memcpy( ( void * ) pxQueue->u.pcReadFrom, pvItemToQueue, ( size_t ) pxQueue->uxItemSize ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */\r
+               ( void ) memcpy( ( void * ) pxQueue->u.pcReadFrom, pvItemToQueue, ( size_t ) pxQueue->uxItemSize ); /*lint !e961 !e9087 MISRA exception as the casts are only redundant for some ports.  Cast to void required by function signature and safe as no alignment requirement and copy length specified in bytes. */\r
                pxQueue->u.pcReadFrom -= pxQueue->uxItemSize;\r
                if( pxQueue->u.pcReadFrom < pxQueue->pcHead ) /*lint !e946 MISRA exception justified as comparison of pointers is the cleanest solution. */\r
                {\r
@@ -2134,7 +2142,7 @@ static void prvCopyDataFromQueue( Queue_t * const pxQueue, void * const pvBuffer
 {\r
        if( pxQueue->uxItemSize != ( UBaseType_t ) 0 )\r
        {\r
-               pxQueue->u.pcReadFrom += pxQueue->uxItemSize;\r
+               pxQueue->u.pcReadFrom += pxQueue->uxItemSize; /*lint !e9016 Pointer arithmetic on char types ok, especially in this use case where it is the clearest way of conveying intent. */\r
                if( pxQueue->u.pcReadFrom >= pxQueue->pcTail ) /*lint !e946 MISRA exception justified as use of the relational operator is the cleanest solutions. */\r
                {\r
                        pxQueue->u.pcReadFrom = pxQueue->pcHead;\r
@@ -2143,7 +2151,7 @@ static void prvCopyDataFromQueue( Queue_t * const pxQueue, void * const pvBuffer
                {\r
                        mtCOVERAGE_TEST_MARKER();\r
                }\r
-               ( void ) memcpy( ( void * ) pvBuffer, ( void * ) pxQueue->u.pcReadFrom, ( size_t ) pxQueue->uxItemSize ); /*lint !e961 !e418 MISRA exception as the casts are only redundant for some ports.  Also previous logic ensures a null pointer can only be passed to memcpy() when the count is 0. */\r
+               ( void ) memcpy( ( void * ) pvBuffer, ( void * ) pxQueue->u.pcReadFrom, ( size_t ) pxQueue->uxItemSize ); /*lint !e961 !e418 !e9087 MISRA exception as the casts are only redundant for some ports.  Also previous logic ensures a null pointer can only be passed to memcpy() when the count is 0.  Cast to void required by function signature and safe as no alignment requirement and copy length specified in bytes. */\r
        }\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -2292,9 +2300,10 @@ BaseType_t xReturn;
 BaseType_t xQueueIsQueueEmptyFromISR( const QueueHandle_t xQueue )\r
 {\r
 BaseType_t xReturn;\r
+Queue_t * const pxQueue = xQueue;\r
 \r
-       configASSERT( xQueue );\r
-       if( ( ( Queue_t * ) xQueue )->uxMessagesWaiting == ( UBaseType_t ) 0 )\r
+       configASSERT( pxQueue );\r
+       if( pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0 )\r
        {\r
                xReturn = pdTRUE;\r
        }\r
@@ -2331,9 +2340,10 @@ BaseType_t xReturn;
 BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )\r
 {\r
 BaseType_t xReturn;\r
+Queue_t * const pxQueue = xQueue;\r
 \r
-       configASSERT( xQueue );\r
-       if( ( ( Queue_t * ) xQueue )->uxMessagesWaiting == ( ( Queue_t * ) xQueue )->uxLength )\r
+       configASSERT( pxQueue );\r
+       if( pxQueue->uxMessagesWaiting == pxQueue->uxLength )\r
        {\r
                xReturn = pdTRUE;\r
        }\r
@@ -2351,7 +2361,7 @@ BaseType_t xReturn;
        BaseType_t xQueueCRSend( QueueHandle_t xQueue, const void *pvItemToQueue, TickType_t xTicksToWait )\r
        {\r
        BaseType_t xReturn;\r
-       Queue_t * const pxQueue = ( Queue_t * ) xQueue;\r
+       Queue_t * const pxQueue = xQueue;\r
 \r
                /* If the queue is already full we may have to block.  A critical section\r
                is required to prevent an interrupt removing something from the queue\r
@@ -2428,7 +2438,7 @@ BaseType_t xReturn;
        BaseType_t xQueueCRReceive( QueueHandle_t xQueue, void *pvBuffer, TickType_t xTicksToWait )\r
        {\r
        BaseType_t xReturn;\r
-       Queue_t * const pxQueue = ( Queue_t * ) xQueue;\r
+       Queue_t * const pxQueue = xQueue;\r
 \r
                /* If the queue is already empty we may have to block.  A critical section\r
                is required to prevent an interrupt adding something to the queue\r
@@ -2517,7 +2527,7 @@ BaseType_t xReturn;
 \r
        BaseType_t xQueueCRSendFromISR( QueueHandle_t xQueue, const void *pvItemToQueue, BaseType_t xCoRoutinePreviouslyWoken )\r
        {\r
-       Queue_t * const pxQueue = ( Queue_t * ) xQueue;\r
+       Queue_t * const pxQueue = xQueue;\r
 \r
                /* Cannot block within an ISR so if there is no space on the queue then\r
                exit without doing anything. */\r
@@ -2566,7 +2576,7 @@ BaseType_t xReturn;
        BaseType_t xQueueCRReceiveFromISR( QueueHandle_t xQueue, void *pvBuffer, BaseType_t *pxCoRoutineWoken )\r
        {\r
        BaseType_t xReturn;\r
-       Queue_t * const pxQueue = ( Queue_t * ) xQueue;\r
+       Queue_t * const pxQueue = xQueue;\r
 \r
                /* We cannot block from an ISR, so check there is data available. If\r
                not then just leave without doing anything. */\r
@@ -2714,7 +2724,7 @@ BaseType_t xReturn;
 \r
        void vQueueWaitForMessageRestricted( QueueHandle_t xQueue, TickType_t xTicksToWait, const BaseType_t xWaitIndefinitely )\r
        {\r
-       Queue_t * const pxQueue = ( Queue_t * ) xQueue;\r
+       Queue_t * const pxQueue = xQueue;\r
 \r
                /* This function should not be called by application code hence the\r
                'Restricted' in its name.  It is not part of the public API.  It is\r
index f26624ed8df9f7cc46aee8bddc5052abb151f1bc..71355f5cbbd172fdba944925c584565c3a89fccb 100644 (file)
@@ -43,11 +43,11 @@ task.h is included from an application file. */
        #error configUSE_TASK_NOTIFICATIONS must be set to 1 to build stream_buffer.c\r
 #endif\r
 \r
-/* Lint e961 and e750 are suppressed as a MISRA exception justified because the\r
-MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be defined for the\r
-header files above, but not in this file, in order to generate the correct\r
-privileged Vs unprivileged linkage and placement. */\r
-#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750. */\r
+/* Lint e961, e9021 and e750 are suppressed as a MISRA exception justified\r
+because the MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be defined\r
+for the header files above, but not in this file, in order to generate the\r
+correct privileged Vs unprivileged linkage and placement. */\r
+#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750 !e9021. */\r
 \r
 /* If the user has not provided application specific Rx notification macros,\r
 or #defined the notification macros away, them provide default implementations\r
@@ -138,7 +138,7 @@ that uses task notifications. */
 /*-----------------------------------------------------------*/\r
 \r
 /* Structure that hold state information on the buffer. */\r
-typedef struct xSTREAM_BUFFER /*lint !e9058 Style convention uses tag. */\r
+typedef struct StreamBufferDef_t /*lint !e9058 Style convention uses tag. */\r
 {\r
        volatile size_t xTail;                          /* Index to the next item to read within the buffer. */\r
        volatile size_t xHead;                          /* Index to the next item to write within the buffer. */\r
@@ -231,7 +231,7 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
                the buffer was empty. */\r
                if( xTriggerLevelBytes == ( size_t ) 0 )\r
                {\r
-                       xTriggerLevelBytes = ( size_t ) 1; /*lint !e9044 Parameter modified to ensure it doesn't have a dangerous value. */\r
+                       xTriggerLevelBytes = ( size_t ) 1;\r
                }\r
 \r
                /* A stream buffer requires a StreamBuffer_t structure and a buffer.\r
@@ -260,7 +260,7 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
                        traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer );\r
                }\r
 \r
-               return ( StreamBufferHandle_t ) pucAllocatedMemory; /*lint !e9087 !e826 Safe cast as allocated memory is aligned. */\r
+               return ( StreamBufferHandle_t ) pucAllocatedMemory; /*lint !e9087 !e826 Safe cast as allocated memory is aligned. */\r
        }\r
 \r
 #endif /* configSUPPORT_DYNAMIC_ALLOCATION */\r
@@ -285,7 +285,7 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
                the buffer was empty. */\r
                if( xTriggerLevelBytes == ( size_t ) 0 )\r
                {\r
-                       xTriggerLevelBytes = ( size_t ) 1; /*lint !e9044 Function parameter deliberately modified to ensure it is in range. */\r
+                       xTriggerLevelBytes = ( size_t ) 1;\r
                }\r
 \r
                /* In case the stream buffer is going to be used as a message buffer\r
@@ -301,7 +301,7 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
                        message buffer structure. */\r
                        volatile size_t xSize = sizeof( StaticStreamBuffer_t );\r
                        configASSERT( xSize == sizeof( StreamBuffer_t ) );\r
-               }\r
+               } /*lint !e529 xSize is referenced is configASSERT() is defined. */\r
                #endif /* configASSERT_DEFINED */\r
 \r
                if( ( pucStreamBufferStorageArea != NULL ) && ( pxStaticStreamBuffer != NULL ) )\r
@@ -334,7 +334,7 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
 \r
 void vStreamBufferDelete( StreamBufferHandle_t xStreamBuffer )\r
 {\r
-StreamBuffer_t * pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */\r
+StreamBuffer_t * pxStreamBuffer = xStreamBuffer;\r
 \r
        configASSERT( pxStreamBuffer );\r
 \r
@@ -385,35 +385,39 @@ BaseType_t xReturn = pdFAIL, xIsMessageBuffer;
        #endif\r
 \r
        /* Can only reset a message buffer if there are no tasks blocked on it. */\r
-       if( pxStreamBuffer->xTaskWaitingToReceive == NULL )\r
+       taskENTER_CRITICAL();\r
        {\r
-               if( pxStreamBuffer->xTaskWaitingToSend == NULL )\r
+               if( pxStreamBuffer->xTaskWaitingToReceive == NULL )\r
                {\r
-                       if( ( pxStreamBuffer->ucFlags & sbFLAGS_IS_MESSAGE_BUFFER ) != ( uint8_t ) 0 )\r
-                       {\r
-                               xIsMessageBuffer = pdTRUE;\r
-                       }\r
-                       else\r
+                       if( pxStreamBuffer->xTaskWaitingToSend == NULL )\r
                        {\r
-                               xIsMessageBuffer = pdFALSE;\r
-                       }\r
+                               if( ( pxStreamBuffer->ucFlags & sbFLAGS_IS_MESSAGE_BUFFER ) != ( uint8_t ) 0 )\r
+                               {\r
+                                       xIsMessageBuffer = pdTRUE;\r
+                               }\r
+                               else\r
+                               {\r
+                                       xIsMessageBuffer = pdFALSE;\r
+                               }\r
 \r
-                       prvInitialiseNewStreamBuffer( pxStreamBuffer,\r
-                                                                                 pxStreamBuffer->pucBuffer,\r
-                                                                                 pxStreamBuffer->xLength,\r
-                                                                                 pxStreamBuffer->xTriggerLevelBytes,\r
-                                                                                 xIsMessageBuffer );\r
-                       xReturn = pdPASS;\r
+                               prvInitialiseNewStreamBuffer( pxStreamBuffer,\r
+                                                                                         pxStreamBuffer->pucBuffer,\r
+                                                                                         pxStreamBuffer->xLength,\r
+                                                                                         pxStreamBuffer->xTriggerLevelBytes,\r
+                                                                                         xIsMessageBuffer );\r
+                               xReturn = pdPASS;\r
 \r
-                       #if( configUSE_TRACE_FACILITY == 1 )\r
-                       {\r
-                               pxStreamBuffer->uxStreamBufferNumber = uxStreamBufferNumber;\r
-                       }\r
-                       #endif\r
+                               #if( configUSE_TRACE_FACILITY == 1 )\r
+                               {\r
+                                       pxStreamBuffer->uxStreamBufferNumber = uxStreamBufferNumber;\r
+                               }\r
+                               #endif\r
 \r
-                       traceSTREAM_BUFFER_RESET( xStreamBuffer );\r
+                               traceSTREAM_BUFFER_RESET( xStreamBuffer );\r
+                       }\r
                }\r
        }\r
+       taskEXIT_CRITICAL();\r
 \r
        return xReturn;\r
 }\r
@@ -421,7 +425,7 @@ BaseType_t xReturn = pdFAIL, xIsMessageBuffer;
 \r
 BaseType_t xStreamBufferSetTriggerLevel( StreamBufferHandle_t xStreamBuffer, size_t xTriggerLevel )\r
 {\r
-StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */\r
+StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;\r
 BaseType_t xReturn;\r
 \r
        configASSERT( pxStreamBuffer );\r
@@ -429,7 +433,7 @@ BaseType_t xReturn;
        /* It is not valid for the trigger level to be 0. */\r
        if( xTriggerLevel == ( size_t ) 0 )\r
        {\r
-               xTriggerLevel = ( size_t ) 1; /*lint !e9044 Parameter modified to ensure it doesn't have a dangerous value. */\r
+               xTriggerLevel = ( size_t ) 1;\r
        }\r
 \r
        /* The trigger level is the number of bytes that must be in the stream\r
@@ -450,7 +454,7 @@ BaseType_t xReturn;
 \r
 size_t xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer )\r
 {\r
-const StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */\r
+const StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;\r
 size_t xSpace;\r
 \r
        configASSERT( pxStreamBuffer );\r
@@ -474,7 +478,7 @@ size_t xSpace;
 \r
 size_t xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer )\r
 {\r
-const StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */\r
+const StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;\r
 size_t xReturn;\r
 \r
        configASSERT( pxStreamBuffer );\r
@@ -489,7 +493,7 @@ size_t xStreamBufferSend( StreamBufferHandle_t xStreamBuffer,
                                                  size_t xDataLengthBytes,\r
                                                  TickType_t xTicksToWait )\r
 {\r
-StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */\r
+StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;\r
 size_t xReturn, xSpace = 0;\r
 size_t xRequiredSpace = xDataLengthBytes;\r
 TimeOut_t xTimeOut;\r
@@ -593,7 +597,7 @@ size_t xStreamBufferSendFromISR( StreamBufferHandle_t xStreamBuffer,
                                                                 size_t xDataLengthBytes,\r
                                                                 BaseType_t * const pxHigherPriorityTaskWoken )\r
 {\r
-StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */\r
+StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;\r
 size_t xReturn, xSpace;\r
 size_t xRequiredSpace = xDataLengthBytes;\r
 \r
@@ -660,7 +664,7 @@ static size_t prvWriteMessageToBuffer( StreamBuffer_t * const pxStreamBuffer,
                stream of bytes rather than discrete messages.  Write as many bytes as\r
                possible. */\r
                xShouldWrite = pdTRUE;\r
-               xDataLengthBytes = configMIN( xDataLengthBytes, xSpace ); /*lint !e9044 Function parameter modified to ensure it is capped to available space. */\r
+               xDataLengthBytes = configMIN( xDataLengthBytes, xSpace );\r
        }\r
        else if( xSpace >= xRequiredSpace )\r
        {\r
@@ -696,7 +700,7 @@ size_t xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer,
                                                         size_t xBufferLengthBytes,\r
                                                         TickType_t xTicksToWait )\r
 {\r
-StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */\r
+StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;\r
 size_t xReceivedLength = 0, xBytesAvailable, xBytesToStoreMessageLength;\r
 \r
        configASSERT( pvRxData );\r
@@ -797,7 +801,7 @@ size_t xReceivedLength = 0, xBytesAvailable, xBytesToStoreMessageLength;
 \r
 size_t xStreamBufferNextMessageLengthBytes( StreamBufferHandle_t xStreamBuffer )\r
 {\r
-StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */\r
+StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;\r
 size_t xReturn, xBytesAvailable, xOriginalTail;\r
 configMESSAGE_BUFFER_LENGTH_TYPE xTempReturn;\r
 \r
@@ -844,7 +848,7 @@ size_t xStreamBufferReceiveFromISR( StreamBufferHandle_t xStreamBuffer,
                                                                        size_t xBufferLengthBytes,\r
                                                                        BaseType_t * const pxHigherPriorityTaskWoken )\r
 {\r
-StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */\r
+StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;\r
 size_t xReceivedLength = 0, xBytesAvailable, xBytesToStoreMessageLength;\r
 \r
        configASSERT( pvRxData );\r
@@ -950,7 +954,7 @@ configMESSAGE_BUFFER_LENGTH_TYPE xTempNextMessageLength;
 \r
 BaseType_t xStreamBufferIsEmpty( StreamBufferHandle_t xStreamBuffer )\r
 {\r
-const StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */\r
+const StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;\r
 BaseType_t xReturn;\r
 size_t xTail;\r
 \r
@@ -975,7 +979,7 @@ BaseType_t xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer )
 {\r
 BaseType_t xReturn;\r
 size_t xBytesToStoreMessageLength;\r
-const StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */\r
+const StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;\r
 \r
        configASSERT( pxStreamBuffer );\r
 \r
@@ -1008,7 +1012,7 @@ const StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer
 \r
 BaseType_t xStreamBufferSendCompletedFromISR( StreamBufferHandle_t xStreamBuffer, BaseType_t *pxHigherPriorityTaskWoken )\r
 {\r
-StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */\r
+StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;\r
 BaseType_t xReturn;\r
 UBaseType_t uxSavedInterruptStatus;\r
 \r
@@ -1038,7 +1042,7 @@ UBaseType_t uxSavedInterruptStatus;
 \r
 BaseType_t xStreamBufferReceiveCompletedFromISR( StreamBufferHandle_t xStreamBuffer, BaseType_t *pxHigherPriorityTaskWoken )\r
 {\r
-StreamBuffer_t * const pxStreamBuffer = ( StreamBuffer_t * ) xStreamBuffer; /*lint !e9087 !e9079 Safe cast as StreamBufferHandle_t is opaque Streambuffer_t. */\r
+StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;\r
 BaseType_t xReturn;\r
 UBaseType_t uxSavedInterruptStatus;\r
 \r
@@ -1203,7 +1207,7 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
                result in confusion as to what is actually being observed. */\r
                const BaseType_t xWriteValue = 0x55;\r
                configASSERT( memset( pucBuffer, ( int ) xWriteValue, xBufferSizeBytes ) == pucBuffer );\r
-       }\r
+       } /*lint !e529 !e438 xWriteValue is only used if configASSERT() is defined. */\r
        #endif\r
 \r
        memset( ( void * ) pxStreamBuffer, 0x00, sizeof( StreamBuffer_t ) ); /*lint !e9087 memset() requires void *. */\r
@@ -1221,7 +1225,7 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
 \r
        UBaseType_t uxStreamBufferGetStreamBufferNumber( StreamBufferHandle_t xStreamBuffer )\r
        {\r
-               return ( ( StreamBuffer_t * ) xStreamBuffer )->uxStreamBufferNumber;\r
+               return xStreamBuffer->uxStreamBufferNumber;\r
        }\r
 \r
 #endif /* configUSE_TRACE_FACILITY */\r
@@ -1231,7 +1235,7 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
 \r
        void vStreamBufferSetStreamBufferNumber( StreamBufferHandle_t xStreamBuffer, UBaseType_t uxStreamBufferNumber )\r
        {\r
-               ( ( StreamBuffer_t * ) xStreamBuffer )->uxStreamBufferNumber = uxStreamBufferNumber;\r
+               xStreamBuffer->uxStreamBufferNumber = uxStreamBufferNumber;\r
        }\r
 \r
 #endif /* configUSE_TRACE_FACILITY */\r
@@ -1241,7 +1245,7 @@ static void prvInitialiseNewStreamBuffer( StreamBuffer_t * const pxStreamBuffer,
 \r
        uint8_t ucStreamBufferGetStreamBufferType( StreamBufferHandle_t xStreamBuffer )\r
        {\r
-               return ( ( StreamBuffer_t * )xStreamBuffer )->ucFlags & sbFLAGS_IS_MESSAGE_BUFFER;\r
+               return ( xStreamBuffer->ucFlags & sbFLAGS_IS_MESSAGE_BUFFER );\r
        }\r
 \r
 #endif /* configUSE_TRACE_FACILITY */\r
index dc022d7b040b6b804363fb2779a1f37397605a9b..fb34246291b9d1ae71e52188ba8235125eb28a3b 100644 (file)
@@ -4267,7 +4267,7 @@ TCB_t *pxTCB;
 \r
                                /* Write the rest of the string. */\r
                                sprintf( pcWriteBuffer, "\t%c\t%u\t%u\t%u\r\n", cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber ); /*lint !e586 sprintf() allowed as this is compiled with many compilers and this is a utility function only - not part of the core kernel implementation. */\r
-                               pcWriteBuffer += strlen( pcWriteBuffer ); /*lint !e9016 Pointer arithmetic ok on char pointers. */\r
+                               pcWriteBuffer += strlen( pcWriteBuffer ); /*lint !e9016 Pointer arithmetic ok on char pointers especially as in this case where it best denotes the intent of the code. */\r
                        }\r
 \r
                        /* Free the array again.  NOTE!  If configSUPPORT_DYNAMIC_ALLOCATION\r
@@ -4389,7 +4389,7 @@ TCB_t *pxTCB;
                                                #endif\r
                                        }\r
 \r
-                                       pcWriteBuffer += strlen( pcWriteBuffer ); /*lint !e9016 Pointer arithmetic ok on char pointers. */\r
+                                       pcWriteBuffer += strlen( pcWriteBuffer ); /*lint !e9016 Pointer arithmetic ok on char pointers especially as in this case where it best denotes the intent of the code. */\r
                                }\r
                        }\r
                        else\r
@@ -4644,8 +4644,9 @@ TickType_t uxReturn;
 \r
                                default:\r
                                        /* Should not get here if all enums are handled.\r
-                                       Artificially force an assert. */\r
-                                       configASSERT( ( volatile uint32_t ) 0 );\r
+                                       Artificially force an assert by testing a value the\r
+                                       compiler can't assume is const. */\r
+                                       configASSERT( pxTCB->ulNotifiedValue == ~0UL );\r
 \r
                                        break;\r
                        }\r
@@ -4776,8 +4777,9 @@ TickType_t uxReturn;
 \r
                                default:\r
                                        /* Should not get here if all enums are handled.\r
-                                       Artificially force an assert. */\r
-                                       configASSERT( ( volatile uint32_t ) 0 );\r
+                                       Artificially force an assert by testing a value the\r
+                                       compiler can't assume is const. */\r
+                                       configASSERT( pxTCB->ulNotifiedValue == ~0UL );\r
                                        break;\r
                        }\r
 \r