From 0885fb373227e2e4d9a9a72820f660b9ffdc67af Mon Sep 17 00:00:00 2001 From: rtel Date: Thu, 28 Nov 2013 10:48:33 +0000 Subject: [PATCH] Multiple tidy up, documentation corrections and typo corrections highlighted by Tamas Kleiber's diligent review. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2118 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- FreeRTOS/Source/croutine.c | 2 +- FreeRTOS/Source/include/FreeRTOS.h | 46 +++++-- FreeRTOS/Source/include/list.h | 22 ++-- FreeRTOS/Source/include/projdefs.h | 1 - FreeRTOS/Source/include/queue.h | 10 +- FreeRTOS/Source/include/semphr.h | 2 +- FreeRTOS/Source/include/task.h | 119 ++++++++++-------- FreeRTOS/Source/include/timers.h | 38 +++--- FreeRTOS/Source/list.c | 25 ++-- .../portable/BCC/16BitDOS/Flsh186/prtmacro.h | 2 +- .../portable/BCC/16BitDOS/PC/prtmacro.h | 2 +- .../Source/portable/CCS/ARM_Cortex-R4/port.c | 7 +- .../Source/portable/CCS/MSP430X/portmacro.h | 2 +- .../CodeWarrior/ColdFire_V1/portmacro.h | 2 +- .../CodeWarrior/ColdFire_V2/portmacro.h | 2 +- .../portable/CodeWarrior/HCS12/portmacro.h | 2 +- .../portable/GCC/ARM7_AT91FR40008/portmacro.h | 2 +- .../portable/GCC/ARM7_AT91SAM7S/portmacro.h | 2 +- .../portable/GCC/ARM7_LPC2000/portmacro.h | 2 +- .../portable/GCC/ARM7_LPC23xx/portmacro.h | 2 +- FreeRTOS/Source/portable/GCC/ARM_CM0/port.c | 10 +- .../Source/portable/GCC/ARM_CM0/portmacro.h | 2 +- .../Source/portable/GCC/ARM_CM3/portmacro.h | 2 +- .../Source/portable/GCC/ARM_CM3_MPU/port.c | 8 +- .../portable/GCC/ARM_CM3_MPU/portmacro.h | 2 +- .../Source/portable/GCC/ARM_CM4F/portmacro.h | 2 +- .../Source/portable/GCC/ATMega323/portmacro.h | 2 +- .../Source/portable/GCC/AVR32_UC3/portmacro.h | 2 +- .../portable/GCC/CORTUS_APS3/portmacro.h | 2 +- .../portable/GCC/ColdFire_V2/portmacro.h | 2 +- .../Source/portable/GCC/H8S2329/portmacro.h | 2 +- .../Source/portable/GCC/HCS12/portmacro.h | 2 +- .../Source/portable/GCC/MCF5235/portmacro.h | 2 +- .../portable/GCC/MSP430F449/portmacro.h | 2 +- .../portable/GCC/MicroBlaze/portmacro.h | 2 +- .../Source/portable/GCC/MicroBlazeV8/port.c | 74 +++++------ .../portable/GCC/MicroBlazeV8/portmacro.h | 2 +- .../Source/portable/GCC/NiosII/portmacro.h | 2 +- .../portable/GCC/PPC405_Xilinx/portmacro.h | 2 +- .../portable/GCC/PPC440_Xilinx/portmacro.h | 2 +- FreeRTOS/Source/portable/GCC/RX100/port.c | 6 +- .../Source/portable/GCC/RX100/portmacro.h | 2 +- FreeRTOS/Source/portable/GCC/RX600/port.c | 80 ++++++------ .../Source/portable/GCC/RX600/portmacro.h | 2 +- .../Source/portable/GCC/STR75x/portmacro.h | 2 +- .../portable/GCC/TriCore_1782/portmacro.h | 2 +- .../Source/portable/IAR/78K0R/portmacro.h | 2 +- FreeRTOS/Source/portable/IAR/ARM_CA9/port.c | 7 +- .../Source/portable/IAR/ARM_CA9/portmacro.h | 2 +- FreeRTOS/Source/portable/IAR/ARM_CM0/port.c | 16 +-- .../Source/portable/IAR/ARM_CM0/portmacro.h | 2 +- FreeRTOS/Source/portable/IAR/ARM_CM3/port.c | 30 ++--- FreeRTOS/Source/portable/IAR/ARM_CM4F/port.c | 18 +-- .../Source/portable/IAR/ARM_CM4F/portmacro.h | 2 +- .../Source/portable/IAR/ATMega323/portmacro.h | 2 +- .../Source/portable/IAR/AVR32_UC3/portmacro.h | 2 +- .../portable/IAR/AtmelSAM7S64/portmacro.h | 2 +- .../portable/IAR/AtmelSAM9XE/portmacro.h | 2 +- .../Source/portable/IAR/LPC2000/portmacro.h | 2 +- .../Source/portable/IAR/MSP430/portmacro.h | 2 +- .../Source/portable/IAR/MSP430X/portmacro.h | 2 +- FreeRTOS/Source/portable/IAR/RL78/portmacro.h | 2 +- FreeRTOS/Source/portable/IAR/RX100/port.c | 6 +- .../Source/portable/IAR/RX100/portmacro.h | 2 +- FreeRTOS/Source/portable/IAR/RX600/port.c | 6 +- .../Source/portable/IAR/RX600/portmacro.h | 2 +- .../Source/portable/IAR/STR71x/portmacro.h | 2 +- .../Source/portable/IAR/STR75x/portmacro.h | 2 +- .../Source/portable/IAR/STR91x/portmacro.h | 2 +- .../Source/portable/IAR/V850ES/portmacro.h | 2 +- .../Source/portable/MPLAB/PIC18F/portmacro.h | 2 +- .../Source/portable/MPLAB/PIC24_dsPIC/port.c | 9 +- .../portable/MPLAB/PIC24_dsPIC/portmacro.h | 2 +- FreeRTOS/Source/portable/MPLAB/PIC32MX/port.c | 7 +- .../Source/portable/MPLAB/PIC32MX/portmacro.h | 2 +- FreeRTOS/Source/portable/MPLAB/PIC32MZ/port.c | 7 +- .../Source/portable/MPLAB/PIC32MZ/portmacro.h | 2 +- .../Source/portable/MSVC-MingW/portmacro.h | 2 +- .../Tern_EE/large_untested/portmacro.h | 2 +- .../Paradigm/Tern_EE/small/portmacro.h | 2 +- .../portable/RVDS/ARM7_LPC21xx/portmacro.h | 2 +- FreeRTOS/Source/portable/RVDS/ARM_CA9/port.c | 11 +- .../Source/portable/RVDS/ARM_CA9/portmacro.h | 2 +- FreeRTOS/Source/portable/RVDS/ARM_CM0/port.c | 26 ++-- .../Source/portable/RVDS/ARM_CM0/portmacro.h | 2 +- FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c | 34 ++--- .../Source/portable/RVDS/ARM_CM3/portmacro.h | 2 +- FreeRTOS/Source/portable/RVDS/ARM_CM4F/port.c | 6 +- .../Source/portable/RVDS/ARM_CM4F/portmacro.h | 2 +- FreeRTOS/Source/portable/Renesas/RX100/port.c | 6 +- .../Source/portable/Renesas/RX100/portmacro.h | 2 +- FreeRTOS/Source/portable/Renesas/RX200/port.c | 52 ++++---- .../Source/portable/Renesas/RX200/portmacro.h | 2 +- FreeRTOS/Source/portable/Renesas/RX600/port.c | 6 +- .../Source/portable/Renesas/RX600/portmacro.h | 2 +- .../portable/Renesas/SH2A_FPU/portmacro.h | 2 +- .../portable/Rowley/MSP430F449/portmacro.h | 2 +- .../Source/portable/SDCC/Cygnal/portmacro.h | 2 +- .../portable/Softune/MB91460/portmacro.h | 2 +- .../portable/Softune/MB96340/portmacro.h | 2 +- .../Source/portable/Tasking/ARM_CM4F/port.c | 16 +-- .../portable/Tasking/ARM_CM4F/portmacro.h | 2 +- .../oWatcom/16BitDOS/Flsh186/portmacro.h | 2 +- .../portable/oWatcom/16BitDOS/PC/portmacro.h | 2 +- FreeRTOS/Source/queue.c | 16 +-- FreeRTOS/Source/tasks.c | 55 ++++---- FreeRTOS/Source/timers.c | 20 ++- 107 files changed, 518 insertions(+), 430 deletions(-) diff --git a/FreeRTOS/Source/croutine.c b/FreeRTOS/Source/croutine.c index 2b135f84e..04b229a47 100644 --- a/FreeRTOS/Source/croutine.c +++ b/FreeRTOS/Source/croutine.c @@ -174,7 +174,7 @@ corCRCB *pxCoRoutine; listSET_LIST_ITEM_OWNER( &( pxCoRoutine->xEventListItem ), pxCoRoutine ); /* Event lists are always in priority order. */ - listSET_LIST_ITEM_VALUE( &( pxCoRoutine->xEventListItem ), configMAX_PRIORITIES - ( portTickType ) uxPriority ); + listSET_LIST_ITEM_VALUE( &( pxCoRoutine->xEventListItem ), ( ( portTickType ) configMAX_CO_ROUTINE_PRIORITIES - ( portTickType ) uxPriority ) ); /* Now the co-routine has been initialised it can be added to the ready list at the correct priority. */ diff --git a/FreeRTOS/Source/include/FreeRTOS.h b/FreeRTOS/Source/include/FreeRTOS.h index f8e68f86f..7832f5547 100644 --- a/FreeRTOS/Source/include/FreeRTOS.h +++ b/FreeRTOS/Source/include/FreeRTOS.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -103,48 +103,66 @@ typedef portTickType xEventBitsType; * within FreeRTOSConfig.h. */ +#ifndef configMINIMAL_STACK_SIZE + #error Missing definition: configMINIMAL_STACK_SIZE must be defined in FreeRTOSConfig.h. configMINIMAL_STACK_SIZE defines the size (in words) of the stack allocated to the idle task. Refer to the demo project provided for your port for a suitable value. +#endif + +#ifndef configMAX_PRIORITIES + #error Missing definition: configMAX_PRIORITIES must be defined in FreeRTOSConfig.h. See the Configuration section of the FreeRTOS API documentation for details. +#endif + #ifndef configUSE_PREEMPTION - #error Missing definition: configUSE_PREEMPTION should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. + #error Missing definition: configUSE_PREEMPTION must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. #endif #ifndef configUSE_IDLE_HOOK - #error Missing definition: configUSE_IDLE_HOOK should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. + #error Missing definition: configUSE_IDLE_HOOK must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. #endif #ifndef configUSE_TICK_HOOK - #error Missing definition: configUSE_TICK_HOOK should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. + #error Missing definition: configUSE_TICK_HOOK must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. #endif #ifndef configUSE_CO_ROUTINES - #error Missing definition: configUSE_CO_ROUTINES should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. + #error Missing definition: configUSE_CO_ROUTINES must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. #endif #ifndef INCLUDE_vTaskPrioritySet - #error Missing definition: INCLUDE_vTaskPrioritySet should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. + #error Missing definition: INCLUDE_vTaskPrioritySet must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. #endif #ifndef INCLUDE_uxTaskPriorityGet - #error Missing definition: INCLUDE_uxTaskPriorityGet should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. + #error Missing definition: INCLUDE_uxTaskPriorityGet must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. #endif #ifndef INCLUDE_vTaskDelete - #error Missing definition: INCLUDE_vTaskDelete should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. + #error Missing definition: INCLUDE_vTaskDelete must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. #endif #ifndef INCLUDE_vTaskSuspend - #error Missing definition: INCLUDE_vTaskSuspend should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. + #error Missing definition: INCLUDE_vTaskSuspend must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. #endif #ifndef INCLUDE_vTaskDelayUntil - #error Missing definition: INCLUDE_vTaskDelayUntil should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. + #error Missing definition: INCLUDE_vTaskDelayUntil must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. #endif #ifndef INCLUDE_vTaskDelay - #error Missing definition: INCLUDE_vTaskDelay should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. + #error Missing definition: INCLUDE_vTaskDelay must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. #endif #ifndef configUSE_16_BIT_TICKS - #error Missing definition: configUSE_16_BIT_TICKS should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. + #error Missing definition: configUSE_16_BIT_TICKS must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details. +#endif + +#if configUSE_CO_ROUTINES != 0 + #if configMAX_CO_ROUTINE_PRIORITIES < 1 + #error configMAX_CO_ROUTINE_PRIORITIES must be greater than or equal to 1. + #endif +#endif + +#if configMAX_PRIORITIES < 1 + #error configMAX_PRIORITIES must be greater than or equal to 1. #endif #ifndef INCLUDE_xTaskGetIdleTaskHandle @@ -627,6 +645,10 @@ typedef portTickType xEventBitsType; #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() #endif +#ifndef configUSE_TRACE_FACILITY + #define configUSE_TRACE_FACILITY 0 +#endif + /* For backward compatability. */ #define eTaskStateGet eTaskGetState diff --git a/FreeRTOS/Source/include/list.h b/FreeRTOS/Source/include/list.h index a49368893..41f269e06 100644 --- a/FreeRTOS/Source/include/list.h +++ b/FreeRTOS/Source/include/list.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -115,8 +115,8 @@ * complete and obvious failure of the scheduler. If this is ever experienced * then the volatile qualifier can be inserted in the relevant places within the * list structures by simply defining configLIST_VOLATILE to volatile in - * FreeRTOSConfig.h (as per the example at the bottom of this comment block). - * If configLIST_VOLATILE is not defined then the preprocessor directives below + * FreeRTOSConfig.h (as per the example at the bottom of this comment block). + * If configLIST_VOLATILE is not defined then the preprocessor directives below * will simply #define configLIST_VOLATILE away completely. * * To use volatile list structure members then add the following line to @@ -157,7 +157,7 @@ typedef struct xMINI_LIST_ITEM xMiniListItem; typedef struct xLIST { configLIST_VOLATILE unsigned portBASE_TYPE uxNumberOfItems; - xListItem * configLIST_VOLATILE pxIndex; /*< Used to walk through the list. Points to the last item returned by a call to pvListGetOwnerOfNextEntry (). */ + xListItem * configLIST_VOLATILE pxIndex; /*< Used to walk through the list. Points to the last item returned by a call to listGET_OWNER_OF_NEXT_ENTRY (). */ xMiniListItem xListEnd; /*< List item that contains the maximum possible item value meaning it is always at the end of the list and is therefore used as a marker. */ } xList; @@ -177,7 +177,7 @@ typedef struct xLIST * \page listSET_LIST_ITEM_OWNER listSET_LIST_ITEM_OWNER * \ingroup LinkedList */ -#define listGET_LIST_ITEM_OWNER( pxListItem ) ( pxListItem )->pvOwner +#define listGET_LIST_ITEM_OWNER( pxListItem ) ( ( pxListItem )->pvOwner ) /* * Access macro to set the value of the list item. In most cases the value is @@ -190,7 +190,7 @@ typedef struct xLIST /* * Access macro to retrieve the value of the list item. The value can - * represent anything - for example a the priority of a task, or the time at + * represent anything - for example the priority of a task, or the time at * which a task should be unblocked. * * \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE @@ -199,7 +199,7 @@ typedef struct xLIST #define listGET_LIST_ITEM_VALUE( pxListItem ) ( ( pxListItem )->xItemValue ) /* - * Access macro the retrieve the value of the list item at the head of a given + * Access macro to retrieve the value of the list item at the head of a given * list. * * \page listGET_LIST_ITEM_VALUE listGET_LIST_ITEM_VALUE @@ -250,7 +250,7 @@ typedef struct xLIST * * The list member pxIndex is used to walk through a list. Calling * listGET_OWNER_OF_NEXT_ENTRY increments pxIndex to the next item in the list - * and returns that entries pxOwner parameter. Using multiple calls to this + * and returns that entry's pxOwner parameter. Using multiple calls to this * function it is therefore possible to move through every item contained in * a list. * @@ -259,6 +259,7 @@ typedef struct xLIST * The pxOwner parameter effectively creates a two way link between the list * item and its owner. * + * @param pxTCB pxTCB is set to the address of the owner of the next list item. * @param pxList The list from which the next item owner is to be returned. * * \page listGET_OWNER_OF_NEXT_ENTRY listGET_OWNER_OF_NEXT_ENTRY @@ -303,8 +304,7 @@ xList * const pxConstList = ( pxList ); \ * * @param pxList The list we want to know if the list item is within. * @param pxListItem The list item we want to know if is in the list. - * @return pdTRUE is the list item is in the list, otherwise pdFALSE. - * pointer against + * @return pdTRUE if the list item is in the list, otherwise pdFALSE. */ #define listIS_CONTAINED_WITHIN( pxList, pxListItem ) ( ( portBASE_TYPE ) ( ( pxListItem )->pvContainer == ( void * ) ( pxList ) ) ) @@ -352,7 +352,7 @@ void vListInitialiseItem( xListItem * const pxItem ); * * @param pxList The list into which the item is to be inserted. * - * @param pxNewListItem The item to that is to be placed in the list. + * @param pxNewListItem The item that is to be placed in the list. * * \page vListInsert vListInsert * \ingroup LinkedList diff --git a/FreeRTOS/Source/include/projdefs.h b/FreeRTOS/Source/include/projdefs.h index 74aa84f0d..766424dbf 100644 --- a/FreeRTOS/Source/include/projdefs.h +++ b/FreeRTOS/Source/include/projdefs.h @@ -83,7 +83,6 @@ typedef void (*pdAPPLICATION_CALLBACK_CODE)( void *, unsigned long ); /* Error definitions. */ #define errCOULD_NOT_ALLOCATE_REQUIRED_MEMORY ( -1 ) -#define errNO_TASK_TO_RUN ( -2 ) #define errQUEUE_BLOCKED ( -4 ) #define errQUEUE_YIELD ( -5 ) diff --git a/FreeRTOS/Source/include/queue.h b/FreeRTOS/Source/include/queue.h index 6873611ca..c67d315dd 100644 --- a/FreeRTOS/Source/include/queue.h +++ b/FreeRTOS/Source/include/queue.h @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -1137,7 +1137,7 @@ void vQueueDelete( xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
 
  xQueueHandle xQueue;
- 
+
  void vFunction( void *pvParameters )
  {
  	// Create a queue to hold one unsigned long value.  It is strongly
@@ -1166,7 +1166,7 @@ unsigned long ulVarToSend, ulValReceived;
 	// Reading from the queue will now return 100.
 
 	// ...
-	
+
 	if( xHigherPrioritytaskWoken == pdTRUE )
 	{
 		// Writing to the queue caused a task to unblock and the unblocked task
@@ -1509,7 +1509,9 @@ portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle pxMutex ) PRIVILEGED_FUNCTI
  * handles can also be passed in here.
  *
  * @param pcName The name to be associated with the handle.  This is the
- * name that the kernel aware debugger will display.
+ * name that the kernel aware debugger will display.  The queue registry only
+ * stores a pointer to the string - so the string must be persistent (global or
+ * preferably in ROM/Flash), not on the stack.
  */
 #if configQUEUE_REGISTRY_SIZE > 0
 	void vQueueAddToRegistry( xQueueHandle xQueue, signed char *pcName ) PRIVILEGED_FUNCTION;
diff --git a/FreeRTOS/Source/include/semphr.h b/FreeRTOS/Source/include/semphr.h
index cfa34c453..9fd8caad2 100644
--- a/FreeRTOS/Source/include/semphr.h
+++ b/FreeRTOS/Source/include/semphr.h
@@ -828,7 +828,7 @@ typedef xQueueHandle xSemaphoreHandle;
  * If xMutex is not a mutex type semaphore, or the mutex is available (not held
  * by a task), return NULL.
  *
- * Note: This Is is a good way of determining if the calling task is the mutex
+ * Note: This is a good way of determining if the calling task is the mutex
  * holder, but not a good way of determining the identity of the mutex holder as
  * the holder may change between the function exiting and the returned value
  * being tested.
diff --git a/FreeRTOS/Source/include/task.h b/FreeRTOS/Source/include/task.h
index d71d5145e..956556e67 100644
--- a/FreeRTOS/Source/include/task.h
+++ b/FreeRTOS/Source/include/task.h
@@ -127,7 +127,7 @@ typedef struct xMEMORY_REGION
 /*
  * Parameters required to create an MPU protected task.
  */
-typedef struct xTASK_PARAMTERS
+typedef struct xTASK_PARAMETERS
 {
 	pdTASK_CODE pvTaskCode;
 	const signed char * const pcName;
@@ -161,7 +161,7 @@ typedef enum
 } eSleepModeStatus;
 
 
-/*
+/**
  * Defines the priority used by the idle task.  This must not be modified.
  *
  * \ingroup TaskUtils
@@ -243,7 +243,7 @@ is used in assert() statements. */
  *
  portBASE_TYPE xTaskCreate(
 							  pdTASK_CODE pvTaskCode,
-							  const char * const pcName,
+							  const signed char * const pcName,
 							  unsigned short usStackDepth,
 							  void *pvParameters,
 							  unsigned portBASE_TYPE uxPriority,
@@ -261,7 +261,7 @@ is used in assert() statements. */
  * must be implemented to never return (i.e. continuous loop).
  *
  * @param pcName A descriptive name for the task.  This is mainly used to
- * facilitate debugging.  Max length defined by tskMAX_TASK_NAME_LEN - default
+ * facilitate debugging.  Max length defined by configMAX_TASK_NAME_LEN - default
  * is 16.
  *
  * @param usStackDepth The size of the task stack specified as the number of
@@ -282,7 +282,7 @@ is used in assert() statements. */
  * can be referenced.
  *
  * @return pdPASS if the task was successfully created and added to a ready
- * list, otherwise an error code defined in the file errors. h
+ * list, otherwise an error code defined in the file projdefs.h
  *
  * Example usage:
    
@@ -299,16 +299,20 @@ is used in assert() statements. */
  void vOtherFunction( void )
  {
  static unsigned char ucParameterToPass;
- xTaskHandle xHandle;
+ xTaskHandle xHandle = NULL;
 
 	 // Create the task, storing the handle.  Note that the passed parameter ucParameterToPass
 	 // must exist for the lifetime of the task, so in this case is declared static.  If it was just an
 	 // an automatic stack variable it might no longer exist, or at least have been corrupted, by the time
 	 // the new task attempts to access it.
 	 xTaskCreate( vTaskCode, "NAME", STACK_SIZE, &ucParameterToPass, tskIDLE_PRIORITY, &xHandle );
+     configASSERT( xHandle );
 
 	 // Use the handle to delete the task.
-	 vTaskDelete( xHandle );
+     if( xHandle != NULL )
+     {
+	     vTaskDelete( xHandle );
+     }
  }
    
* \defgroup xTaskCreate xTaskCreate @@ -337,7 +341,7 @@ is used in assert() statements. */ * can be referenced. * * @return pdPASS if the task was successfully created and added to a ready - * list, otherwise an error code defined in the file errors. h + * list, otherwise an error code defined in the file projdefs.h * * Example usage:
@@ -376,7 +380,7 @@ xTaskHandle xHandle;
 	vTaskStartScheduler();
 
 	// Will only get here if there was insufficient memory to create the idle
-	// task.
+	// and/or timer task.
 	for( ;; );
 }
    
@@ -440,7 +444,7 @@ void vTaskAllocateMPURegions( xTaskHandle xTask, const xMemoryRegion * const pxR * INCLUDE_vTaskDelete must be defined as 1 for this function to be available. * See the configuration section for more information. * - * Remove a task from the RTOS real time kernels management. The task being + * Remove a task from the RTOS real time kernel's management. The task being * deleted will be removed from all ready, blocked, suspended and event lists. * * NOTE: The idle task is responsible for freeing the kernel allocated @@ -480,7 +484,7 @@ void vTaskDelete( xTaskHandle xTaskToDelete ) PRIVILEGED_FUNCTION; /** * task. h - *
void vTaskDelay( portTickType xTicksToDelay );
+ *
void vTaskDelay( const portTickType xTicksToDelay );
* * Delay a task for a given number of ticks. The actual time that the * task remains blocked depends on the tick rate. The constant @@ -495,7 +499,7 @@ void vTaskDelete( xTaskHandle xTaskToDelete ) PRIVILEGED_FUNCTION; * the time at which vTaskDelay() is called. For example, specifying a block * period of 100 ticks will cause the task to unblock 100 ticks after * vTaskDelay() is called. vTaskDelay() does not therefore provide a good method - * of controlling the frequency of a cyclical task as the path taken through the + * of controlling the frequency of a periodic task as the path taken through the * code, as well as other task and interrupt activity, will effect the frequency * at which vTaskDelay() gets called and therefore the time at which the task * next executes. See vTaskDelayUntil() for an alternative API function designed @@ -508,8 +512,6 @@ void vTaskDelete( xTaskHandle xTaskToDelete ) PRIVILEGED_FUNCTION; * * Example usage: - void vTaskFunction( void * pvParameters ) - { void vTaskFunction( void * pvParameters ) { // Block for 500ms. @@ -526,16 +528,16 @@ void vTaskDelete( xTaskHandle xTaskToDelete ) PRIVILEGED_FUNCTION; * \defgroup vTaskDelay vTaskDelay * \ingroup TaskCtrl */ -void vTaskDelay( portTickType xTicksToDelay ) PRIVILEGED_FUNCTION; +void vTaskDelay( const portTickType xTicksToDelay ) PRIVILEGED_FUNCTION; /** * task. h - *
void vTaskDelayUntil( portTickType *pxPreviousWakeTime, portTickType xTimeIncrement );
+ *
void vTaskDelayUntil( portTickType *pxPreviousWakeTime, const portTickType xTimeIncrement );
* * INCLUDE_vTaskDelayUntil must be defined as 1 for this function to be available. * See the configuration section for more information. * - * Delay a task until a specified time. This function can be used by cyclical + * Delay a task until a specified time. This function can be used by periodic * tasks to ensure a constant execution frequency. * * This function differs from vTaskDelay () in one important aspect: vTaskDelay () will @@ -585,13 +587,13 @@ void vTaskDelay( portTickType xTicksToDelay ) PRIVILEGED_FUNCTION; * \defgroup vTaskDelayUntil vTaskDelayUntil * \ingroup TaskCtrl */ -void vTaskDelayUntil( portTickType * const pxPreviousWakeTime, portTickType xTimeIncrement ) PRIVILEGED_FUNCTION; +void vTaskDelayUntil( portTickType * const pxPreviousWakeTime, const portTickType xTimeIncrement ) PRIVILEGED_FUNCTION; /** * task. h *
unsigned portBASE_TYPE uxTaskPriorityGet( xTaskHandle xTask );
* - * INCLUDE_xTaskPriorityGet must be defined as 1 for this function to be available. + * INCLUDE_uxTaskPriorityGet must be defined as 1 for this function to be available. * See the configuration section for more information. * * Obtain the priority of any task. @@ -754,7 +756,7 @@ void vTaskSuspend( xTaskHandle xTaskToSuspend ) PRIVILEGED_FUNCTION; * * Resumes a suspended task. * - * A task that has been suspended by one of more calls to vTaskSuspend () + * A task that has been suspended by one or more calls to vTaskSuspend () * will be made available for running again by a single call to * vTaskResume (). * @@ -786,7 +788,7 @@ void vTaskSuspend( xTaskHandle xTaskToSuspend ) PRIVILEGED_FUNCTION; vTaskResume( xHandle ); // The created task will once again get microcontroller processing - // time in accordance with it priority within the system. + // time in accordance with its priority within the system. }
* \defgroup vTaskResume vTaskResume @@ -803,12 +805,21 @@ void vTaskResume( xTaskHandle xTaskToResume ) PRIVILEGED_FUNCTION; * * An implementation of vTaskResume() that can be called from within an ISR. * - * A task that has been suspended by one of more calls to vTaskSuspend () + * A task that has been suspended by one or more calls to vTaskSuspend () * will be made available for running again by a single call to * xTaskResumeFromISR (). * + * xTaskResumeFromISR() should not be used to synchronise a task with an + * interrupt if there is a chance that the interrupt could arrive prior to the + * task being suspended - as this can lead to interrupts being missed. Use of a + * semaphore as a synchronisation mechanism would avoid this eventuality. + * * @param xTaskToResume Handle to the task being readied. * + * @return pdTRUE if resuming the task should result in a context switch, + * otherwise pdFALSE. This is used by the ISR to determine if a context switch + * may be required following the ISR. + * * \defgroup vTaskResumeFromISR vTaskResumeFromISR * \ingroup TaskCtrl */ @@ -823,12 +834,7 @@ portBASE_TYPE xTaskResumeFromISR( xTaskHandle xTaskToResume ) PRIVILEGED_FUNCTIO *
void vTaskStartScheduler( void );
* * Starts the real time kernel tick processing. After calling the kernel - * has control over which tasks are executed and when. This function - * does not return until an executing task calls vTaskEndScheduler (). - * - * At least one task should be created via a call to xTaskCreate () - * before calling vTaskStartScheduler (). The idle task is created - * automatically when the first application task is created. + * has control over which tasks are executed and when. * * See the demo application file main.c for an example of creating * tasks and starting the kernel. @@ -856,6 +862,9 @@ void vTaskStartScheduler( void ) PRIVILEGED_FUNCTION; * task. h *
void vTaskEndScheduler( void );
* + * NOTE: At the time of writing only the x86 real mode port, which runs on a PC + * in place of DOS, implements this function. + * * Stops the real time kernel tick. All created tasks will be automatically * deleted and multitasking (either preemptive or cooperative) will * stop. Execution then resumes from the point where vTaskStartScheduler () @@ -909,8 +918,8 @@ void vTaskEndScheduler( void ) PRIVILEGED_FUNCTION; * task. h *
void vTaskSuspendAll( void );
* - * Suspends all real time kernel activity while keeping interrupts (including the - * kernel tick) enabled. + * Suspends the scheduler without disabling interrupts. Context switches will + * not occur while the scheduler is suspended. * * After calling vTaskSuspendAll () the calling task will continue to execute * without risk of being swapped out until a call to xTaskResumeAll () has been @@ -960,9 +969,11 @@ void vTaskSuspendAll( void ) PRIVILEGED_FUNCTION; * task. h *
char xTaskResumeAll( void );
* - * Resumes real time kernel activity following a call to vTaskSuspendAll (). - * After a call to vTaskSuspendAll () the kernel will take control of which - * task is executing at any time. + * Resumes scheduler activity after it was suspended by a call to + * vTaskSuspendAll(). + * + * xTaskResumeAll() only resumes the scheduler. It does not unsuspend tasks + * that were previously suspended by a call to vTaskSuspend(). * * @return If resuming the scheduler caused a context switch then pdTRUE is * returned, otherwise pdFALSE is returned. @@ -1017,7 +1028,7 @@ signed portBASE_TYPE xTaskResumeAll( void ) PRIVILEGED_FUNCTION; * is in any other state. * */ -signed portBASE_TYPE xTaskIsTaskSuspended( xTaskHandle xTask ) PRIVILEGED_FUNCTION; +signed portBASE_TYPE xTaskIsTaskSuspended( const xTaskHandle xTask ) PRIVILEGED_FUNCTION; /*----------------------------------------------------------- * TASK UTILITIES @@ -1045,7 +1056,7 @@ portTickType xTaskGetTickCount( void ) PRIVILEGED_FUNCTION; * microcontroller being used or interrupt nesting is either not supported or * not being used. * - * \defgroup xTaskGetTickCount xTaskGetTickCount + * \defgroup xTaskGetTickCountFromISR xTaskGetTickCountFromISR * \ingroup TaskUtils */ portTickType xTaskGetTickCountFromISR( void ) PRIVILEGED_FUNCTION; @@ -1069,7 +1080,7 @@ unsigned portBASE_TYPE uxTaskGetNumberOfTasks( void ) PRIVILEGED_FUNCTION; *
signed char *pcTaskGetTaskName( xTaskHandle xTaskToQuery );
* * @return The text (human readable) name of the task referenced by the handle - * xTaskToQueury. A task can query its own name by either passing in its own + * xTaskToQuery. A task can query its own name by either passing in its own * handle, or by setting xTaskToQuery to NULL. INCLUDE_pcTaskGetTaskName must be * set to 1 in FreeRTOSConfig.h for pcTaskGetTaskName() to be available. * @@ -1093,12 +1104,13 @@ signed char *pcTaskGetTaskName( xTaskHandle xTaskToQuery ); * @param xTask Handle of the task associated with the stack to be checked. * Set xTask to NULL to check the stack of the calling task. * - * @return The smallest amount of free stack space there has been (in bytes) - * since the task referenced by xTask was created. + * @return The smallest amount of free stack space there has been (in words, so + * actual spaces on the stack rather than bytes) since the task referenced by + * xTask was created. */ unsigned portBASE_TYPE uxTaskGetStackHighWaterMark( xTaskHandle xTask ) PRIVILEGED_FUNCTION; -/* When using trace macros it is sometimes necessary to include tasks.h before +/* When using trace macros it is sometimes necessary to include task.h before FreeRTOS.h. When this is done pdTASK_HOOK_CODE will not yet have been defined, so the following two prototypes will cause a compilation error. This can be fixed by simply guarding against the inclusion of these two prototypes unless @@ -1128,13 +1140,14 @@ constant. */ /** * task.h - *
portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, pdTASK_HOOK_CODE pxHookFunction );
+ *
portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter );
* * Calls the hook function associated with xTask. Passing xTask as NULL has * the effect of calling the Running tasks (the calling task) hook function. * * pvParameter is passed to the hook function for the task to interpret as it - * wants. + * wants. The return value is the value returned by the task hook function + * registered by the user. */ portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter ) PRIVILEGED_FUNCTION; @@ -1148,7 +1161,7 @@ portBASE_TYPE xTaskCallApplicationTaskHook( xTaskHandle xTask, void *pvParameter xTaskHandle xTaskGetIdleTaskHandle( void ); /** - * configUSE_TRACE_FACILITY must bet defined as 1 in FreeRTOSConfig.h for + * configUSE_TRACE_FACILITY must be defined as 1 in FreeRTOSConfig.h for * uxTaskGetSystemState() to be available. * * uxTaskGetSystemState() populates an xTaskStatusType structure for each task in @@ -1197,11 +1210,11 @@ xTaskHandle xTaskGetIdleTaskHandle( void ); // Take a snapshot of the number of tasks in case it changes while this // function is executing. - uxArraySize = uxCurrentNumberOfTasks(); + uxArraySize = uxTaskGetNumberOfTasks(); // Allocate a xTaskStatusType structure for each task. An array could be // allocated statically at compile time. - pxTaskStatusArray = pvPortMalloc( uxCurrentNumberOfTasks * sizeof( xTaskStatusType ) ); + pxTaskStatusArray = pvPortMalloc( uxArraySize * sizeof( xTaskStatusType ) ); if( pxTaskStatusArray != NULL ) { @@ -1284,7 +1297,7 @@ unsigned portBASE_TYPE uxTaskGetSystemState( xTaskStatusType *pxTaskStatusArray, * call to vTaskList(). * * @param pcWriteBuffer A buffer into which the above mentioned details - * will be written, in ascii form. This buffer is assumed to be large + * will be written, in ASCII form. This buffer is assumed to be large * enough to contain the generated report. Approximately 40 bytes per * task should be sufficient. * @@ -1300,7 +1313,7 @@ void vTaskList( signed char *pcWriteBuffer ) PRIVILEGED_FUNCTION; * configGENERATE_RUN_TIME_STATS and configUSE_STATS_FORMATTING_FUNCTIONS * must both be defined as 1 for this function to be available. The application * must also then provide definitions for - * portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() and portGET_RUN_TIME_COUNTER_VALUE + * portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() and portGET_RUN_TIME_COUNTER_VALUE() * to configure a peripheral timer/counter and return the timers current count * value respectively. The counter should be at least 10 times the frequency of * the tick count. @@ -1338,7 +1351,7 @@ void vTaskList( signed char *pcWriteBuffer ) PRIVILEGED_FUNCTION; * vTaskGetRunTimeStats(). * * @param pcWriteBuffer A buffer into which the execution times will be - * written, in ascii form. This buffer is assumed to be large enough to + * written, in ASCII form. This buffer is assumed to be large enough to * contain the generated report. Approximately 40 bytes per task should * be sufficient. * @@ -1412,8 +1425,6 @@ void vTaskPlaceOnUnorderedEventList( xList * pxEventList, portTickType xItemValu * The difference being that this function does not permit tasks to block * indefinitely, whereas vTaskPlaceOnEventList() does. * - * @return pdTRUE if the task being removed has a higher priority than the task - * making the call, otherwise pdFALSE. */ void vTaskPlaceOnEventListRestricted( xList * const pxEventList, portTickType xTicksToWait ) PRIVILEGED_FUNCTION; @@ -1512,21 +1523,23 @@ signed portBASE_TYPE xTaskGenericCreate( pdTASK_CODE pxTaskCode, const signed ch unsigned portBASE_TYPE uxTaskGetTaskNumber( xTaskHandle xTask ) PRIVILEGED_FUNCTION; /* - * Set the uxTCBNumber of the task referenced by the xTask parameter to - * ucHandle. + * Set the uxTaskNumber of the task referenced by the xTask parameter to + * uxHandle. */ void vTaskSetTaskNumber( xTaskHandle xTask, unsigned portBASE_TYPE uxHandle ) PRIVILEGED_FUNCTION; /* + * Only available when configUSE_TICKLESS_IDLE is set to 1. * If tickless mode is being used, or a low power mode is implemented, then * the tick interrupt will not execute during idle periods. When this is the * case, the tick count value maintained by the scheduler needs to be kept up - * to date with the actual execution time by being skipped forward by the by - * a time equal to the idle period. + * to date with the actual execution time by being skipped forward by a time + * equal to the idle period. */ void vTaskStepTick( portTickType xTicksToJump ) PRIVILEGED_FUNCTION; /* + * Only avilable when configUSE_TICKLESS_IDLE is set to 1. * Provided for use within portSUPPRESS_TICKS_AND_SLEEP() to allow the port * specific sleep function to determine if it is ok to proceed with the sleep, * and if it is ok to proceed, if it is ok to sleep indefinitely. diff --git a/FreeRTOS/Source/include/timers.h b/FreeRTOS/Source/include/timers.h index f41ac583b..4b6775cda 100644 --- a/FreeRTOS/Source/include/timers.h +++ b/FreeRTOS/Source/include/timers.h @@ -80,6 +80,10 @@ happens to also be including task.h. */ extern "C" { #endif +/*----------------------------------------------------------- + * MACROS AND DEFINITIONS + *----------------------------------------------------------*/ + /* IDs for commands that can be sent/received on the timer queue. These are to be used solely through the macros that make up the public software timer API, as defined below. */ @@ -89,11 +93,7 @@ as defined below. */ #define tmrCOMMAND_CHANGE_PERIOD ( ( portBASE_TYPE ) 2 ) #define tmrCOMMAND_DELETE ( ( portBASE_TYPE ) 3 ) -/*----------------------------------------------------------- - * MACROS AND DEFINITIONS - *----------------------------------------------------------*/ - - /** +/** * Type by which software timers are referenced. For example, a call to * xTimerCreate() returns an xTimerHandle variable that can then be used to * reference the subject timer in calls to other software timer API functions @@ -105,7 +105,7 @@ typedef void * xTimerHandle; typedef void (*tmrTIMER_CALLBACK)( xTimerHandle xTimer ); /** - * xTimerHandle xTimerCreate( const signed char *pcTimerName, + * xTimerHandle xTimerCreate( const signed char * const pcTimerName, * portTickType xTimerPeriodInTicks, * unsigned portBASE_TYPE uxAutoReload, * void * pvTimerID, @@ -145,10 +145,10 @@ typedef void (*tmrTIMER_CALLBACK)( xTimerHandle xTimer ); * Callback functions must have the prototype defined by tmrTIMER_CALLBACK, * which is "void vCallbackFunction( xTimerHandle xTimer );". * - * @return If the timer is successfully create then a handle to the newly + * @return If the timer is successfully created then a handle to the newly * created timer is returned. If the timer cannot be created (because either * there is insufficient FreeRTOS heap remaining to allocate the timer - * structures, or the timer period was set to 0) then 0 is returned. + * structures, or the timer period was set to 0) then NULL is returned. * * Example usage: * @verbatim @@ -263,7 +263,7 @@ void *pvTimerGetTimerID( xTimerHandle xTimer ) PRIVILEGED_FUNCTION; * * A timer will be dormant if: * 1) It has been created but not started, or - * 2) It is an expired on-shot timer that has not been restarted. + * 2) It is an expired one-shot timer that has not been restarted. * * Timers are created in the dormant state. The xTimerStart(), xTimerReset(), * xTimerStartFromISR(), xTimerResetFromISR(), xTimerChangePeriod() and @@ -294,6 +294,8 @@ void *pvTimerGetTimerID( xTimerHandle xTimer ) PRIVILEGED_FUNCTION; portBASE_TYPE xTimerIsTimerActive( xTimerHandle xTimer ) PRIVILEGED_FUNCTION; /** + * xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); + * * xTimerGetTimerDaemonTaskHandle() is only available if * INCLUDE_xTimerGetTimerDaemonTaskHandle is set to 1 in FreeRTOSConfig.h. * @@ -307,7 +309,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); * * Timer functionality is provided by a timer service/daemon task. Many of the * public FreeRTOS timer API functions send commands to the timer service task - * though a queue called the timer command queue. The timer command queue is + * through a queue called the timer command queue. The timer command queue is * private to the kernel itself and is not directly accessible to application * code. The length of the timer command queue is set by the * configTIMER_QUEUE_LENGTH configuration constant. @@ -359,7 +361,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); * * Timer functionality is provided by a timer service/daemon task. Many of the * public FreeRTOS timer API functions send commands to the timer service task - * though a queue called the timer command queue. The timer command queue is + * through a queue called the timer command queue. The timer command queue is * private to the kernel itself and is not directly accessible to application * code. The length of the timer command queue is set by the * configTIMER_QUEUE_LENGTH configuration constant. @@ -403,7 +405,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); * * Timer functionality is provided by a timer service/daemon task. Many of the * public FreeRTOS timer API functions send commands to the timer service task - * though a queue called the timer command queue. The timer command queue is + * through a queue called the timer command queue. The timer command queue is * private to the kernel itself and is not directly accessible to application * code. The length of the timer command queue is set by the * configTIMER_QUEUE_LENGTH configuration constant. @@ -481,7 +483,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); * * Timer functionality is provided by a timer service/daemon task. Many of the * public FreeRTOS timer API functions send commands to the timer service task - * though a queue called the timer command queue. The timer command queue is + * through a queue called the timer command queue. The timer command queue is * private to the kernel itself and is not directly accessible to application * code. The length of the timer command queue is set by the * configTIMER_QUEUE_LENGTH configuration constant. @@ -519,7 +521,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); * * Timer functionality is provided by a timer service/daemon task. Many of the * public FreeRTOS timer API functions send commands to the timer service task - * though a queue called the timer command queue. The timer command queue is + * through a queue called the timer command queue. The timer command queue is * private to the kernel itself and is not directly accessible to application * code. The length of the timer command queue is set by the * configTIMER_QUEUE_LENGTH configuration constant. @@ -716,7 +718,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); * if( xHigherPriorityTaskWoken != pdFALSE ) * { * // Call the interrupt safe yield function here (actual function - * // depends on the FreeRTOS port being used. + * // depends on the FreeRTOS port being used). * } * } * @endverbatim @@ -779,7 +781,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); * if( xHigherPriorityTaskWoken != pdFALSE ) * { * // Call the interrupt safe yield function here (actual function - * // depends on the FreeRTOS port being used. + * // depends on the FreeRTOS port being used). * } * } * @endverbatim @@ -852,7 +854,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); * if( xHigherPriorityTaskWoken != pdFALSE ) * { * // Call the interrupt safe yield function here (actual function - * // depends on the FreeRTOS port being used. + * // depends on the FreeRTOS port being used). * } * } * @endverbatim @@ -938,7 +940,7 @@ xTaskHandle xTimerGetTimerDaemonTaskHandle( void ); * if( xHigherPriorityTaskWoken != pdFALSE ) * { * // Call the interrupt safe yield function here (actual function - * // depends on the FreeRTOS port being used. + * // depends on the FreeRTOS port being used). * } * } * @endverbatim diff --git a/FreeRTOS/Source/list.c b/FreeRTOS/Source/list.c index 1421bc689..a3e6755d9 100644 --- a/FreeRTOS/Source/list.c +++ b/FreeRTOS/Source/list.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -101,13 +101,11 @@ void vListInitialiseItem( xListItem * const pxItem ) void vListInsertEnd( xList * const pxList, xListItem * const pxNewListItem ) { -xListItem * pxIndex; +xListItem * const pxIndex = pxList->pxIndex; /* Insert a new list item into pxList, but rather than sort the list, makes the new list item the last item to be removed by a call to - pvListGetOwnerOfNextEntry. */ - pxIndex = pxList->pxIndex; - + listGET_OWNER_OF_NEXT_ENTRY(). */ pxNewListItem->pxNext = pxIndex; pxNewListItem->pxPrevious = pxIndex->pxPrevious; pxIndex->pxPrevious->pxNext = pxNewListItem; @@ -123,14 +121,13 @@ xListItem * pxIndex; void vListInsert( xList * const pxList, xListItem * const pxNewListItem ) { xListItem *pxIterator; -portTickType xValueOfInsertion; +const portTickType xValueOfInsertion = pxNewListItem->xItemValue; - /* Insert the new list item into the list, sorted in ulListItem order. */ - xValueOfInsertion = pxNewListItem->xItemValue; + /* Insert the new list item into the list, sorted in xItemValue order. - /* If the list already contains a list item with the same item value then + 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) + are stored in ready lists (all of which have the same xItemValue value) 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 @@ -180,15 +177,13 @@ portTickType xValueOfInsertion; unsigned portBASE_TYPE uxListRemove( xListItem * const pxItemToRemove ) { -xList * pxList; +/* The list item knows which list it is in. Obtain the list from the list +item. */ +xList * const pxList = ( xList * ) pxItemToRemove->pvContainer; pxItemToRemove->pxNext->pxPrevious = pxItemToRemove->pxPrevious; pxItemToRemove->pxPrevious->pxNext = pxItemToRemove->pxNext; - /* The list item knows which list it is in. Obtain the list from the list - item. */ - pxList = ( xList * ) pxItemToRemove->pvContainer; - /* Make sure the index is left pointing to a valid item. */ if( pxList->pxIndex == pxItemToRemove ) { diff --git a/FreeRTOS/Source/portable/BCC/16BitDOS/Flsh186/prtmacro.h b/FreeRTOS/Source/portable/BCC/16BitDOS/Flsh186/prtmacro.h index e98654064..04ca47ee8 100644 --- a/FreeRTOS/Source/portable/BCC/16BitDOS/Flsh186/prtmacro.h +++ b/FreeRTOS/Source/portable/BCC/16BitDOS/Flsh186/prtmacro.h @@ -90,7 +90,7 @@ #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/BCC/16BitDOS/PC/prtmacro.h b/FreeRTOS/Source/portable/BCC/16BitDOS/PC/prtmacro.h index 9dc720c1e..21ff0000d 100644 --- a/FreeRTOS/Source/portable/BCC/16BitDOS/PC/prtmacro.h +++ b/FreeRTOS/Source/portable/BCC/16BitDOS/PC/prtmacro.h @@ -90,7 +90,7 @@ #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/CCS/ARM_Cortex-R4/port.c b/FreeRTOS/Source/portable/CCS/ARM_Cortex-R4/port.c index afb646fa2..7fd41deed 100644 --- a/FreeRTOS/Source/portable/CCS/ARM_Cortex-R4/port.c +++ b/FreeRTOS/Source/portable/CCS/ARM_Cortex-R4/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -258,8 +258,9 @@ portBASE_TYPE xPortStartScheduler(void) */ void vPortEndScheduler(void) { - /* It is unlikely that the port will require this function as there - is nothing to return to. */ + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT( ulCriticalNesting == 1000UL ); } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/CCS/MSP430X/portmacro.h b/FreeRTOS/Source/portable/CCS/MSP430X/portmacro.h index 589549bce..4a9785bef 100644 --- a/FreeRTOS/Source/portable/CCS/MSP430X/portmacro.h +++ b/FreeRTOS/Source/portable/CCS/MSP430X/portmacro.h @@ -99,7 +99,7 @@ #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/CodeWarrior/ColdFire_V1/portmacro.h b/FreeRTOS/Source/portable/CodeWarrior/ColdFire_V1/portmacro.h index a8b6377cc..65b3dba55 100644 --- a/FreeRTOS/Source/portable/CodeWarrior/ColdFire_V1/portmacro.h +++ b/FreeRTOS/Source/portable/CodeWarrior/ColdFire_V1/portmacro.h @@ -94,7 +94,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/CodeWarrior/ColdFire_V2/portmacro.h b/FreeRTOS/Source/portable/CodeWarrior/ColdFire_V2/portmacro.h index af146cede..dea63b3db 100644 --- a/FreeRTOS/Source/portable/CodeWarrior/ColdFire_V2/portmacro.h +++ b/FreeRTOS/Source/portable/CodeWarrior/ColdFire_V2/portmacro.h @@ -94,7 +94,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/CodeWarrior/HCS12/portmacro.h b/FreeRTOS/Source/portable/CodeWarrior/HCS12/portmacro.h index 6eaf3ae76..c159b5e00 100644 --- a/FreeRTOS/Source/portable/CodeWarrior/HCS12/portmacro.h +++ b/FreeRTOS/Source/portable/CodeWarrior/HCS12/portmacro.h @@ -91,7 +91,7 @@ #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/ARM7_AT91FR40008/portmacro.h b/FreeRTOS/Source/portable/GCC/ARM7_AT91FR40008/portmacro.h index 0e8e666fe..6fd0f401b 100644 --- a/FreeRTOS/Source/portable/GCC/ARM7_AT91FR40008/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/ARM7_AT91FR40008/portmacro.h @@ -117,7 +117,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h b/FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h index 757d62235..4bc8b5c86 100644 --- a/FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/ARM7_AT91SAM7S/portmacro.h @@ -117,7 +117,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portmacro.h b/FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portmacro.h index d702d735c..62a2b9335 100644 --- a/FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/ARM7_LPC2000/portmacro.h @@ -94,7 +94,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/ARM7_LPC23xx/portmacro.h b/FreeRTOS/Source/portable/GCC/ARM7_LPC23xx/portmacro.h index 580e47cb7..80f0bb27d 100644 --- a/FreeRTOS/Source/portable/GCC/ARM7_LPC23xx/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/ARM7_LPC23xx/portmacro.h @@ -117,7 +117,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM0/port.c b/FreeRTOS/Source/portable/GCC/ARM_CM0/port.c index f34e9fd32..b469a9ebf 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CM0/port.c +++ b/FreeRTOS/Source/portable/GCC/ARM_CM0/port.c @@ -185,7 +185,7 @@ void vPortStartFirstTask( void ) " pop {pc} \n" /* Finally, pop the PC to jump to the user defined task code. */ " \n" " .align 2 \n" - "pxCurrentTCBConst2: .word pxCurrentTCB " + "pxCurrentTCBConst2: .word pxCurrentTCB " ); } /*-----------------------------------------------------------*/ @@ -208,7 +208,7 @@ portBASE_TYPE xPortStartScheduler( void ) /* Start the first task. */ vPortStartFirstTask(); - + /* Should never get here as the tasks will now be executing! Call the task exit error function to prevent compiler warnings about a static function not being called in the case that the application writer overrides this @@ -222,8 +222,9 @@ portBASE_TYPE xPortStartScheduler( void ) void vPortEndScheduler( void ) { - /* It is unlikely that the CM0 port will require this function as there - is nothing to return to. */ + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT( uxCriticalNesting == 1000UL ); } /*-----------------------------------------------------------*/ @@ -250,6 +251,7 @@ void vPortEnterCritical( void ) void vPortExitCritical( void ) { + configASSERT( uxCriticalNesting ); uxCriticalNesting--; if( uxCriticalNesting == 0 ) { diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM0/portmacro.h b/FreeRTOS/Source/portable/GCC/ARM_CM0/portmacro.h index 200b881ac..0492ef4a7 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CM0/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/ARM_CM0/portmacro.h @@ -95,7 +95,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h b/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h index 9a164ede0..e7dcd63ce 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h @@ -95,7 +95,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c b/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c index 8b3d9a481..140812a31 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c +++ b/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -370,8 +370,9 @@ portBASE_TYPE xPortStartScheduler( void ) void vPortEndScheduler( void ) { - /* It is unlikely that the CM3 port will require this function as there - is nothing to return to. */ + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT( uxCriticalNesting == 1000UL ); } /*-----------------------------------------------------------*/ @@ -390,6 +391,7 @@ void vPortExitCritical( void ) { portBASE_TYPE xRunningPrivileged = prvRaisePrivilege(); + configASSERT( uxCriticalNesting ); uxCriticalNesting--; if( uxCriticalNesting == 0 ) { diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/portmacro.h b/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/portmacro.h index eb4cafa73..b2bda49d8 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/ARM_CM3_MPU/portmacro.h @@ -95,7 +95,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h b/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h index e846f6603..cb411bc88 100644 --- a/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h @@ -95,7 +95,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/ATMega323/portmacro.h b/FreeRTOS/Source/portable/GCC/ATMega323/portmacro.h index 2dfc6c247..301aa8628 100644 --- a/FreeRTOS/Source/portable/GCC/ATMega323/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/ATMega323/portmacro.h @@ -101,7 +101,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/AVR32_UC3/portmacro.h b/FreeRTOS/Source/portable/GCC/AVR32_UC3/portmacro.h index dfb54a68e..ad022b0e1 100644 --- a/FreeRTOS/Source/portable/GCC/AVR32_UC3/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/AVR32_UC3/portmacro.h @@ -119,7 +119,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/CORTUS_APS3/portmacro.h b/FreeRTOS/Source/portable/GCC/CORTUS_APS3/portmacro.h index bada2d6d6..73bb0dbeb 100644 --- a/FreeRTOS/Source/portable/GCC/CORTUS_APS3/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/CORTUS_APS3/portmacro.h @@ -96,7 +96,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/ColdFire_V2/portmacro.h b/FreeRTOS/Source/portable/GCC/ColdFire_V2/portmacro.h index bff44b627..76c4c4e25 100644 --- a/FreeRTOS/Source/portable/GCC/ColdFire_V2/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/ColdFire_V2/portmacro.h @@ -94,7 +94,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/H8S2329/portmacro.h b/FreeRTOS/Source/portable/GCC/H8S2329/portmacro.h index bf077a8b5..939266ab2 100644 --- a/FreeRTOS/Source/portable/GCC/H8S2329/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/H8S2329/portmacro.h @@ -95,7 +95,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/HCS12/portmacro.h b/FreeRTOS/Source/portable/GCC/HCS12/portmacro.h index d94e81ec8..ddf523b93 100644 --- a/FreeRTOS/Source/portable/GCC/HCS12/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/HCS12/portmacro.h @@ -95,7 +95,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/MCF5235/portmacro.h b/FreeRTOS/Source/portable/GCC/MCF5235/portmacro.h index 90ecf78ea..e986d6d26 100644 --- a/FreeRTOS/Source/portable/GCC/MCF5235/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/MCF5235/portmacro.h @@ -72,7 +72,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /* ------------------------ Architecture specifics ------------------------ */ diff --git a/FreeRTOS/Source/portable/GCC/MSP430F449/portmacro.h b/FreeRTOS/Source/portable/GCC/MSP430F449/portmacro.h index 4b80440e9..dbe229bee 100644 --- a/FreeRTOS/Source/portable/GCC/MSP430F449/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/MSP430F449/portmacro.h @@ -94,7 +94,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/MicroBlaze/portmacro.h b/FreeRTOS/Source/portable/GCC/MicroBlaze/portmacro.h index bb3c37e5e..39d70723e 100644 --- a/FreeRTOS/Source/portable/GCC/MicroBlaze/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/MicroBlaze/portmacro.h @@ -94,7 +94,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/MicroBlazeV8/port.c b/FreeRTOS/Source/portable/GCC/MicroBlazeV8/port.c index aa31f5546..1fe020a30 100644 --- a/FreeRTOS/Source/portable/GCC/MicroBlazeV8/port.c +++ b/FreeRTOS/Source/portable/GCC/MicroBlazeV8/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -80,8 +80,8 @@ #include #include -/* Tasks are started with a critical section nesting of 0 - however, prior to -the scheduler being commenced interrupts should not be enabled, so the critical +/* Tasks are started with a critical section nesting of 0 - however, prior to +the scheduler being commenced interrupts should not be enabled, so the critical nesting variable is initialised to a non-zero value. */ #define portINITIAL_NESTING_VALUE ( 0xff ) @@ -100,14 +100,14 @@ created. */ */ static long prvInitialiseInterruptController( void ); -/* Ensure the interrupt controller instance variable is initialised before it is - * used, and that the initialisation only happens once. +/* Ensure the interrupt controller instance variable is initialised before it is + * used, and that the initialisation only happens once. */ static long prvEnsureInterruptControllerIsInitialised( void ); /*-----------------------------------------------------------*/ -/* Counts the nesting depth of calls to portENTER_CRITICAL(). Each task +/* Counts the nesting depth of calls to portENTER_CRITICAL(). Each task maintains its own count, so this variable is saved as part of the task context. */ volatile unsigned portBASE_TYPE uxCriticalNesting = portINITIAL_NESTING_VALUE; @@ -121,8 +121,8 @@ unsigned long *pulISRStack; get set to 1. ulTaskSwitchRequested is inspected just before the main interrupt handler exits. If, at that time, ulTaskSwitchRequested is set to 1, the kernel will call vTaskSwitchContext() to ensure the task that runs immediately after -the interrupt exists is the highest priority task that is able to run. This is -an unusual mechanism, but is used for this port because a single interrupt can +the interrupt exists is the highest priority task that is able to run. This is +an unusual mechanism, but is used for this port because a single interrupt can cause the servicing of multiple peripherals - and it is inefficient to call vTaskSwitchContext() multiple times as each peripheral is serviced. */ volatile unsigned long ulTaskSwitchRequested = 0UL; @@ -133,10 +133,10 @@ static XIntc xInterruptControllerInstance; /*-----------------------------------------------------------*/ -/* - * Initialise the stack of a task to look exactly as if a call to +/* + * Initialise the stack of a task to look exactly as if a call to * portSAVE_CONTEXT had been made. - * + * * See the portable.h header file. */ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) @@ -145,7 +145,7 @@ extern void *_SDA2_BASE_, *_SDA_BASE_; const unsigned long ulR2 = ( unsigned long ) &_SDA2_BASE_; const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_; - /* Place a few bytes of known values on the bottom of the stack. + /* Place a few bytes of known values on the bottom of the stack. This is essential for the Microblaze port and these lines must not be omitted. */ *pxTopOfStack = ( portSTACK_TYPE ) 0x00000000; @@ -170,7 +170,7 @@ const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_; /* First stack an initial value for the critical section nesting. This is initialised to zero. */ *pxTopOfStack = ( portSTACK_TYPE ) 0x00; - + /* R0 is always zero. */ /* R1 is the SP. */ @@ -203,13 +203,13 @@ const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_; #else pxTopOfStack-= 8; #endif - + *pxTopOfStack = ( portSTACK_TYPE ) ulR13; /* R13 - read/write small data area. */ pxTopOfStack--; *pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* R14 - return address for interrupt. */ pxTopOfStack--; *pxTopOfStack = ( portSTACK_TYPE ) NULL; /* R15 - return address for subroutine. */ - + #ifdef portPRE_LOAD_STACK_FOR_DEBUGGING pxTopOfStack--; *pxTopOfStack = ( portSTACK_TYPE ) 0x10; /* R16 - return address for trap (debugger). */ @@ -221,10 +221,10 @@ const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_; #else pxTopOfStack -= 4; #endif - + *pxTopOfStack = ( portSTACK_TYPE ) 0x00; /* R19 - must be saved across function calls. Callee-save. Seems to be interpreted as the frame pointer. */ - - #ifdef portPRE_LOAD_STACK_FOR_DEBUGGING + + #ifdef portPRE_LOAD_STACK_FOR_DEBUGGING pxTopOfStack--; *pxTopOfStack = ( portSTACK_TYPE ) 0x14; /* R20 - reserved for storing a pointer to the Global Offset Table (GOT) in Position Independent Code (PIC). Non-volatile in non-PIC code. Must be saved across function calls. Callee-save. Not used by FreeRTOS. */ pxTopOfStack--; @@ -254,7 +254,7 @@ const unsigned long ulR13 = ( unsigned long ) &_SDA_BASE_; pxTopOfStack -= 13; #endif - /* Return a pointer to the top of the stack that has been generated so this + /* Return a pointer to the top of the stack that has been generated so this can be stored in the task control block for the task. */ return pxTopOfStack; } @@ -266,11 +266,11 @@ extern void ( vPortStartFirstTask )( void ); extern unsigned long _stack[]; /* Setup the hardware to generate the tick. Interrupts are disabled when - this function is called. - + this function is called. + This port uses an application defined callback function to install the tick - interrupt handler because the kernel will run on lots of different - MicroBlaze and FPGA configurations - not all of which will have the same + interrupt handler because the kernel will run on lots of different + MicroBlaze and FPGA configurations - not all of which will have the same timer peripherals defined or available. An example definition of vApplicationSetupTimerInterrupt() is provided in the official demo application that accompanies this port. */ @@ -294,12 +294,14 @@ extern unsigned long _stack[]; void vPortEndScheduler( void ) { - /* Not implemented. */ + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT( uxCriticalNesting == 1000UL ); } /*-----------------------------------------------------------*/ /* - * Manual context switch called by portYIELD or taskYIELD. + * Manual context switch called by portYIELD or taskYIELD. */ void vPortYield( void ) { @@ -331,7 +333,7 @@ long lReturn; { XIntc_Enable( &xInterruptControllerInstance, ucInterruptID ); } - + configASSERT( lReturn ); } /*-----------------------------------------------------------*/ @@ -344,12 +346,12 @@ long lReturn; controller because the interrupt controller instance variable is private to this file. */ lReturn = prvEnsureInterruptControllerIsInitialised(); - + if( lReturn == pdPASS ) { XIntc_Disable( &xInterruptControllerInstance, ucInterruptID ); } - + configASSERT( lReturn ); } /*-----------------------------------------------------------*/ @@ -358,11 +360,11 @@ portBASE_TYPE xPortInstallInterruptHandler( unsigned char ucInterruptID, XInterr { long lReturn; - /* An API function is provided to install an interrupt handler because the + /* An API function is provided to install an interrupt handler because the interrupt controller instance variable is private to this file. */ lReturn = prvEnsureInterruptControllerIsInitialised(); - + if( lReturn == pdPASS ) { lReturn = XIntc_Connect( &xInterruptControllerInstance, ucInterruptID, pxHandler, pvCallBackRef ); @@ -372,7 +374,7 @@ long lReturn; { lReturn = pdPASS; } - + configASSERT( lReturn == pdPASS ); return lReturn; @@ -389,7 +391,7 @@ long lReturn; if( lInterruptControllerInitialised != pdTRUE ) { lReturn = prvInitialiseInterruptController(); - + if( lReturn == pdPASS ) { lInterruptControllerInitialised = pdTRUE; @@ -404,7 +406,7 @@ long lReturn; } /*-----------------------------------------------------------*/ -/* +/* * Handler for the timer interrupt. This is the handler that the application * defined callback function vApplicationSetupTimerInterrupt() should install. */ @@ -416,11 +418,11 @@ extern void vApplicationClearTimerInterrupt( void ); ( void ) pvUnused; /* This port uses an application defined callback function to clear the tick - interrupt because the kernel will run on lots of different MicroBlaze and - FPGA configurations - not all of which will have the same timer peripherals + interrupt because the kernel will run on lots of different MicroBlaze and + FPGA configurations - not all of which will have the same timer peripherals defined or available. An example definition of vApplicationClearTimerInterrupt() is provided in the official demo - application that accompanies this port. */ + application that accompanies this port. */ vApplicationClearTimerInterrupt(); /* Increment the RTOS tick - this might cause a task to unblock. */ diff --git a/FreeRTOS/Source/portable/GCC/MicroBlazeV8/portmacro.h b/FreeRTOS/Source/portable/GCC/MicroBlazeV8/portmacro.h index 60067bd8c..73e4248c7 100644 --- a/FreeRTOS/Source/portable/GCC/MicroBlazeV8/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/MicroBlazeV8/portmacro.h @@ -98,7 +98,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/NiosII/portmacro.h b/FreeRTOS/Source/portable/GCC/NiosII/portmacro.h index 38301647c..8e8ba3898 100644 --- a/FreeRTOS/Source/portable/GCC/NiosII/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/NiosII/portmacro.h @@ -96,7 +96,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/PPC405_Xilinx/portmacro.h b/FreeRTOS/Source/portable/GCC/PPC405_Xilinx/portmacro.h index 2201debfe..3a57cf146 100644 --- a/FreeRTOS/Source/portable/GCC/PPC405_Xilinx/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/PPC405_Xilinx/portmacro.h @@ -96,7 +96,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/PPC440_Xilinx/portmacro.h b/FreeRTOS/Source/portable/GCC/PPC440_Xilinx/portmacro.h index 2201debfe..3a57cf146 100644 --- a/FreeRTOS/Source/portable/GCC/PPC440_Xilinx/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/PPC440_Xilinx/portmacro.h @@ -96,7 +96,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/RX100/port.c b/FreeRTOS/Source/portable/GCC/RX100/port.c index 35ed60087..24fab584b 100644 --- a/FreeRTOS/Source/portable/GCC/RX100/port.c +++ b/FreeRTOS/Source/portable/GCC/RX100/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -299,7 +299,9 @@ portBASE_TYPE xPortStartScheduler( void ) void vPortEndScheduler( void ) { - /* Not implemented as there is nothing to return to. */ + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT( pxCurrentTCB == NULL ); } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/RX100/portmacro.h b/FreeRTOS/Source/portable/GCC/RX100/portmacro.h index 00d737e91..c51ae9d50 100644 --- a/FreeRTOS/Source/portable/GCC/RX100/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/RX100/portmacro.h @@ -96,7 +96,7 @@ portSTACK_TYPE and portBASE_TYPE. */ #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/RX600/port.c b/FreeRTOS/Source/portable/GCC/RX600/port.c index 4d05d45bf..68b4d5a6d 100644 --- a/FreeRTOS/Source/portable/GCC/RX600/port.c +++ b/FreeRTOS/Source/portable/GCC/RX600/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -79,15 +79,15 @@ /*-----------------------------------------------------------*/ -/* Tasks should start with interrupts enabled and in Supervisor mode, therefore +/* Tasks should start with interrupts enabled and in Supervisor mode, therefore PSW is set with U and I set, and PM and IPL clear. */ #define portINITIAL_PSW ( ( portSTACK_TYPE ) 0x00030000 ) #define portINITIAL_FPSW ( ( portSTACK_TYPE ) 0x00000100 ) /* These macros allow a critical section to be added around the call to -xTaskIncrementTick(), which is only ever called from interrupts at the kernel -priority - ie a known priority. Therefore these local macros are a slight -optimisation compared to calling the global SET/CLEAR_INTERRUPT_MASK macros, +xTaskIncrementTick(), which is only ever called from interrupts at the kernel +priority - ie a known priority. Therefore these local macros are a slight +optimisation compared to calling the global SET/CLEAR_INTERRUPT_MASK macros, which would require the old IPL to be read first and stored in a local variable. */ #define portDISABLE_INTERRUPTS_FROM_KERNEL_ISR() __asm volatile ( "MVTIPL %0" ::"i"(configMAX_SYSCALL_INTERRUPT_PRIORITY) ) #define portENABLE_INTERRUPTS_FROM_KERNEL_ISR() __asm volatile ( "MVTIPL %0" ::"i"(configKERNEL_INTERRUPT_PRIORITY) ) @@ -96,7 +96,7 @@ which would require the old IPL to be read first and stored in a local variable. /* * Function to start the first task executing - written in asm code as direct - * access to registers is required. + * access to registers is required. */ static void prvStartFirstTask( void ) __attribute__((naked)); @@ -118,19 +118,19 @@ extern void *pxCurrentTCB; /*-----------------------------------------------------------*/ -/* - * See header file for description. +/* + * See header file for description. */ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { /* R0 is not included as it is the stack pointer. */ - + *pxTopOfStack = 0x00; pxTopOfStack--; *pxTopOfStack = portINITIAL_PSW; pxTopOfStack--; *pxTopOfStack = ( portSTACK_TYPE ) pxCode; - + /* When debugging it can be useful if every register is set to a known value. Otherwise code space can be saved by just setting the registers that need to be set. */ @@ -171,9 +171,9 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxTopOfStack -= 15; } #endif - + *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R1 */ - pxTopOfStack--; + pxTopOfStack--; *pxTopOfStack = portINITIAL_FPSW; pxTopOfStack--; *pxTopOfStack = 0x12345678; /* Accumulator. */ @@ -192,16 +192,16 @@ extern void vApplicationSetupTimerInterrupt( void ); if( pxCurrentTCB != NULL ) { /* Call an application function to set up the timer that will generate the - tick interrupt. This way the application can decide which peripheral to + tick interrupt. This way the application can decide which peripheral to use. A demo application is provided to show a suitable example. */ vApplicationSetupTimerInterrupt(); - /* Enable the software interrupt. */ + /* Enable the software interrupt. */ _IEN( _ICU_SWINT ) = 1; - + /* Ensure the software interrupt is clear. */ _IR( _ICU_SWINT ) = 0; - + /* Ensure the software interrupt is set to the kernel priority. */ _IPR( _ICU_SWINT ) = configKERNEL_INTERRUPT_PRIORITY; @@ -216,43 +216,45 @@ extern void vApplicationSetupTimerInterrupt( void ); void vPortEndScheduler( void ) { - /* Not implemented as there is nothing to return to. */ + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT( pxCurrentTCB == NULL ); } /*-----------------------------------------------------------*/ static void prvStartFirstTask( void ) { __asm volatile - ( + ( /* When starting the scheduler there is nothing that needs moving to the interrupt stack because the function is not called from an interrupt. Just ensure the current stack is the user stack. */ "SETPSW U \n" \ - /* Obtain the location of the stack associated with which ever task + /* Obtain the location of the stack associated with which ever task pxCurrentTCB is currently pointing to. */ "MOV.L #_pxCurrentTCB, R15 \n" \ "MOV.L [R15], R15 \n" \ "MOV.L [R15], R0 \n" \ - /* Restore the registers from the stack of the task pointed to by + /* Restore the registers from the stack of the task pointed to by pxCurrentTCB. */ "POP R15 \n" \ - + /* Accumulator low 32 bits. */ "MVTACLO R15 \n" \ "POP R15 \n" \ - + /* Accumulator high 32 bits. */ "MVTACHI R15 \n" \ "POP R15 \n" \ - + /* Floating point status word. */ "MVTC R15, FPSW \n" \ - + /* R1 to R15 - R0 is not included as it is the SP. */ "POPM R1-R15 \n" \ - + /* This pops the remaining registers. */ "RTE \n" \ "NOP \n" \ @@ -269,18 +271,18 @@ void vSoftwareInterruptISR( void ) "SETPSW I \n" \ /* Move the data that was automatically pushed onto the interrupt stack when - the interrupt occurred from the interrupt stack to the user stack. - + the interrupt occurred from the interrupt stack to the user stack. + R15 is saved before it is clobbered. */ "PUSH.L R15 \n" \ - + /* Read the user stack pointer. */ "MVFC USP, R15 \n" \ - + /* Move the address down to the data being moved. */ "SUB #12, R15 \n" \ "MVTC R15, USP \n" \ - + /* Copy the data across, R15, then PC, then PSW. */ "MOV.L [ R0 ], [ R15 ] \n" \ "MOV.L 4[ R0 ], 4[ R15 ] \n" \ @@ -288,22 +290,22 @@ void vSoftwareInterruptISR( void ) /* Move the interrupt stack pointer to its new correct position. */ "ADD #12, R0 \n" \ - + /* All the rest of the registers are saved directly to the user stack. */ "SETPSW U \n" \ /* Save the rest of the general registers (R15 has been saved already). */ "PUSHM R1-R14 \n" \ - + /* Save the FPSW and accumulator. */ "MVFC FPSW, R15 \n" \ "PUSH.L R15 \n" \ "MVFACHI R15 \n" \ "PUSH.L R15 \n" \ - + /* Middle word. */ "MVFACMI R15 \n" \ - + /* Shifted left as it is restored to the low order word. */ "SHLL #16, R15 \n" \ "PUSH.L R15 \n" \ @@ -312,7 +314,7 @@ void vSoftwareInterruptISR( void ) "MOV.L #_pxCurrentTCB, R15 \n" \ "MOV.L [ R15 ], R15 \n" \ "MOV.L R0, [ R15 ] \n" \ - + /* Ensure the interrupt mask is set to the syscall priority while the kernel structures are being accessed. */ "MVTIPL %0 \n" \ @@ -350,7 +352,7 @@ void vTickISR( void ) { /* Re-enabled interrupts. */ __asm volatile( "SETPSW I" ); - + /* Increment the tick, and perform any processing the new tick value necessitates. Ensure IPL is at the max syscall value first. */ portDISABLE_INTERRUPTS_FROM_KERNEL_ISR(); @@ -367,12 +369,12 @@ void vTickISR( void ) unsigned long ulPortGetIPL( void ) { __asm volatile - ( + ( "MVFC PSW, R1 \n" \ "SHLR #24, R1 \n" \ "RTS " ); - + /* This will never get executed, but keeps the compiler from complaining. */ return 0; } @@ -381,7 +383,7 @@ unsigned long ulPortGetIPL( void ) void vPortSetIPL( unsigned long ulNewIPL ) { __asm volatile - ( + ( "PUSH R5 \n" \ "MVFC PSW, R5 \n" \ "SHLL #24, R1 \n" \ diff --git a/FreeRTOS/Source/portable/GCC/RX600/portmacro.h b/FreeRTOS/Source/portable/GCC/RX600/portmacro.h index 5338c22fb..c17591af1 100644 --- a/FreeRTOS/Source/portable/GCC/RX600/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/RX600/portmacro.h @@ -96,7 +96,7 @@ portSTACK_TYPE and portBASE_TYPE. */ #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/STR75x/portmacro.h b/FreeRTOS/Source/portable/GCC/STR75x/portmacro.h index 851f2c0de..8621f7452 100644 --- a/FreeRTOS/Source/portable/GCC/STR75x/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/STR75x/portmacro.h @@ -95,7 +95,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/GCC/TriCore_1782/portmacro.h b/FreeRTOS/Source/portable/GCC/TriCore_1782/portmacro.h index 67fec8ef6..bbe15baae 100644 --- a/FreeRTOS/Source/portable/GCC/TriCore_1782/portmacro.h +++ b/FreeRTOS/Source/portable/GCC/TriCore_1782/portmacro.h @@ -98,7 +98,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*---------------------------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/78K0R/portmacro.h b/FreeRTOS/Source/portable/IAR/78K0R/portmacro.h index 71faa1b00..e1842a801 100644 --- a/FreeRTOS/Source/portable/IAR/78K0R/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/78K0R/portmacro.h @@ -95,7 +95,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned long portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/ARM_CA9/port.c b/FreeRTOS/Source/portable/IAR/ARM_CA9/port.c index fc79ce54e..8e86d3406 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CA9/port.c +++ b/FreeRTOS/Source/portable/IAR/ARM_CA9/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -297,8 +297,9 @@ unsigned long ulAPSR; void vPortEndScheduler( void ) { - /* It is unlikely that the ARM port will require this function as there - is nothing to return to. */ + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT( ulCriticalNesting == 1000UL ); } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/ARM_CA9/portmacro.h b/FreeRTOS/Source/portable/IAR/ARM_CA9/portmacro.h index 7c203b91d..c0c79c78d 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CA9/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/ARM_CA9/portmacro.h @@ -94,7 +94,7 @@ #define portSTACK_TYPE unsigned long #define portBASE_TYPE portLONG typedef unsigned long portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/ARM_CM0/port.c b/FreeRTOS/Source/portable/IAR/ARM_CM0/port.c index 813cde995..c1fa13709 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CM0/port.c +++ b/FreeRTOS/Source/portable/IAR/ARM_CM0/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -145,13 +145,13 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE static void prvTaskExitError( void ) { /* A function that implements a task must not exit or attempt to return to - its caller as there is nothing to return to. If a task wants to exit it + its caller as there is nothing to return to. If a task wants to exit it should instead call vTaskDelete( NULL ). - - Artificially force an assert() to be triggered if configASSERT() is + + Artificially force an assert() to be triggered if configASSERT() is defined, then stop here so application writers can catch the error. */ configASSERT( uxCriticalNesting == ~0UL ); - portDISABLE_INTERRUPTS(); + portDISABLE_INTERRUPTS(); for( ;; ); } /*-----------------------------------------------------------*/ @@ -182,8 +182,9 @@ portBASE_TYPE xPortStartScheduler( void ) void vPortEndScheduler( void ) { - /* It is unlikely that the CM0 port will require this function as there - is nothing to return to. */ + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT( uxCriticalNesting == 1000UL ); } /*-----------------------------------------------------------*/ @@ -210,6 +211,7 @@ void vPortEnterCritical( void ) void vPortExitCritical( void ) { + configASSERT( uxCriticalNesting ); uxCriticalNesting--; if( uxCriticalNesting == 0 ) { diff --git a/FreeRTOS/Source/portable/IAR/ARM_CM0/portmacro.h b/FreeRTOS/Source/portable/IAR/ARM_CM0/portmacro.h index 31f672beb..67d04cfcb 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CM0/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/ARM_CM0/portmacro.h @@ -95,7 +95,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/ARM_CM3/port.c b/FreeRTOS/Source/portable/IAR/ARM_CM3/port.c index 94519613c..4e718a4ac 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CM3/port.c +++ b/FreeRTOS/Source/portable/IAR/ARM_CM3/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -214,13 +214,13 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE static void prvTaskExitError( void ) { /* A function that implements a task must not exit or attempt to return to - its caller as there is nothing to return to. If a task wants to exit it + its caller as there is nothing to return to. If a task wants to exit it should instead call vTaskDelete( NULL ). - - Artificially force an assert() to be triggered if configASSERT() is + + Artificially force an assert() to be triggered if configASSERT() is defined, then stop here so application writers can catch the error. */ configASSERT( uxCriticalNesting == ~0UL ); - portDISABLE_INTERRUPTS(); + portDISABLE_INTERRUPTS(); for( ;; ); } /*-----------------------------------------------------------*/ @@ -295,8 +295,9 @@ portBASE_TYPE xPortStartScheduler( void ) void vPortEndScheduler( void ) { - /* It is unlikely that the CM3 port will require this function as there - is nothing to return to. */ + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT( uxCriticalNesting == 1000UL ); } /*-----------------------------------------------------------*/ @@ -323,6 +324,7 @@ void vPortEnterCritical( void ) void vPortExitCritical( void ) { + configASSERT( uxCriticalNesting ); uxCriticalNesting--; if( uxCriticalNesting == 0 ) { @@ -390,10 +392,10 @@ void xPortSysTickHandler( void ) /* Restart from whatever is left in the count register to complete this tick period. */ portNVIC_SYSTICK_LOAD_REG = portNVIC_SYSTICK_CURRENT_VALUE_REG; - + /* Restart SysTick. */ portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT; - + /* Reset the reload register to the value required for normal tick periods. */ portNVIC_SYSTICK_LOAD_REG = ulTimerCountsForOneTick - 1UL; @@ -442,23 +444,23 @@ void xPortSysTickHandler( void ) if( ( portNVIC_SYSTICK_CTRL_REG & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 ) { unsigned long ulCalculatedLoadValue; - + /* The tick interrupt has already executed, and the SysTick count reloaded with ulReloadValue. Reset the portNVIC_SYSTICK_LOAD_REG with whatever remains of this tick period. */ ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL ) - ( ulReloadValue - portNVIC_SYSTICK_CURRENT_VALUE_REG ); - /* Don't allow a tiny value, or values that have somehow - underflowed because the post sleep hook did something + /* Don't allow a tiny value, or values that have somehow + underflowed because the post sleep hook did something that took too long. */ if( ( ulCalculatedLoadValue < ulStoppedTimerCompensation ) || ( ulCalculatedLoadValue > ulTimerCountsForOneTick ) ) { ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL ); } - + portNVIC_SYSTICK_LOAD_REG = ulCalculatedLoadValue; - + /* The tick interrupt handler will already have pended the tick processing in the kernel. As the pending tick will be processed as soon as this function exits, the tick value diff --git a/FreeRTOS/Source/portable/IAR/ARM_CM4F/port.c b/FreeRTOS/Source/portable/IAR/ARM_CM4F/port.c index 0b46f09c8..95b8b1870 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CM4F/port.c +++ b/FreeRTOS/Source/portable/IAR/ARM_CM4F/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -321,8 +321,9 @@ portBASE_TYPE xPortStartScheduler( void ) void vPortEndScheduler( void ) { - /* It is unlikely that the CM4F port will require this function as there - is nothing to return to. */ + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT( uxCriticalNesting == 1000UL ); } /*-----------------------------------------------------------*/ @@ -349,6 +350,7 @@ void vPortEnterCritical( void ) void vPortExitCritical( void ) { + configASSERT( uxCriticalNesting ); uxCriticalNesting--; if( uxCriticalNesting == 0 ) { @@ -468,23 +470,23 @@ void xPortSysTickHandler( void ) if( ( portNVIC_SYSTICK_CTRL_REG & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 ) { unsigned long ulCalculatedLoadValue; - + /* The tick interrupt has already executed, and the SysTick count reloaded with ulReloadValue. Reset the portNVIC_SYSTICK_LOAD_REG with whatever remains of this tick period. */ ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL ) - ( ulReloadValue - portNVIC_SYSTICK_CURRENT_VALUE_REG ); - /* Don't allow a tiny value, or values that have somehow - underflowed because the post sleep hook did something + /* Don't allow a tiny value, or values that have somehow + underflowed because the post sleep hook did something that took too long. */ if( ( ulCalculatedLoadValue < ulStoppedTimerCompensation ) || ( ulCalculatedLoadValue > ulTimerCountsForOneTick ) ) { ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL ); } - + portNVIC_SYSTICK_LOAD_REG = ulCalculatedLoadValue; - + /* The tick interrupt handler will already have pended the tick processing in the kernel. As the pending tick will be processed as soon as this function exits, the tick value diff --git a/FreeRTOS/Source/portable/IAR/ARM_CM4F/portmacro.h b/FreeRTOS/Source/portable/IAR/ARM_CM4F/portmacro.h index 8e2c0e23c..dfe6acfb6 100644 --- a/FreeRTOS/Source/portable/IAR/ARM_CM4F/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/ARM_CM4F/portmacro.h @@ -95,7 +95,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/ATMega323/portmacro.h b/FreeRTOS/Source/portable/IAR/ATMega323/portmacro.h index 9d5dee983..1f6614477 100644 --- a/FreeRTOS/Source/portable/IAR/ATMega323/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/ATMega323/portmacro.h @@ -102,7 +102,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/AVR32_UC3/portmacro.h b/FreeRTOS/Source/portable/IAR/AVR32_UC3/portmacro.h index 196379f7b..fb781c224 100644 --- a/FreeRTOS/Source/portable/IAR/AVR32_UC3/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/AVR32_UC3/portmacro.h @@ -120,7 +120,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/AtmelSAM7S64/portmacro.h b/FreeRTOS/Source/portable/IAR/AtmelSAM7S64/portmacro.h index 1801b1953..13a35ac24 100644 --- a/FreeRTOS/Source/portable/IAR/AtmelSAM7S64/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/AtmelSAM7S64/portmacro.h @@ -95,7 +95,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/AtmelSAM9XE/portmacro.h b/FreeRTOS/Source/portable/IAR/AtmelSAM9XE/portmacro.h index ca29e3e55..0a763e866 100644 --- a/FreeRTOS/Source/portable/IAR/AtmelSAM9XE/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/AtmelSAM9XE/portmacro.h @@ -97,7 +97,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/LPC2000/portmacro.h b/FreeRTOS/Source/portable/IAR/LPC2000/portmacro.h index 30b20f2d2..6172cd6a5 100644 --- a/FreeRTOS/Source/portable/IAR/LPC2000/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/LPC2000/portmacro.h @@ -97,7 +97,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/MSP430/portmacro.h b/FreeRTOS/Source/portable/IAR/MSP430/portmacro.h index 9f930f954..86174be24 100644 --- a/FreeRTOS/Source/portable/IAR/MSP430/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/MSP430/portmacro.h @@ -90,7 +90,7 @@ #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/MSP430X/portmacro.h b/FreeRTOS/Source/portable/IAR/MSP430X/portmacro.h index 2f31dde2c..68a75eadb 100644 --- a/FreeRTOS/Source/portable/IAR/MSP430X/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/MSP430X/portmacro.h @@ -99,7 +99,7 @@ #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/RL78/portmacro.h b/FreeRTOS/Source/portable/IAR/RL78/portmacro.h index 05a2dde73..a02c896c2 100644 --- a/FreeRTOS/Source/portable/IAR/RL78/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/RL78/portmacro.h @@ -110,7 +110,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned long portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/RX100/port.c b/FreeRTOS/Source/portable/IAR/RX100/port.c index 757fb3694..a2e49bd3c 100644 --- a/FreeRTOS/Source/portable/IAR/RX100/port.c +++ b/FreeRTOS/Source/portable/IAR/RX100/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -317,7 +317,9 @@ __interrupt static void prvTickISR( void ) void vPortEndScheduler( void ) { - /* Not implemented as there is nothing to return to. */ + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT( pxCurrentTCB == NULL ); } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/RX100/portmacro.h b/FreeRTOS/Source/portable/IAR/RX100/portmacro.h index 78376394d..e21653038 100644 --- a/FreeRTOS/Source/portable/IAR/RX100/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/RX100/portmacro.h @@ -101,7 +101,7 @@ portSTACK_TYPE and portBASE_TYPE. */ #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/RX600/port.c b/FreeRTOS/Source/portable/IAR/RX600/port.c index 31dfcca5c..53fa6104c 100644 --- a/FreeRTOS/Source/portable/IAR/RX600/port.c +++ b/FreeRTOS/Source/portable/IAR/RX600/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -221,7 +221,9 @@ __interrupt void vTickISR( void ) void vPortEndScheduler( void ) { - /* Not implemented as there is nothing to return to. */ + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT( pxCurrentTCB == NULL ); } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/RX600/portmacro.h b/FreeRTOS/Source/portable/IAR/RX600/portmacro.h index 971a49541..2fd450e3b 100644 --- a/FreeRTOS/Source/portable/IAR/RX600/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/RX600/portmacro.h @@ -98,7 +98,7 @@ portSTACK_TYPE and portBASE_TYPE. */ #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/STR71x/portmacro.h b/FreeRTOS/Source/portable/IAR/STR71x/portmacro.h index b521b0b6f..3ae75b7f3 100644 --- a/FreeRTOS/Source/portable/IAR/STR71x/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/STR71x/portmacro.h @@ -98,7 +98,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/STR75x/portmacro.h b/FreeRTOS/Source/portable/IAR/STR75x/portmacro.h index 898617ccf..4f7999258 100644 --- a/FreeRTOS/Source/portable/IAR/STR75x/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/STR75x/portmacro.h @@ -97,7 +97,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/STR91x/portmacro.h b/FreeRTOS/Source/portable/IAR/STR91x/portmacro.h index 2f9e06e45..31eedd0be 100644 --- a/FreeRTOS/Source/portable/IAR/STR91x/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/STR91x/portmacro.h @@ -97,7 +97,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/IAR/V850ES/portmacro.h b/FreeRTOS/Source/portable/IAR/V850ES/portmacro.h index 7f3d86e40..2c1d2337f 100644 --- a/FreeRTOS/Source/portable/IAR/V850ES/portmacro.h +++ b/FreeRTOS/Source/portable/IAR/V850ES/portmacro.h @@ -95,7 +95,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/MPLAB/PIC18F/portmacro.h b/FreeRTOS/Source/portable/MPLAB/PIC18F/portmacro.h index e0f4f4268..3327499a3 100644 --- a/FreeRTOS/Source/portable/MPLAB/PIC18F/portmacro.h +++ b/FreeRTOS/Source/portable/MPLAB/PIC18F/portmacro.h @@ -90,7 +90,7 @@ #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/MPLAB/PIC24_dsPIC/port.c b/FreeRTOS/Source/portable/MPLAB/PIC24_dsPIC/port.c index 7741e05ce..a19e1b15a 100644 --- a/FreeRTOS/Source/portable/MPLAB/PIC24_dsPIC/port.c +++ b/FreeRTOS/Source/portable/MPLAB/PIC24_dsPIC/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -300,9 +300,9 @@ portBASE_TYPE xPortStartScheduler( void ) void vPortEndScheduler( void ) { - /* It is unlikely that the scheduler for the PIC port will get stopped - once running. If required disable the tick interrupt here, then return - to xPortStartScheduler(). */ + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT( uxCriticalNesting == 1000UL ); } /*-----------------------------------------------------------*/ @@ -346,6 +346,7 @@ void vPortEnterCritical( void ) void vPortExitCritical( void ) { + configASSERT( uxCriticalNesting ); uxCriticalNesting--; if( uxCriticalNesting == 0 ) { diff --git a/FreeRTOS/Source/portable/MPLAB/PIC24_dsPIC/portmacro.h b/FreeRTOS/Source/portable/MPLAB/PIC24_dsPIC/portmacro.h index c625f8c38..65c162901 100644 --- a/FreeRTOS/Source/portable/MPLAB/PIC24_dsPIC/portmacro.h +++ b/FreeRTOS/Source/portable/MPLAB/PIC24_dsPIC/portmacro.h @@ -94,7 +94,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/MPLAB/PIC32MX/port.c b/FreeRTOS/Source/portable/MPLAB/PIC32MX/port.c index 968cda3c4..cb8ba11d6 100644 --- a/FreeRTOS/Source/portable/MPLAB/PIC32MX/port.c +++ b/FreeRTOS/Source/portable/MPLAB/PIC32MX/port.c @@ -270,10 +270,9 @@ const unsigned long ulCompareMatch = ( (configPERIPHERAL_CLOCK_HZ / portTIMER_PR void vPortEndScheduler(void) { - /* It is unlikely that the scheduler for the PIC port will get stopped - once running. If required disable the tick interrupt here, then return - to xPortStartScheduler(). */ - for( ;; ); + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT( uxInterruptNesting == 1000UL ); } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/MPLAB/PIC32MX/portmacro.h b/FreeRTOS/Source/portable/MPLAB/PIC32MX/portmacro.h index a28796a0a..e1730981e 100644 --- a/FreeRTOS/Source/portable/MPLAB/PIC32MX/portmacro.h +++ b/FreeRTOS/Source/portable/MPLAB/PIC32MX/portmacro.h @@ -97,7 +97,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned long portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/MPLAB/PIC32MZ/port.c b/FreeRTOS/Source/portable/MPLAB/PIC32MZ/port.c index 4e62b77d2..4b2e2c078 100644 --- a/FreeRTOS/Source/portable/MPLAB/PIC32MZ/port.c +++ b/FreeRTOS/Source/portable/MPLAB/PIC32MZ/port.c @@ -279,10 +279,9 @@ const unsigned long ulCompareMatch = ( (configPERIPHERAL_CLOCK_HZ / portTIMER_PR void vPortEndScheduler(void) { - /* It is unlikely that the scheduler for the PIC port will get stopped - once running. If required disable the tick interrupt here, then return - to xPortStartScheduler(). */ - for( ;; ); + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT( uxInterruptNesting == 1000UL ); } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/MPLAB/PIC32MZ/portmacro.h b/FreeRTOS/Source/portable/MPLAB/PIC32MZ/portmacro.h index 86dde7309..cd4ca1927 100644 --- a/FreeRTOS/Source/portable/MPLAB/PIC32MZ/portmacro.h +++ b/FreeRTOS/Source/portable/MPLAB/PIC32MZ/portmacro.h @@ -97,7 +97,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned long portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/MSVC-MingW/portmacro.h b/FreeRTOS/Source/portable/MSVC-MingW/portmacro.h index e6aa4606c..518223622 100644 --- a/FreeRTOS/Source/portable/MSVC-MingW/portmacro.h +++ b/FreeRTOS/Source/portable/MSVC-MingW/portmacro.h @@ -85,7 +85,7 @@ #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /* Hardware specifics. */ diff --git a/FreeRTOS/Source/portable/Paradigm/Tern_EE/large_untested/portmacro.h b/FreeRTOS/Source/portable/Paradigm/Tern_EE/large_untested/portmacro.h index d94a8db89..6b979a7cf 100644 --- a/FreeRTOS/Source/portable/Paradigm/Tern_EE/large_untested/portmacro.h +++ b/FreeRTOS/Source/portable/Paradigm/Tern_EE/large_untested/portmacro.h @@ -94,7 +94,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/Paradigm/Tern_EE/small/portmacro.h b/FreeRTOS/Source/portable/Paradigm/Tern_EE/small/portmacro.h index d8768dd19..fe7bca553 100644 --- a/FreeRTOS/Source/portable/Paradigm/Tern_EE/small/portmacro.h +++ b/FreeRTOS/Source/portable/Paradigm/Tern_EE/small/portmacro.h @@ -96,7 +96,7 @@ typedef void ( __interrupt __far *pxISR )(); #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/RVDS/ARM7_LPC21xx/portmacro.h b/FreeRTOS/Source/portable/RVDS/ARM7_LPC21xx/portmacro.h index fcb4fc4a3..0dddc9692 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM7_LPC21xx/portmacro.h +++ b/FreeRTOS/Source/portable/RVDS/ARM7_LPC21xx/portmacro.h @@ -95,7 +95,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CA9/port.c b/FreeRTOS/Source/portable/RVDS/ARM_CA9/port.c index 818668498..ba9634d9a 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM_CA9/port.c +++ b/FreeRTOS/Source/portable/RVDS/ARM_CA9/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -316,9 +316,9 @@ unsigned long ulAPSR; setting. See the comments in vPortValidateInterruptPriority() below for more information. */ configASSERT( ( portICCBPR_BINARY_POINT_REGISTER & portBINARY_POINT_BITS ) <= portMAX_BINARY_POINT_VALUE ); - + if( ( portICCBPR_BINARY_POINT_REGISTER & portBINARY_POINT_BITS ) <= portMAX_BINARY_POINT_VALUE ) - { + { /* Start the timer that generates the tick ISR. */ configSETUP_TICK_INTERRUPT(); @@ -336,8 +336,9 @@ unsigned long ulAPSR; void vPortEndScheduler( void ) { - /* It is unlikely that the ARM port will require this function as there - is nothing to return to. */ + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT( ulCriticalNesting == 1000UL ); } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CA9/portmacro.h b/FreeRTOS/Source/portable/RVDS/ARM_CA9/portmacro.h index 75b1fd95d..7aff296f7 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM_CA9/portmacro.h +++ b/FreeRTOS/Source/portable/RVDS/ARM_CA9/portmacro.h @@ -94,7 +94,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned long portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CM0/port.c b/FreeRTOS/Source/portable/RVDS/ARM_CM0/port.c index 560dcf725..e7bb261b4 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM_CM0/port.c +++ b/FreeRTOS/Source/portable/RVDS/ARM_CM0/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -142,20 +142,20 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE static void prvTaskExitError( void ) { /* A function that implements a task must not exit or attempt to return to - its caller as there is nothing to return to. If a task wants to exit it + its caller as there is nothing to return to. If a task wants to exit it should instead call vTaskDelete( NULL ). - - Artificially force an assert() to be triggered if configASSERT() is + + Artificially force an assert() to be triggered if configASSERT() is defined, then stop here so application writers can catch the error. */ configASSERT( uxCriticalNesting == ~0UL ); - portDISABLE_INTERRUPTS(); + portDISABLE_INTERRUPTS(); for( ;; ); } /*-----------------------------------------------------------*/ void vPortSVCHandler( void ) { - /* This function is no longer used, but retained for backward + /* This function is no longer used, but retained for backward compatibility. */ } /*-----------------------------------------------------------*/ @@ -163,15 +163,15 @@ void vPortSVCHandler( void ) __asm void prvPortStartFirstTask( void ) { extern pxCurrentTCB; - + PRESERVE8 - + /* The MSP stack is not reset as, unlike on M3/4 parts, there is no vector table offset register that can be used to locate the initial stack value. Not all M0 parts have the application vector table at address 0. */ - + ldr r3, =pxCurrentTCB /* Obtain location of pxCurrentTCB. */ - ldr r1, [r3] + ldr r1, [r3] ldr r0, [r1] /* The first item in pxCurrentTCB is the task top of stack. */ adds r0, #32 /* Discard everything up to r0. */ msr psp, r0 /* This is now the new top of stack to use in the task. */ @@ -212,8 +212,9 @@ portBASE_TYPE xPortStartScheduler( void ) void vPortEndScheduler( void ) { - /* It is unlikely that the CM0 port will require this function as there - is nothing to return to. */ + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT( uxCriticalNesting == 1000UL ); } /*-----------------------------------------------------------*/ @@ -240,6 +241,7 @@ void vPortEnterCritical( void ) void vPortExitCritical( void ) { + configASSERT( uxCriticalNesting ); uxCriticalNesting--; if( uxCriticalNesting == 0 ) { diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CM0/portmacro.h b/FreeRTOS/Source/portable/RVDS/ARM_CM0/portmacro.h index 1b19d260c..1f7aefa0a 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM_CM0/portmacro.h +++ b/FreeRTOS/Source/portable/RVDS/ARM_CM0/portmacro.h @@ -95,7 +95,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c b/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c index 6bea4e5e8..8e881953f 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c +++ b/FreeRTOS/Source/portable/RVDS/ARM_CM3/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -186,7 +186,7 @@ static void prvTaskExitError( void ); #endif /* configUSE_TICKLESS_IDLE */ /* - * Used by the portASSERT_IF_INTERRUPT_PRIORITY_INVALID() macro to ensure + * Used by the portASSERT_IF_INTERRUPT_PRIORITY_INVALID() macro to ensure * FreeRTOS API functions are not called from interrupts that have been assigned * a priority above configMAX_SYSCALL_INTERRUPT_PRIORITY. */ @@ -223,13 +223,13 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE static void prvTaskExitError( void ) { /* A function that implements a task must not exit or attempt to return to - its caller as there is nothing to return to. If a task wants to exit it + its caller as there is nothing to return to. If a task wants to exit it should instead call vTaskDelete( NULL ). - - Artificially force an assert() to be triggered if configASSERT() is + + Artificially force an assert() to be triggered if configASSERT() is defined, then stop here so application writers can catch the error. */ configASSERT( uxCriticalNesting == ~0UL ); - portDISABLE_INTERRUPTS(); + portDISABLE_INTERRUPTS(); for( ;; ); } /*-----------------------------------------------------------*/ @@ -338,8 +338,9 @@ portBASE_TYPE xPortStartScheduler( void ) void vPortEndScheduler( void ) { - /* It is unlikely that the CM3 port will require this function as there - is nothing to return to. */ + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT( uxCriticalNesting == 1000UL ); } /*-----------------------------------------------------------*/ @@ -366,6 +367,7 @@ void vPortEnterCritical( void ) void vPortExitCritical( void ) { + configASSERT( uxCriticalNesting ); uxCriticalNesting--; if( uxCriticalNesting == 0 ) { @@ -466,10 +468,10 @@ void xPortSysTickHandler( void ) /* Restart from whatever is left in the count register to complete this tick period. */ portNVIC_SYSTICK_LOAD_REG = portNVIC_SYSTICK_CURRENT_VALUE_REG; - + /* Restart SysTick. */ portNVIC_SYSTICK_CTRL_REG = portNVIC_SYSTICK_CLK_BIT | portNVIC_SYSTICK_INT_BIT | portNVIC_SYSTICK_ENABLE_BIT; - + /* Reset the reload register to the value required for normal tick periods. */ portNVIC_SYSTICK_LOAD_REG = ulTimerCountsForOneTick - 1UL; @@ -518,23 +520,23 @@ void xPortSysTickHandler( void ) if( ( portNVIC_SYSTICK_CTRL_REG & portNVIC_SYSTICK_COUNT_FLAG_BIT ) != 0 ) { unsigned long ulCalculatedLoadValue; - + /* The tick interrupt has already executed, and the SysTick count reloaded with ulReloadValue. Reset the portNVIC_SYSTICK_LOAD_REG with whatever remains of this tick period. */ ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL ) - ( ulReloadValue - portNVIC_SYSTICK_CURRENT_VALUE_REG ); - /* Don't allow a tiny value, or values that have somehow - underflowed because the post sleep hook did something + /* Don't allow a tiny value, or values that have somehow + underflowed because the post sleep hook did something that took too long. */ if( ( ulCalculatedLoadValue < ulStoppedTimerCompensation ) || ( ulCalculatedLoadValue > ulTimerCountsForOneTick ) ) { ulCalculatedLoadValue = ( ulTimerCountsForOneTick - 1UL ); } - + portNVIC_SYSTICK_LOAD_REG = ulCalculatedLoadValue; - + /* The tick interrupt handler will already have pended the tick processing in the kernel. As the pending tick will be processed as soon as this function exits, the tick value @@ -627,7 +629,7 @@ __asm void vPortClearInterruptMask( unsigned long ulNewMask ) __asm unsigned long vPortGetIPSR( void ) { PRESERVE8 - + mrs r0, ipsr bx r14 } diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CM3/portmacro.h b/FreeRTOS/Source/portable/RVDS/ARM_CM3/portmacro.h index 2f9f4bef2..e7c0c33e7 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM_CM3/portmacro.h +++ b/FreeRTOS/Source/portable/RVDS/ARM_CM3/portmacro.h @@ -95,7 +95,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CM4F/port.c b/FreeRTOS/Source/portable/RVDS/ARM_CM4F/port.c index 125edaab5..615f2fa8b 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM_CM4F/port.c +++ b/FreeRTOS/Source/portable/RVDS/ARM_CM4F/port.c @@ -382,8 +382,9 @@ portBASE_TYPE xPortStartScheduler( void ) void vPortEndScheduler( void ) { - /* It is unlikely that the CM4F port will require this function as there - is nothing to return to. */ + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT( uxCriticalNesting == 1000UL ); } /*-----------------------------------------------------------*/ @@ -410,6 +411,7 @@ void vPortEnterCritical( void ) void vPortExitCritical( void ) { + configASSERT( uxCriticalNesting ); uxCriticalNesting--; if( uxCriticalNesting == 0 ) { diff --git a/FreeRTOS/Source/portable/RVDS/ARM_CM4F/portmacro.h b/FreeRTOS/Source/portable/RVDS/ARM_CM4F/portmacro.h index 144db9fc2..52beda0f8 100644 --- a/FreeRTOS/Source/portable/RVDS/ARM_CM4F/portmacro.h +++ b/FreeRTOS/Source/portable/RVDS/ARM_CM4F/portmacro.h @@ -95,7 +95,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/Renesas/RX100/port.c b/FreeRTOS/Source/portable/Renesas/RX100/port.c index 6f3558eea..5f4946646 100644 --- a/FreeRTOS/Source/portable/Renesas/RX100/port.c +++ b/FreeRTOS/Source/portable/Renesas/RX100/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -444,7 +444,9 @@ static void prvYieldHandler( void ) void vPortEndScheduler( void ) { - /* Not implemented as there is nothing to return to. */ + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT( pxCurrentTCB == NULL ); /* The following line is just to prevent the symbol getting optimised away. */ ( void ) vTaskSwitchContext(); diff --git a/FreeRTOS/Source/portable/Renesas/RX100/portmacro.h b/FreeRTOS/Source/portable/Renesas/RX100/portmacro.h index ba02d2413..bdf7fd0d9 100644 --- a/FreeRTOS/Source/portable/Renesas/RX100/portmacro.h +++ b/FreeRTOS/Source/portable/Renesas/RX100/portmacro.h @@ -99,7 +99,7 @@ than portSTACK_TYPE and portBASE_TYPE. */ #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/Renesas/RX200/port.c b/FreeRTOS/Source/portable/Renesas/RX200/port.c index 66afeaac9..2dad68672 100644 --- a/FreeRTOS/Source/portable/Renesas/RX200/port.c +++ b/FreeRTOS/Source/portable/Renesas/RX200/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -79,7 +79,7 @@ /*-----------------------------------------------------------*/ -/* Tasks should start with interrupts enabled and in Supervisor mode, therefore +/* Tasks should start with interrupts enabled and in Supervisor mode, therefore PSW is set with U and I set, and PM and IPL clear. */ #define portINITIAL_PSW ( ( portSTACK_TYPE ) 0x00030000 ) @@ -95,7 +95,7 @@ const portBASE_TYPE * p_vSoftwareInterruptEntry = &vSoftwareInterruptEntry; /* * Function to start the first task executing - written in asm code as direct - * access to registers is required. + * access to registers is required. */ static void prvStartFirstTask( void ); @@ -108,7 +108,7 @@ static void prvYieldHandler( void ); /* * The entry point for the software interrupt handler. This is the function - * that calls the inline asm function prvYieldHandler(). It is installed in + * that calls the inline asm function prvYieldHandler(). It is installed in * the vector table, but the code that installs it is in prvYieldHandler rather * than using a #pragma. */ @@ -123,8 +123,8 @@ extern void vTaskSwitchContext( void ); /*-----------------------------------------------------------*/ -/* - * See header file for description. +/* + * See header file for description. */ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters ) { @@ -180,9 +180,9 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxTopOfStack -= 15; } #endif - + *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R1 */ - pxTopOfStack--; + pxTopOfStack--; *pxTopOfStack = 0x12345678; /* Accumulator. */ pxTopOfStack--; *pxTopOfStack = 0x87654321; /* Accumulator. */ @@ -199,19 +199,19 @@ extern void vApplicationSetupTimerInterrupt( void ); if( pxCurrentTCB != NULL ) { /* Call an application function to set up the timer that will generate the - tick interrupt. This way the application can decide which peripheral to + tick interrupt. This way the application can decide which peripheral to use. A demo application is provided to show a suitable example. */ vApplicationSetupTimerInterrupt(); - /* Enable the software interrupt. */ + /* Enable the software interrupt. */ _IEN( _ICU_SWINT ) = 1; - + /* Ensure the software interrupt is clear. */ _IR( _ICU_SWINT ) = 0; - + /* Ensure the software interrupt is set to the kernel priority. */ _IPR( _ICU_SWINT ) = configKERNEL_INTERRUPT_PRIORITY; - + /* Start the first task. */ prvStartFirstTask(); } @@ -232,13 +232,13 @@ static void prvStartFirstTask( void ) Just ensure the current stack is the user stack. */ SETPSW U - /* Obtain the location of the stack associated with which ever task + /* Obtain the location of the stack associated with which ever task pxCurrentTCB is currently pointing to. */ MOV.L #_pxCurrentTCB, R15 MOV.L [R15], R15 MOV.L [R15], R0 - /* Restore the registers from the stack of the task pointed to by + /* Restore the registers from the stack of the task pointed to by pxCurrentTCB. */ POP R15 MVTACLO R15 /* Accumulator low 32 bits. */ @@ -280,18 +280,18 @@ static void prvYieldHandler( void ) SETPSW I /* Move the data that was automatically pushed onto the interrupt stack when - the interrupt occurred from the interrupt stack to the user stack. - + the interrupt occurred from the interrupt stack to the user stack. + R15 is saved before it is clobbered. */ PUSH.L R15 - + /* Read the user stack pointer. */ MVFC USP, R15 - + /* Move the address down to the data being moved. */ SUB #12, R15 MVTC R15, USP - + /* Copy the data across. */ MOV.L [ R0 ], [ R15 ] ; R15 MOV.L 4[ R0 ], 4[ R15 ] ; PC @@ -299,13 +299,13 @@ static void prvYieldHandler( void ) /* Move the interrupt stack pointer to its new correct position. */ ADD #12, R0 - + /* All the rest of the registers are saved directly to the user stack. */ SETPSW U /* Save the rest of the general registers (R15 has been saved already). */ PUSHM R1-R14 - + /* Save the accumulator. */ MVFACHI R15 PUSH.L R15 @@ -317,7 +317,7 @@ static void prvYieldHandler( void ) MOV.L #_pxCurrentTCB, R15 MOV.L [ R15 ], R15 MOV.L R0, [ R15 ] - + /* Ensure the interrupt mask is set to the syscall priority while the kernel structures are being accessed. */ MVTIPL #configMAX_SYSCALL_INTERRUPT_PRIORITY @@ -349,8 +349,10 @@ static void prvYieldHandler( void ) void vPortEndScheduler( void ) { - /* Not implemented as there is nothing to return to. */ - + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT( pxCurrentTCB == NULL ); + /* The following line is just to prevent the symbol getting optimised away. */ ( void ) vTaskSwitchContext(); } diff --git a/FreeRTOS/Source/portable/Renesas/RX200/portmacro.h b/FreeRTOS/Source/portable/Renesas/RX200/portmacro.h index 4db447f2b..575bd12ac 100644 --- a/FreeRTOS/Source/portable/Renesas/RX200/portmacro.h +++ b/FreeRTOS/Source/portable/Renesas/RX200/portmacro.h @@ -99,7 +99,7 @@ portSTACK_TYPE and portBASE_TYPE. */ #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/Renesas/RX600/port.c b/FreeRTOS/Source/portable/Renesas/RX600/port.c index 3078c6617..636c8e62f 100644 --- a/FreeRTOS/Source/portable/Renesas/RX600/port.c +++ b/FreeRTOS/Source/portable/Renesas/RX600/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -354,7 +354,9 @@ static void prvYieldHandler( void ) void vPortEndScheduler( void ) { - /* Not implemented as there is nothing to return to. */ + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT( pxCurrentTCB == NULL ); /* The following line is just to prevent the symbol getting optimised away. */ ( void ) vTaskSwitchContext(); diff --git a/FreeRTOS/Source/portable/Renesas/RX600/portmacro.h b/FreeRTOS/Source/portable/Renesas/RX600/portmacro.h index c145b77fc..847021405 100644 --- a/FreeRTOS/Source/portable/Renesas/RX600/portmacro.h +++ b/FreeRTOS/Source/portable/Renesas/RX600/portmacro.h @@ -99,7 +99,7 @@ portSTACK_TYPE and portBASE_TYPE. */ #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/Renesas/SH2A_FPU/portmacro.h b/FreeRTOS/Source/portable/Renesas/SH2A_FPU/portmacro.h index dc3d6fe3c..d6fba0b4e 100644 --- a/FreeRTOS/Source/portable/Renesas/SH2A_FPU/portmacro.h +++ b/FreeRTOS/Source/portable/Renesas/SH2A_FPU/portmacro.h @@ -98,7 +98,7 @@ portSTACK_TYPE and portBASE_TYPE. */ #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/Rowley/MSP430F449/portmacro.h b/FreeRTOS/Source/portable/Rowley/MSP430F449/portmacro.h index 580267439..322ae3e26 100644 --- a/FreeRTOS/Source/portable/Rowley/MSP430F449/portmacro.h +++ b/FreeRTOS/Source/portable/Rowley/MSP430F449/portmacro.h @@ -90,7 +90,7 @@ #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/SDCC/Cygnal/portmacro.h b/FreeRTOS/Source/portable/SDCC/Cygnal/portmacro.h index 1a338ab69..9f4e33aa9 100644 --- a/FreeRTOS/Source/portable/SDCC/Cygnal/portmacro.h +++ b/FreeRTOS/Source/portable/SDCC/Cygnal/portmacro.h @@ -99,7 +99,7 @@ void vSerialISR( void ) interrupt 4; #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/Softune/MB91460/portmacro.h b/FreeRTOS/Source/portable/Softune/MB91460/portmacro.h index 007e3fb79..26a931435 100644 --- a/FreeRTOS/Source/portable/Softune/MB91460/portmacro.h +++ b/FreeRTOS/Source/portable/Softune/MB91460/portmacro.h @@ -96,7 +96,7 @@ #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/Softune/MB96340/portmacro.h b/FreeRTOS/Source/portable/Softune/MB96340/portmacro.h index 368557f9a..c8fe208bf 100644 --- a/FreeRTOS/Source/portable/Softune/MB96340/portmacro.h +++ b/FreeRTOS/Source/portable/Softune/MB96340/portmacro.h @@ -102,7 +102,7 @@ FreeRTOSConfig.h to set the configMEMMODEL value. */ #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/Tasking/ARM_CM4F/port.c b/FreeRTOS/Source/portable/Tasking/ARM_CM4F/port.c index bb9b9789c..02b99dbbb 100644 --- a/FreeRTOS/Source/portable/Tasking/ARM_CM4F/port.c +++ b/FreeRTOS/Source/portable/Tasking/ARM_CM4F/port.c @@ -1,5 +1,5 @@ /* - FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. + FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd. All rights reserved VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. @@ -169,13 +169,13 @@ portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE static void prvTaskExitError( void ) { /* A function that implements a task must not exit or attempt to return to - its caller as there is nothing to return to. If a task wants to exit it + its caller as there is nothing to return to. If a task wants to exit it should instead call vTaskDelete( NULL ). - - Artificially force an assert() to be triggered if configASSERT() is + + Artificially force an assert() to be triggered if configASSERT() is defined, then stop here so application writers can catch the error. */ configASSERT( ulCriticalNesting == ~0UL ); - portDISABLE_INTERRUPTS(); + portDISABLE_INTERRUPTS(); for( ;; ); } /*-----------------------------------------------------------*/ @@ -216,8 +216,9 @@ portBASE_TYPE xPortStartScheduler( void ) void vPortEndScheduler( void ) { - /* It is unlikely that the CM4F port will require this function as there - is nothing to return to. */ + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT( ulCriticalNesting == 1000UL ); } /*-----------------------------------------------------------*/ @@ -244,6 +245,7 @@ void vPortEnterCritical( void ) void vPortExitCritical( void ) { + configASSERT( ulCriticalNesting ); ulCriticalNesting--; if( ulCriticalNesting == 0 ) { diff --git a/FreeRTOS/Source/portable/Tasking/ARM_CM4F/portmacro.h b/FreeRTOS/Source/portable/Tasking/ARM_CM4F/portmacro.h index 42d66aa4a..99596091d 100644 --- a/FreeRTOS/Source/portable/Tasking/ARM_CM4F/portmacro.h +++ b/FreeRTOS/Source/portable/Tasking/ARM_CM4F/portmacro.h @@ -95,7 +95,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/oWatcom/16BitDOS/Flsh186/portmacro.h b/FreeRTOS/Source/portable/oWatcom/16BitDOS/Flsh186/portmacro.h index 7afc42f60..e17e66834 100644 --- a/FreeRTOS/Source/portable/oWatcom/16BitDOS/Flsh186/portmacro.h +++ b/FreeRTOS/Source/portable/oWatcom/16BitDOS/Flsh186/portmacro.h @@ -95,7 +95,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/portable/oWatcom/16BitDOS/PC/portmacro.h b/FreeRTOS/Source/portable/oWatcom/16BitDOS/PC/portmacro.h index 5a44f5505..15e42fb66 100644 --- a/FreeRTOS/Source/portable/oWatcom/16BitDOS/PC/portmacro.h +++ b/FreeRTOS/Source/portable/oWatcom/16BitDOS/PC/portmacro.h @@ -94,7 +94,7 @@ extern "C" { #define portMAX_DELAY ( portTickType ) 0xffff #else typedef unsigned portLONG portTickType; - #define portMAX_DELAY ( portTickType ) 0xffffffff + #define portMAX_DELAY ( portTickType ) 0xffffffffUL #endif /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Source/queue.c b/FreeRTOS/Source/queue.c index 023aa4124..43ceaca92 100644 --- a/FreeRTOS/Source/queue.c +++ b/FreeRTOS/Source/queue.c @@ -418,7 +418,7 @@ xQueueHandle xReturn = NULL; void *pxReturn; /* This function is called by xSemaphoreGetMutexHolder(), and should not - be called directly. Note: This is is a good way of determining if the + be called directly. Note: This is a good way of determining if the calling task is the mutex holder, but not a good way of determining the identity of the mutex holder, as the holder may change between the following critical section exiting and the function returning. */ @@ -909,11 +909,11 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; { if( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX ) { - portENTER_CRITICAL(); + taskENTER_CRITICAL(); { vTaskPriorityInherit( ( void * ) pxQueue->pxMutexHolder ); } - portEXIT_CRITICAL(); + taskEXIT_CRITICAL(); } } #endif @@ -949,7 +949,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; /* RTOS ports that support interrupt nesting have the concept of a maximum system call (or maximum API call) interrupt priority. Interrupts that are - above the maximum system call priority are keep permanently enabled, even + above the maximum system call priority are kept permanently enabled, even when the RTOS kernel is in a critical section, but cannot make any calls to FreeRTOS API functions. If configASSERT() is defined in FreeRTOSConfig.h then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion @@ -1175,11 +1175,11 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; { if( pxQueue->uxQueueType == queueQUEUE_IS_MUTEX ) { - portENTER_CRITICAL(); + taskENTER_CRITICAL(); { vTaskPriorityInherit( ( void * ) pxQueue->pxMutexHolder ); } - portEXIT_CRITICAL(); + taskEXIT_CRITICAL(); } } #endif @@ -1220,7 +1220,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; /* RTOS ports that support interrupt nesting have the concept of a maximum system call (or maximum API call) interrupt priority. Interrupts that are - above the maximum system call priority are keep permanently enabled, even + above the maximum system call priority are kept permanently enabled, even when the RTOS kernel is in a critical section, but cannot make any calls to FreeRTOS API functions. If configASSERT() is defined in FreeRTOSConfig.h then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion @@ -1296,7 +1296,7 @@ xQUEUE * const pxQueue = ( xQUEUE * ) xQueue; /* RTOS ports that support interrupt nesting have the concept of a maximum system call (or maximum API call) interrupt priority. Interrupts that are - above the maximum system call priority are keep permanently enabled, even + above the maximum system call priority are kept permanently enabled, even when the RTOS kernel is in a critical section, but cannot make any calls to FreeRTOS API functions. If configASSERT() is defined in FreeRTOSConfig.h then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion diff --git a/FreeRTOS/Source/tasks.c b/FreeRTOS/Source/tasks.c index 1c93cf3a8..bf7475ab1 100644 --- a/FreeRTOS/Source/tasks.c +++ b/FreeRTOS/Source/tasks.c @@ -192,7 +192,7 @@ PRIVILEGED_DATA static xList xPendingReadyList; /*< Tasks that have been r #if ( INCLUDE_vTaskDelete == 1 ) - PRIVILEGED_DATA static xList xTasksWaitingTermination; /*< Tasks that have been deleted - but the their memory not yet freed. */ + PRIVILEGED_DATA static xList xTasksWaitingTermination; /*< Tasks that have been deleted - but their memory not yet freed. */ PRIVILEGED_DATA static volatile unsigned portBASE_TYPE uxTasksDeleted = ( unsigned portBASE_TYPE ) 0U; #endif @@ -514,7 +514,7 @@ tskTCB * pxNewTCB; #endif /* portUSING_MPU_WRAPPERS == 1 */ /* Calculate the top of stack address. This depends on whether the - stack grows from high memory to low (as per the 80x86) or visa versa. + stack grows from high memory to low (as per the 80x86) or vice versa. portSTACK_GROWTH is used to make the result positive or negative as required by the port. */ #if( portSTACK_GROWTH < 0 ) @@ -645,7 +645,8 @@ tskTCB * pxNewTCB; taskENTER_CRITICAL(); { - /* If null is passed in here then we are deleting ourselves. */ + /* If null is passed in here then it is the calling task that is + being deleted. */ pxTCB = prvGetTCBFromHandle( xTaskToDelete ); /* Remove task from the ready list and place in the termination list. @@ -694,7 +695,7 @@ tskTCB * pxNewTCB; #if ( INCLUDE_vTaskDelayUntil == 1 ) - void vTaskDelayUntil( portTickType * const pxPreviousWakeTime, portTickType xTimeIncrement ) + void vTaskDelayUntil( portTickType * const pxPreviousWakeTime, const portTickType xTimeIncrement ) { portTickType xTimeToWake; portBASE_TYPE xAlreadyYielded, xShouldDelay = pdFALSE; @@ -771,7 +772,7 @@ tskTCB * pxNewTCB; #if ( INCLUDE_vTaskDelay == 1 ) - void vTaskDelay( portTickType xTicksToDelay ) + void vTaskDelay( const portTickType xTicksToDelay ) { portTickType xTimeToWake; signed portBASE_TYPE xAlreadyYielded = pdFALSE; @@ -831,6 +832,8 @@ tskTCB * pxNewTCB; xList *pxStateList; const tskTCB * const pxTCB = ( tskTCB * ) xTask; + configASSERT( pxTCB ); + if( pxTCB == pxCurrentTCB ) { /* The task calling this function is querying its own state. */ @@ -1108,9 +1111,9 @@ tskTCB * pxNewTCB; #if ( INCLUDE_vTaskSuspend == 1 ) - signed portBASE_TYPE xTaskIsTaskSuspended( xTaskHandle xTask ) + signed portBASE_TYPE xTaskIsTaskSuspended( const xTaskHandle xTask ) { - portBASE_TYPE xReturn = pdFALSE; + signed portBASE_TYPE xReturn = pdFALSE; const tskTCB * const pxTCB = ( tskTCB * ) xTask; /* It does not make sense to check if the calling task is suspended. */ @@ -1460,7 +1463,7 @@ unsigned portBASE_TYPE uxSavedInterruptStatus; /* RTOS ports that support interrupt nesting have the concept of a maximum system call (or maximum API call) interrupt priority. Interrupts that are - above the maximum system call priority are keep permanently enabled, even + above the maximum system call priority are kept permanently enabled, even when the RTOS kernel is in a critical section, but cannot make any calls to FreeRTOS API functions. If configASSERT() is defined in FreeRTOSConfig.h then portASSERT_IF_INTERRUPT_PRIORITY_INVALID() will result in an assertion @@ -1634,8 +1637,8 @@ portBASE_TYPE xSwitchRequired = pdFALSE; } /* See if this tick has made a timeout expire. Tasks are stored in the - queue in the order of their wake time - meaning once one tasks has been - found whose block time has not expired there is no need not look any + queue in the order of their wake time - meaning once one task has been + found whose block time has not expired there is no need to look any further down the list. */ if( xConstTickCount >= xNextTaskUnblockTime ) { @@ -1757,7 +1760,8 @@ portBASE_TYPE xSwitchRequired = pdFALSE; { tskTCB *xTCB; - /* If xTask is NULL then we are setting our own task hook. */ + /* If xTask is NULL then it is the task hook of the calling task that is + getting set. */ if( xTask == NULL ) { xTCB = ( tskTCB * ) pxCurrentTCB; @@ -1956,7 +1960,7 @@ portTickType xTimeToWake; /* Store the item value in the event list item. */ listSET_LIST_ITEM_VALUE( &( pxCurrentTCB->xEventListItem ), xItemValue ); - /* Place the event list item of the TCB at the end of the appropriate event + /* Place the event list item of the TCB at the end of the appropriate event list. */ vListInsertEnd( pxEventList, &( pxCurrentTCB->xEventListItem ) ); @@ -2118,7 +2122,7 @@ portBASE_TYPE xReturn; } else { - /* Cannot access the delayed or ready lists, so will hold this task + /* Cannot access the delayed or ready lists, so will hold this task pending until the scheduler is resumed. */ vListInsertEnd( &( xPendingReadyList ), pxEventListItem ); } @@ -2603,8 +2607,13 @@ tskTCB *pxNewTCB; } else { - /* Just to help debugging. */ - ( void ) memset( pxNewTCB->pxStack, ( int ) tskSTACK_FILL_BYTE, ( size_t ) usStackDepth * sizeof( portSTACK_TYPE ) ); + /* Avoid dependency on memset() if it is not required. */ + #if( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) || ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) ) + { + /* Just to help debugging. */ + ( void ) memset( pxNewTCB->pxStack, ( int ) tskSTACK_FILL_BYTE, ( size_t ) usStackDepth * sizeof( portSTACK_TYPE ) ); + } + #endif /* ( ( configCHECK_FOR_STACK_OVERFLOW > 1 ) || ( ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) ) ) */ } } @@ -2682,17 +2691,17 @@ tskTCB *pxNewTCB; static unsigned short prvTaskCheckFreeStackSpace( const unsigned char * pucStackByte ) { - unsigned short usCount = 0U; + unsigned long ulCount = 0U; while( *pucStackByte == tskSTACK_FILL_BYTE ) { pucStackByte -= portSTACK_GROWTH; - usCount++; + ulCount++; } - usCount /= sizeof( portSTACK_TYPE ); + ulCount /= ( unsigned long ) sizeof( portSTACK_TYPE ); - return usCount; + return ( unsigned short ) ulCount; } #endif /* ( ( configUSE_TRACE_FACILITY == 1 ) || ( INCLUDE_uxTaskGetStackHighWaterMark == 1 ) ) */ @@ -2903,7 +2912,7 @@ tskTCB *pxNewTCB; { xTaskStatusType *pxTaskStatusArray; volatile unsigned portBASE_TYPE uxArraySize, x; - char cStatus; + signed char cStatus; /* * PLEASE NOTE: @@ -2968,7 +2977,7 @@ tskTCB *pxNewTCB; break; } - sprintf( ( char * ) pcWriteBuffer, ( char * ) "%s\t\t%c\t%u\t%u\t%u\r\n", pxTaskStatusArray[ x ].pcTaskName, cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber ); + sprintf( ( char * ) pcWriteBuffer, ( char * ) "%s\t\t%c\t%u\t%u\t%u\r\n", pxTaskStatusArray[ x ].pcTaskName, ( char ) cStatus, ( unsigned int ) pxTaskStatusArray[ x ].uxCurrentPriority, ( unsigned int ) pxTaskStatusArray[ x ].usStackHighWaterMark, ( unsigned int ) pxTaskStatusArray[ x ].xTaskNumber ); pcWriteBuffer += strlen( ( char * ) pcWriteBuffer ); } @@ -2977,7 +2986,7 @@ tskTCB *pxNewTCB; } } -#endif /* configUSE_TRACE_FACILITY */ +#endif /* ( ( configUSE_TRACE_FACILITY == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS == 1 ) ) */ /*----------------------------------------------------------*/ #if ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS == 1 ) ) @@ -3082,7 +3091,7 @@ tskTCB *pxNewTCB; } } -#endif /* configGENERATE_RUN_TIME_STATS */ +#endif /* ( ( configGENERATE_RUN_TIME_STATS == 1 ) && ( configUSE_STATS_FORMATTING_FUNCTIONS == 1 ) ) */ /*-----------------------------------------------------------*/ portTickType uxTaskResetEventItemValue( void ) diff --git a/FreeRTOS/Source/timers.c b/FreeRTOS/Source/timers.c index eebc99646..d29c071f4 100644 --- a/FreeRTOS/Source/timers.c +++ b/FreeRTOS/Source/timers.c @@ -102,7 +102,7 @@ typedef struct tmrTimerControl const signed char *pcTimerName; /*<< Text name. This is not used by the kernel, it is included simply to make debugging easier. */ xListItem xTimerListItem; /*<< Standard linked list item as used by all kernel features for event management. */ portTickType xTimerPeriodInTicks;/*<< How quickly and often the timer expires. */ - unsigned portBASE_TYPE uxAutoReload; /*<< Set to pdTRUE if the timer should be automatically restarted once expired. Set to pdFALSE if the timer is, in effect, a one shot timer. */ + unsigned portBASE_TYPE uxAutoReload; /*<< Set to pdTRUE if the timer should be automatically restarted once expired. Set to pdFALSE if the timer is, in effect, a one-shot timer. */ void *pvTimerID; /*<< An ID to identify the timer. This allows the timer to be identified when the same callback is used for multiple timers. */ tmrTIMER_CALLBACK pxCallbackFunction; /*<< The function that will be called when the timer expires. */ } xTIMER; @@ -148,7 +148,7 @@ static variables must be declared volatile. */ /* The list in which active timers are stored. Timers are referenced in expire time order, with the nearest expiry time at the front of the list. Only the -timer service task is allowed to access xActiveTimerList. */ +timer service task is allowed to access these lists. */ PRIVILEGED_DATA static xList xActiveTimerList1; PRIVILEGED_DATA static xList xActiveTimerList2; PRIVILEGED_DATA static xList *pxCurrentTimerList; @@ -242,12 +242,12 @@ portBASE_TYPE xReturn = pdFAIL; { /* Create the timer task, storing its handle in xTimerTaskHandle so it can be returned by the xTimerGetTimerDaemonTaskHandle() function. */ - xReturn = xTaskCreate( prvTimerTask, ( const signed char * ) "Tmr Svc", ( unsigned short ) configTIMER_TASK_STACK_DEPTH, NULL, ( ( unsigned portBASE_TYPE ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, &xTimerTaskHandle ); + xReturn = xTaskCreate( prvTimerTask, ( const signed char * const ) "Tmr Svc", ( unsigned short ) configTIMER_TASK_STACK_DEPTH, NULL, ( ( unsigned portBASE_TYPE ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, &xTimerTaskHandle ); } #else { /* Create the timer task without storing its handle. */ - xReturn = xTaskCreate( prvTimerTask, ( const signed char * ) "Tmr Svc", ( unsigned short ) configTIMER_TASK_STACK_DEPTH, NULL, ( ( unsigned portBASE_TYPE ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, NULL); + xReturn = xTaskCreate( prvTimerTask, ( const signed char * const ) "Tmr Svc", ( unsigned short ) configTIMER_TASK_STACK_DEPTH, NULL, ( ( unsigned portBASE_TYPE ) configTIMER_TASK_PRIORITY ) | portPRIVILEGE_BIT, NULL); } #endif } @@ -419,7 +419,7 @@ portBASE_TYPE xTimerListsWereSwitched; has expired or not. If obtaining the time causes the lists to switch then don't process this timer as any timers that remained in the list when the lists were switched will have been processed within the - prvSampelTimeNow() function. */ + prvSampleTimeNow() function. */ xTimeNow = prvSampleTimeNow( &xTimerListsWereSwitched ); if( xTimerListsWereSwitched == pdFALSE ) { @@ -717,6 +717,16 @@ static void prvCheckForValidListAndQueue( void ) pxCurrentTimerList = &xActiveTimerList1; pxOverflowTimerList = &xActiveTimerList2; xTimerQueue = xQueueCreate( ( unsigned portBASE_TYPE ) configTIMER_QUEUE_LENGTH, sizeof( xDAEMON_TASK_MESSAGE ) ); + configASSERT( xTimerQueue ); + + #if ( configQUEUE_REGISTRY_SIZE > 0 ) + { + if( xTimerQueue != NULL ) + { + vQueueAddToRegistry( xTimerQueue, ( signed char * ) "TmrQ" ); + } + } + #endif /* configQUEUE_REGISTRY_SIZE */ } } taskEXIT_CRITICAL(); -- 2.39.2