Make changes required for MISRA 2004 compliance.
diff --git a/Source/include/FreeRTOS.h b/Source/include/FreeRTOS.h
index f440a16..64b8f63 100644
--- a/Source/include/FreeRTOS.h
+++ b/Source/include/FreeRTOS.h
@@ -415,7 +415,7 @@
 #endif

 

 #ifndef pvPortMallocAligned

-	#define pvPortMallocAligned( x, puxStackBuffer ) ( ( puxStackBuffer == NULL ) ? ( pvPortMalloc( x ) ) : ( puxStackBuffer ) )

+	#define pvPortMallocAligned( x, puxStackBuffer ) ( ( ( puxStackBuffer ) == NULL ) ? ( pvPortMalloc( ( x ) ) ) : ( puxStackBuffer ) )

 #endif

 

 #ifndef vPortFreeAligned

diff --git a/Source/include/StackMacros.h b/Source/include/StackMacros.h
index 00645e8..902738c 100644
--- a/Source/include/StackMacros.h
+++ b/Source/include/StackMacros.h
@@ -93,8 +93,6 @@
 	/* Only the current stack state is to be checked. */

 	#define taskFIRST_CHECK_FOR_STACK_OVERFLOW()														\

 	{																									\

-	extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName );			\

-																										\

 		/* Is the currently saved stack pointer within the stack limit? */								\

 		if( pxCurrentTCB->pxTopOfStack <= pxCurrentTCB->pxStack )										\

 		{																								\

@@ -110,7 +108,6 @@
 	/* Only the current stack state is to be checked. */

 	#define taskFIRST_CHECK_FOR_STACK_OVERFLOW()														\

 	{																									\

-	extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName );			\

 																										\

 		/* Is the currently saved stack pointer within the stack limit? */								\

 		if( pxCurrentTCB->pxTopOfStack >= pxCurrentTCB->pxEndOfStack )									\

@@ -124,21 +121,20 @@
 

 #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) && ( portSTACK_GROWTH < 0 ) )

 

-	#define taskSECOND_CHECK_FOR_STACK_OVERFLOW()																									\

-	{																																				\

-	extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName );														\

-	static const unsigned char ucExpectedStackBytes[] = {	tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,			\

-																tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,		\

-																tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,		\

-																tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,		\

-																tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE };	\

-																																					\

-																																					\

-		/* Has the extremity of the task stack ever been written over? */																			\

-		if( memcmp( ( void * ) pxCurrentTCB->pxStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 )						\

-		{																																			\

-			vApplicationStackOverflowHook( ( xTaskHandle ) pxCurrentTCB, pxCurrentTCB->pcTaskName );												\

-		}																																			\

+	#define taskSECOND_CHECK_FOR_STACK_OVERFLOW()																								\

+	{																																			\

+	static const unsigned char ucExpectedStackBytes[] = {	tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,		\

+															tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,		\

+															tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,		\

+															tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,		\

+															tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE };	\

+																																				\

+																																				\

+		/* Has the extremity of the task stack ever been written over? */																		\

+		if( memcmp( ( void * ) pxCurrentTCB->pxStack, ( void * ) ucExpectedStackBytes, sizeof( ucExpectedStackBytes ) ) != 0 )					\

+		{																																		\

+			vApplicationStackOverflowHook( ( xTaskHandle ) pxCurrentTCB, pxCurrentTCB->pcTaskName );											\

+		}																																		\

 	}

 

 #endif /* #if( configCHECK_FOR_STACK_OVERFLOW > 1 ) */

@@ -148,7 +144,6 @@
 

 	#define taskSECOND_CHECK_FOR_STACK_OVERFLOW()																									\

 	{																																				\

-	extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName );														\

 	char *pcEndOfStack = ( char * ) pxCurrentTCB->pxEndOfStack;																						\

 	static const unsigned char ucExpectedStackBytes[] = {	tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,			\

 																tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE, tskSTACK_FILL_BYTE,		\

diff --git a/Source/include/croutine.h b/Source/include/croutine.h
index 64c64a7..fec57c4 100644
--- a/Source/include/croutine.h
+++ b/Source/include/croutine.h
@@ -33,9 +33,9 @@
     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT

     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or

     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for

-    more details. You should have received a copy of the GNU General Public 

-    License and the FreeRTOS license exception along with FreeRTOS; if not it 

-    can be viewed here: http://www.freertos.org/a00114.html and also obtained 

+    more details. You should have received a copy of the GNU General Public

+    License and the FreeRTOS license exception along with FreeRTOS; if not it

+    can be viewed here: http://www.freertos.org/a00114.html and also obtained

     by writing to Richard Barry, contact details for whom are available on the

     FreeRTOS WEB site.

 

@@ -51,16 +51,13 @@
     licensing and training services.

 */

 

+#ifndef CO_ROUTINE_H

+#define CO_ROUTINE_H

+

 #ifndef INC_FREERTOS_H

 	#error "include FreeRTOS.h must appear in source files before include croutine.h"

 #endif

 

-

-

-

-#ifndef CO_ROUTINE_H

-#define CO_ROUTINE_H

-

 #include "list.h"

 

 #ifdef __cplusplus

@@ -230,7 +227,7 @@
  * \defgroup crSTART crSTART

  * \ingroup Tasks

  */

-#define crSTART( pxCRCB ) switch( ( ( corCRCB * )pxCRCB )->uxState ) { case 0:

+#define crSTART( pxCRCB ) switch( ( ( corCRCB * )( pxCRCB ) )->uxState ) { case 0:

 

 /**

  * croutine. h

@@ -267,8 +264,8 @@
  * These macros are intended for internal use by the co-routine implementation

  * only.  The macros should not be used directly by application writers.

  */

-#define crSET_STATE0( xHandle ) ( ( corCRCB * )xHandle)->uxState = (__LINE__ * 2); return; case (__LINE__ * 2):

-#define crSET_STATE1( xHandle ) ( ( corCRCB * )xHandle)->uxState = ((__LINE__ * 2)+1); return; case ((__LINE__ * 2)+1):

+#define crSET_STATE0( xHandle ) ( ( corCRCB * )( xHandle ) )->uxState = (__LINE__ * 2); return; case (__LINE__ * 2):

+#define crSET_STATE1( xHandle ) ( ( corCRCB * )( xHandle ) )->uxState = ((__LINE__ * 2)+1); return; case ((__LINE__ * 2)+1):

 

 /**

  * croutine. h

@@ -317,11 +314,11 @@
  * \ingroup Tasks

  */

 #define crDELAY( xHandle, xTicksToDelay )												\

-	if( xTicksToDelay > 0 )																\

+	if( ( xTicksToDelay ) > 0 )															\

 	{																					\

-		vCoRoutineAddToDelayedList( xTicksToDelay, NULL );								\

+		vCoRoutineAddToDelayedList( ( xTicksToDelay ), NULL );							\

 	}																					\

-	crSET_STATE0( xHandle );

+	crSET_STATE0( ( xHandle ) );

 

 /**

  * <pre>

@@ -408,15 +405,15 @@
  */

 #define crQUEUE_SEND( xHandle, pxQueue, pvItemToQueue, xTicksToWait, pxResult )			\

 {																						\

-	*pxResult = xQueueCRSend( pxQueue, pvItemToQueue, xTicksToWait );					\

+	*( pxResult ) = xQueueCRSend( ( pxQueue) , ( pvItemToQueue) , ( xTicksToWait ) );	\

 	if( *pxResult == errQUEUE_BLOCKED )													\

 	{																					\

-		crSET_STATE0( xHandle );														\

-		*pxResult = xQueueCRSend( pxQueue, pvItemToQueue, 0 );							\

+		crSET_STATE0( ( xHandle ) );													\

+		*pxResult = xQueueCRSend( ( pxQueue ), ( pvItemToQueue ), 0 );					\

 	}																					\

 	if( *pxResult == errQUEUE_YIELD )													\

 	{																					\

-		crSET_STATE1( xHandle );														\

+		crSET_STATE1( ( xHandle ) );													\

 		*pxResult = pdPASS;																\

 	}																					\

 }

@@ -500,16 +497,16 @@
  */

 #define crQUEUE_RECEIVE( xHandle, pxQueue, pvBuffer, xTicksToWait, pxResult )			\

 {																						\

-	*pxResult = xQueueCRReceive( pxQueue, pvBuffer, xTicksToWait );						\

-	if( *pxResult == errQUEUE_BLOCKED ) 												\

+	*( pxResult ) = xQueueCRReceive( ( pxQueue) , ( pvBuffer ), ( xTicksToWait ) );		\

+	if( *( pxResult ) == errQUEUE_BLOCKED ) 											\

 	{																					\

-		crSET_STATE0( xHandle );														\

-		*pxResult = xQueueCRReceive( pxQueue, pvBuffer, 0 );							\

+		crSET_STATE0( ( xHandle ) );													\

+		*( pxResult ) = xQueueCRReceive( ( pxQueue) , ( pvBuffer ), 0 );				\

 	}																					\

-	if( *pxResult == errQUEUE_YIELD )													\

+	if( *( pxResult ) == errQUEUE_YIELD )												\

 	{																					\

-		crSET_STATE1( xHandle );														\

-		*pxResult = pdPASS;																\

+		crSET_STATE1( ( xHandle ) );													\

+		*( pxResult ) = pdPASS;															\

 	}																					\

 }

 

@@ -607,7 +604,7 @@
  * \defgroup crQUEUE_SEND_FROM_ISR crQUEUE_SEND_FROM_ISR

  * \ingroup Tasks

  */

-#define crQUEUE_SEND_FROM_ISR( pxQueue, pvItemToQueue, xCoRoutinePreviouslyWoken ) xQueueCRSendFromISR( pxQueue, pvItemToQueue, xCoRoutinePreviouslyWoken )

+#define crQUEUE_SEND_FROM_ISR( pxQueue, pvItemToQueue, xCoRoutinePreviouslyWoken ) xQueueCRSendFromISR( ( pxQueue ), ( pvItemToQueue ), ( xCoRoutinePreviouslyWoken ) )

 

 

 /**

@@ -720,7 +717,7 @@
  * \defgroup crQUEUE_RECEIVE_FROM_ISR crQUEUE_RECEIVE_FROM_ISR

  * \ingroup Tasks

  */

-#define crQUEUE_RECEIVE_FROM_ISR( pxQueue, pvBuffer, pxCoRoutineWoken ) xQueueCRReceiveFromISR( pxQueue, pvBuffer, pxCoRoutineWoken )

+#define crQUEUE_RECEIVE_FROM_ISR( pxQueue, pvBuffer, pxCoRoutineWoken ) xQueueCRReceiveFromISR( ( pxQueue ), ( pvBuffer ), ( pxCoRoutineWoken ) )

 

 /*

  * This function is intended for internal use by the co-routine macros only.

diff --git a/Source/include/list.h b/Source/include/list.h
index ec1d08c..5a8b439 100644
--- a/Source/include/list.h
+++ b/Source/include/list.h
@@ -33,9 +33,9 @@
     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT

     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or

     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for

-    more details. You should have received a copy of the GNU General Public 

-    License and the FreeRTOS license exception along with FreeRTOS; if not it 

-    can be viewed here: http://www.freertos.org/a00114.html and also obtained 

+    more details. You should have received a copy of the GNU General Public

+    License and the FreeRTOS license exception along with FreeRTOS; if not it

+    can be viewed here: http://www.freertos.org/a00114.html and also obtained

     by writing to Richard Barry, contact details for whom are available on the

     FreeRTOS WEB site.

 

@@ -130,7 +130,7 @@
  * \page listSET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER

  * \ingroup LinkedList

  */

-#define listSET_LIST_ITEM_OWNER( pxListItem, pxOwner )		( pxListItem )->pvOwner = ( void * ) pxOwner

+#define listSET_LIST_ITEM_OWNER( pxListItem, pxOwner )		( pxListItem )->pvOwner = ( void * ) ( pxOwner )

 

 /*

  * Access macro to set the value of the list item.  In most cases the value is

@@ -139,7 +139,7 @@
  * \page listSET_LIST_ITEM_VALUE listSET_LIST_ITEM_VALUE

  * \ingroup LinkedList

  */

-#define listSET_LIST_ITEM_VALUE( pxListItem, xValue )		( pxListItem )->xItemValue = xValue

+#define listSET_LIST_ITEM_VALUE( pxListItem, xValue )		( pxListItem )->xItemValue = ( xValue )

 

 /*

  * Access macro the retrieve the value of the list item.  The value can

@@ -186,7 +186,7 @@
  */

 #define listGET_OWNER_OF_NEXT_ENTRY( pxTCB, pxList )									\

 {																						\

-xList * const pxConstList = pxList;														\

+xList * const pxConstList = ( pxList );													\

 	/* Increment the index to the next item and return the item, ensuring */			\

 	/* we don't return the marker used at the end of the list.  */						\

 	( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext;						\

@@ -194,7 +194,7 @@
 	{																					\

 		( pxConstList )->pxIndex = ( pxConstList )->pxIndex->pxNext;					\

 	}																					\

-	pxTCB = ( pxConstList )->pxIndex->pvOwner;											\

+	( pxTCB ) = ( pxConstList )->pxIndex->pvOwner;										\

 }

 

 

@@ -214,7 +214,7 @@
  * \page listGET_OWNER_OF_HEAD_ENTRY listGET_OWNER_OF_HEAD_ENTRY

  * \ingroup LinkedList

  */

-#define listGET_OWNER_OF_HEAD_ENTRY( pxList )  ( (&( pxList->xListEnd ))->pxNext->pvOwner )

+#define listGET_OWNER_OF_HEAD_ENTRY( pxList )  ( (&( ( pxList )->xListEnd ))->pxNext->pvOwner )

 

 /*

  * Check to see if a list item is within a list.  The list item maintains a

@@ -226,7 +226,7 @@
  * @return pdTRUE is the list item is in the list, otherwise pdFALSE.

  * pointer against

  */

-#define listIS_CONTAINED_WITHIN( pxList, pxListItem ) ( ( pxListItem )->pvContainer == ( void * ) pxList )

+#define listIS_CONTAINED_WITHIN( pxList, pxListItem ) ( ( pxListItem )->pvContainer == ( void * ) ( pxList ) )

 

 /*

  * Must be called before a list is used!  This initialises all the members

diff --git a/Source/include/queue.h b/Source/include/queue.h
index 53790f6..b044d04 100644
--- a/Source/include/queue.h
+++ b/Source/include/queue.h
@@ -469,7 +469,7 @@
  * \defgroup xQueueSend xQueueSend

  * \ingroup QueueManagement

  */

-signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition );

+signed portBASE_TYPE xQueueGenericSend( xQueueHandle pxQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition );

 

 /**

  * queue. h

@@ -784,7 +784,7 @@
  * \page vQueueDelete vQueueDelete

  * \ingroup QueueManagement

  */

-void vQueueDelete( xQueueHandle xQueue );

+void vQueueDelete( xQueueHandle pxQueue );

 

 /**

  * queue. h

@@ -1223,8 +1223,8 @@
  * For internal use only.  Use xSemaphoreTakeMutexRecursive() or

  * xSemaphoreGiveMutexRecursive() instead of calling these functions directly.

  */

-portBASE_TYPE xQueueTakeMutexRecursive( xQueueHandle xMutex, portTickType xBlockTime );

-portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle xMutex );

+portBASE_TYPE xQueueTakeMutexRecursive( xQueueHandle pxMutex, portTickType xBlockTime );

+portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle pxMutex );

 

 /*

  * The registry is provided as a means for kernel aware debuggers to

diff --git a/Source/include/task.h b/Source/include/task.h
index 1f29ef4..fbffae7 100644
--- a/Source/include/task.h
+++ b/Source/include/task.h
@@ -52,15 +52,13 @@
 */

 

 

+#ifndef TASK_H

+#define TASK_H

+

 #ifndef INC_FREERTOS_H

 	#error "include FreeRTOS.h must appear in source files before include task.h"

 #endif

 

-

-

-#ifndef TASK_H

-#define TASK_H

-

 #include "portable.h"

 #include "list.h"

 

@@ -427,8 +425,7 @@
  * \defgroup vTaskDelete vTaskDelete

  * \ingroup Tasks

  */

-void vTaskDelete( xTaskHandle pxTask ) PRIVILEGED_FUNCTION;

-

+void vTaskDelete( xTaskHandle pxTaskToDelete ) PRIVILEGED_FUNCTION;

 

 /*-----------------------------------------------------------

  * TASK CONTROL API

@@ -1103,7 +1100,7 @@
  *

  * Returns the high water mark of the stack associated with xTask.  That is,

  * the minimum free stack space there has been (in words, so on a 32 bit machine

- * a value of 1 means 4 bytes) since the task started.  The smaller the returned 

+ * a value of 1 means 4 bytes) since the task started.  The smaller the returned

  * number the closer the task has come to overflowing its stack.

  *

  * @param xTask Handle of the task associated with the stack to be checked.

@@ -1278,7 +1275,7 @@
  * Generic version of the task creation function which is in turn called by the

  * xTaskCreate() and xTaskCreateRestricted() macros.

  */

-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;

+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;

 

 #ifdef __cplusplus

 }

diff --git a/Source/list.c b/Source/list.c
index 89562dc..4b0a3cd 100644
--- a/Source/list.c
+++ b/Source/list.c
@@ -33,9 +33,9 @@
     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT

     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or

     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for

-    more details. You should have received a copy of the GNU General Public 

-    License and the FreeRTOS license exception along with FreeRTOS; if not it 

-    can be viewed here: http://www.freertos.org/a00114.html and also obtained 

+    more details. You should have received a copy of the GNU General Public

+    License and the FreeRTOS license exception along with FreeRTOS; if not it

+    can be viewed here: http://www.freertos.org/a00114.html and also obtained

     by writing to Richard Barry, contact details for whom are available on the

     FreeRTOS WEB site.

 

@@ -76,7 +76,7 @@
 	pxList->xListEnd.pxNext = ( xListItem * ) &( pxList->xListEnd );

 	pxList->xListEnd.pxPrevious = ( xListItem * ) &( pxList->xListEnd );

 

-	pxList->uxNumberOfItems = 0;

+	pxList->uxNumberOfItems = ( unsigned portBASE_TYPE ) 0U;

 }

 /*-----------------------------------------------------------*/

 

@@ -121,9 +121,9 @@
 	/* If the list already contains a list item with the same item value then

 	the new list item should be placed after it.  This ensures that TCB's which

 	are stored in ready lists (all of which have the same ulListItem value)

-	get an equal share of the CPU.  However, if the xItemValue is the same as 

+	get an equal share of the CPU.  However, if the xItemValue is the same as

 	the back marker the iteration loop below will not end.  This means we need

-	to guard against this by checking the value first and modifying the 

+	to guard against this by checking the value first and modifying the

 	algorithm slightly if necessary. */

 	if( xValueOfInsertion == portMAX_DELAY )

 	{

@@ -133,18 +133,18 @@
 	{

 		/* *** NOTE ***********************************************************

 		If you find your application is crashing here then likely causes are:

-			1) Stack overflow - 

+			1) Stack overflow -

 			   see http://www.freertos.org/Stacks-and-stack-overflow-checking.html

-			2) Incorrect interrupt priority assignment, especially on Cortex-M3 

-			   parts where numerically high priority values denote low actual 

-			   interrupt priories, which can seem counter intuitive.  See 

+			2) Incorrect interrupt priority assignment, especially on Cortex-M3

+			   parts where numerically high priority values denote low actual

+			   interrupt priories, which can seem counter intuitive.  See

 			   configMAX_SYSCALL_INTERRUPT_PRIORITY on http://www.freertos.org/a00110.html

 			3) Calling an API function from within a critical section or when

 			   the scheduler is suspended.

 			4) Using a queue or semaphore before it has been initialised or

 			   before the scheduler has been started (are interrupts firing

 			   before vTaskStartScheduler() has been called?).

-		See http://www.freertos.org/FAQHelp.html for more tips. 

+		See http://www.freertos.org/FAQHelp.html for more tips.

 		**********************************************************************/

 		

 		for( pxIterator = ( xListItem * ) &( pxList->xListEnd ); pxIterator->pxNext->xItemValue <= xValueOfInsertion; pxIterator = pxIterator->pxNext )

diff --git a/Source/portable/IAR/RX600/portmacro.h b/Source/portable/IAR/RX600/portmacro.h
index 968cb90..e4b26a1 100644
--- a/Source/portable/IAR/RX600/portmacro.h
+++ b/Source/portable/IAR/RX600/portmacro.h
@@ -99,15 +99,15 @@
 /* The location of the software interrupt register.  Software interrupts use

 vector 27. */

 #define portITU_SWINTR			( ( unsigned char * ) 0x000872E0 )

-#define portYIELD()				*portITU_SWINTR = 0x01; portNOP(); portNOP(); portNOP(); portNOP(); portNOP()

-#define portYIELD_FROM_ISR( x )	if( x != pdFALSE ) portYIELD()

+#define portYIELD()				*portITU_SWINTR = ( unsigned char ) 0x01; portNOP(); portNOP(); portNOP(); portNOP(); portNOP()

+#define portYIELD_FROM_ISR( x )	if( ( x ) != pdFALSE ) portYIELD()

 

 /*

  * These macros should be called directly, but through the taskENTER_CRITICAL()

  * and taskEXIT_CRITICAL() macros.

  */

-#define portENABLE_INTERRUPTS() 	__set_interrupt_level( 0 )

-#define portDISABLE_INTERRUPTS() 	__set_interrupt_level( configMAX_SYSCALL_INTERRUPT_PRIORITY )

+#define portENABLE_INTERRUPTS() 	__set_interrupt_level( ( unsigned char ) 0 )

+#define portDISABLE_INTERRUPTS() 	__set_interrupt_level( ( unsigned char ) configMAX_SYSCALL_INTERRUPT_PRIORITY )

 

 /* Critical nesting counts are stored in the TCB. */

 #define portCRITICAL_NESTING_IN_TCB ( 1 )

@@ -115,14 +115,14 @@
 /* The critical nesting functions defined within tasks.c. */

 extern void vTaskEnterCritical( void );

 extern void vTaskExitCritical( void );

-#define portENTER_CRITICAL()	vTaskEnterCritical();

-#define portEXIT_CRITICAL()		vTaskExitCritical();

+#define portENTER_CRITICAL()	vTaskEnterCritical()

+#define portEXIT_CRITICAL()		vTaskExitCritical()

 

 /* As this port allows interrupt nesting... */

 unsigned long ulPortGetIPL( void );

 void vPortSetIPL( unsigned long ulNewIPL );

 #define portSET_INTERRUPT_MASK_FROM_ISR() __get_interrupt_level(); portDISABLE_INTERRUPTS()

-#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ) __set_interrupt_level( uxSavedInterruptStatus )

+#define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedInterruptStatus ) __set_interrupt_level( ( unsigned char ) ( uxSavedInterruptStatus ) )

 

 /*-----------------------------------------------------------*/

 

diff --git a/Source/queue.c b/Source/queue.c
index 30c30b0..2107b36 100644
--- a/Source/queue.c
+++ b/Source/queue.c
@@ -33,9 +33,9 @@
     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT

     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or

     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for

-    more details. You should have received a copy of the GNU General Public 

-    License and the FreeRTOS license exception along with FreeRTOS; if not it 

-    can be viewed here: http://www.freertos.org/a00114.html and also obtained 

+    more details. You should have received a copy of the GNU General Public

+    License and the FreeRTOS license exception along with FreeRTOS; if not it

+    can be viewed here: http://www.freertos.org/a00114.html and also obtained

     by writing to Richard Barry, contact details for whom are available on the

     FreeRTOS WEB site.

 

@@ -222,21 +222,19 @@
  * Macro to mark a queue as locked.  Locking a queue prevents an ISR from

  * accessing the queue event lists.

  */

-#define prvLockQueue( pxQueue )							\

-{														\

-	taskENTER_CRITICAL();								\

-	{													\

-		if( pxQueue->xRxLock == queueUNLOCKED )			\

-		{												\

-			pxQueue->xRxLock = queueLOCKED_UNMODIFIED;	\

-		}												\

-		if( pxQueue->xTxLock == queueUNLOCKED )			\

-		{												\

-			pxQueue->xTxLock = queueLOCKED_UNMODIFIED;	\

-		}												\

-	}													\

-	taskEXIT_CRITICAL();								\

-}

+#define prvLockQueue( pxQueue )								\

+	taskENTER_CRITICAL();									\

+	{														\

+		if( ( pxQueue )->xRxLock == queueUNLOCKED )			\

+		{													\

+			( pxQueue )->xRxLock = queueLOCKED_UNMODIFIED;	\

+		}													\

+		if( ( pxQueue )->xTxLock == queueUNLOCKED )			\

+		{													\

+			( pxQueue )->xTxLock = queueLOCKED_UNMODIFIED;	\

+		}													\

+	}														\

+	taskEXIT_CRITICAL()

 /*-----------------------------------------------------------*/

 

 

@@ -248,6 +246,7 @@
 {

 xQUEUE *pxNewQueue;

 size_t xQueueSizeInBytes;

+xQueueHandle xReturn = NULL;

 

 	/* Allocate the new queue structure. */

 	if( uxQueueLength > ( unsigned portBASE_TYPE ) 0 )

@@ -265,9 +264,9 @@
 				/* Initialise the queue members as described above where the

 				queue type is defined. */

 				pxNewQueue->pcTail = pxNewQueue->pcHead + ( uxQueueLength * uxItemSize );

-				pxNewQueue->uxMessagesWaiting = 0;

+				pxNewQueue->uxMessagesWaiting = ( unsigned portBASE_TYPE ) 0U;

 				pxNewQueue->pcWriteTo = pxNewQueue->pcHead;

-				pxNewQueue->pcReadFrom = pxNewQueue->pcHead + ( ( uxQueueLength - 1 ) * uxItemSize );

+				pxNewQueue->pcReadFrom = pxNewQueue->pcHead + ( ( uxQueueLength - ( unsigned portBASE_TYPE ) 1U ) * uxItemSize );

 				pxNewQueue->uxLength = uxQueueLength;

 				pxNewQueue->uxItemSize = uxItemSize;

 				pxNewQueue->xRxLock = queueUNLOCKED;

@@ -278,7 +277,7 @@
 				vListInitialise( &( pxNewQueue->xTasksWaitingToReceive ) );

 

 				traceQUEUE_CREATE( pxNewQueue );

-				return  pxNewQueue;

+				xReturn = pxNewQueue;

 			}

 			else

 			{

@@ -288,9 +287,7 @@
 		}

 	}

 

-	/* Will only reach here if we could not allocate enough memory or no memory

-	was required. */

-	return NULL;

+	return xReturn;

 }

 /*-----------------------------------------------------------*/

 

@@ -316,9 +313,9 @@
 			/* Each mutex has a length of 1 (like a binary semaphore) and

 			an item size of 0 as nothing is actually copied into or out

 			of the mutex. */

-			pxNewQueue->uxMessagesWaiting = 0;

-			pxNewQueue->uxLength = 1;

-			pxNewQueue->uxItemSize = 0;

+			pxNewQueue->uxMessagesWaiting = ( unsigned portBASE_TYPE ) 0U;

+			pxNewQueue->uxLength = ( unsigned portBASE_TYPE ) 1U;

+			pxNewQueue->uxItemSize = ( unsigned portBASE_TYPE ) 0U;

 			pxNewQueue->xRxLock = queueUNLOCKED;

 			pxNewQueue->xTxLock = queueUNLOCKED;

 

@@ -327,7 +324,7 @@
 			vListInitialise( &( pxNewQueue->xTasksWaitingToReceive ) );

 

 			/* Start with the semaphore in the expected state. */

-			xQueueGenericSend( pxNewQueue, NULL, 0, queueSEND_TO_BACK );

+			xQueueGenericSend( pxNewQueue, NULL, ( portTickType ) 0U, queueSEND_TO_BACK );

 

 			traceCREATE_MUTEX( pxNewQueue );

 		}

diff --git a/Source/tasks.c b/Source/tasks.c
index 965d0a0..201b062 100644
--- a/Source/tasks.c
+++ b/Source/tasks.c
@@ -177,7 +177,7 @@
  * The value used to fill the stack of a task when the task is created.  This

  * is used purely for checking the high water mark for tasks.

  */

-#define tskSTACK_FILL_BYTE	( 0xa5 )

+#define tskSTACK_FILL_BYTE	( 0xa5U )

 

 /*

  * Macros used by vListTask to indicate which state a task is in.

@@ -197,7 +197,7 @@
 	PRIVILEGED_DATA static signed char *pcTraceBufferStart;

 	PRIVILEGED_DATA static signed char *pcTraceBufferEnd;

 	PRIVILEGED_DATA static signed portBASE_TYPE xTracing = pdFALSE;

-	static unsigned portBASE_TYPE uxPreviousTask = 255;

+	static unsigned portBASE_TYPE uxPreviousTask = 255U;

 	PRIVILEGED_DATA static char pcStatusString[ 50 ];

 

 #endif

@@ -248,14 +248,12 @@
  * executing task, then it will only be rescheduled after the currently

  * executing task has been rescheduled.

  */

-#define prvAddTaskToReadyQueue( pxTCB )																			\

-{																												\

-	if( pxTCB->uxPriority > uxTopReadyPriority )																\

-	{																											\

-		uxTopReadyPriority = pxTCB->uxPriority;																	\

-	}																											\

-	vListInsertEnd( ( xList * ) &( pxReadyTasksLists[ pxTCB->uxPriority ] ), &( pxTCB->xGenericListItem ) );	\

-}

+#define prvAddTaskToReadyQueue( pxTCB )																					\

+	if( ( pxTCB )->uxPriority > uxTopReadyPriority )																	\

+	{																													\

+		uxTopReadyPriority = ( pxTCB )->uxPriority;																		\

+	}																													\

+	vListInsertEnd( ( xList * ) &( pxReadyTasksLists[ ( pxTCB )->uxPriority ] ), &( ( pxTCB )->xGenericListItem ) )

 /*-----------------------------------------------------------*/

 

 /*

@@ -326,9 +324,11 @@
  * task should be used in place of the parameter.  This macro simply checks to

  * see if the parameter is NULL and returns a pointer to the appropriate TCB.

  */

-#define prvGetTCBFromHandle( pxHandle ) ( ( pxHandle == NULL ) ? ( tskTCB * ) pxCurrentTCB : ( tskTCB * ) pxHandle )

+#define prvGetTCBFromHandle( pxHandle ) ( ( ( pxHandle ) == NULL ) ? ( tskTCB * ) pxCurrentTCB : ( tskTCB * ) ( pxHandle ) )

 

-

+/* Callback function prototypes. --------------------------*/

+extern void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName );

+		

 /* File private functions. --------------------------------*/

 

 /*

@@ -456,7 +456,7 @@
 		required by the port. */

 		#if( portSTACK_GROWTH < 0 )

 		{

-			pxTopOfStack = pxNewTCB->pxStack + ( usStackDepth - 1 );

+			pxTopOfStack = pxNewTCB->pxStack + ( usStackDepth - ( unsigned short ) 1 );

 			pxTopOfStack = ( portSTACK_TYPE * ) ( ( ( unsigned long ) pxTopOfStack ) & ( ( unsigned long ) ~portBYTE_ALIGNMENT_MASK  ) );

 		}

 		#else

@@ -497,7 +497,7 @@
 		

 		/* We are going to manipulate the task queues to add this task to a

 		ready list, so must make sure no interrupts occur. */

-		portENTER_CRITICAL();

+		taskENTER_CRITICAL();

 		{

 			uxCurrentNumberOfTasks++;

 			if( pxCurrentTCB == NULL )

@@ -548,7 +548,7 @@
 			xReturn = pdPASS;

 			traceTASK_CREATE( pxNewTCB );

 		}

-		portEXIT_CRITICAL();

+		taskEXIT_CRITICAL();

 	}

 	else

 	{

@@ -579,7 +579,7 @@
 	{

 	tskTCB *pxTCB;

 

-		portENTER_CRITICAL();

+		taskENTER_CRITICAL();

 		{

 			/* Ensure a yield is performed if the current task is being

 			deleted. */

@@ -616,7 +616,7 @@
 

 			traceTASK_DELETE( pxTCB );

 		}

-		portEXIT_CRITICAL();

+		taskEXIT_CRITICAL();

 

 		/* Force a reschedule if we have just deleted the current task. */

 		if( xSchedulerRunning != pdFALSE )

@@ -754,14 +754,14 @@
 	tskTCB *pxTCB;

 	unsigned portBASE_TYPE uxReturn;

 

-		portENTER_CRITICAL();

+		taskENTER_CRITICAL();

 		{

 			/* If null is passed in here then we are changing the

 			priority of the calling function. */

 			pxTCB = prvGetTCBFromHandle( pxTask );

 			uxReturn = pxTCB->uxPriority;

 		}

-		portEXIT_CRITICAL();

+		taskEXIT_CRITICAL();

 

 		return uxReturn;

 	}

@@ -774,15 +774,16 @@
 	void vTaskPrioritySet( xTaskHandle pxTask, unsigned portBASE_TYPE uxNewPriority )

 	{

 	tskTCB *pxTCB;

-	unsigned portBASE_TYPE uxCurrentPriority, xYieldRequired = pdFALSE;

+	unsigned portBASE_TYPE uxCurrentPriority;

+	portBASE_TYPE xYieldRequired = pdFALSE;

 

 		/* Ensure the new priority is valid. */

 		if( uxNewPriority >= configMAX_PRIORITIES )

 		{

-			uxNewPriority = configMAX_PRIORITIES - 1;

+			uxNewPriority = configMAX_PRIORITIES - ( unsigned portBASE_TYPE ) 1U;

 		}

 

-		portENTER_CRITICAL();

+		taskENTER_CRITICAL();

 		{

 			if( pxTask == pxCurrentTCB )

 			{

@@ -868,7 +869,7 @@
 				}

 			}

 		}

-		portEXIT_CRITICAL();

+		taskEXIT_CRITICAL();

 	}

 

 #endif

@@ -880,7 +881,7 @@
 	{

 	tskTCB *pxTCB;

 

-		portENTER_CRITICAL();

+		taskENTER_CRITICAL();

 		{

 			/* Ensure a yield is performed if the current task is being

 			suspended. */

@@ -905,7 +906,7 @@
 

 			vListInsertEnd( ( xList * ) &xSuspendedTaskList, &( pxTCB->xGenericListItem ) );

 		}

-		portEXIT_CRITICAL();

+		taskEXIT_CRITICAL();

 

 		if( ( void * ) pxTaskToSuspend == NULL )

 		{

@@ -919,7 +920,7 @@
 				/* The scheduler is not running, but the task that was pointed

 				to by pxCurrentTCB has just been suspended and pxCurrentTCB

 				must be adjusted to point to a different task. */

-				if( uxCurrentNumberOfTasks == 1 )

+				if( uxCurrentNumberOfTasks == ( unsigned portBASE_TYPE ) 1U )

 				{

 					/* No other tasks are defined, so set pxCurrentTCB back to

 					NULL so when the next task is created pxCurrentTCB will

@@ -983,7 +984,7 @@
 		currently executing task. */

 		if( ( pxTCB != NULL ) && ( pxTCB != pxCurrentTCB ) )

 		{

-			portENTER_CRITICAL();

+			taskENTER_CRITICAL();

 			{

 				if( xTaskIsTaskSuspended( pxTCB ) == pdTRUE )

 				{

@@ -1003,7 +1004,7 @@
 					}

 				}

 			}

-			portEXIT_CRITICAL();

+			taskEXIT_CRITICAL();

 		}

 	}

 

@@ -1123,7 +1124,7 @@
 	removed task will have been added to the xPendingReadyList.  Once the

 	scheduler has been resumed it is safe to move all the pending ready

 	tasks from this list into their appropriate ready list. */

-	portENTER_CRITICAL();

+	taskENTER_CRITICAL();

 	{

 		--uxSchedulerSuspended;

 

@@ -1180,7 +1181,7 @@
 			}

 		}

 	}

-	portEXIT_CRITICAL();

+	taskEXIT_CRITICAL();

 

 	return xAlreadyYielded;

 }

@@ -1201,11 +1202,11 @@
 portTickType xTicks;

 

 	/* Critical section required if running on a 16 bit processor. */

-	portENTER_CRITICAL();

+	taskENTER_CRITICAL();

 	{

 		xTicks = xTickCount;

 	}

-	portEXIT_CRITICAL();

+	taskEXIT_CRITICAL();

 

 	return xTicks;

 }

@@ -1239,10 +1240,10 @@
 			/* Run through all the lists that could potentially contain a TCB and

 			report the task name, state and stack high water mark. */

 

-			pcWriteBuffer[ 0 ] = ( signed char ) 0x00;

+			*pcWriteBuffer = ( signed char ) 0x00;

 			strcat( ( char * ) pcWriteBuffer, ( const char * ) "\r\n" );

 

-			uxQueue = uxTopUsedPriority + 1;

+			uxQueue = uxTopUsedPriority + ( unsigned portBASE_TYPE ) 1U;

 

 			do

 			{

@@ -1314,10 +1315,10 @@
 			generating a table of run timer percentages in the provided

 			buffer. */

 

-			pcWriteBuffer[ 0 ] = ( signed char ) 0x00;

+			*pcWriteBuffer = ( signed char ) 0x00;

 			strcat( ( char * ) pcWriteBuffer, ( const char * ) "\r\n" );

 

-			uxQueue = uxTopUsedPriority + 1;

+			uxQueue = uxTopUsedPriority + ( unsigned portBASE_TYPE ) 1U;

 

 			do

 			{

@@ -1367,14 +1368,14 @@
 

 	void vTaskStartTrace( signed char * pcBuffer, unsigned long ulBufferSize )

 	{

-		portENTER_CRITICAL();

+		taskENTER_CRITICAL();

 		{

 			pcTraceBuffer = ( signed char * )pcBuffer;

 			pcTraceBufferStart = pcBuffer;

 			pcTraceBufferEnd = pcBuffer + ( ulBufferSize - tskSIZE_OF_EACH_TRACE_LINE );

 			xTracing = pdTRUE;

 		}

-		portEXIT_CRITICAL();

+		taskEXIT_CRITICAL();

 	}

 

 #endif

@@ -1386,9 +1387,9 @@
 	{

 	unsigned long ulBufferLength;

 

-		portENTER_CRITICAL();

+		taskENTER_CRITICAL();

 			xTracing = pdFALSE;

-		portEXIT_CRITICAL();

+		taskEXIT_CRITICAL();

 

 		ulBufferLength = ( unsigned long ) ( pcTraceBuffer - pcTraceBufferStart );

 

@@ -1426,8 +1427,8 @@
 			xNumOfOverflows++;

 			if( listLIST_IS_EMPTY( pxDelayedTaskList ) != pdFALSE )

 			{

-				/* The delayed list is empty.  Set xNextTaskUnblockTime to the 

-				maximum possible value so it is extremely unlikely that the 

+				/* The delayed list is empty.  Set xNextTaskUnblockTime to the

+				maximum possible value so it is extremely unlikely that the

 				if( xTickCount >= xNextTaskUnblockTime ) test will pass

 				until there is an item in the delayed list. */

 				xNextTaskUnblockTime = portMAX_DELAY;

@@ -1436,7 +1437,7 @@
 			{

 				tskTCB * pxTCB;

 

-				/* The delayed list is not empty, get the value of the item at 

+				/* The delayed list is not empty, get the value of the item at

 				the head of the delayed list.  This is the time at which the

 				task at the head of the delayed list should be removed from

 				the Blocked state. */

@@ -1551,9 +1552,9 @@
 

 		/* Save the hook function in the TCB.  A critical section is required as

 		the value can be accessed from an interrupt. */

-		portENTER_CRITICAL();

+		taskENTER_CRITICAL();

 			xTCB->pxTaskTag = pxTagValue;

-		portEXIT_CRITICAL();

+		taskEXIT_CRITICAL();

 	}

 

 #endif

@@ -1578,9 +1579,9 @@
 

 		/* Save the hook function in the TCB.  A critical section is required as

 		the value can be accessed from an interrupt. */

-		portENTER_CRITICAL();

+		taskENTER_CRITICAL();

 			xReturn = xTCB->pxTaskTag;

-		portEXIT_CRITICAL();

+		taskEXIT_CRITICAL();

 

 		return xReturn;

 	}

@@ -1627,46 +1628,47 @@
 		/* The scheduler is currently suspended - do not allow a context

 		switch. */

 		xMissedYield = pdTRUE;

-		return;

 	}

-

-	traceTASK_SWITCHED_OUT();

-

-	#if ( configGENERATE_RUN_TIME_STATS == 1 )

+	else

 	{

-		unsigned long ulTempCounter;

-		

-			#ifdef portALT_GET_RUN_TIME_COUNTER_VALUE

-				portALT_GET_RUN_TIME_COUNTER_VALUE( ulTempCounter );

-			#else

-				ulTempCounter = portGET_RUN_TIME_COUNTER_VALUE();

-			#endif

-

-			/* Add the amount of time the task has been running to the accumulated

-			time so far.  The time the task started running was stored in

-			ulTaskSwitchedInTime.  Note that there is no overflow protection here

-			so count values are only valid until the timer overflows.  Generally

-			this will be about 1 hour assuming a 1uS timer increment. */

-			pxCurrentTCB->ulRunTimeCounter += ( ulTempCounter - ulTaskSwitchedInTime );

-			ulTaskSwitchedInTime = ulTempCounter;

+		traceTASK_SWITCHED_OUT();

+	

+		#if ( configGENERATE_RUN_TIME_STATS == 1 )

+		{

+			unsigned long ulTempCounter;

+			

+				#ifdef portALT_GET_RUN_TIME_COUNTER_VALUE

+					portALT_GET_RUN_TIME_COUNTER_VALUE( ulTempCounter );

+				#else

+					ulTempCounter = portGET_RUN_TIME_COUNTER_VALUE();

+				#endif

+	

+				/* Add the amount of time the task has been running to the accumulated

+				time so far.  The time the task started running was stored in

+				ulTaskSwitchedInTime.  Note that there is no overflow protection here

+				so count values are only valid until the timer overflows.  Generally

+				this will be about 1 hour assuming a 1uS timer increment. */

+				pxCurrentTCB->ulRunTimeCounter += ( ulTempCounter - ulTaskSwitchedInTime );

+				ulTaskSwitchedInTime = ulTempCounter;

+		}

+		#endif

+	

+		taskFIRST_CHECK_FOR_STACK_OVERFLOW();

+		taskSECOND_CHECK_FOR_STACK_OVERFLOW();

+	

+		/* Find the highest priority queue that contains ready tasks. */

+		while( listLIST_IS_EMPTY( &( pxReadyTasksLists[ uxTopReadyPriority ] ) ) )

+		{

+			--uxTopReadyPriority;

+		}

+	

+		/* listGET_OWNER_OF_NEXT_ENTRY walks through the list, so the tasks of the

+		same priority get an equal share of the processor time. */

+		listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopReadyPriority ] ) );

+	

+		traceTASK_SWITCHED_IN();

+		vWriteTraceToBuffer();

 	}

-	#endif

-

-	taskFIRST_CHECK_FOR_STACK_OVERFLOW();

-	taskSECOND_CHECK_FOR_STACK_OVERFLOW();

-

-	/* Find the highest priority queue that contains ready tasks. */

-	while( listLIST_IS_EMPTY( &( pxReadyTasksLists[ uxTopReadyPriority ] ) ) )

-	{

-		--uxTopReadyPriority;

-	}

-

-	/* listGET_OWNER_OF_NEXT_ENTRY walks through the list, so the tasks of the

-	same priority get an equal share of the processor time. */

-	listGET_OWNER_OF_NEXT_ENTRY( pxCurrentTCB, &( pxReadyTasksLists[ uxTopReadyPriority ] ) );

-

-	traceTASK_SWITCHED_IN();

-	vWriteTraceToBuffer();

 }

 /*-----------------------------------------------------------*/

 

@@ -1730,7 +1732,7 @@
 

 	If an event is for a queue that is locked then this function will never

 	get called - the lock count on the queue will get modified instead.  This

-	means we can always expect exclusive access to the event list here. 

+	means we can always expect exclusive access to the event list here.

 	

 	This function assumes that a check has already been made to ensure that

 	pxEventList is not empty. */

@@ -1777,7 +1779,7 @@
 {

 portBASE_TYPE xReturn;

 

-	portENTER_CRITICAL();

+	taskENTER_CRITICAL();

 	{

 		#if ( INCLUDE_vTaskSuspend == 1 )

 			/* If INCLUDE_vTaskSuspend is set to 1 and the block time specified is

@@ -1810,7 +1812,7 @@
 			xReturn = pdTRUE;

 		}

 	}

-	portEXIT_CRITICAL();

+	taskEXIT_CRITICAL();

 

 	return xReturn;

 }

@@ -1906,13 +1908,13 @@
 		strncpy( ( char * ) pxTCB->pcTaskName, ( const char * ) pcName, ( unsigned short ) configMAX_TASK_NAME_LEN );

 	}

 	#endif

-	pxTCB->pcTaskName[ ( unsigned short ) configMAX_TASK_NAME_LEN - ( unsigned short ) 1 ] = '\0';

+	pxTCB->pcTaskName[ ( unsigned short ) configMAX_TASK_NAME_LEN - ( unsigned short ) 1 ] = ( signed char ) '\0';

 

 	/* This is used as an array index so must ensure it's not too large.  First

 	remove the privilege bit if one is present. */

 	if( uxPriority >= configMAX_PRIORITIES )

 	{

-		uxPriority = configMAX_PRIORITIES - 1;

+		uxPriority = configMAX_PRIORITIES - ( unsigned portBASE_TYPE ) 1U;

 	}

 

 	pxTCB->uxPriority = uxPriority;

@@ -1987,7 +1989,7 @@
 {

 unsigned portBASE_TYPE uxPriority;

 

-	for( uxPriority = 0; uxPriority < configMAX_PRIORITIES; uxPriority++ )

+	for( uxPriority = ( unsigned portBASE_TYPE ) 0U; uxPriority < configMAX_PRIORITIES; uxPriority++ )

 	{

 		vListInitialise( ( xList * ) &( pxReadyTasksLists[ uxPriority ] ) );

 	}

@@ -2033,14 +2035,14 @@
 			{

 				tskTCB *pxTCB;

 

-				portENTER_CRITICAL();

+				taskENTER_CRITICAL();

 				{

 					pxTCB = ( tskTCB * ) listGET_OWNER_OF_HEAD_ENTRY( ( ( xList * ) &xTasksWaitingTermination ) );

 					vListRemove( &( pxTCB->xGenericListItem ) );

 					--uxCurrentNumberOfTasks;

 					--uxTasksDeleted;

 				}

-				portEXIT_CRITICAL();

+				taskEXIT_CRITICAL();

 

 				prvDeleteTCB( pxTCB );

 			}

@@ -2165,7 +2167,7 @@
 				else

 				{

 					/* What percentage of the total run time has the task used?

-					This will always be rounded down to the nearest integer. 

+					This will always be rounded down to the nearest integer.

 					ulTotalRunTime has already been divided by 100. */

 					ulStatsAsPercentage = pxNextTCB->ulRunTimeCounter / ulTotalRunTime;