]> git.sur5r.net Git - freertos/commitdiff
Linting and MISRA checking
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Mon, 15 Jul 2013 14:27:15 +0000 (14:27 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Mon, 15 Jul 2013 14:27:15 +0000 (14:27 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1982 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

FreeRTOS/Source/include/list.h
FreeRTOS/Source/include/portable.h
FreeRTOS/Source/include/projdefs.h
FreeRTOS/Source/include/queue.h
FreeRTOS/Source/include/task.h
FreeRTOS/Source/include/timers.h
FreeRTOS/Source/list.c
FreeRTOS/Source/portable/IAR/ARM_CM3/portmacro.h
FreeRTOS/Source/queue.c
FreeRTOS/Source/tasks.c
FreeRTOS/Source/timers.c

index 934fd2afb9293a175d40cbd5ebb26ac340bac3f5..d95977f55e1b10e18060344fac42bff03c6576d0 100644 (file)
@@ -177,7 +177,7 @@ typedef struct xLIST
  * \page listSET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER\r
  * \ingroup LinkedList\r
  */\r
-#define listSET_LIST_ITEM_OWNER( pxListItem, pxOwner )         ( pxListItem )->pvOwner = ( void * ) ( pxOwner )\r
+#define listSET_LIST_ITEM_OWNER( pxListItem, pxOwner )         ( ( pxListItem )->pvOwner = ( void * ) ( pxOwner ) )\r
 \r
 /*\r
  * Access macro to get the owner of a list item.  The owner of a list item\r
@@ -195,7 +195,7 @@ typedef struct xLIST
  * \page listSET_LIST_ITEM_VALUE listSET_LIST_ITEM_VALUE\r
  * \ingroup LinkedList\r
  */\r
-#define listSET_LIST_ITEM_VALUE( pxListItem, xValue )          ( pxListItem )->xItemValue = ( xValue )\r
+#define listSET_LIST_ITEM_VALUE( pxListItem, xValue )          ( ( pxListItem )->xItemValue = ( xValue ) )\r
 \r
 /*\r
  * Access macro to retrieve the value of the list item.  The value can\r
@@ -223,7 +223,7 @@ typedef struct xLIST
  * \page listLIST_IS_EMPTY listLIST_IS_EMPTY\r
  * \ingroup LinkedList\r
  */\r
-#define listLIST_IS_EMPTY( pxList )                            ( ( pxList )->uxNumberOfItems == ( unsigned portBASE_TYPE ) 0 )\r
+#define listLIST_IS_EMPTY( pxList )                            ( ( portBASE_TYPE ) ( ( pxList )->uxNumberOfItems == ( unsigned portBASE_TYPE ) 0 ) )\r
 \r
 /*\r
  * Access macro to return the number of items in the list.\r
@@ -249,17 +249,17 @@ typedef struct xLIST
  * \page listGET_OWNER_OF_NEXT_ENTRY listGET_OWNER_OF_NEXT_ENTRY\r
  * \ingroup LinkedList\r
  */\r
-#define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList )                                                                   \\r
-{                                                                                                                                                                              \\r
-xList * const pxConstList = ( pxList );                                                                                                        \\r
-       /* Increment the index to the next item and return the item, ensuring */                        \\r
-       /* we don't return the marker used at the end of the list.  */                                          \\r
-       ( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext;                                            \\r
-       if( ( pxConstList )->pxIndex == ( xListItem * ) &( ( pxConstList )->xListEnd ) )        \\r
-       {                                                                                                                                                                       \\r
-               ( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext;                                    \\r
-       }                                                                                                                                                                       \\r
-       ( pxTCB ) = ( pxConstList )->pxIndex->pvOwner;                                                                          \\r
+#define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList )                                                                           \\r
+{                                                                                                                                                                                      \\r
+xList * const pxConstList = ( pxList );                                                                                                                \\r
+       /* Increment the index to the next item and return the item, ensuring */                                \\r
+       /* we don't return the marker used at the end of the list.  */                                                  \\r
+       ( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext;                                                    \\r
+       if( ( void * ) ( pxConstList )->pxIndex == ( void * ) &( ( pxConstList )->xListEnd ) )  \\r
+       {                                                                                                                                                                               \\r
+               ( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext;                                            \\r
+       }                                                                                                                                                                               \\r
+       ( pxTCB ) = ( pxConstList )->pxIndex->pvOwner;                                                                                  \\r
 }\r
 \r
 \r
@@ -291,7 +291,7 @@ xList * const pxConstList = ( pxList );                                                                                                     \
  * @return pdTRUE is the list item is in the list, otherwise pdFALSE.\r
  * pointer against\r
  */\r
-#define listIS_CONTAINED_WITHIN( pxList, pxListItem ) ( ( pxListItem )->pvContainer == ( void * ) ( pxList ) )\r
+#define listIS_CONTAINED_WITHIN( pxList, pxListItem ) ( ( portBASE_TYPE ) ( ( pxListItem )->pvContainer == ( void * ) ( pxList ) ) )\r
 \r
 /*\r
  * Return the list a list item is contained within (referenced from).\r
index cd4fa3b523a3f6963d4adcd1cd617bc5f7620b57..5ad56178aedacc000a9b63889f0c02cf8b9b5f34 100644 (file)
     ***************************************************************************\r
 \r
 \r
-    http://www.FreeRTOS.org - Documentation, books, training, latest versions, \r
+    http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
     license and Real Time Engineers Ltd. contact details.\r
 \r
     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
     including FreeRTOS+Trace - an indispensable productivity tool, and our new\r
     fully thread aware and reentrant UDP/IP stack.\r
 \r
-    http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High \r
-    Integrity Systems, who sell the code with commercial support, \r
+    http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
+    Integrity Systems, who sell the code with commercial support,\r
     indemnification and middleware, under the OpenRTOS brand.\r
-    \r
-    http://www.SafeRTOS.com - High Integrity Systems also provide a safety \r
-    engineered and independently SIL3 certified version for use in safety and \r
+\r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
     mission critical applications that require provable dependability.\r
 */\r
 \r
 #endif\r
 \r
 #ifdef IAR_MSP430\r
-       #include "..\..\Source\portable\IAR\MSP430\portmacro.h" \r
+       #include "..\..\Source\portable\IAR\MSP430\portmacro.h"\r
 #endif\r
-       \r
+\r
 #ifdef GCC_MSP430\r
        #include "../../Source/portable/GCC/MSP430F449/portmacro.h"\r
 #endif\r
 #ifdef STR75X_IAR\r
        #include "..\..\Source\portable\IAR\STR75x\portmacro.h"\r
 #endif\r
-       \r
+\r
 #ifdef STR75X_GCC\r
        #include "..\..\Source\portable\GCC\STR75x\portmacro.h"\r
 #endif\r
 #ifdef STR91X_IAR\r
        #include "..\..\Source\portable\IAR\STR91x\portmacro.h"\r
 #endif\r
-       \r
+\r
 #ifdef GCC_H8S\r
        #include "../../Source/portable/GCC/H8S2329/portmacro.h"\r
 #endif\r
 #ifdef IAR_ARMCM3_LM\r
        #include "../../Source/portable/IAR/ARM_CM3/portmacro.h"\r
 #endif\r
-       \r
+\r
 #ifdef HCS12_CODE_WARRIOR\r
        #include "../../Source/portable/CodeWarrior/HCS12/portmacro.h"\r
-#endif \r
+#endif\r
 \r
 #ifdef MICROBLAZE_GCC\r
        #include "../../Source/portable/GCC/MicroBlaze/portmacro.h"\r
 #ifdef __IAR_78K0R_Kx3__\r
        #include "../../Source/portable/IAR/78K0R/portmacro.h"\r
 #endif\r
-       \r
+\r
 #ifdef __IAR_78K0R_Kx3L__\r
        #include "../../Source/portable/IAR/78K0R/portmacro.h"\r
 #endif\r
-       \r
+\r
 /* Catch all to ensure portmacro.h is included in the build.  Newer demos\r
 have the path as part of the project options, rather than as relative from\r
 the project location.  If portENTER_CRITICAL() has not been defined then\r
@@ -325,9 +325,9 @@ portmacro.h has not yet been included - as every portmacro.h provides a
 portENTER_CRITICAL() definition.  Check the demo application for your demo\r
 to find the path to the correct portmacro.h file. */\r
 #ifndef portENTER_CRITICAL\r
-       #include "portmacro.h"  \r
+       #include "portmacro.h"\r
 #endif\r
-       \r
+\r
 #if portBYTE_ALIGNMENT == 8\r
        #define portBYTE_ALIGNMENT_MASK ( 0x0007 )\r
 #endif\r
@@ -367,7 +367,7 @@ extern "C" {
 #if( portUSING_MPU_WRAPPERS == 1 )\r
        portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters, portBASE_TYPE xRunPrivileged ) PRIVILEGED_FUNCTION;\r
 #else\r
-       portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters );\r
+       portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) PRIVILEGED_FUNCTION;\r
 #endif\r
 \r
 /*\r
@@ -398,7 +398,7 @@ void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;
  * Fills the xMPUSettings structure with the memory region information\r
  * contained in xRegions.\r
  */\r
-#if( portUSING_MPU_WRAPPERS == 1 ) \r
+#if( portUSING_MPU_WRAPPERS == 1 )\r
        struct xMEMORY_REGION;\r
        void vPortStoreTaskMPUSettings( xMPU_SETTINGS *xMPUSettings, const struct xMEMORY_REGION * const xRegions, portSTACK_TYPE *pxBottomOfStack, unsigned short usStackDepth ) PRIVILEGED_FUNCTION;\r
 #endif\r
index 5371cddcceddc632090a99836878318aa0b3b3c3..4dfb05dd842e5bc05a247ee18e242e5253878612 100644 (file)
 /* Defines the prototype to which task functions must conform. */\r
 typedef void (*pdTASK_CODE)( void * );\r
 \r
-#define pdTRUE         ( 1 )\r
-#define pdFALSE                ( 0 )\r
+#define pdFALSE                ( ( portBASE_TYPE ) 0 )\r
+#define pdTRUE         ( ( portBASE_TYPE ) 1 )\r
 \r
-#define pdPASS                                                                 ( 1 )\r
-#define pdFAIL                                                                 ( 0 )\r
-#define errQUEUE_EMPTY                                                 ( 0 )\r
-#define errQUEUE_FULL                                                  ( 0 )\r
+#define pdPASS                                                                 ( pdTRUE )\r
+#define pdFAIL                                                                 ( pdFALSE )\r
+#define errQUEUE_EMPTY                                                 ( ( portBASE_TYPE ) 0 )\r
+#define errQUEUE_FULL                                                  ( ( portBASE_TYPE ) 0 )\r
 \r
 /* Error definitions. */\r
 #define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY  ( -1 )\r
index d0d2e895fe54db4e46ccca4be79dada8ec9db377..07bb6d6e37c2a751a4a75332b6a3cf7ba0809571 100644 (file)
@@ -85,8 +85,6 @@ extern "C" {
 #endif\r
 \r
 \r
-#include "mpu_wrappers.h"\r
-\r
 /**\r
  * Type by which queues are referenced.  For example, a call to xQueueCreate()\r
  * returns an xQueueHandle variable that can then be used as a parameter to\r
@@ -109,17 +107,17 @@ typedef void * xQueueSetHandle;
 typedef void * xQueueSetMemberHandle;\r
 \r
 /* For internal use only. */\r
-#define        queueSEND_TO_BACK               ( 0 )\r
-#define        queueSEND_TO_FRONT              ( 1 )\r
-#define queueOVERWRITE                 ( 2 )\r
+#define        queueSEND_TO_BACK               ( ( portBASE_TYPE ) 0 )\r
+#define        queueSEND_TO_FRONT              ( ( portBASE_TYPE ) 1 )\r
+#define queueOVERWRITE                 ( ( portBASE_TYPE ) 2 )\r
 \r
 /* For internal use only.  These definitions *must* match those in queue.c. */\r
-#define queueQUEUE_TYPE_BASE                           ( 0U )\r
-#define queueQUEUE_TYPE_SET                                    ( 0U )\r
-#define queueQUEUE_TYPE_MUTEX                          ( 1U )\r
-#define queueQUEUE_TYPE_COUNTING_SEMAPHORE     ( 2U )\r
-#define queueQUEUE_TYPE_BINARY_SEMAPHORE       ( 3U )\r
-#define queueQUEUE_TYPE_RECURSIVE_MUTEX                ( 4U )\r
+#define queueQUEUE_TYPE_BASE                           ( ( unsigned char ) 0U )\r
+#define queueQUEUE_TYPE_SET                                    ( ( unsigned char ) 0U )\r
+#define queueQUEUE_TYPE_MUTEX                          ( ( unsigned char ) 1U )\r
+#define queueQUEUE_TYPE_COUNTING_SEMAPHORE     ( ( unsigned char ) 2U )\r
+#define queueQUEUE_TYPE_BINARY_SEMAPHORE       ( ( unsigned char ) 3U )\r
+#define queueQUEUE_TYPE_RECURSIVE_MUTEX                ( ( unsigned char ) 4U )\r
 \r
 /**\r
  * queue. h\r
@@ -724,7 +722,7 @@ signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const
  * \defgroup xQueuePeekFromISR xQueuePeekFromISR\r
  * \ingroup QueueManagement\r
  */\r
-signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuffer ) PRIVILEGED_FUNCTION;\r
+signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, const void * const pvBuffer ) PRIVILEGED_FUNCTION;\r
 \r
 /**\r
  * queue. h\r
@@ -916,7 +914,7 @@ signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuff
  * \defgroup xQueueReceive xQueueReceive\r
  * \ingroup QueueManagement\r
  */\r
-signed portBASE_TYPE xQueueGenericReceive( xQueueHandle xQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeek ) PRIVILEGED_FUNCTION;\r
+signed portBASE_TYPE xQueueGenericReceive( xQueueHandle xQueue, const void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeek ) PRIVILEGED_FUNCTION;\r
 \r
 /**\r
  * queue. h\r
@@ -1405,7 +1403,7 @@ signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle xQueue, const void *
  * \defgroup xQueueReceiveFromISR xQueueReceiveFromISR\r
  * \ingroup QueueManagement\r
  */\r
-signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle xQueue, void * const pvBuffer, signed portBASE_TYPE *pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;\r
+signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle xQueue, const void * const pvBuffer, signed portBASE_TYPE *pxHigherPriorityTaskWoken ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
  * Utilities to query queues that are safe to use from an ISR.  These utilities\r
@@ -1495,7 +1493,7 @@ portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle pxMutex ) PRIVILEGED_FUNCTI
  * @param pcName The name to be associated with the handle.  This is the\r
  * name that the kernel aware debugger will display.\r
  */\r
-#if configQUEUE_REGISTRY_SIZE > 0U\r
+#if configQUEUE_REGISTRY_SIZE > 0\r
        void vQueueAddToRegistry( xQueueHandle xQueue, signed char *pcName ) PRIVILEGED_FUNCTION;\r
 #endif\r
 \r
@@ -1509,7 +1507,7 @@ portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle pxMutex ) PRIVILEGED_FUNCTI
  *\r
  * @param xQueue The handle of the queue being removed from the registry.\r
  */\r
-#if configQUEUE_REGISTRY_SIZE > 0U\r
+#if configQUEUE_REGISTRY_SIZE > 0\r
        void vQueueUnregisterQueue( xQueueHandle xQueue ) PRIVILEGED_FUNCTION;\r
 #endif\r
 \r
index 23aadd7ab51e8bd47da801b8fffe9a0a717f0108..c1612bed67803943a8ee69ee8bdafd46a050bfb9 100644 (file)
@@ -73,8 +73,8 @@
 */\r
 \r
 \r
-#ifndef TASK_H\r
-#define TASK_H\r
+#ifndef INC_TASK_H\r
+#define INC_TASK_H\r
 \r
 #ifndef INC_FREERTOS_H\r
        #error "include FreeRTOS.h must appear in source files before include task.h"\r
@@ -236,9 +236,9 @@ typedef enum
 #define taskENABLE_INTERRUPTS()                portENABLE_INTERRUPTS()\r
 \r
 /* Definitions returned by xTaskGetSchedulerState(). */\r
-#define taskSCHEDULER_NOT_STARTED      0\r
-#define taskSCHEDULER_RUNNING          1\r
-#define taskSCHEDULER_SUSPENDED                2\r
+#define taskSCHEDULER_NOT_STARTED      ( ( portBASE_TYPE ) 0 )\r
+#define taskSCHEDULER_RUNNING          ( ( portBASE_TYPE ) 1 )\r
+#define taskSCHEDULER_SUSPENDED                ( ( portBASE_TYPE ) 2 )\r
 \r
 /*-----------------------------------------------------------\r
  * TASK CREATION API\r
@@ -1016,7 +1016,7 @@ signed portBASE_TYPE xTaskResumeAll( void ) PRIVILEGED_FUNCTION;
 \r
 /**\r
  * task. h\r
- * <pre>signed portBASE_TYPE xTaskIsTaskSuspended( xTaskHandle xTask );</pre>\r
+ * <pre>signed portBASE_TYPE xTaskIsTaskSuspended( const xTaskHandle xTask );</pre>\r
  *\r
  * Utility task that simply returns pdTRUE if the task referenced by xTask is\r
  * currently in the Suspended state, or pdFALSE if the task referenced by xTask\r
@@ -1394,7 +1394,7 @@ portBASE_TYPE xTaskIncrementTick( void ) PRIVILEGED_FUNCTION;
  * portTICK_RATE_MS can be used to convert kernel ticks into a real time\r
  * period.\r
  */\r
-void vTaskPlaceOnEventList( const xList * const pxEventList, portTickType xTicksToWait ) PRIVILEGED_FUNCTION;\r
+void vTaskPlaceOnEventList( xList * const pxEventList, portTickType xTicksToWait ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
  * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE.  IT IS AN\r
@@ -1409,7 +1409,7 @@ void vTaskPlaceOnEventList( const xList * const pxEventList, portTickType xTicks
  * @return pdTRUE if the task being removed has a higher priority than the task\r
  * making the call, otherwise pdFALSE.\r
  */\r
-void vTaskPlaceOnEventListRestricted( const xList * const pxEventList, portTickType xTicksToWait ) PRIVILEGED_FUNCTION;\r
+void vTaskPlaceOnEventListRestricted( xList * const pxEventList, portTickType xTicksToWait ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
  * THIS FUNCTION MUST NOT BE USED FROM APPLICATION CODE.  IT IS AN\r
@@ -1470,13 +1470,13 @@ portBASE_TYPE xTaskGetSchedulerState( void ) PRIVILEGED_FUNCTION;
  * Raises the priority of the mutex holder to that of the calling task should\r
  * the mutex holder have a priority less than the calling task.\r
  */\r
-void vTaskPriorityInherit( xTaskHandle const pxMutexHolder ) PRIVILEGED_FUNCTION;\r
+void vTaskPriorityInherit( xTaskHandle const pxMutexHolder ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
  * Set the priority of a task back to its proper priority in the case that it\r
  * inherited a higher priority while it was holding a semaphore.\r
  */\r
-void vTaskPriorityDisinherit( xTaskHandle const pxMutexHolder ) PRIVILEGED_FUNCTION;\r
+void vTaskPriorityDisinherit( xTaskHandle const pxMutexHolder ) PRIVILEGED_FUNCTION;\r
 \r
 /*\r
  * Generic version of the task creation function which is in turn called by the\r
@@ -1522,7 +1522,7 @@ eSleepModeStatus eTaskConfirmSleepModeStatus( void );
 #ifdef __cplusplus\r
 }\r
 #endif\r
-#endif /* TASK_H */\r
+#endif /* INC_TASK_H */\r
 \r
 \r
 \r
index 95669d43cb8505e310f8808fd2faadc9102346c3..096105c68872ea8cad2b31a2d4a00386c4e0e4f6 100644 (file)
        #error "include FreeRTOS.h must appear in source files before include timers.h"\r
 #endif\r
 \r
-#include "portable.h"\r
-#include "list.h"\r
+/*lint -e537 This headers are only multiply included if the application code\r
+happens to also be including task.h. */\r
 #include "task.h"\r
+/*lint +e956 */\r
 \r
 #ifdef __cplusplus\r
 extern "C" {\r
@@ -91,10 +92,10 @@ extern "C" {
 /* IDs for commands that can be sent/received on the timer queue.  These are to\r
 be used solely through the macros that make up the public software timer API,\r
 as defined below. */\r
-#define tmrCOMMAND_START                                       0\r
-#define tmrCOMMAND_STOP                                                1\r
-#define tmrCOMMAND_CHANGE_PERIOD                       2\r
-#define tmrCOMMAND_DELETE                                      3\r
+#define tmrCOMMAND_START                                       ( ( portBASE_TYPE ) 0 )\r
+#define tmrCOMMAND_STOP                                                ( ( portBASE_TYPE ) 1 )\r
+#define tmrCOMMAND_CHANGE_PERIOD                       ( ( portBASE_TYPE ) 2 )\r
+#define tmrCOMMAND_DELETE                                      ( ( portBASE_TYPE ) 3 )\r
 \r
 /*-----------------------------------------------------------\r
  * MACROS AND DEFINITIONS\r
index 9dcdcb18ed47dc8bbc5678f4b1689fc602fa1af2..9eb7eef7686587ba1f6e0f4b6b021815c7f03f54 100644 (file)
@@ -86,7 +86,7 @@ void vListInitialise( xList * const pxList )
        /* The list structure contains a list item which is used to mark the\r
        end of the list.  To initialise the list the list end is inserted\r
        as the only list entry. */\r
-       pxList->pxIndex = ( xListItem * ) &( pxList->xListEnd );\r
+       pxList->pxIndex = ( xListItem * ) &( pxList->xListEnd );                        /*lint !e826 !e740 The mini list structure is used as the list end to save RAM.  This is checked and valid. */\r
 \r
        /* The list end value is the highest possible value in the list to\r
        ensure it remains at the end of the list. */\r
@@ -94,8 +94,8 @@ void vListInitialise( xList * const pxList )
 \r
        /* The list end next and previous pointers point to itself so we know\r
        when the list is empty. */\r
-       pxList->xListEnd.pxNext = ( xListItem * ) &( pxList->xListEnd );\r
-       pxList->xListEnd.pxPrevious = ( xListItem * ) &( pxList->xListEnd );\r
+       pxList->xListEnd.pxNext = ( xListItem * ) &( pxList->xListEnd );        /*lint !e826 !e740 The mini list structure is used as the list end to save RAM.  This is checked and valid. */\r
+       pxList->xListEnd.pxPrevious = ( xListItem * ) &( pxList->xListEnd );/*lint !e826 !e740 The mini list structure is used as the list end to save RAM.  This is checked and valid. */\r
 \r
        pxList->uxNumberOfItems = ( unsigned portBASE_TYPE ) 0U;\r
 }\r
@@ -167,7 +167,7 @@ portTickType xValueOfInsertion;
                See http://www.freertos.org/FAQHelp.html for more tips.\r
                **********************************************************************/\r
 \r
-               for( pxIterator = ( xListItem * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext )\r
+               for( pxIterator = ( xListItem * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext ) /*lint !e826 !e740 The mini list structure is used as the list end to save RAM.  This is checked and valid. */\r
                {\r
                        /* There is nothing to do here, we are just iterating to the\r
                        wanted insertion position. */\r
index a49d042ee02eae7762b0c93f8f153686645a5546..b3568290044a477c49f06771ef97f8ec3ae95cf0 100644 (file)
@@ -101,10 +101,10 @@ extern "C" {
 \r
 #if( configUSE_16_BIT_TICKS == 1 )\r
        typedef unsigned portSHORT portTickType;\r
-       #define portMAX_DELAY ( portTickType ) 0xffff\r
+       #define portMAX_DELAY 0xffff\r
 #else\r
        typedef unsigned portLONG portTickType;\r
-       #define portMAX_DELAY ( portTickType ) 0xffffffff\r
+       #define portMAX_DELAY 0xffffffffUL\r
 #endif\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -116,7 +116,7 @@ extern "C" {
 \r
 /* Scheduler utilities. */\r
 extern void vPortYield( void );\r
-#define portNVIC_INT_CTRL_REG          ( * ( ( volatile unsigned long * ) 0xe000ed04 ) )\r
+#define portNVIC_INT_CTRL_REG          ( * ( ( volatile unsigned long * ) 0xe000ed04UL ) )\r
 #define portNVIC_PENDSVSET_BIT         ( 1UL << 28UL )\r
 #define portYIELD()                                    vPortYield()\r
 #define portEND_SWITCHING_ISR( xSwitchRequired ) if( xSwitchRequired ) portNVIC_INT_CTRL_REG = portNVIC_PENDSVSET_BIT\r
@@ -132,8 +132,8 @@ extern void vPortYield( void );
        #endif\r
 \r
        /* Store/clear the ready priorities in a bit map. */\r
-       #define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) )\r
-       #define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) )\r
+       #define portRECORD_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( ( uxReadyPriorities ) |= ( 1UL << ( uxPriority ) ) )\r
+       #define portRESET_READY_PRIORITY( uxPriority, uxReadyPriorities ) ( ( uxReadyPriorities ) &= ~( 1UL << ( uxPriority ) ) )\r
 \r
        /*-----------------------------------------------------------*/\r
 \r
index d1e8d5cfcbcd80dab7b67b2034896eccec8a06e4..8968ddf147253af4873db4e32833bfa72d53f6b3 100644 (file)
@@ -88,14 +88,17 @@ task.h is included from an application file. */
        #include "croutine.h"\r
 #endif\r
 \r
-#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE\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
+\r
 \r
 /* Constants used with the cRxLock and xTxLock structure members. */\r
 #define queueUNLOCKED                                  ( ( signed portBASE_TYPE ) -1 )\r
 #define queueLOCKED_UNMODIFIED                 ( ( signed portBASE_TYPE ) 0 )\r
 \r
-#define queueERRONEOUS_UNBLOCK                 ( -1 )\r
-\r
 /* When the xQUEUE structure is used to represent a base queue its pcHead and\r
 pcTail members are used as pointers into the queue storage area.  When the\r
 xQUEUE structure is used to represent a mutex pcHead and pcTail pointers are\r
@@ -114,7 +117,6 @@ structure member). */
 /* Semaphores do not actually store or copy data, so have an item size of\r
 zero. */\r
 #define queueSEMAPHORE_QUEUE_ITEM_LENGTH ( ( unsigned portBASE_TYPE ) 0 )\r
-#define queueDONT_BLOCK                                         ( ( portTickType ) 0U )\r
 #define queueMUTEX_GIVE_BLOCK_TIME              ( ( portTickType ) 0U )\r
 \r
 \r
@@ -212,14 +214,14 @@ static void prvCopyDataToQueue( xQUEUE *pxQueue, const void *pvItemToQueue, port
 /*\r
  * Copies an item out of a queue.\r
  */\r
-static void prvCopyDataFromQueue( xQUEUE * const pxQueue, const void *pvBuffer ) PRIVILEGED_FUNCTION;\r
+static void prvCopyDataFromQueue( xQUEUE * const pxQueue, const void * const pvBuffer ) PRIVILEGED_FUNCTION;\r
 \r
 #if ( configUSE_QUEUE_SETS == 1 )\r
        /*\r
         * Checks to see if a queue is a member of a queue set, and if so, notifies\r
         * the queue set that the queue contains data.\r
         */\r
-       static portBASE_TYPE prvNotifyQueueSetContainer( xQUEUE *pxQueue, portBASE_TYPE xCopyPosition ) PRIVILEGED_FUNCTION;\r
+       static portBASE_TYPE prvNotifyQueueSetContainer( const xQUEUE * const pxQueue, portBASE_TYPE xCopyPosition ) PRIVILEGED_FUNCTION;\r
 #endif\r
 \r
 /*-----------------------------------------------------------*/\r
@@ -306,7 +308,7 @@ xQueueHandle xReturn = NULL;
                {\r
                        /* Create the list of pointers to queue items.  The queue is one byte\r
                        longer than asked for to make wrap checking easier/faster. */\r
-                       xQueueSizeInBytes = ( size_t ) ( uxQueueLength * uxItemSize ) + ( size_t ) 1;\r
+                       xQueueSizeInBytes = ( size_t ) ( uxQueueLength * uxItemSize ) + ( size_t ) 1; /*lint !e961 MISRA exception as the casts are only redundant for some ports. */\r
 \r
                        pxNewQueue->pcHead = ( signed char * ) pvPortMalloc( xQueueSizeInBytes );\r
                        if( pxNewQueue->pcHead != NULL )\r
@@ -315,7 +317,7 @@ xQueueHandle xReturn = NULL;
                                queue type is defined. */\r
                                pxNewQueue->uxLength = uxQueueLength;\r
                                pxNewQueue->uxItemSize = uxItemSize;\r
-                               xQueueGenericReset( pxNewQueue, pdTRUE );\r
+                               ( void ) xQueueGenericReset( pxNewQueue, pdTRUE );\r
 \r
                                #if ( configUSE_TRACE_FACILITY == 1 )\r
                                {\r
@@ -397,7 +399,7 @@ xQueueHandle xReturn = NULL;
                        traceCREATE_MUTEX( pxNewQueue );\r
 \r
                        /* Start with the semaphore in the expected state. */\r
-                       xQueueGenericSend( pxNewQueue, NULL, ( portTickType ) 0U, queueSEND_TO_BACK );\r
+                       ( void ) xQueueGenericSend( pxNewQueue, NULL, ( portTickType ) 0U, queueSEND_TO_BACK );\r
                }\r
                else\r
                {\r
@@ -456,7 +458,7 @@ xQueueHandle xReturn = NULL;
                this is the only condition we are interested in it does not matter if\r
                pxMutexHolder is accessed simultaneously by another task.  Therefore no\r
                mutual exclusion is required to test the pxMutexHolder variable. */\r
-               if( pxMutex->pxMutexHolder == ( void * ) xTaskGetCurrentTaskHandle() )\r
+               if( pxMutex->pxMutexHolder == ( void * ) xTaskGetCurrentTaskHandle() ) /*lint !e961 Not a redundant cast as xTaskHandle is a typedef. */\r
                {\r
                        traceGIVE_MUTEX_RECURSIVE( pxMutex );\r
 \r
@@ -468,11 +470,11 @@ xQueueHandle xReturn = NULL;
                        ( pxMutex->u.uxRecursiveCallCount )--;\r
 \r
                        /* Have we unwound the call count? */\r
-                       if( pxMutex->u.uxRecursiveCallCount == 0 )\r
+                       if( pxMutex->u.uxRecursiveCallCount == ( unsigned portBASE_TYPE ) 0 )\r
                        {\r
                                /* Return the mutex.  This will automatically unblock any other\r
                                task that might be waiting to access the mutex. */\r
-                               xQueueGenericSend( pxMutex, NULL, queueMUTEX_GIVE_BLOCK_TIME, queueSEND_TO_BACK );\r
+                               ( void ) xQueueGenericSend( pxMutex, NULL, queueMUTEX_GIVE_BLOCK_TIME, queueSEND_TO_BACK );\r
                        }\r
 \r
                        xReturn = pdPASS;\r
@@ -505,7 +507,7 @@ xQueueHandle xReturn = NULL;
 \r
                traceTAKE_MUTEX_RECURSIVE( pxMutex );\r
 \r
-               if( pxMutex->pxMutexHolder == ( void * )  xTaskGetCurrentTaskHandle() )\r
+               if( pxMutex->pxMutexHolder == ( void * )  xTaskGetCurrentTaskHandle() ) /*lint !e961 Cast is not redundant as xTaskHandle is a typedef. */\r
                {\r
                        ( pxMutex->u.uxRecursiveCallCount )++;\r
                        xReturn = pdPASS;\r
@@ -538,7 +540,7 @@ xQueueHandle xReturn = NULL;
        {\r
        xQueueHandle xHandle;\r
 \r
-               xHandle = xQueueGenericCreate( ( unsigned portBASE_TYPE ) uxCountValue, queueSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_COUNTING_SEMAPHORE );\r
+               xHandle = xQueueGenericCreate( uxCountValue, queueSEMAPHORE_QUEUE_ITEM_LENGTH, queueQUEUE_TYPE_COUNTING_SEMAPHORE );\r
 \r
                if( xHandle != NULL )\r
                {\r
@@ -657,6 +659,10 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
                                        vTaskSetTimeOutState( &xTimeOut );\r
                                        xEntryTimeSet = pdTRUE;\r
                                }\r
+                               else\r
+                               {\r
+                                       /* Entry time was already set. */                                       \r
+                               }\r
                        }\r
                }\r
                taskEXIT_CRITICAL();\r
@@ -1036,7 +1042,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-signed portBASE_TYPE xQueueGenericReceive( xQueueHandle xQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking )\r
+signed portBASE_TYPE xQueueGenericReceive( xQueueHandle xQueue, const void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking )\r
 {\r
 signed portBASE_TYPE xEntryTimeSet = pdFALSE;\r
 xTimeOutType xTimeOut;\r
@@ -1077,7 +1083,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
                                                {\r
                                                        /* Record the information required to implement\r
                                                        priority inheritance should it become necessary. */\r
-                                                       pxQueue->pxMutexHolder = ( void * ) xTaskGetCurrentTaskHandle();\r
+                                                       pxQueue->pxMutexHolder = ( void * ) xTaskGetCurrentTaskHandle(); /*lint !e961 Cast is not redundant as xTaskHandle is a typedef. */\r
                                                }\r
                                        }\r
                                        #endif\r
@@ -1132,6 +1138,10 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
                                        vTaskSetTimeOutState( &xTimeOut );\r
                                        xEntryTimeSet = pdTRUE;\r
                                }\r
+                               else\r
+                               {\r
+                                       /* Entry time was already set. */\r
+                               }\r
                        }\r
                }\r
                taskEXIT_CRITICAL();\r
@@ -1187,7 +1197,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle xQueue, void * const pvBuffer, signed portBASE_TYPE *pxHigherPriorityTaskWoken )\r
+signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle xQueue, const void * const pvBuffer, signed portBASE_TYPE *pxHigherPriorityTaskWoken )\r
 {\r
 signed portBASE_TYPE xReturn;\r
 unsigned portBASE_TYPE uxSavedInterruptStatus;\r
@@ -1262,7 +1272,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, void * const pvBuffer )\r
+signed portBASE_TYPE xQueuePeekFromISR( xQueueHandle xQueue, const void * const pvBuffer )\r
 {\r
 signed portBASE_TYPE xReturn;\r
 unsigned portBASE_TYPE uxSavedInterruptStatus;\r
@@ -1326,7 +1336,7 @@ unsigned portBASE_TYPE uxReturn;
        taskEXIT_CRITICAL();\r
 \r
        return uxReturn;\r
-}\r
+} /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */\r
 /*-----------------------------------------------------------*/\r
 \r
 unsigned portBASE_TYPE uxQueueMessagesWaitingFromISR( const xQueueHandle xQueue )\r
@@ -1338,7 +1348,7 @@ unsigned portBASE_TYPE uxReturn;
        uxReturn = ( ( xQUEUE * ) xQueue )->uxMessagesWaiting;\r
 \r
        return uxReturn;\r
-}\r
+} /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */\r
 /*-----------------------------------------------------------*/\r
 \r
 void vQueueDelete( xQueueHandle xQueue )\r
@@ -1405,25 +1415,25 @@ static void prvCopyDataToQueue( xQUEUE *pxQueue, const void *pvItemToQueue, port
        }\r
        else if( xPosition == queueSEND_TO_BACK )\r
        {\r
-               memcpy( ( void * ) pxQueue->pcWriteTo, pvItemToQueue, ( size_t ) pxQueue->uxItemSize );\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
-               if( pxQueue->pcWriteTo >= pxQueue->pcTail )\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
                }\r
        }\r
        else\r
        {\r
-               memcpy( ( void * ) pxQueue->u.pcReadFrom, pvItemToQueue, ( size_t ) pxQueue->uxItemSize );\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
                pxQueue->u.pcReadFrom -= pxQueue->uxItemSize;\r
-               if( pxQueue->u.pcReadFrom < pxQueue->pcHead )\r
+               if( pxQueue->u.pcReadFrom < pxQueue->pcHead ) /*lint !e946 MISRA exception justified as comparison of pointers is the cleanest solution. */\r
                {\r
                        pxQueue->u.pcReadFrom = ( pxQueue->pcTail - pxQueue->uxItemSize );\r
                }\r
 \r
                if( xPosition == queueOVERWRITE )\r
                {\r
-                       if( pxQueue->uxMessagesWaiting > 0 )\r
+                       if( pxQueue->uxMessagesWaiting > ( unsigned portBASE_TYPE ) 0 )\r
                        {\r
                                /* An item is not being added but overwritten, so subtract\r
                                one from the recorded number of items in the queue so when\r
@@ -1438,16 +1448,16 @@ static void prvCopyDataToQueue( xQUEUE *pxQueue, const void *pvItemToQueue, port
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-static void prvCopyDataFromQueue( xQUEUE * const pxQueue, const void *pvBuffer )\r
+static void prvCopyDataFromQueue( xQUEUE * const pxQueue, const void * const pvBuffer )\r
 {\r
        if( pxQueue->uxQueueType != queueQUEUE_IS_MUTEX )\r
        {\r
                pxQueue->u.pcReadFrom += pxQueue->uxItemSize;\r
-               if( pxQueue->u.pcReadFrom >= pxQueue->pcTail )\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
                }\r
-               memcpy( ( void * ) pvBuffer, ( void * ) pxQueue->u.pcReadFrom, ( size_t ) pxQueue->uxItemSize );\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
        }\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -1557,7 +1567,7 @@ signed portBASE_TYPE xReturn;
 \r
        taskENTER_CRITICAL();\r
        {\r
-               if( pxQueue->uxMessagesWaiting == 0 )\r
+               if( pxQueue->uxMessagesWaiting == ( unsigned portBASE_TYPE )  0 )\r
                {\r
                        xReturn = pdTRUE;\r
                }\r
@@ -1577,7 +1587,7 @@ signed portBASE_TYPE xQueueIsQueueEmptyFromISR( const xQueueHandle xQueue )
 signed portBASE_TYPE xReturn;\r
 \r
        configASSERT( xQueue );\r
-       if( ( ( xQUEUE * ) xQueue )->uxMessagesWaiting == 0 )\r
+       if( ( ( xQUEUE * ) xQueue )->uxMessagesWaiting == ( unsigned portBASE_TYPE ) 0 )\r
        {\r
                xReturn = pdTRUE;\r
        }\r
@@ -1587,7 +1597,7 @@ signed portBASE_TYPE xReturn;
        }\r
 \r
        return xReturn;\r
-}\r
+} /*lint !e818 xQueue could not be pointer to const because it is a typedef. */\r
 /*-----------------------------------------------------------*/\r
 \r
 static signed portBASE_TYPE prvIsQueueFull( const xQUEUE *pxQueue )\r
@@ -1626,7 +1636,7 @@ signed portBASE_TYPE xReturn;
        }\r
 \r
        return xReturn;\r
-}\r
+} /*lint !e818 xQueue could not be pointer to const because it is a typedef. */\r
 /*-----------------------------------------------------------*/\r
 \r
 #if ( configUSE_CO_ROUTINES == 1 )\r
@@ -1889,7 +1899,7 @@ signed portBASE_TYPE xReturn;
                        }\r
                }\r
 \r
-       }\r
+       } /*lint !e818 xQueue could not be pointer to const because it is a typedef. */\r
 \r
 #endif /* configQUEUE_REGISTRY_SIZE */\r
 /*-----------------------------------------------------------*/\r
@@ -1951,7 +1961,7 @@ signed portBASE_TYPE xReturn;
                        /* Cannot add a queue/semaphore to more than one queue set. */\r
                        xReturn = pdFAIL;\r
                }\r
-               else if( ( ( xQUEUE * ) xQueueOrSemaphore )->uxMessagesWaiting != 0 )\r
+               else if( ( ( xQUEUE * ) xQueueOrSemaphore )->uxMessagesWaiting != ( unsigned portBASE_TYPE ) 0 )\r
                {\r
                        /* Cannot add a queue/semaphore to a queue set if there are already\r
                        items in the queue/semaphore. */\r
@@ -1985,7 +1995,7 @@ signed portBASE_TYPE xReturn;
                        /* The queue was not a member of the set. */\r
                        xReturn = pdFAIL;\r
                }\r
-               else if( pxQueueOrSemaphore->uxMessagesWaiting != 0 )\r
+               else if( pxQueueOrSemaphore->uxMessagesWaiting != ( unsigned portBASE_TYPE ) 0 )\r
                {\r
                        /* It is dangerous to remove a queue from a set when the queue is\r
                        not empty because the queue set will still hold pending events for\r
@@ -2004,7 +2014,7 @@ signed portBASE_TYPE xReturn;
                }\r
 \r
                return xReturn;\r
-       }\r
+       } /*lint !e818 xQueueSet could not be declared as pointing to const as it is a typedef. */\r
 \r
 #endif /* configUSE_QUEUE_SETS */\r
 /*-----------------------------------------------------------*/\r
@@ -2015,7 +2025,7 @@ signed portBASE_TYPE xReturn;
        {\r
        xQueueSetMemberHandle xReturn = NULL;\r
 \r
-               xQueueGenericReceive( ( xQueueHandle ) xQueueSet, &xReturn, xBlockTimeTicks, pdFALSE );\r
+               ( void ) xQueueGenericReceive( ( xQueueHandle ) xQueueSet, &xReturn, xBlockTimeTicks, pdFALSE ); /*lint !e961 Casting from one typedef to another is not redundant. */\r
                return xReturn;\r
        }\r
 \r
@@ -2028,7 +2038,7 @@ signed portBASE_TYPE xReturn;
        {\r
        xQueueSetMemberHandle xReturn = NULL;\r
 \r
-               xQueueReceiveFromISR( ( xQueueHandle ) xQueueSet, &xReturn, NULL );\r
+               ( void ) xQueueReceiveFromISR( ( xQueueHandle ) xQueueSet, &xReturn, NULL ); /*lint !e961 Casting from one typedef to another is not redundant. */\r
                return xReturn;\r
        }\r
 \r
@@ -2037,7 +2047,7 @@ signed portBASE_TYPE xReturn;
 \r
 #if ( configUSE_QUEUE_SETS == 1 )\r
 \r
-       static portBASE_TYPE prvNotifyQueueSetContainer( xQUEUE *pxQueue, portBASE_TYPE xCopyPosition )\r
+       static portBASE_TYPE prvNotifyQueueSetContainer( const xQUEUE * const pxQueue, portBASE_TYPE xCopyPosition )\r
        {\r
        xQUEUE *pxQueueSetContainer = pxQueue->pxQueueSetContainer;\r
        portBASE_TYPE xReturn = pdFALSE;\r
index 91bd4ff70ea21514a4b8e62ad9a3a9cb148c1a37..a851af055bf05e99fa28b2eea1e83d90ded53270 100644 (file)
@@ -73,7 +73,6 @@
 */\r
 \r
 /* Standard includes. */\r
-#include <stdio.h>\r
 #include <stdlib.h>\r
 #include <string.h>\r
 \r
@@ -88,7 +87,19 @@ task.h is included from an application file. */
 #include "timers.h"\r
 #include "StackMacros.h"\r
 \r
-#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE\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
+\r
+#if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( configINCLUDE_STATS_FORMATTING_FUNCTIONS == 1 ) )\r
+       /* At the bottom of this file are two optional functions that can be used\r
+       to generate human readable text from the raw data generated by the\r
+       xTaskGetSystemState() function.  Note the formatting functions are provided\r
+       for convenience only, and are NOT considered part of the kernel. */\r
+       #include <stdio.h>\r
+#endif /* ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( configINCLUDE_STATS_FORMATTING_FUNCTIONS == 1 ) ) */\r
 \r
 /* Sanity check the configuration. */\r
 #if configUSE_TICKLESS_IDLE != 0\r
@@ -168,6 +179,9 @@ typedef struct tskTaskControlBlock
        #define static\r
 #endif\r
 \r
+/*lint -e956 A manual analysis and inspection has been used to determine which\r
+static variables must be declared volatile. */\r
+\r
 PRIVILEGED_DATA tskTCB * volatile pxCurrentTCB = NULL;\r
 \r
 /* Lists for ready and blocked tasks. --------------------*/\r
@@ -204,10 +218,10 @@ PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxTopReadyPriority                 = ts
 PRIVILEGED_DATA static volatile signed portBASE_TYPE xSchedulerRunning                         = pdFALSE;\r
 PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxSchedulerSuspended            = ( unsigned portBASE_TYPE ) pdFALSE;\r
 PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxPendedTicks                   = ( unsigned portBASE_TYPE ) 0U;\r
-PRIVILEGED_DATA static volatile portBASE_TYPE xYieldPending                                    = ( portBASE_TYPE ) pdFALSE;\r
+PRIVILEGED_DATA static volatile portBASE_TYPE xYieldPending                                    = pdFALSE;\r
 PRIVILEGED_DATA static volatile portBASE_TYPE xNumOfOverflows                                  = ( portBASE_TYPE ) 0;\r
 PRIVILEGED_DATA static unsigned portBASE_TYPE uxTaskNumber                                             = ( unsigned portBASE_TYPE ) 0U;\r
-PRIVILEGED_DATA static volatile portTickType xNextTaskUnblockTime                              = ( portTickType ) portMAX_DELAY;\r
+PRIVILEGED_DATA static volatile portTickType xNextTaskUnblockTime                              = portMAX_DELAY;\r
 \r
 #if ( configGENERATE_RUN_TIME_STATS == 1 )\r
 \r
@@ -216,6 +230,8 @@ PRIVILEGED_DATA static volatile portTickType xNextTaskUnblockTime                           = ( portTic
 \r
 #endif\r
 \r
+/*lint +e956 */\r
+\r
 /* Debugging and trace facilities private variables and macros. ------------*/\r
 \r
 /*\r
@@ -355,7 +371,7 @@ count overflows. */
 #define prvAddTaskToReadyList( pxTCB )                                                                                                                                                         \\r
        traceMOVED_TASK_TO_READY_STATE( pxTCB )                                                                                                                                                 \\r
        taskRECORD_READY_PRIORITY( ( pxTCB )->uxPriority );                                                                                                                             \\r
-       vListInsertEnd( ( xList * ) &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xGenericListItem ) )\r
+       vListInsertEnd( &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xGenericListItem ) )\r
 /*-----------------------------------------------------------*/\r
 \r
 /*\r
@@ -506,7 +522,7 @@ tskTCB * pxNewTCB;
                #if( portSTACK_GROWTH < 0 )\r
                {\r
                        pxTopOfStack = pxNewTCB->pxStack + ( usStackDepth - ( unsigned short ) 1 );\r
-                       pxTopOfStack = ( portSTACK_TYPE * ) ( ( ( portPOINTER_SIZE_TYPE ) pxTopOfStack ) & ( ( portPOINTER_SIZE_TYPE ) ~portBYTE_ALIGNMENT_MASK  ) );\r
+                       pxTopOfStack = ( portSTACK_TYPE * ) ( ( ( 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( ( ( ( unsigned long ) pxTopOfStack & ( unsigned long ) portBYTE_ALIGNMENT_MASK ) == 0UL ) );\r
@@ -645,7 +661,7 @@ tskTCB * pxNewTCB;
                        This will stop the task from be scheduled.  The idle task will check\r
                        the termination list and free up any memory allocated by the\r
                        scheduler for the TCB and stack. */\r
-                       if( uxListRemove( ( xListItem * ) &( pxTCB->xGenericListItem ) ) == 0 )\r
+                       if( uxListRemove( &( pxTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 )\r
                        {\r
                                taskRESET_READY_PRIORITY( pxTCB->uxPriority );\r
                        }\r
@@ -653,10 +669,10 @@ tskTCB * pxNewTCB;
                        /* Is the task waiting on an event also? */\r
                        if( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) != NULL )\r
                        {\r
-                               uxListRemove( &( pxTCB->xEventListItem ) );\r
+                               ( void ) uxListRemove( &( pxTCB->xEventListItem ) );\r
                        }\r
 \r
-                       vListInsertEnd( ( xList * ) &xTasksWaitingTermination, &( pxTCB->xGenericListItem ) );\r
+                       vListInsertEnd( &xTasksWaitingTermination, &( pxTCB->xGenericListItem ) );\r
 \r
                        /* Increment the ucTasksDeleted variable so the idle task knows\r
                        there is a task that has been deleted and that it should therefore\r
@@ -674,7 +690,7 @@ tskTCB * pxNewTCB;
                /* Force a reschedule if we have just deleted the current task. */\r
                if( xSchedulerRunning != pdFALSE )\r
                {\r
-                       if( ( void * ) xTaskToDelete == NULL )\r
+                       if( ( void * ) xTaskToDelete ==  NULL ) /*lint !e961 MISRA exception as this is not a redundant cast when used with some supported compilers. */\r
                        {\r
                                portYIELD_WITHIN_API();\r
                        }\r
@@ -736,7 +752,7 @@ tskTCB * pxNewTCB;
                                /* We must remove ourselves from the ready list before adding\r
                                ourselves to the blocked list as the same list item is used for\r
                                both lists. */\r
-                               if( uxListRemove( ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) ) == 0 )\r
+                               if( uxListRemove( &( pxCurrentTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 )\r
                                {\r
                                        /* The current task must be in a ready list, so there is\r
                                        no need to check, and the port reset macro can be called\r
@@ -789,7 +805,7 @@ tskTCB * pxNewTCB;
                                /* We must remove ourselves from the ready list before adding\r
                                ourselves to the blocked list as the same list item is used for\r
                                both lists. */\r
-                               if( uxListRemove( ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) ) == 0 )\r
+                               if( uxListRemove( &( pxCurrentTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 )\r
                                {\r
                                        /* The current task must be in a ready list, so there is\r
                                        no need to check, and the port reset macro can be called\r
@@ -905,9 +921,9 @@ tskTCB * pxNewTCB;
                configASSERT( ( uxNewPriority < configMAX_PRIORITIES ) );\r
 \r
                /* Ensure the new priority is valid. */\r
-               if( uxNewPriority >= configMAX_PRIORITIES )\r
+               if( uxNewPriority >= ( unsigned portBASE_TYPE ) configMAX_PRIORITIES )\r
                {\r
-                       uxNewPriority = configMAX_PRIORITIES - ( unsigned portBASE_TYPE ) 1U;\r
+                       uxNewPriority = ( unsigned portBASE_TYPE ) configMAX_PRIORITIES - ( unsigned portBASE_TYPE ) 1U;\r
                }\r
 \r
                taskENTER_CRITICAL();\r
@@ -954,6 +970,10 @@ tskTCB * pxNewTCB;
                                        task of higher priority that is ready to execute. */\r
                                        xYieldRequired = pdTRUE;\r
                                }\r
+                               else\r
+                               {\r
+                                       /* Yield not required. */\r
+                               }\r
 \r
                                /* Remember the ready list the task might be referenced from\r
                                before its uxPriority member is changed so the\r
@@ -978,18 +998,18 @@ tskTCB * pxNewTCB;
                                }\r
                                #endif\r
 \r
-                               listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( configMAX_PRIORITIES - ( portTickType ) uxNewPriority ) );\r
+                               listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( ( portTickType ) configMAX_PRIORITIES - ( portTickType ) uxNewPriority ) ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */\r
 \r
                                /* If the task is in the blocked or suspended list we need do\r
                                nothing more than change it's priority variable. However, if\r
                                the task is in a ready list it needs to be removed and placed\r
                                in the queue appropriate to its new priority. */\r
-                               if( listIS_CONTAINED_WITHIN( &( pxReadyTasksLists[ uxCurrentPriority ] ), &( pxTCB->xGenericListItem ) ) )\r
+                               if( listIS_CONTAINED_WITHIN( &( pxReadyTasksLists[ uxCurrentPriority ] ), &( pxTCB->xGenericListItem ) ) != pdFALSE )\r
                                {\r
                                        /* The task is currently in its ready list - remove before adding\r
                                        it to it's new ready list.  As we are in a critical section we\r
                                        can do this even if the scheduler is suspended. */\r
-                                       if( uxListRemove( ( xListItem * ) &( pxTCB->xGenericListItem ) ) == 0 )\r
+                                       if( uxListRemove( &( pxTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 )\r
                                        {\r
                                                taskRESET_READY_PRIORITY( uxPriorityUsedOnEntry );\r
                                        }\r
@@ -1033,7 +1053,7 @@ tskTCB * pxNewTCB;
                        traceTASK_SUSPEND( pxTCB );\r
 \r
                        /* Remove task from the ready/delayed list and place in the     suspended list. */\r
-                       if( uxListRemove( ( xListItem * ) &( pxTCB->xGenericListItem ) ) == 0 )\r
+                       if( uxListRemove( &( pxTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 )\r
                        {\r
                                taskRESET_READY_PRIORITY( pxTCB->uxPriority );\r
                        }\r
@@ -1041,14 +1061,14 @@ tskTCB * pxNewTCB;
                        /* Is the task waiting on an event also? */\r
                        if( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) != NULL )\r
                        {\r
-                               uxListRemove( &( pxTCB->xEventListItem ) );\r
+                               ( void ) uxListRemove( &( pxTCB->xEventListItem ) );\r
                        }\r
 \r
-                       vListInsertEnd( ( xList * ) &xSuspendedTaskList, &( pxTCB->xGenericListItem ) );\r
+                       vListInsertEnd( &xSuspendedTaskList, &( pxTCB->xGenericListItem ) );\r
                }\r
                taskEXIT_CRITICAL();\r
 \r
-               if( ( void * ) xTaskToSuspend == NULL )\r
+               if( ( void * ) xTaskToSuspend == NULL ) /*lint !e961 MISRA exception justified because it is not a redundant cast for some supported compilers. */\r
                {\r
                        if( xSchedulerRunning != pdFALSE )\r
                        {\r
@@ -1094,13 +1114,13 @@ tskTCB * pxNewTCB;
                if( listIS_CONTAINED_WITHIN( &xSuspendedTaskList, &( pxTCB->xGenericListItem ) ) != pdFALSE )\r
                {\r
                        /* Has the task already been resumed from within an ISR? */\r
-                       if( listIS_CONTAINED_WITHIN( &xPendingReadyList, &( pxTCB->xEventListItem ) ) != pdTRUE )\r
+                       if( listIS_CONTAINED_WITHIN( &xPendingReadyList, &( pxTCB->xEventListItem ) ) == pdFALSE )\r
                        {\r
                                /* Is it in the suspended list because it is in the\r
                                Suspended state?  It is possible to be in the suspended\r
                                list because it is blocked on a task with no timeout\r
                                specified. */\r
-                               if( listIS_CONTAINED_WITHIN( NULL, &( pxTCB->xEventListItem ) ) == pdTRUE )\r
+                               if( listIS_CONTAINED_WITHIN( NULL, &( pxTCB->xEventListItem ) ) != pdFALSE )\r
                                {\r
                                        xReturn = pdTRUE;\r
                                }\r
@@ -1108,7 +1128,7 @@ tskTCB * pxNewTCB;
                }\r
 \r
                return xReturn;\r
-       }\r
+       } /*lint !e818 xTask cannot be a pointer to const because it is a typedef. */\r
 \r
 #endif /* INCLUDE_vTaskSuspend */\r
 /*-----------------------------------------------------------*/\r
@@ -1134,7 +1154,7 @@ tskTCB * pxNewTCB;
 \r
                                        /* As we are in a critical section we can access the ready\r
                                        lists even if the scheduler is suspended. */\r
-                                       uxListRemove(  &( pxTCB->xGenericListItem ) );\r
+                                       ( void ) uxListRemove(  &( pxTCB->xGenericListItem ) );\r
                                        prvAddTaskToReadyList( pxTCB );\r
 \r
                                        /* We may have just resumed a higher priority task. */\r
@@ -1191,7 +1211,7 @@ tskTCB * pxNewTCB;
                                if( uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE )\r
                                {\r
                                        xYieldRequired = ( pxTCB->uxPriority >= pxCurrentTCB->uxPriority );\r
-                                       uxListRemove(  &( pxTCB->xGenericListItem ) );\r
+                                       ( void ) uxListRemove(  &( pxTCB->xGenericListItem ) );\r
                                        prvAddTaskToReadyList( pxTCB );\r
                                }\r
                                else\r
@@ -1199,7 +1219,7 @@ tskTCB * pxNewTCB;
                                        /* We cannot access the delayed or ready lists, so will hold this\r
                                        task pending until the scheduler is resumed, at which point a\r
                                        yield will be performed if necessary. */\r
-                                       vListInsertEnd( ( xList * ) &( xPendingReadyList ), &( pxTCB->xEventListItem ) );\r
+                                       vListInsertEnd( &( xPendingReadyList ), &( pxTCB->xEventListItem ) );\r
                                }\r
                        }\r
                }\r
@@ -1220,12 +1240,12 @@ portBASE_TYPE xReturn;
        {\r
                /* Create the idle task, storing its handle in xIdleTaskHandle so it can\r
                be returned by the xTaskGetIdleTaskHandle() function. */\r
-               xReturn = xTaskCreate( prvIdleTask, ( signed char * ) "IDLE", tskIDLE_STACK_SIZE, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), &xIdleTaskHandle );\r
+               xReturn = xTaskCreate( prvIdleTask, ( signed char * ) "IDLE", tskIDLE_STACK_SIZE, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), &xIdleTaskHandle ); /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */\r
        }\r
        #else\r
        {\r
                /* Create the idle task without storing its handle. */\r
-               xReturn = xTaskCreate( prvIdleTask, ( signed char * ) "IDLE", tskIDLE_STACK_SIZE, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), NULL );\r
+               xReturn = xTaskCreate( prvIdleTask, ( signed char * ) "IDLE", tskIDLE_STACK_SIZE, ( void * ) NULL, ( tskIDLE_PRIORITY | portPRIVILEGE_BIT ), NULL );  /*lint !e961 MISRA exception, justified as it is not a redundant explicit cast to all supported compilers. */\r
        }\r
        #endif /* INCLUDE_xTaskGetIdleTaskHandle */\r
 \r
@@ -1329,8 +1349,8 @@ void vTaskSuspendAll( void )
 \r
 signed portBASE_TYPE xTaskResumeAll( void )\r
 {\r
-register tskTCB *pxTCB;\r
-signed portBASE_TYPE xAlreadyYielded = pdFALSE;\r
+tskTCB *pxTCB;\r
+portBASE_TYPE xAlreadyYielded = pdFALSE;\r
 portBASE_TYPE xYieldRequired = pdFALSE;\r
 \r
        /* If uxSchedulerSuspended is zero then this function does not match a\r
@@ -1352,11 +1372,11 @@ portBASE_TYPE xYieldRequired = pdFALSE;
                        {\r
                                /* Move any readied tasks from the pending list into the\r
                                appropriate ready list. */\r
-                               while( listLIST_IS_EMPTY( ( xList * ) &xPendingReadyList ) == pdFALSE )\r
+                               while( listLIST_IS_EMPTY( &xPendingReadyList ) == pdFALSE )\r
                                {\r
-                                       pxTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY(  ( ( xList * ) &xPendingReadyList ) );\r
-                                       uxListRemove( &( pxTCB->xEventListItem ) );\r
-                                       uxListRemove( &( pxTCB->xGenericListItem ) );\r
+                                       pxTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( ( &xPendingReadyList ) );\r
+                                       ( void ) uxListRemove( &( pxTCB->xEventListItem ) );\r
+                                       ( void ) uxListRemove( &( pxTCB->xGenericListItem ) );\r
                                        prvAddTaskToReadyList( pxTCB );\r
 \r
                                        /* If we have moved a task that has a priority higher than\r
@@ -1480,9 +1500,9 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
                                do\r
                                {\r
                                        uxQueue--;\r
-                                       uxTask += prvListTaskWithinSingleList( &( pxTaskStatusArray[ uxTask ] ), ( xList * ) &( pxReadyTasksLists[ uxQueue ] ), eReady );\r
+                                       uxTask += prvListTaskWithinSingleList( &( pxTaskStatusArray[ uxTask ] ), &( pxReadyTasksLists[ uxQueue ] ), eReady );\r
 \r
-                               }while( uxQueue > ( unsigned short ) tskIDLE_PRIORITY );\r
+                               } while( uxQueue > ( unsigned portBASE_TYPE ) tskIDLE_PRIORITY ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */\r
 \r
                                /* Fill in an xTaskStatusType structure with information on each\r
                                task in the Blocked state. */\r
@@ -1522,7 +1542,7 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
                                #endif\r
                        }\r
                }\r
-               xTaskResumeAll();\r
+               ( void ) xTaskResumeAll();\r
 \r
                return uxTask;\r
        }\r
@@ -1624,13 +1644,13 @@ portBASE_TYPE xSwitchRequired = pdFALSE;
                                                }\r
 \r
                                                /* It is time to remove the item from the Blocked state. */\r
-                                               uxListRemove( &( pxTCB->xGenericListItem ) );\r
+                                               ( void ) uxListRemove( &( pxTCB->xGenericListItem ) );\r
 \r
                                                /* Is the task waiting on an event also?  If so remove it\r
                                                from the event list. */\r
                                                if( listLIST_ITEM_CONTAINER( &( pxTCB->xEventListItem ) ) != NULL )\r
                                                {\r
-                                                       uxListRemove( &( pxTCB->xEventListItem ) );\r
+                                                       ( void ) uxListRemove( &( pxTCB->xEventListItem ) );\r
                                                }\r
 \r
                                                /* Place the unblocked task into the appropriate ready\r
@@ -1661,7 +1681,7 @@ portBASE_TYPE xSwitchRequired = pdFALSE;
                writer has not explicitly turned time slicing off. */\r
                #if ( ( configUSE_PREEMPTION == 1 ) && ( configUSE_TIME_SLICING == 1 ) )\r
                {\r
-                       if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ pxCurrentTCB->uxPriority ] ) ) > 1 )\r
+                       if( listCURRENT_LIST_LENGTH( &( pxReadyTasksLists[ pxCurrentTCB->uxPriority ] ) ) > ( unsigned portBASE_TYPE ) 1 )\r
                        {\r
                                xSwitchRequired = pdTRUE;\r
                        }\r
@@ -1836,7 +1856,7 @@ void vTaskSwitchContext( void )
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-void vTaskPlaceOnEventList( const xList * const pxEventList, portTickType xTicksToWait )\r
+void vTaskPlaceOnEventList( xList * const pxEventList, portTickType xTicksToWait )\r
 {\r
 portTickType xTimeToWake;\r
 \r
@@ -1848,12 +1868,12 @@ portTickType xTimeToWake;
        /* Place the event list item of the TCB in the appropriate event list.\r
        This is placed in the list in priority order so the highest priority task\r
        is the first to be woken by the event. */\r
-       vListInsert( ( xList * ) pxEventList, ( xListItem * ) &( pxCurrentTCB->xEventListItem ) );\r
+       vListInsert( pxEventList, &( pxCurrentTCB->xEventListItem ) );\r
 \r
        /* We must remove ourselves from the ready list before adding ourselves\r
        to the blocked list as the same list item is used for both lists.  We have\r
        exclusive access to the ready lists as the scheduler is locked. */\r
-       if( uxListRemove( ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) ) == 0 )\r
+       if( uxListRemove( &( pxCurrentTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 )\r
        {\r
                /* The current task must be in a ready list, so there is no need to\r
                check, and the port reset macro can be called directly. */\r
@@ -1867,7 +1887,7 @@ portTickType xTimeToWake;
                        /* Add ourselves to the suspended task list instead of a delayed task\r
                        list to ensure we are not woken by a timing event.  We will block\r
                        indefinitely. */\r
-                       vListInsertEnd( ( xList * ) &xSuspendedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );\r
+                       vListInsertEnd( &xSuspendedTaskList, &( pxCurrentTCB->xGenericListItem ) );\r
                }\r
                else\r
                {\r
@@ -1890,7 +1910,7 @@ portTickType xTimeToWake;
 \r
 #if configUSE_TIMERS == 1\r
 \r
-       void vTaskPlaceOnEventListRestricted( const xList * const pxEventList, portTickType xTicksToWait )\r
+       void vTaskPlaceOnEventListRestricted( xList * const pxEventList, portTickType xTicksToWait )\r
        {\r
        portTickType xTimeToWake;\r
 \r
@@ -1906,12 +1926,12 @@ portTickType xTimeToWake;
                In this case it is assume that this is the only task that is going to\r
                be waiting on this event list, so the faster vListInsertEnd() function\r
                can be used in place of vListInsert. */\r
-               vListInsertEnd( ( xList * ) pxEventList, ( xListItem * ) &( pxCurrentTCB->xEventListItem ) );\r
+               vListInsertEnd( pxEventList, &( pxCurrentTCB->xEventListItem ) );\r
 \r
                /* We must remove this task from the ready list before adding it to the\r
                blocked list as the same list item is used for both lists.  This\r
                function is called form a critical section. */\r
-               if( uxListRemove( ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) ) == 0 )\r
+               if( uxListRemove( &( pxCurrentTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 )\r
                {\r
                        /* The current task must be in a ready list, so there is no need to\r
                        check, and the port reset macro can be called directly. */\r
@@ -1949,18 +1969,18 @@ portBASE_TYPE xReturn;
        pxEventList is not empty. */\r
        pxUnblockedTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( pxEventList );\r
        configASSERT( pxUnblockedTCB );\r
-       uxListRemove( &( pxUnblockedTCB->xEventListItem ) );\r
+       ( void ) uxListRemove( &( pxUnblockedTCB->xEventListItem ) );\r
 \r
        if( uxSchedulerSuspended == ( unsigned portBASE_TYPE ) pdFALSE )\r
        {\r
-               uxListRemove( &( pxUnblockedTCB->xGenericListItem ) );\r
+               ( void ) uxListRemove( &( pxUnblockedTCB->xGenericListItem ) );\r
                prvAddTaskToReadyList( pxUnblockedTCB );\r
        }\r
        else\r
        {\r
                /* We cannot access the delayed or ready lists, so will hold this\r
                task pending until the scheduler is resumed. */\r
-               vListInsertEnd( ( xList * ) &( xPendingReadyList ), &( pxUnblockedTCB->xEventListItem ) );\r
+               vListInsertEnd( &( xPendingReadyList ), &( pxUnblockedTCB->xEventListItem ) );\r
        }\r
 \r
        if( pxUnblockedTCB->uxPriority >= pxCurrentTCB->uxPriority )\r
@@ -2011,7 +2031,7 @@ portBASE_TYPE xReturn;
                        else /* We are not blocking indefinitely, perform the checks below. */\r
                #endif\r
 \r
-               if( ( xNumOfOverflows != pxTimeOut->xOverflowCount ) && ( ( portTickType ) xConstTickCount >= ( portTickType ) pxTimeOut->xTimeOnEntering ) )\r
+               if( ( xNumOfOverflows != pxTimeOut->xOverflowCount ) && ( xConstTickCount >= pxTimeOut->xTimeOnEntering ) ) /*lint !e525 Indentation preferred as is to make code within pre-processor directives clearer. */\r
                {\r
                        /* The tick count is greater than the time at which vTaskSetTimeout()\r
                        was called, but has also overflowed since vTaskSetTimeOut() was called.\r
@@ -2019,10 +2039,10 @@ portBASE_TYPE xReturn;
                        passed since vTaskSetTimeout() was called. */\r
                        xReturn = pdTRUE;\r
                }\r
-               else if( ( ( portTickType ) ( ( portTickType ) xConstTickCount - ( portTickType ) pxTimeOut->xTimeOnEntering ) ) < ( portTickType ) *pxTicksToWait )\r
+               else if( ( xConstTickCount - pxTimeOut->xTimeOnEntering ) < *pxTicksToWait )\r
                {\r
                        /* Not a genuine timeout. Adjust parameters for time remaining. */\r
-                       *pxTicksToWait -= ( ( portTickType ) xConstTickCount - ( portTickType ) pxTimeOut->xTimeOnEntering );\r
+                       *pxTicksToWait -= ( xConstTickCount -  pxTimeOut->xTimeOnEntering );\r
                        vTaskSetTimeOutState( pxTimeOut );\r
                        xReturn = pdFALSE;\r
                }\r
@@ -2223,10 +2243,10 @@ static portTASK_FUNCTION( prvIdleTask, pvParameters )
 \r
 static void prvInitialiseTCBVariables( tskTCB *pxTCB, const signed char * const pcName, unsigned portBASE_TYPE uxPriority, const xMemoryRegion * const xRegions, unsigned short usStackDepth )\r
 {\r
-portBASE_TYPE x;\r
+unsigned portBASE_TYPE x;\r
 \r
        /* Store the task name in the TCB. */\r
-       for( x = 0; x < configMAX_TASK_NAME_LEN; x++ )\r
+       for( x = ( unsigned portBASE_TYPE ) 0; x < ( unsigned portBASE_TYPE ) configMAX_TASK_NAME_LEN; x++ )\r
        {\r
                pxTCB->pcTaskName[ x ] = pcName[ x ];\r
 \r
@@ -2245,9 +2265,9 @@ portBASE_TYPE x;
 \r
        /* This is used as an array index so must ensure it's not too large.  First\r
        remove the privilege bit if one is present. */\r
-       if( uxPriority >= configMAX_PRIORITIES )\r
+       if( uxPriority >= ( unsigned portBASE_TYPE ) configMAX_PRIORITIES )\r
        {\r
-               uxPriority = configMAX_PRIORITIES - ( unsigned portBASE_TYPE ) 1U;\r
+               uxPriority = ( unsigned portBASE_TYPE ) configMAX_PRIORITIES - ( unsigned portBASE_TYPE ) 1U;\r
        }\r
 \r
        pxTCB->uxPriority = uxPriority;\r
@@ -2265,7 +2285,7 @@ portBASE_TYPE x;
        listSET_LIST_ITEM_OWNER( &( pxTCB->xGenericListItem ), pxTCB );\r
 \r
        /* Event lists are always in priority order. */\r
-       listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), configMAX_PRIORITIES - ( portTickType ) uxPriority );\r
+       listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( portTickType ) configMAX_PRIORITIES - ( portTickType ) uxPriority ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */\r
        listSET_LIST_ITEM_OWNER( &( pxTCB->xEventListItem ), pxTCB );\r
 \r
        #if ( portCRITICAL_NESTING_IN_TCB == 1 )\r
@@ -2330,24 +2350,24 @@ static void prvInitialiseTaskLists( void )
 {\r
 unsigned portBASE_TYPE uxPriority;\r
 \r
-       for( uxPriority = ( unsigned portBASE_TYPE ) 0U; uxPriority < configMAX_PRIORITIES; uxPriority++ )\r
+       for( uxPriority = ( unsigned portBASE_TYPE ) 0U; uxPriority < ( unsigned portBASE_TYPE ) configMAX_PRIORITIES; uxPriority++ )\r
        {\r
-               vListInitialise( ( xList * ) &( pxReadyTasksLists[ uxPriority ] ) );\r
+               vListInitialise( &( pxReadyTasksLists[ uxPriority ] ) );\r
        }\r
 \r
-       vListInitialise( ( xList * ) &xDelayedTaskList1 );\r
-       vListInitialise( ( xList * ) &xDelayedTaskList2 );\r
-       vListInitialise( ( xList * ) &xPendingReadyList );\r
+       vListInitialise( &xDelayedTaskList1 );\r
+       vListInitialise( &xDelayedTaskList2 );\r
+       vListInitialise( &xPendingReadyList );\r
 \r
        #if ( INCLUDE_vTaskDelete == 1 )\r
        {\r
-               vListInitialise( ( xList * ) &xTasksWaitingTermination );\r
+               vListInitialise( &xTasksWaitingTermination );\r
        }\r
        #endif /* INCLUDE_vTaskDelete */\r
 \r
        #if ( INCLUDE_vTaskSuspend == 1 )\r
        {\r
-               vListInitialise( ( xList * ) &xSuspendedTaskList );\r
+               vListInitialise( &xSuspendedTaskList );\r
        }\r
        #endif /* INCLUDE_vTaskSuspend */\r
 \r
@@ -2370,7 +2390,7 @@ static void prvCheckTasksWaitingTermination( void )
                {\r
                        vTaskSuspendAll();\r
                                xListIsEmpty = listLIST_IS_EMPTY( &xTasksWaitingTermination );\r
-                       xTaskResumeAll();\r
+                       ( void ) xTaskResumeAll();\r
 \r
                        if( xListIsEmpty == pdFALSE )\r
                        {\r
@@ -2378,8 +2398,8 @@ static void prvCheckTasksWaitingTermination( void )
 \r
                                taskENTER_CRITICAL();\r
                                {\r
-                                       pxTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( ( ( xList * ) &xTasksWaitingTermination ) );\r
-                                       uxListRemove( &( pxTCB->xGenericListItem ) );\r
+                                       pxTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( ( &xTasksWaitingTermination ) );\r
+                                       ( void ) uxListRemove( &( pxTCB->xGenericListItem ) );\r
                                        --uxCurrentNumberOfTasks;\r
                                        --uxTasksDeleted;\r
                                }\r
@@ -2401,12 +2421,12 @@ static void prvAddCurrentTaskToDelayedList( portTickType xTimeToWake )
        if( xTimeToWake < xTickCount )\r
        {\r
                /* Wake time has overflowed.  Place this item in the overflow list. */\r
-               vListInsert( ( xList * ) pxOverflowDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );\r
+               vListInsert( pxOverflowDelayedTaskList, &( pxCurrentTCB->xGenericListItem ) );\r
        }\r
        else\r
        {\r
                /* The wake time has not overflowed, so we can use the current block list. */\r
-               vListInsert( ( xList * ) pxDelayedTaskList, ( xListItem * ) &( pxCurrentTCB->xGenericListItem ) );\r
+               vListInsert( pxDelayedTaskList, &( pxCurrentTCB->xGenericListItem ) );\r
 \r
                /* If the task entering the blocked state was placed at the head of the\r
                list of blocked tasks then xNextTaskUnblockTime needs to be updated\r
@@ -2432,7 +2452,7 @@ tskTCB *pxNewTCB;
                /* Allocate space for the stack used by the task being created.\r
                The base of the stack memory stored in the TCB so the task can\r
                be deleted later if required. */\r
-               pxNewTCB->pxStack = ( portSTACK_TYPE * ) pvPortMallocAligned( ( ( ( size_t )usStackDepth ) * sizeof( portSTACK_TYPE ) ), puxStackBuffer );\r
+               pxNewTCB->pxStack = ( portSTACK_TYPE * ) pvPortMallocAligned( ( ( ( size_t ) usStackDepth ) * sizeof( portSTACK_TYPE ) ), puxStackBuffer ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */\r
 \r
                if( pxNewTCB->pxStack == NULL )\r
                {\r
@@ -2443,7 +2463,7 @@ tskTCB *pxNewTCB;
                else\r
                {\r
                        /* Just to help debugging. */\r
-                       memset( pxNewTCB->pxStack, ( int ) tskSTACK_FILL_BYTE, ( size_t ) usStackDepth * sizeof( portSTACK_TYPE ) );\r
+                       ( void ) memset( pxNewTCB->pxStack, ( int ) tskSTACK_FILL_BYTE, ( size_t ) usStackDepth * sizeof( portSTACK_TYPE ) );\r
                }\r
        }\r
 \r
@@ -2458,7 +2478,7 @@ tskTCB *pxNewTCB;
        volatile tskTCB *pxNextTCB, *pxFirstTCB;\r
        unsigned portBASE_TYPE uxTask = 0;\r
 \r
-               if( listCURRENT_LIST_LENGTH( pxList ) > 0 )\r
+               if( listCURRENT_LIST_LENGTH( pxList ) > ( unsigned portBASE_TYPE ) 0 )\r
                {\r
                        listGET_OWNER_OF_NEXT_ENTRY( pxFirstTCB, pxList );\r
 \r
@@ -2630,7 +2650,7 @@ tskTCB *pxNewTCB;
 \r
 #if ( configUSE_MUTEXES == 1 )\r
 \r
-       void vTaskPriorityInherit( xTaskHandle const pxMutexHolder )\r
+       void vTaskPriorityInherit( xTaskHandle const pxMutexHolder )\r
        {\r
        tskTCB * const pxTCB = ( tskTCB * ) pxMutexHolder;\r
 \r
@@ -2641,13 +2661,13 @@ tskTCB *pxNewTCB;
                        if( pxTCB->uxPriority < pxCurrentTCB->uxPriority )\r
                        {\r
                                /* Adjust the mutex holder state to account for its new priority. */\r
-                               listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), configMAX_PRIORITIES - ( portTickType ) pxCurrentTCB->uxPriority );\r
+                               listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( portTickType ) configMAX_PRIORITIES - ( portTickType ) pxCurrentTCB->uxPriority ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */\r
 \r
                                /* If the task being modified is in the ready state it will need to\r
                                be moved into a new list. */\r
                                if( listIS_CONTAINED_WITHIN( &( pxReadyTasksLists[ pxTCB->uxPriority ] ), &( pxTCB->xGenericListItem ) ) != pdFALSE )\r
                                {\r
-                                       if( uxListRemove( ( xListItem * ) &( pxTCB->xGenericListItem ) ) == 0 )\r
+                                       if( uxListRemove( &( pxTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 )\r
                                        {\r
                                                taskRESET_READY_PRIORITY( pxTCB->uxPriority );\r
                                        }\r
@@ -2672,7 +2692,7 @@ tskTCB *pxNewTCB;
 \r
 #if ( configUSE_MUTEXES == 1 )\r
 \r
-       void vTaskPriorityDisinherit( xTaskHandle const pxMutexHolder )\r
+       void vTaskPriorityDisinherit( xTaskHandle const pxMutexHolder )\r
        {\r
        tskTCB * const pxTCB = ( tskTCB * ) pxMutexHolder;\r
 \r
@@ -2682,7 +2702,7 @@ tskTCB *pxNewTCB;
                        {\r
                                /* We must be the running task to be able to give the mutex back.\r
                                Remove ourselves from the ready list we currently appear in. */\r
-                               if( uxListRemove( ( xListItem * ) &( pxTCB->xGenericListItem ) ) == 0 )\r
+                               if( uxListRemove( &( pxTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 )\r
                                {\r
                                        taskRESET_READY_PRIORITY( pxTCB->uxPriority );\r
                                }\r
@@ -2691,7 +2711,7 @@ tskTCB *pxNewTCB;
                                ready list. */\r
                                traceTASK_PRIORITY_DISINHERIT( pxTCB, pxTCB->uxBasePriority );\r
                                pxTCB->uxPriority = pxTCB->uxBasePriority;\r
-                               listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), configMAX_PRIORITIES - ( portTickType ) pxTCB->uxPriority );\r
+                               listSET_LIST_ITEM_VALUE( &( pxTCB->xEventListItem ), ( portTickType ) configMAX_PRIORITIES - ( portTickType ) pxTCB->uxPriority ); /*lint !e961 MISRA exception as the casts are only redundant for some ports. */\r
                                prvAddTaskToReadyList( pxTCB );\r
                        }\r
                }\r
index 982975b5e3c04d5b9c16bfdb34bfd3c12d753a8f..8222ebb8848617b90ab33c538d120ac756e57949 100644 (file)
@@ -72,6 +72,9 @@
     mission critical applications that require provable dependability.\r
 */\r
 \r
+/* Standard includes. */\r
+#include <stdlib.h>\r
+\r
 /* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining\r
 all the API functions to use the MPU wrappers.  That should only be done when\r
 task.h is included from an application file. */\r
@@ -82,7 +85,12 @@ task.h is included from an application file. */
 #include "queue.h"\r
 #include "timers.h"\r
 \r
-#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE\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
+\r
 \r
 /* This entire source file will be skipped if the application is not configured\r
 to include software timer functionality.  This #if is closed at the very bottom\r
@@ -113,6 +121,8 @@ typedef struct tmrTimerQueueMessage
        xTIMER *                                pxTimer;                        /*<< The timer to which the command will be applied. */\r
 } xTIMER_MESSAGE;\r
 \r
+/*lint -e956 A manual analysis and inspection has been used to determine which\r
+static variables must be declared volatile. */\r
 \r
 /* The list in which active timers are stored.  Timers are referenced in expire\r
 time order, with the nearest expiry time at the front of the list.  Only the\r
@@ -131,6 +141,8 @@ PRIVILEGED_DATA static xQueueHandle xTimerQueue = NULL;
 \r
 #endif\r
 \r
+/*lint +e956 */\r
+\r
 /*-----------------------------------------------------------*/\r
 \r
 /*\r
@@ -320,7 +332,7 @@ portBASE_TYPE xResult;
        /* Remove the timer from the list of active timers.  A check has already\r
        been performed to ensure the list is not empty. */\r
        pxTimer = ( xTIMER * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTimerList );\r
-       uxListRemove( &( pxTimer->xTimerListItem ) );\r
+       ( void ) uxListRemove( &( pxTimer->xTimerListItem ) );\r
        traceTIMER_EXPIRED( pxTimer );\r
 \r
        /* If the timer is an auto reload timer then calculate the next\r
@@ -390,7 +402,7 @@ portBASE_TYPE xTimerListsWereSwitched;
                        /* The tick count has not overflowed, has the timer expired? */\r
                        if( ( xListWasEmpty == pdFALSE ) && ( xNextExpireTime <= xTimeNow ) )\r
                        {\r
-                               xTaskResumeAll();\r
+                               ( void ) xTaskResumeAll();\r
                                prvProcessExpiredTimer( xNextExpireTime, xTimeNow );\r
                        }\r
                        else\r
@@ -415,7 +427,7 @@ portBASE_TYPE xTimerListsWereSwitched;
                }\r
                else\r
                {\r
-                       xTaskResumeAll();\r
+                       ( void ) xTaskResumeAll();\r
                }\r
        }\r
 }\r
@@ -450,7 +462,7 @@ portTickType xNextExpireTime;
 static portTickType prvSampleTimeNow( portBASE_TYPE *pxTimerListsWereSwitched )\r
 {\r
 portTickType xTimeNow;\r
-PRIVILEGED_DATA static portTickType xLastTime = ( portTickType ) 0U;\r
+PRIVILEGED_DATA static portTickType xLastTime = ( portTickType ) 0U; /*lint !e956 Variable is only accessible to one task. */\r
 \r
        xTimeNow = xTaskGetTickCount();\r
 \r
@@ -481,7 +493,7 @@ portBASE_TYPE xProcessTimerNow = pdFALSE;
        {\r
                /* Has the expiry time elapsed between the command to start/reset a\r
                timer was issued, and the time the command was processed? */\r
-               if( ( ( portTickType ) ( xTimeNow - xCommandTime ) ) >= pxTimer->xTimerPeriodInTicks )\r
+               if( ( xTimeNow - xCommandTime ) >= pxTimer->xTimerPeriodInTicks )\r
                {\r
                        /* The time between a command being issued and the command being\r
                        processed actually exceeds the timers period.  */\r
@@ -518,14 +530,14 @@ xTIMER *pxTimer;
 portBASE_TYPE xTimerListsWereSwitched, xResult;\r
 portTickType xTimeNow;\r
 \r
-       while( xQueueReceive( xTimerQueue, &xMessage, tmrNO_DELAY ) != pdFAIL )\r
+       while( xQueueReceive( xTimerQueue, &xMessage, tmrNO_DELAY ) != pdFAIL ) /*lint !e603 xMessage does not have to be initialised as it is passed out, not in, and it is not used unless xQueueReceive() returns pdTRUE. */\r
        {\r
                pxTimer = xMessage.pxTimer;\r
 \r
                if( listIS_CONTAINED_WITHIN( NULL, &( pxTimer->xTimerListItem ) ) == pdFALSE )\r
                {\r
                        /* The timer is in a list, remove it. */\r
-                       uxListRemove( &( pxTimer->xTimerListItem ) );\r
+                       ( void ) uxListRemove( &( pxTimer->xTimerListItem ) );\r
                }\r
 \r
                traceTIMER_COMMAND_RECEIVED( pxTimer, xMessage.xMessageID, xMessage.xMessageValue );\r
@@ -565,7 +577,7 @@ portTickType xTimeNow;
                        case tmrCOMMAND_CHANGE_PERIOD :\r
                                pxTimer->xTimerPeriodInTicks = xMessage.xMessageValue;\r
                                configASSERT( ( pxTimer->xTimerPeriodInTicks > 0 ) );\r
-                               prvInsertTimerInActiveList( pxTimer, ( xTimeNow + pxTimer->xTimerPeriodInTicks ), xTimeNow, xTimeNow );\r
+                               ( void ) prvInsertTimerInActiveList( pxTimer, ( xTimeNow + pxTimer->xTimerPeriodInTicks ), xTimeNow, xTimeNow );\r
                                break;\r
 \r
                        case tmrCOMMAND_DELETE :\r
@@ -602,7 +614,7 @@ portBASE_TYPE xResult;
 \r
                /* Remove the timer from the list. */\r
                pxTimer = ( xTIMER * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTimerList );\r
-               uxListRemove( &( pxTimer->xTimerListItem ) );\r
+               ( void ) uxListRemove( &( pxTimer->xTimerListItem ) );\r
 \r
                /* Execute its callback, then send a command to restart the timer if\r
                it is an auto-reload timer.  It cannot be restarted here as the lists\r