]> git.sur5r.net Git - freertos/commitdiff
Make changes required for MISRA 2004 compliance.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sun, 6 Feb 2011 18:47:57 +0000 (18:47 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sun, 6 Feb 2011 18:47:57 +0000 (18:47 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1274 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Source/include/FreeRTOS.h
Source/include/StackMacros.h
Source/include/croutine.h
Source/include/list.h
Source/include/queue.h
Source/include/task.h
Source/list.c
Source/portable/IAR/RX600/portmacro.h
Source/queue.c
Source/tasks.c

index f440a16d10f8142f2e62dbfa254bc920737c7ca5..64b8f63d77b9499472aa249aba09a82c2b3950c2 100644 (file)
@@ -415,7 +415,7 @@ typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
 #endif\r
 \r
 #ifndef pvPortMallocAligned\r
-       #define pvPortMallocAligned( x, puxStackBuffer ) ( ( puxStackBuffer == NULL ) ? ( pvPortMalloc( x ) ) : ( puxStackBuffer ) )\r
+       #define pvPortMallocAligned( x, puxStackBuffer ) ( ( ( puxStackBuffer ) == NULL ) ? ( pvPortMalloc( ( x ) ) ) : ( puxStackBuffer ) )\r
 #endif\r
 \r
 #ifndef vPortFreeAligned\r
index 00645e895470675946a2ac0e2a289412c3edd27f..902738c81944c96cc70616b20b10b32d99e9f244 100644 (file)
@@ -93,8 +93,6 @@
        /* Only the current stack state is to be checked. */\r
        #define taskFIRST_CHECK_FOR_STACK_OVERFLOW()                                                                                                            \\r
        {                                                                                                                                                                                                       \\r
-       extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName );                      \\r
-                                                                                                                                                                                                               \\r
                /* Is the currently saved stack pointer within the stack limit? */                                                              \\r
                if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack )                                                                               \\r
                {                                                                                                                                                                                               \\r
        /* Only the current stack state is to be checked. */\r
        #define taskFIRST_CHECK_FOR_STACK_OVERFLOW()                                                                                                            \\r
        {                                                                                                                                                                                                       \\r
-       extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName );                      \\r
                                                                                                                                                                                                                \\r
                /* Is the currently saved stack pointer within the stack limit? */                                                              \\r
                if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack )                                                                  \\r
 \r
 #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) )\r
 \r
-       #define taskSECOND_CHECK_FOR_STACK_OVERFLOW()                                                                                                                                                                                                   \\r
-       {                                                                                                                                                                                                                                                                                               \\r
-       extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName );                                                                                                              \\r
-       static const unsigned char ucExpectedStackBytes[] = {   tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,                 \\r
-                                                                                                                               tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,         \\r
-                                                                                                                               tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,         \\r
-                                                                                                                               tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,         \\r
-                                                                                                                               tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE };       \\r
-                                                                                                                                                                                                                                                                                                       \\r
-                                                                                                                                                                                                                                                                                                       \\r
-               /* Has the extremity of the task stack ever been written over? */                                                                                                                                                       \\r
-               if( memcmp( ( void * ) pxCurrentTCB->pxStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 )                                          \\r
-               {                                                                                                                                                                                                                                                                                       \\r
-                       vApplicationStackOverflowHook( ( xTaskHandle ) pxCurrentTCB, pxCurrentTCB->pcTaskName );                                                                                                \\r
-               }                                                                                                                                                                                                                                                                                       \\r
+       #define taskSECOND_CHECK_FOR_STACK_OVERFLOW()                                                                                                                                                                                           \\r
+       {                                                                                                                                                                                                                                                                                       \\r
+       static const unsigned char ucExpectedStackBytes[] = {   tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,         \\r
+                                                                                                                       tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,         \\r
+                                                                                                                       tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,         \\r
+                                                                                                                       tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,         \\r
+                                                                                                                       tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE };       \\r
+                                                                                                                                                                                                                                                                                               \\r
+                                                                                                                                                                                                                                                                                               \\r
+               /* Has the extremity of the task stack ever been written over? */                                                                                                                                               \\r
+               if( memcmp( ( void * ) pxCurrentTCB->pxStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 )                                  \\r
+               {                                                                                                                                                                                                                                                                               \\r
+                       vApplicationStackOverflowHook( ( xTaskHandle ) pxCurrentTCB, pxCurrentTCB->pcTaskName );                                                                                        \\r
+               }                                                                                                                                                                                                                                                                               \\r
        }\r
 \r
 #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */\r
 \r
        #define taskSECOND_CHECK_FOR_STACK_OVERFLOW()                                                                                                                                                                                                   \\r
        {                                                                                                                                                                                                                                                                                               \\r
-       extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName );                                                                                                              \\r
        char *pcEndOfStack = ( char * ) pxCurrentTCB->pxEndOfStack;                                                                                                                                                                             \\r
        static const unsigned char ucExpectedStackBytes[] = {   tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,                 \\r
                                                                                                                                tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,         \\r
index 64c64a7546c5cb12eea1dc439bc1c64545c37d94..fec57c46ca21aec31e9b01c37bc8248acc39bb4f 100644 (file)
@@ -33,9 +33,9 @@
     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\r
-    more details. You should have received a copy of the GNU General Public \r
-    License and the FreeRTOS license exception along with FreeRTOS; if not it \r
-    can be viewed here: http://www.freertos.org/a00114.html and also obtained \r
+    more details. You should have received a copy of the GNU General Public\r
+    License and the FreeRTOS license exception along with FreeRTOS; if not it\r
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
     by writing to Richard Barry, contact details for whom are available on the\r
     FreeRTOS WEB site.\r
 \r
     licensing and training services.\r
 */\r
 \r
+#ifndef CO_ROUTINE_H\r
+#define CO_ROUTINE_H\r
+\r
 #ifndef INC_FREERTOS_H\r
        #error "include FreeRTOS.h must appear in source files before include croutine.h"\r
 #endif\r
 \r
-\r
-\r
-\r
-#ifndef CO_ROUTINE_H\r
-#define CO_ROUTINE_H\r
-\r
 #include "list.h"\r
 \r
 #ifdef __cplusplus\r
@@ -230,7 +227,7 @@ void vCoRoutineSchedule( void );
  * \defgroup crSTART crSTART\r
  * \ingroup Tasks\r
  */\r
-#define crSTART( pxCRCB ) switch( ( ( corCRCB * )pxCRCB )->uxState ) { case 0:\r
+#define crSTART( pxCRCB ) switch( ( ( corCRCB * )( pxCRCB ) )->uxState ) { case 0:\r
 \r
 /**\r
  * croutine. h\r
@@ -267,8 +264,8 @@ void vCoRoutineSchedule( void );
  * These macros are intended for internal use by the co-routine implementation\r
  * only.  The macros should not be used directly by application writers.\r
  */\r
-#define crSET_STATE0( xHandle ) ( ( corCRCB * )xHandle)->uxState = (__LINE__ * 2); return; case (__LINE__ * 2):\r
-#define crSET_STATE1( xHandle ) ( ( corCRCB * )xHandle)->uxState = ((__LINE__ * 2)+1); return; case ((__LINE__ * 2)+1):\r
+#define crSET_STATE0( xHandle ) ( ( corCRCB * )( xHandle ) )->uxState = (__LINE__ * 2); return; case (__LINE__ * 2):\r
+#define crSET_STATE1( xHandle ) ( ( corCRCB * )( xHandle ) )->uxState = ((__LINE__ * 2)+1); return; case ((__LINE__ * 2)+1):\r
 \r
 /**\r
  * croutine. h\r
@@ -317,11 +314,11 @@ void vCoRoutineSchedule( void );
  * \ingroup Tasks\r
  */\r
 #define crDELAY( xHandle, xTicksToDelay )                                                                                              \\r
-       if( xTicksToDelay > 0 )                                                                                                                         \\r
+       if( ( xTicksToDelay ) > 0 )                                                                                                                     \\r
        {                                                                                                                                                                       \\r
-               vCoRoutineAddToDelayedList( xTicksToDelay, NULL );                                                              \\r
+               vCoRoutineAddToDelayedList( ( xTicksToDelay ), NULL );                                                  \\r
        }                                                                                                                                                                       \\r
-       crSET_STATE0( xHandle );\r
+       crSET_STATE0( ( xHandle ) );\r
 \r
 /**\r
  * <pre>\r
@@ -408,15 +405,15 @@ void vCoRoutineSchedule( void );
  */\r
 #define crQUEUE_SEND( xHandle, pxQueue, pvItemToQueue, xTicksToWait, pxResult )                        \\r
 {                                                                                                                                                                              \\r
-       *pxResult = xQueueCRSend( pxQueue, pvItemToQueue, xTicksToWait );                                       \\r
+       *( pxResult ) = xQueueCRSend( ( pxQueue) , ( pvItemToQueue) , ( xTicksToWait ) );       \\r
        if( *pxResult == errQUEUE_BLOCKED )                                                                                                     \\r
        {                                                                                                                                                                       \\r
-               crSET_STATE0( xHandle );                                                                                                                \\r
-               *pxResult = xQueueCRSend( pxQueue, pvItemToQueue, 0 );                                                  \\r
+               crSET_STATE0( ( xHandle ) );                                                                                                    \\r
+               *pxResult = xQueueCRSend( ( pxQueue ), ( pvItemToQueue ), 0 );                                  \\r
        }                                                                                                                                                                       \\r
        if( *pxResult == errQUEUE_YIELD )                                                                                                       \\r
        {                                                                                                                                                                       \\r
-               crSET_STATE1( xHandle );                                                                                                                \\r
+               crSET_STATE1( ( xHandle ) );                                                                                                    \\r
                *pxResult = pdPASS;                                                                                                                             \\r
        }                                                                                                                                                                       \\r
 }\r
@@ -500,16 +497,16 @@ void vCoRoutineSchedule( void );
  */\r
 #define crQUEUE_RECEIVE( xHandle, pxQueue, pvBuffer, xTicksToWait, pxResult )                  \\r
 {                                                                                                                                                                              \\r
-       *pxResult = xQueueCRReceive( pxQueue, pvBuffer, xTicksToWait );                                         \\r
-       if( *pxResult == errQUEUE_BLOCKED )                                                                                             \\r
+       *( pxResult ) = xQueueCRReceive( ( pxQueue) , ( pvBuffer ), ( xTicksToWait ) );         \\r
+       if( *( pxResult ) == errQUEUE_BLOCKED )                                                                                         \\r
        {                                                                                                                                                                       \\r
-               crSET_STATE0( xHandle );                                                                                                                \\r
-               *pxResult = xQueueCRReceive( pxQueue, pvBuffer, 0 );                                                    \\r
+               crSET_STATE0( ( xHandle ) );                                                                                                    \\r
+               *( pxResult ) = xQueueCRReceive( ( pxQueue) , ( pvBuffer ), 0 );                                \\r
        }                                                                                                                                                                       \\r
-       if( *pxResult == errQUEUE_YIELD )                                                                                                       \\r
+       if( *( pxResult ) == errQUEUE_YIELD )                                                                                           \\r
        {                                                                                                                                                                       \\r
-               crSET_STATE1( xHandle );                                                                                                                \\r
-               *pxResult = pdPASS;                                                                                                                             \\r
+               crSET_STATE1( ( xHandle ) );                                                                                                    \\r
+               *( pxResult ) = pdPASS;                                                                                                                 \\r
        }                                                                                                                                                                       \\r
 }\r
 \r
@@ -607,7 +604,7 @@ void vCoRoutineSchedule( void );
  * \defgroup crQUEUE_SEND_FROM_ISR crQUEUE_SEND_FROM_ISR\r
  * \ingroup Tasks\r
  */\r
-#define crQUEUE_SEND_FROM_ISR( pxQueue, pvItemToQueue, xCoRoutinePreviouslyWoken ) xQueueCRSendFromISR( pxQueue, pvItemToQueue, xCoRoutinePreviouslyWoken )\r
+#define crQUEUE_SEND_FROM_ISR( pxQueue, pvItemToQueue, xCoRoutinePreviouslyWoken ) xQueueCRSendFromISR( ( pxQueue ), ( pvItemToQueue ), ( xCoRoutinePreviouslyWoken ) )\r
 \r
 \r
 /**\r
@@ -720,7 +717,7 @@ void vCoRoutineSchedule( void );
  * \defgroup crQUEUE_RECEIVE_FROM_ISR crQUEUE_RECEIVE_FROM_ISR\r
  * \ingroup Tasks\r
  */\r
-#define crQUEUE_RECEIVE_FROM_ISR( pxQueue, pvBuffer, pxCoRoutineWoken ) xQueueCRReceiveFromISR( pxQueue, pvBuffer, pxCoRoutineWoken )\r
+#define crQUEUE_RECEIVE_FROM_ISR( pxQueue, pvBuffer, pxCoRoutineWoken ) xQueueCRReceiveFromISR( ( pxQueue ), ( pvBuffer ), ( pxCoRoutineWoken ) )\r
 \r
 /*\r
  * This function is intended for internal use by the co-routine macros only.\r
index ec1d08ce44ed9caa4889b6990a480d982e03288b..5a8b4399e8c96f9be418e2736f5793fce47be3a2 100644 (file)
@@ -33,9 +33,9 @@
     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\r
-    more details. You should have received a copy of the GNU General Public \r
-    License and the FreeRTOS license exception along with FreeRTOS; if not it \r
-    can be viewed here: http://www.freertos.org/a00114.html and also obtained \r
+    more details. You should have received a copy of the GNU General Public\r
+    License and the FreeRTOS license exception along with FreeRTOS; if not it\r
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
     by writing to Richard Barry, contact details for whom are available on the\r
     FreeRTOS WEB site.\r
 \r
@@ -130,7 +130,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 set the value of the list item.  In most cases the value is\r
@@ -139,7 +139,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 the retrieve the value of the list item.  The value can\r
@@ -186,7 +186,7 @@ typedef struct xLIST
  */\r
 #define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList )                                                                   \\r
 {                                                                                                                                                                              \\r
-xList * const pxConstList = pxList;                                                                                                            \\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
@@ -194,7 +194,7 @@ xList * const pxConstList = pxList;                                                                                                         \
        {                                                                                                                                                                       \\r
                ( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext;                                    \\r
        }                                                                                                                                                                       \\r
-       pxTCB = ( pxConstList )->pxIndex->pvOwner;                                                                                      \\r
+       ( pxTCB ) = ( pxConstList )->pxIndex->pvOwner;                                                                          \\r
 }\r
 \r
 \r
@@ -214,7 +214,7 @@ xList * const pxConstList = pxList;                                                                                                         \
  * \page listGET_OWNER_OF_HEAD_ENTRY listGET_OWNER_OF_HEAD_ENTRY\r
  * \ingroup LinkedList\r
  */\r
-#define listGET_OWNER_OF_HEAD_ENTRY( pxList )  ( (&( pxList->xListEnd ))->pxNext->pvOwner )\r
+#define listGET_OWNER_OF_HEAD_ENTRY( pxList )  ( (&( ( pxList )->xListEnd ))->pxNext->pvOwner )\r
 \r
 /*\r
  * Check to see if a list item is within a list.  The list item maintains a\r
@@ -226,7 +226,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 ) ( ( pxListItem )->pvContainer == ( void * ) ( pxList ) )\r
 \r
 /*\r
  * Must be called before a list is used!  This initialises all the members\r
index 53790f67675d4215ca8bfbaf2f953c13f4776644..b044d04de4afe04ca30ebe17fdbe6fc73e4a67ba 100644 (file)
@@ -469,7 +469,7 @@ xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBA
  * \defgroup xQueueSend xQueueSend\r
  * \ingroup QueueManagement\r
  */\r
-signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition );\r
+signed portBASE_TYPE xQueueGenericSend( xQueueHandle pxQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition );\r
 \r
 /**\r
  * queue. h\r
@@ -784,7 +784,7 @@ unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle xQueue );
  * \page vQueueDelete vQueueDelete\r
  * \ingroup QueueManagement\r
  */\r
-void vQueueDelete( xQueueHandle xQueue );\r
+void vQueueDelete( xQueueHandle pxQueue );\r
 \r
 /**\r
  * queue. h\r
@@ -1223,8 +1223,8 @@ xQueueHandle xQueueCreateCountingSemaphore( unsigned portBASE_TYPE uxCountValue,
  * For internal use only.  Use xSemaphoreTakeMutexRecursive() or\r
  * xSemaphoreGiveMutexRecursive() instead of calling these functions directly.\r
  */\r
-portBASE_TYPE xQueueTakeMutexRecursive( xQueueHandle xMutex, portTickType xBlockTime );\r
-portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle xMutex );\r
+portBASE_TYPE xQueueTakeMutexRecursive( xQueueHandle pxMutex, portTickType xBlockTime );\r
+portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle pxMutex );\r
 \r
 /*\r
  * The registry is provided as a means for kernel aware debuggers to\r
index 1f29ef46fdfd29c776d4938cb3b440f92c63e7ff..fbffae73fba2d7e27cd100b0734eaadaed320581 100644 (file)
 */\r
 \r
 \r
+#ifndef TASK_H\r
+#define TASK_H\r
+\r
 #ifndef INC_FREERTOS_H\r
        #error "include FreeRTOS.h must appear in source files before include task.h"\r
 #endif\r
 \r
-\r
-\r
-#ifndef TASK_H\r
-#define TASK_H\r
-\r
 #include "portable.h"\r
 #include "list.h"\r
 \r
@@ -427,8 +425,7 @@ void vTaskAllocateMPURegions( xTaskHandle xTask, const xMemoryRegion * const pxR
  * \defgroup vTaskDelete vTaskDelete\r
  * \ingroup Tasks\r
  */\r
-void vTaskDelete( xTaskHandle pxTask ) PRIVILEGED_FUNCTION;\r
-\r
+void vTaskDelete( xTaskHandle pxTaskToDelete ) PRIVILEGED_FUNCTION;\r
 \r
 /*-----------------------------------------------------------\r
  * TASK CONTROL API\r
@@ -1103,7 +1100,7 @@ unsigned long ulTaskEndTrace( void ) PRIVILEGED_FUNCTION;
  *\r
  * Returns the high water mark of the stack associated with xTask.  That is,\r
  * the minimum free stack space there has been (in words, so on a 32 bit machine\r
- * a value of 1 means 4 bytes) since the task started.  The smaller the returned \r
+ * a value of 1 means 4 bytes) since the task started.  The smaller the returned\r
  * number the closer the task has come to overflowing its stack.\r
  *\r
  * @param xTask Handle of the task associated with the stack to be checked.\r
@@ -1278,7 +1275,7 @@ void vTaskPriorityDisinherit( xTaskHandle * const pxMutexHolder ) PRIVILEGED_FUN
  * Generic version of the task creation function which is in turn called by the\r
  * xTaskCreate() and xTaskCreateRestricted() macros.\r
  */\r
-signed portBASE_TYPE xTaskGenericCreate( pdTASK_CODE pvTaskCode, const signed char * const pcName, unsigned short usStackDepth, void *pvParameters, unsigned portBASE_TYPE uxPriority, xTaskHandle *pxCreatedTask, portSTACK_TYPE *puxStackBuffer, const xMemoryRegion * const xRegions ) PRIVILEGED_FUNCTION;\r
+signed portBASE_TYPE xTaskGenericCreate( pdTASK_CODE pxTaskCode, const signed char * const pcName, unsigned short usStackDepth, void *pvParameters, unsigned portBASE_TYPE uxPriority, xTaskHandle *pxCreatedTask, portSTACK_TYPE *puxStackBuffer, const xMemoryRegion * const xRegions ) PRIVILEGED_FUNCTION;\r
 \r
 #ifdef __cplusplus\r
 }\r
index 89562dc85d3efd9a57df3cb4005dde5c93ab6bd6..4b0a3cdc11783102ea62b8e4dcdc0ff83b7a744e 100644 (file)
@@ -33,9 +33,9 @@
     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\r
-    more details. You should have received a copy of the GNU General Public \r
-    License and the FreeRTOS license exception along with FreeRTOS; if not it \r
-    can be viewed here: http://www.freertos.org/a00114.html and also obtained \r
+    more details. You should have received a copy of the GNU General Public\r
+    License and the FreeRTOS license exception along with FreeRTOS; if not it\r
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
     by writing to Richard Barry, contact details for whom are available on the\r
     FreeRTOS WEB site.\r
 \r
@@ -76,7 +76,7 @@ void vListInitialise( xList *pxList )
        pxList->xListEnd.pxNext = ( xListItem * ) &( pxList->xListEnd );\r
        pxList->xListEnd.pxPrevious = ( xListItem * ) &( pxList->xListEnd );\r
 \r
-       pxList->uxNumberOfItems = 0;\r
+       pxList->uxNumberOfItems = ( unsigned portBASE_TYPE ) 0U;\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -121,9 +121,9 @@ portTickType xValueOfInsertion;
        /* If the list already contains a list item with the same item value then\r
        the new list item should be placed after it.  This ensures that TCB's which\r
        are stored in ready lists (all of which have the same ulListItem value)\r
-       get an equal share of the CPU.  However, if the xItemValue is the same as \r
+       get an equal share of the CPU.  However, if the xItemValue is the same as\r
        the back marker the iteration loop below will not end.  This means we need\r
-       to guard against this by checking the value first and modifying the \r
+       to guard against this by checking the value first and modifying the\r
        algorithm slightly if necessary. */\r
        if( xValueOfInsertion == portMAX_DELAY )\r
        {\r
@@ -133,18 +133,18 @@ portTickType xValueOfInsertion;
        {\r
                /* *** NOTE ***********************************************************\r
                If you find your application is crashing here then likely causes are:\r
-                       1) Stack overflow - \r
+                       1) Stack overflow -\r
                           see http://www.freertos.org/Stacks-and-stack-overflow-checking.html\r
-                       2) Incorrect interrupt priority assignment, especially on Cortex-M3 \r
-                          parts where numerically high priority values denote low actual \r
-                          interrupt priories, which can seem counter intuitive.  See \r
+                       2) Incorrect interrupt priority assignment, especially on Cortex-M3\r
+                          parts where numerically high priority values denote low actual\r
+                          interrupt priories, which can seem counter intuitive.  See\r
                           configMAX_SYSCALL_INTERRUPT_PRIORITY on http://www.freertos.org/a00110.html\r
                        3) Calling an API function from within a critical section or when\r
                           the scheduler is suspended.\r
                        4) Using a queue or semaphore before it has been initialised or\r
                           before the scheduler has been started (are interrupts firing\r
                           before vTaskStartScheduler() has been called?).\r
-               See http://www.freertos.org/FAQHelp.html for more tips. \r
+               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
index 968cb900d24487179ce388dcf8c8a1ddbeafbd67..e4b26a1176e81188f6fda309a0afd15ee3b4ff78 100644 (file)
@@ -99,15 +99,15 @@ portSTACK_TYPE and portBASE_TYPE. */
 /* The location of the software interrupt register.  Software interrupts use\r
 vector 27. */\r
 #define portITU_SWINTR                 ( ( unsigned char * ) 0x000872E0 )\r
-#define portYIELD()                            *portITU_SWINTR = 0x01; portNOP(); portNOP(); portNOP(); portNOP(); portNOP()\r
-#define portYIELD_FROM_ISR( x )        if( x != pdFALSE ) portYIELD()\r
+#define portYIELD()                            *portITU_SWINTR = ( unsigned char ) 0x01; portNOP(); portNOP(); portNOP(); portNOP(); portNOP()\r
+#define portYIELD_FROM_ISR( x )        if( ( x ) != pdFALSE ) portYIELD()\r
 \r
 /*\r
  * These macros should be called directly, but through the taskENTER_CRITICAL()\r
  * and taskEXIT_CRITICAL() macros.\r
  */\r
-#define portENABLE_INTERRUPTS()        __set_interrupt_level( 0 )\r
-#define portDISABLE_INTERRUPTS()       __set_interrupt_level( configMAX_SYSCALL_INTERRUPT_PRIORITY )\r
+#define portENABLE_INTERRUPTS()        __set_interrupt_level( ( unsigned char ) 0 )\r
+#define portDISABLE_INTERRUPTS()       __set_interrupt_level( ( unsigned char ) configMAX_SYSCALL_INTERRUPT_PRIORITY )\r
 \r
 /* Critical nesting counts are stored in the TCB. */\r
 #define portCRITICAL_NESTING_IN_TCB ( 1 )\r
@@ -115,14 +115,14 @@ vector 27. */
 /* The critical nesting functions defined within tasks.c. */\r
 extern void vTaskEnterCritical( void );\r
 extern void vTaskExitCritical( void );\r
-#define portENTER_CRITICAL()   vTaskEnterCritical();\r
-#define portEXIT_CRITICAL()            vTaskExitCritical();\r
+#define portENTER_CRITICAL()   vTaskEnterCritical()\r
+#define portEXIT_CRITICAL()            vTaskExitCritical()\r
 \r
 /* As this port allows interrupt nesting... */\r
 unsigned long ulPortGetIPL( void );\r
 void vPortSetIPL( unsigned long ulNewIPL );\r
 #define portSET_INTERRUPT_MASK_FROM_ISR() __get_interrupt_level(); portDISABLE_INTERRUPTS()\r
-#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ) __set_interrupt_level( uxSavedInterruptStatus )\r
+#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ) __set_interrupt_level( ( unsigned char ) ( uxSavedInterruptStatus ) )\r
 \r
 /*-----------------------------------------------------------*/\r
 \r
index 30c30b0766d60f91e7046ea994ebb7133ba72e09..2107b363762fb5ed8167991a30e668bcb3a76625 100644 (file)
@@ -33,9 +33,9 @@
     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\r
-    more details. You should have received a copy of the GNU General Public \r
-    License and the FreeRTOS license exception along with FreeRTOS; if not it \r
-    can be viewed here: http://www.freertos.org/a00114.html and also obtained \r
+    more details. You should have received a copy of the GNU General Public\r
+    License and the FreeRTOS license exception along with FreeRTOS; if not it\r
+    can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
     by writing to Richard Barry, contact details for whom are available on the\r
     FreeRTOS WEB site.\r
 \r
@@ -222,21 +222,19 @@ static void prvCopyDataFromQueue( xQUEUE * const pxQueue, const void *pvBuffer )
  * Macro to mark a queue as locked.  Locking a queue prevents an ISR from\r
  * accessing the queue event lists.\r
  */\r
-#define prvLockQueue( pxQueue )                                                        \\r
-{                                                                                                              \\r
-       taskENTER_CRITICAL();                                                           \\r
-       {                                                                                                       \\r
-               if( pxQueue->xRxLock == queueUNLOCKED )                 \\r
-               {                                                                                               \\r
-                       pxQueue->xRxLock = queueLOCKED_UNMODIFIED;      \\r
-               }                                                                                               \\r
-               if( pxQueue->xTxLock == queueUNLOCKED )                 \\r
-               {                                                                                               \\r
-                       pxQueue->xTxLock = queueLOCKED_UNMODIFIED;      \\r
-               }                                                                                               \\r
-       }                                                                                                       \\r
-       taskEXIT_CRITICAL();                                                            \\r
-}\r
+#define prvLockQueue( pxQueue )                                                                \\r
+       taskENTER_CRITICAL();                                                                   \\r
+       {                                                                                                               \\r
+               if( ( pxQueue )->xRxLock == queueUNLOCKED )                     \\r
+               {                                                                                                       \\r
+                       ( pxQueue )->xRxLock = queueLOCKED_UNMODIFIED;  \\r
+               }                                                                                                       \\r
+               if( ( pxQueue )->xTxLock == queueUNLOCKED )                     \\r
+               {                                                                                                       \\r
+                       ( pxQueue )->xTxLock = queueLOCKED_UNMODIFIED;  \\r
+               }                                                                                                       \\r
+       }                                                                                                               \\r
+       taskEXIT_CRITICAL()\r
 /*-----------------------------------------------------------*/\r
 \r
 \r
@@ -248,6 +246,7 @@ xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBA
 {\r
 xQUEUE *pxNewQueue;\r
 size_t xQueueSizeInBytes;\r
+xQueueHandle xReturn = NULL;\r
 \r
        /* Allocate the new queue structure. */\r
        if( uxQueueLength > ( unsigned portBASE_TYPE ) 0 )\r
@@ -265,9 +264,9 @@ size_t xQueueSizeInBytes;
                                /* Initialise the queue members as described above where the\r
                                queue type is defined. */\r
                                pxNewQueue->pcTail = pxNewQueue->pcHead + ( uxQueueLength * uxItemSize );\r
-                               pxNewQueue->uxMessagesWaiting = 0;\r
+                               pxNewQueue->uxMessagesWaiting = ( unsigned portBASE_TYPE ) 0U;\r
                                pxNewQueue->pcWriteTo = pxNewQueue->pcHead;\r
-                               pxNewQueue->pcReadFrom = pxNewQueue->pcHead + ( ( uxQueueLength - 1 ) * uxItemSize );\r
+                               pxNewQueue->pcReadFrom = pxNewQueue->pcHead + ( ( uxQueueLength - ( unsigned portBASE_TYPE ) 1U ) * uxItemSize );\r
                                pxNewQueue->uxLength = uxQueueLength;\r
                                pxNewQueue->uxItemSize = uxItemSize;\r
                                pxNewQueue->xRxLock = queueUNLOCKED;\r
@@ -278,7 +277,7 @@ size_t xQueueSizeInBytes;
                                vListInitialise( &( pxNewQueue->xTasksWaitingToReceive ) );\r
 \r
                                traceQUEUE_CREATE( pxNewQueue );\r
-                               return  pxNewQueue;\r
+                               xReturn = pxNewQueue;\r
                        }\r
                        else\r
                        {\r
@@ -288,9 +287,7 @@ size_t xQueueSizeInBytes;
                }\r
        }\r
 \r
-       /* Will only reach here if we could not allocate enough memory or no memory\r
-       was required. */\r
-       return NULL;\r
+       return xReturn;\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -316,9 +313,9 @@ size_t xQueueSizeInBytes;
                        /* Each mutex has a length of 1 (like a binary semaphore) and\r
                        an item size of 0 as nothing is actually copied into or out\r
                        of the mutex. */\r
-                       pxNewQueue->uxMessagesWaiting = 0;\r
-                       pxNewQueue->uxLength = 1;\r
-                       pxNewQueue->uxItemSize = 0;\r
+                       pxNewQueue->uxMessagesWaiting = ( unsigned portBASE_TYPE ) 0U;\r
+                       pxNewQueue->uxLength = ( unsigned portBASE_TYPE ) 1U;\r
+                       pxNewQueue->uxItemSize = ( unsigned portBASE_TYPE ) 0U;\r
                        pxNewQueue->xRxLock = queueUNLOCKED;\r
                        pxNewQueue->xTxLock = queueUNLOCKED;\r
 \r
@@ -327,7 +324,7 @@ size_t xQueueSizeInBytes;
                        vListInitialise( &( pxNewQueue->xTasksWaitingToReceive ) );\r
 \r
                        /* Start with the semaphore in the expected state. */\r
-                       xQueueGenericSend( pxNewQueue, NULL, 0, queueSEND_TO_BACK );\r
+                       xQueueGenericSend( pxNewQueue, NULL, ( portTickType ) 0U, queueSEND_TO_BACK );\r
 \r
                        traceCREATE_MUTEX( pxNewQueue );\r
                }\r
index 965d0a015f25c98e58a6149b0c99137803d498dc..201b0629cd1e2cfd188756f64d17030c4e0539d9 100644 (file)
@@ -177,7 +177,7 @@ PRIVILEGED_DATA static portTickType xNextTaskUnblockTime                                            = ( portTickType )
  * The value used to fill the stack of a task when the task is created.  This\r
  * is used purely for checking the high water mark for tasks.\r
  */\r
-#define tskSTACK_FILL_BYTE     ( 0xa5 )\r
+#define tskSTACK_FILL_BYTE     ( 0xa5U )\r
 \r
 /*\r
  * Macros used by vListTask to indicate which state a task is in.\r
@@ -197,7 +197,7 @@ PRIVILEGED_DATA static portTickType xNextTaskUnblockTime                                            = ( portTickType )
        PRIVILEGED_DATA static signed char *pcTraceBufferStart;\r
        PRIVILEGED_DATA static signed char *pcTraceBufferEnd;\r
        PRIVILEGED_DATA static signed portBASE_TYPE xTracing = pdFALSE;\r
-       static unsigned portBASE_TYPE uxPreviousTask = 255;\r
+       static unsigned portBASE_TYPE uxPreviousTask = 255U;\r
        PRIVILEGED_DATA static char pcStatusString[ 50 ];\r
 \r
 #endif\r
@@ -248,14 +248,12 @@ PRIVILEGED_DATA static portTickType xNextTaskUnblockTime                                          = ( portTickType )
  * executing task, then it will only be rescheduled after the currently\r
  * executing task has been rescheduled.\r
  */\r
-#define prvAddTaskToReadyQueue( pxTCB )                                                                                                                                                        \\r
-{                                                                                                                                                                                                                              \\r
-       if( pxTCB->uxPriority > uxTopReadyPriority )                                                                                                                            \\r
-       {                                                                                                                                                                                                                       \\r
-               uxTopReadyPriority = pxTCB->uxPriority;                                                                                                                                 \\r
-       }                                                                                                                                                                                                                       \\r
-       vListInsertEnd( ( xList * ) &( pxReadyTasksLists[ pxTCB->uxPriority ] ), &( pxTCB->xGenericListItem ) );        \\r
-}\r
+#define prvAddTaskToReadyQueue( pxTCB )                                                                                                                                                                        \\r
+       if( ( pxTCB )->uxPriority > uxTopReadyPriority )                                                                                                                                        \\r
+       {                                                                                                                                                                                                                                       \\r
+               uxTopReadyPriority = ( pxTCB )->uxPriority;                                                                                                                                             \\r
+       }                                                                                                                                                                                                                                       \\r
+       vListInsertEnd( ( xList * ) &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xGenericListItem ) )\r
 /*-----------------------------------------------------------*/\r
 \r
 /*\r
@@ -326,9 +324,11 @@ portTickType xItemValue;                                                                                                                           \
  * task should be used in place of the parameter.  This macro simply checks to\r
  * see if the parameter is NULL and returns a pointer to the appropriate TCB.\r
  */\r
-#define prvGetTCBFromHandle( pxHandle ) ( ( pxHandle == NULL ) ? ( tskTCB * ) pxCurrentTCB : ( tskTCB * ) pxHandle )\r
-\r
+#define prvGetTCBFromHandle( pxHandle ) ( ( ( pxHandle ) == NULL ) ? ( tskTCB * ) pxCurrentTCB : ( tskTCB * ) ( pxHandle ) )\r
 \r
+/* Callback function prototypes. --------------------------*/\r
+extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName );\r
+               \r
 /* File private functions. --------------------------------*/\r
 \r
 /*\r
@@ -456,7 +456,7 @@ tskTCB * pxNewTCB;
                required by the port. */\r
                #if( portSTACK_GROWTH < 0 )\r
                {\r
-                       pxTopOfStack = pxNewTCB->pxStack + ( usStackDepth - 1 );\r
+                       pxTopOfStack = pxNewTCB->pxStack + ( usStackDepth - ( unsigned short ) 1 );\r
                        pxTopOfStack = ( portSTACK_TYPE * ) ( ( ( unsigned long ) pxTopOfStack ) & ( ( unsigned long ) ~portBYTE_ALIGNMENT_MASK  ) );\r
                }\r
                #else\r
@@ -497,7 +497,7 @@ tskTCB * pxNewTCB;
                \r
                /* We are going to manipulate the task queues to add this task to a\r
                ready list, so must make sure no interrupts occur. */\r
-               portENTER_CRITICAL();\r
+               taskENTER_CRITICAL();\r
                {\r
                        uxCurrentNumberOfTasks++;\r
                        if( pxCurrentTCB == NULL )\r
@@ -548,7 +548,7 @@ tskTCB * pxNewTCB;
                        xReturn = pdPASS;\r
                        traceTASK_CREATE( pxNewTCB );\r
                }\r
-               portEXIT_CRITICAL();\r
+               taskEXIT_CRITICAL();\r
        }\r
        else\r
        {\r
@@ -579,7 +579,7 @@ tskTCB * pxNewTCB;
        {\r
        tskTCB *pxTCB;\r
 \r
-               portENTER_CRITICAL();\r
+               taskENTER_CRITICAL();\r
                {\r
                        /* Ensure a yield is performed if the current task is being\r
                        deleted. */\r
@@ -616,7 +616,7 @@ tskTCB * pxNewTCB;
 \r
                        traceTASK_DELETE( pxTCB );\r
                }\r
-               portEXIT_CRITICAL();\r
+               taskEXIT_CRITICAL();\r
 \r
                /* Force a reschedule if we have just deleted the current task. */\r
                if( xSchedulerRunning != pdFALSE )\r
@@ -754,14 +754,14 @@ tskTCB * pxNewTCB;
        tskTCB *pxTCB;\r
        unsigned portBASE_TYPE uxReturn;\r
 \r
-               portENTER_CRITICAL();\r
+               taskENTER_CRITICAL();\r
                {\r
                        /* If null is passed in here then we are changing the\r
                        priority of the calling function. */\r
                        pxTCB = prvGetTCBFromHandle( pxTask );\r
                        uxReturn = pxTCB->uxPriority;\r
                }\r
-               portEXIT_CRITICAL();\r
+               taskEXIT_CRITICAL();\r
 \r
                return uxReturn;\r
        }\r
@@ -774,15 +774,16 @@ tskTCB * pxNewTCB;
        void vTaskPrioritySet( xTaskHandle pxTask, unsigned portBASE_TYPE uxNewPriority )\r
        {\r
        tskTCB *pxTCB;\r
-       unsigned portBASE_TYPE uxCurrentPriority, xYieldRequired = pdFALSE;\r
+       unsigned portBASE_TYPE uxCurrentPriority;\r
+       portBASE_TYPE xYieldRequired = pdFALSE;\r
 \r
                /* Ensure the new priority is valid. */\r
                if( uxNewPriority >= configMAX_PRIORITIES )\r
                {\r
-                       uxNewPriority = configMAX_PRIORITIES - 1;\r
+                       uxNewPriority = configMAX_PRIORITIES - ( unsigned portBASE_TYPE ) 1U;\r
                }\r
 \r
-               portENTER_CRITICAL();\r
+               taskENTER_CRITICAL();\r
                {\r
                        if( pxTask == pxCurrentTCB )\r
                        {\r
@@ -868,7 +869,7 @@ tskTCB * pxNewTCB;
                                }\r
                        }\r
                }\r
-               portEXIT_CRITICAL();\r
+               taskEXIT_CRITICAL();\r
        }\r
 \r
 #endif\r
@@ -880,7 +881,7 @@ tskTCB * pxNewTCB;
        {\r
        tskTCB *pxTCB;\r
 \r
-               portENTER_CRITICAL();\r
+               taskENTER_CRITICAL();\r
                {\r
                        /* Ensure a yield is performed if the current task is being\r
                        suspended. */\r
@@ -905,7 +906,7 @@ tskTCB * pxNewTCB;
 \r
                        vListInsertEnd( ( xList * ) &xSuspendedTaskList, &( pxTCB->xGenericListItem ) );\r
                }\r
-               portEXIT_CRITICAL();\r
+               taskEXIT_CRITICAL();\r
 \r
                if( ( void * ) pxTaskToSuspend == NULL )\r
                {\r
@@ -919,7 +920,7 @@ tskTCB * pxNewTCB;
                                /* The scheduler is not running, but the task that was pointed\r
                                to by pxCurrentTCB has just been suspended and pxCurrentTCB\r
                                must be adjusted to point to a different task. */\r
-                               if( uxCurrentNumberOfTasks == 1 )\r
+                               if( uxCurrentNumberOfTasks == ( unsigned portBASE_TYPE ) 1U )\r
                                {\r
                                        /* No other tasks are defined, so set pxCurrentTCB back to\r
                                        NULL so when the next task is created pxCurrentTCB will\r
@@ -983,7 +984,7 @@ tskTCB * pxNewTCB;
                currently executing task. */\r
                if( ( pxTCB != NULL ) && ( pxTCB != pxCurrentTCB ) )\r
                {\r
-                       portENTER_CRITICAL();\r
+                       taskENTER_CRITICAL();\r
                        {\r
                                if( xTaskIsTaskSuspended( pxTCB ) == pdTRUE )\r
                                {\r
@@ -1003,7 +1004,7 @@ tskTCB * pxNewTCB;
                                        }\r
                                }\r
                        }\r
-                       portEXIT_CRITICAL();\r
+                       taskEXIT_CRITICAL();\r
                }\r
        }\r
 \r
@@ -1123,7 +1124,7 @@ signed portBASE_TYPE xAlreadyYielded = pdFALSE;
        removed task will have been added to the xPendingReadyList.  Once the\r
        scheduler has been resumed it is safe to move all the pending ready\r
        tasks from this list into their appropriate ready list. */\r
-       portENTER_CRITICAL();\r
+       taskENTER_CRITICAL();\r
        {\r
                --uxSchedulerSuspended;\r
 \r
@@ -1180,7 +1181,7 @@ signed portBASE_TYPE xAlreadyYielded = pdFALSE;
                        }\r
                }\r
        }\r
-       portEXIT_CRITICAL();\r
+       taskEXIT_CRITICAL();\r
 \r
        return xAlreadyYielded;\r
 }\r
@@ -1201,11 +1202,11 @@ portTickType xTaskGetTickCount( void )
 portTickType xTicks;\r
 \r
        /* Critical section required if running on a 16 bit processor. */\r
-       portENTER_CRITICAL();\r
+       taskENTER_CRITICAL();\r
        {\r
                xTicks = xTickCount;\r
        }\r
-       portEXIT_CRITICAL();\r
+       taskEXIT_CRITICAL();\r
 \r
        return xTicks;\r
 }\r
@@ -1239,10 +1240,10 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
                        /* Run through all the lists that could potentially contain a TCB and\r
                        report the task name, state and stack high water mark. */\r
 \r
-                       pcWriteBuffer[ 0 ] = ( signed char ) 0x00;\r
+                       *pcWriteBuffer = ( signed char ) 0x00;\r
                        strcat( ( char * ) pcWriteBuffer, ( const char * ) "\r\n" );\r
 \r
-                       uxQueue = uxTopUsedPriority + 1;\r
+                       uxQueue = uxTopUsedPriority + ( unsigned portBASE_TYPE ) 1U;\r
 \r
                        do\r
                        {\r
@@ -1314,10 +1315,10 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
                        generating a table of run timer percentages in the provided\r
                        buffer. */\r
 \r
-                       pcWriteBuffer[ 0 ] = ( signed char ) 0x00;\r
+                       *pcWriteBuffer = ( signed char ) 0x00;\r
                        strcat( ( char * ) pcWriteBuffer, ( const char * ) "\r\n" );\r
 \r
-                       uxQueue = uxTopUsedPriority + 1;\r
+                       uxQueue = uxTopUsedPriority + ( unsigned portBASE_TYPE ) 1U;\r
 \r
                        do\r
                        {\r
@@ -1367,14 +1368,14 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
 \r
        void vTaskStartTrace( signed char * pcBuffer, unsigned long ulBufferSize )\r
        {\r
-               portENTER_CRITICAL();\r
+               taskENTER_CRITICAL();\r
                {\r
                        pcTraceBuffer = ( signed char * )pcBuffer;\r
                        pcTraceBufferStart = pcBuffer;\r
                        pcTraceBufferEnd = pcBuffer + ( ulBufferSize - tskSIZE_OF_EACH_TRACE_LINE );\r
                        xTracing = pdTRUE;\r
                }\r
-               portEXIT_CRITICAL();\r
+               taskEXIT_CRITICAL();\r
        }\r
 \r
 #endif\r
@@ -1386,9 +1387,9 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void )
        {\r
        unsigned long ulBufferLength;\r
 \r
-               portENTER_CRITICAL();\r
+               taskENTER_CRITICAL();\r
                        xTracing = pdFALSE;\r
-               portEXIT_CRITICAL();\r
+               taskEXIT_CRITICAL();\r
 \r
                ulBufferLength = ( unsigned long ) ( pcTraceBuffer - pcTraceBufferStart );\r
 \r
@@ -1426,8 +1427,8 @@ void vTaskIncrementTick( void )
                        xNumOfOverflows++;\r
                        if( listLIST_IS_EMPTY( pxDelayedTaskList ) != pdFALSE )\r
                        {\r
-                               /* The delayed list is empty.  Set xNextTaskUnblockTime to the \r
-                               maximum possible value so it is extremely unlikely that the \r
+                               /* The delayed list is empty.  Set xNextTaskUnblockTime to the\r
+                               maximum possible value so it is extremely unlikely that the\r
                                if( xTickCount >= xNextTaskUnblockTime ) test will pass\r
                                until there is an item in the delayed list. */\r
                                xNextTaskUnblockTime = portMAX_DELAY;\r
@@ -1436,7 +1437,7 @@ void vTaskIncrementTick( void )
                        {\r
                                tskTCB * pxTCB;\r
 \r
-                               /* The delayed list is not empty, get the value of the item at \r
+                               /* The delayed list is not empty, get the value of the item at\r
                                the head of the delayed list.  This is the time at which the\r
                                task at the head of the delayed list should be removed from\r
                                the Blocked state. */\r
@@ -1551,9 +1552,9 @@ void vTaskIncrementTick( void )
 \r
                /* Save the hook function in the TCB.  A critical section is required as\r
                the value can be accessed from an interrupt. */\r
-               portENTER_CRITICAL();\r
+               taskENTER_CRITICAL();\r
                        xTCB->pxTaskTag = pxTagValue;\r
-               portEXIT_CRITICAL();\r
+               taskEXIT_CRITICAL();\r
        }\r
 \r
 #endif\r
@@ -1578,9 +1579,9 @@ void vTaskIncrementTick( void )
 \r
                /* Save the hook function in the TCB.  A critical section is required as\r
                the value can be accessed from an interrupt. */\r
-               portENTER_CRITICAL();\r
+               taskENTER_CRITICAL();\r
                        xReturn = xTCB->pxTaskTag;\r
-               portEXIT_CRITICAL();\r
+               taskEXIT_CRITICAL();\r
 \r
                return xReturn;\r
        }\r
@@ -1627,46 +1628,47 @@ void vTaskSwitchContext( void )
                /* The scheduler is currently suspended - do not allow a context\r
                switch. */\r
                xMissedYield = pdTRUE;\r
-               return;\r
        }\r
-\r
-       traceTASK_SWITCHED_OUT();\r
-\r
-       #if ( configGENERATE_RUN_TIME_STATS == 1 )\r
-       {\r
-               unsigned long ulTempCounter;\r
-               \r
-                       #ifdef portALT_GET_RUN_TIME_COUNTER_VALUE\r
-                               portALT_GET_RUN_TIME_COUNTER_VALUE( ulTempCounter );\r
-                       #else\r
-                               ulTempCounter = portGET_RUN_TIME_COUNTER_VALUE();\r
-                       #endif\r
-\r
-                       /* Add the amount of time the task has been running to the accumulated\r
-                       time so far.  The time the task started running was stored in\r
-                       ulTaskSwitchedInTime.  Note that there is no overflow protection here\r
-                       so count values are only valid until the timer overflows.  Generally\r
-                       this will be about 1 hour assuming a 1uS timer increment. */\r
-                       pxCurrentTCB->ulRunTimeCounter += ( ulTempCounter - ulTaskSwitchedInTime );\r
-                       ulTaskSwitchedInTime = ulTempCounter;\r
-       }\r
-       #endif\r
-\r
-       taskFIRST_CHECK_FOR_STACK_OVERFLOW();\r
-       taskSECOND_CHECK_FOR_STACK_OVERFLOW();\r
-\r
-       /* Find the highest priority queue that contains ready tasks. */\r
-       while( listLIST_IS_EMPTY( &( pxReadyTasksLists[ uxTopReadyPriority ] ) ) )\r
+       else\r
        {\r
-               --uxTopReadyPriority;\r
+               traceTASK_SWITCHED_OUT();\r
+       \r
+               #if ( configGENERATE_RUN_TIME_STATS == 1 )\r
+               {\r
+                       unsigned long ulTempCounter;\r
+                       \r
+                               #ifdef portALT_GET_RUN_TIME_COUNTER_VALUE\r
+                                       portALT_GET_RUN_TIME_COUNTER_VALUE( ulTempCounter );\r
+                               #else\r
+                                       ulTempCounter = portGET_RUN_TIME_COUNTER_VALUE();\r
+                               #endif\r
+       \r
+                               /* Add the amount of time the task has been running to the accumulated\r
+                               time so far.  The time the task started running was stored in\r
+                               ulTaskSwitchedInTime.  Note that there is no overflow protection here\r
+                               so count values are only valid until the timer overflows.  Generally\r
+                               this will be about 1 hour assuming a 1uS timer increment. */\r
+                               pxCurrentTCB->ulRunTimeCounter += ( ulTempCounter - ulTaskSwitchedInTime );\r
+                               ulTaskSwitchedInTime = ulTempCounter;\r
+               }\r
+               #endif\r
+       \r
+               taskFIRST_CHECK_FOR_STACK_OVERFLOW();\r
+               taskSECOND_CHECK_FOR_STACK_OVERFLOW();\r
+       \r
+               /* Find the highest priority queue that contains ready tasks. */\r
+               while( listLIST_IS_EMPTY( &( pxReadyTasksLists[ uxTopReadyPriority ] ) ) )\r
+               {\r
+                       --uxTopReadyPriority;\r
+               }\r
+       \r
+               /* listGET_OWNER_OF_NEXT_ENTRY walks through the list, so the tasks of the\r
+               same priority get an equal share of the processor time. */\r
+               listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopReadyPriority ] ) );\r
+       \r
+               traceTASK_SWITCHED_IN();\r
+               vWriteTraceToBuffer();\r
        }\r
-\r
-       /* listGET_OWNER_OF_NEXT_ENTRY walks through the list, so the tasks of the\r
-       same priority get an equal share of the processor time. */\r
-       listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopReadyPriority ] ) );\r
-\r
-       traceTASK_SWITCHED_IN();\r
-       vWriteTraceToBuffer();\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -1730,7 +1732,7 @@ portBASE_TYPE xReturn;
 \r
        If an event is for a queue that is locked then this function will never\r
        get called - the lock count on the queue will get modified instead.  This\r
-       means we can always expect exclusive access to the event list here. \r
+       means we can always expect exclusive access to the event list here.\r
        \r
        This function assumes that a check has already been made to ensure that\r
        pxEventList is not empty. */\r
@@ -1777,7 +1779,7 @@ portBASE_TYPE xTaskCheckForTimeOut( xTimeOutType * const pxTimeOut, portTickType
 {\r
 portBASE_TYPE xReturn;\r
 \r
-       portENTER_CRITICAL();\r
+       taskENTER_CRITICAL();\r
        {\r
                #if ( INCLUDE_vTaskSuspend == 1 )\r
                        /* If INCLUDE_vTaskSuspend is set to 1 and the block time specified is\r
@@ -1810,7 +1812,7 @@ portBASE_TYPE xReturn;
                        xReturn = pdTRUE;\r
                }\r
        }\r
-       portEXIT_CRITICAL();\r
+       taskEXIT_CRITICAL();\r
 \r
        return xReturn;\r
 }\r
@@ -1906,13 +1908,13 @@ static void prvInitialiseTCBVariables( tskTCB *pxTCB, const signed char * const
                strncpy( ( char * ) pxTCB->pcTaskName, ( const char * ) pcName, ( unsigned short ) configMAX_TASK_NAME_LEN );\r
        }\r
        #endif\r
-       pxTCB->pcTaskName[ ( unsigned short ) configMAX_TASK_NAME_LEN - ( unsigned short ) 1 ] = '\0';\r
+       pxTCB->pcTaskName[ ( unsigned short ) configMAX_TASK_NAME_LEN - ( unsigned short ) 1 ] = ( signed char ) '\0';\r
 \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
        {\r
-               uxPriority = configMAX_PRIORITIES - 1;\r
+               uxPriority = configMAX_PRIORITIES - ( unsigned portBASE_TYPE ) 1U;\r
        }\r
 \r
        pxTCB->uxPriority = uxPriority;\r
@@ -1987,7 +1989,7 @@ static void prvInitialiseTaskLists( void )
 {\r
 unsigned portBASE_TYPE uxPriority;\r
 \r
-       for( uxPriority = 0; uxPriority < configMAX_PRIORITIES; uxPriority++ )\r
+       for( uxPriority = ( unsigned portBASE_TYPE ) 0U; uxPriority < configMAX_PRIORITIES; uxPriority++ )\r
        {\r
                vListInitialise( ( xList * ) &( pxReadyTasksLists[ uxPriority ] ) );\r
        }\r
@@ -2033,14 +2035,14 @@ static void prvCheckTasksWaitingTermination( void )
                        {\r
                                tskTCB *pxTCB;\r
 \r
-                               portENTER_CRITICAL();\r
+                               taskENTER_CRITICAL();\r
                                {\r
                                        pxTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( ( ( xList * ) &xTasksWaitingTermination ) );\r
                                        vListRemove( &( pxTCB->xGenericListItem ) );\r
                                        --uxCurrentNumberOfTasks;\r
                                        --uxTasksDeleted;\r
                                }\r
-                               portEXIT_CRITICAL();\r
+                               taskEXIT_CRITICAL();\r
 \r
                                prvDeleteTCB( pxTCB );\r
                        }\r
@@ -2165,7 +2167,7 @@ tskTCB *pxNewTCB;
                                else\r
                                {\r
                                        /* What percentage of the total run time has the task used?\r
-                                       This will always be rounded down to the nearest integer. \r
+                                       This will always be rounded down to the nearest integer.\r
                                        ulTotalRunTime has already been divided by 100. */\r
                                        ulStatsAsPercentage = pxNextTCB->ulRunTimeCounter / ulTotalRunTime;\r
 \r