/*\r
- FreeRTOS V7.3.0 - Copyright (C) 2012 Real Time Engineers Ltd.\r
+ FreeRTOS V7.5.3 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+ All rights reserved\r
\r
- FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT \r
- http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+ VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
\r
***************************************************************************\r
* *\r
- * FreeRTOS tutorial books are available in pdf and paperback. *\r
- * Complete, revised, and edited pdf reference manuals are also *\r
- * available. *\r
+ * FreeRTOS provides completely free yet professionally developed, *\r
+ * robust, strictly quality controlled, supported, and cross *\r
+ * platform software that has become a de facto standard. *\r
* *\r
- * Purchasing FreeRTOS documentation will not only help you, by *\r
- * ensuring you get running as quickly as possible and with an *\r
- * in-depth knowledge of how to use FreeRTOS, it will also help *\r
- * the FreeRTOS project to continue with its mission of providing *\r
- * professional grade, cross platform, de facto standard solutions *\r
- * for microcontrollers - completely free of charge! *\r
+ * Help yourself get started quickly and support the FreeRTOS *\r
+ * project by purchasing a FreeRTOS tutorial book, reference *\r
+ * manual, or both from: http://www.FreeRTOS.org/Documentation *\r
* *\r
- * >>> See http://www.FreeRTOS.org/Documentation for details. <<< *\r
- * *\r
- * Thank you for using FreeRTOS, and thank you for your support! *\r
+ * Thank you! *\r
* *\r
***************************************************************************\r
\r
-\r
This file is part of the FreeRTOS distribution.\r
\r
FreeRTOS is free software; you can redistribute it and/or modify it under\r
the terms of the GNU General Public License (version 2) as published by the\r
- Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
- >>>NOTE<<< The modification to the GPL is included to allow you to\r
- distribute a combined work that includes FreeRTOS without being obliged to\r
- provide the source code for proprietary components outside of the FreeRTOS\r
- kernel. FreeRTOS is distributed in the hope that it will be useful, but\r
- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r
- more details. You should have received a copy of the GNU General Public\r
- License and the FreeRTOS license exception along with FreeRTOS; if not it\r
- can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
- by writing to Richard Barry, contact details for whom are available on the\r
- FreeRTOS WEB site.\r
+ Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
+\r
+ >>! NOTE: The modification to the GPL is included to allow you to distribute\r
+ >>! a combined work that includes FreeRTOS without being obliged to provide\r
+ >>! the source code for proprietary components outside of the FreeRTOS\r
+ >>! kernel.\r
+\r
+ FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+ FOR A PARTICULAR PURPOSE. Full license text is available from the following\r
+ link: http://www.freertos.org/a00114.html\r
\r
1 tab == 4 spaces!\r
- \r
+\r
***************************************************************************\r
* *\r
* Having a problem? Start by reading the FAQ "My application does *\r
* *\r
***************************************************************************\r
\r
- \r
- http://www.FreeRTOS.org - Documentation, training, latest versions, license \r
- and contact details. \r
- \r
+ http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
+ license and Real Time Engineers Ltd. contact details.\r
+\r
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
- including FreeRTOS+Trace - an indispensable productivity tool.\r
+ including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+ compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
\r
- Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell \r
- the code with commercial support, indemnification, and middleware, under \r
- the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also\r
- provide a safety engineered and independently SIL3 certified version under \r
- the SafeRTOS brand: http://www.SafeRTOS.com.\r
+ http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
+ Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS\r
+ licenses offer ticketed support, indemnification and middleware.\r
+\r
+ http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+ engineered and independently SIL3 certified version for use in safety and\r
+ mission critical applications that require provable dependability.\r
+\r
+ 1 tab == 4 spaces!\r
*/\r
\r
+/* Standard includes. */\r
+#include <stdlib.h>\r
+\r
/* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining\r
all the API functions to use the MPU wrappers. That should only be done when\r
task.h is included from an application file. */\r
#include "queue.h"\r
#include "timers.h"\r
\r
-#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE\r
+/* Lint e961 and e750 are suppressed as a MISRA exception justified because the\r
+MPU ports require MPU_WRAPPERS_INCLUDED_FROM_API_FILE to be defined for the\r
+header files above, but not in this file, in order to generate the correct\r
+privileged Vs unprivileged linkage and placement. */\r
+#undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE /*lint !e961 !e750. */\r
+\r
\r
/* This entire source file will be skipped if the application is not configured\r
to include software timer functionality. This #if is closed at the very bottom\r
xTIMER * pxTimer; /*<< The timer to which the command will be applied. */\r
} xTIMER_MESSAGE;\r
\r
+/*lint -e956 A manual analysis and inspection has been used to determine which\r
+static variables must be declared volatile. */\r
\r
/* The list in which active timers are stored. Timers are referenced in expire\r
time order, with the nearest expiry time at the front of the list. Only the\r
\r
#endif\r
\r
+/*lint +e956 */\r
+\r
/*-----------------------------------------------------------*/\r
\r
/*\r
if( xTimerPeriodInTicks == ( portTickType ) 0U )\r
{\r
pxNewTimer = NULL;\r
- configASSERT( ( xTimerPeriodInTicks > 0 ) );\r
}\r
else\r
{\r
}\r
}\r
\r
+ /* 0 is not a valid value for xTimerPeriodInTicks. */\r
+ configASSERT( ( xTimerPeriodInTicks > 0 ) );\r
+\r
return ( xTimerHandle ) pxNewTimer;\r
}\r
/*-----------------------------------------------------------*/\r
/* Remove the timer from the list of active timers. A check has already\r
been performed to ensure the list is not empty. */\r
pxTimer = ( xTIMER * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTimerList );\r
- uxListRemove( &( pxTimer->xTimerListItem ) );\r
+ ( void ) uxListRemove( &( pxTimer->xTimerListItem ) );\r
traceTIMER_EXPIRED( pxTimer );\r
\r
/* If the timer is an auto reload timer then calculate the next\r
/* The tick count has not overflowed, has the timer expired? */\r
if( ( xListWasEmpty == pdFALSE ) && ( xNextExpireTime <= xTimeNow ) )\r
{\r
- xTaskResumeAll();\r
+ ( void ) xTaskResumeAll();\r
prvProcessExpiredTimer( xNextExpireTime, xTimeNow );\r
}\r
else\r
}\r
else\r
{\r
- xTaskResumeAll();\r
+ ( void ) xTaskResumeAll();\r
}\r
}\r
}\r
static portTickType prvSampleTimeNow( portBASE_TYPE *pxTimerListsWereSwitched )\r
{\r
portTickType xTimeNow;\r
-PRIVILEGED_DATA static portTickType xLastTime = ( portTickType ) 0U;\r
+PRIVILEGED_DATA static portTickType xLastTime = ( portTickType ) 0U; /*lint !e956 Variable is only accessible to one task. */\r
\r
xTimeNow = xTaskGetTickCount();\r
\r
{\r
/* Has the expiry time elapsed between the command to start/reset a\r
timer was issued, and the time the command was processed? */\r
- if( ( ( portTickType ) ( xTimeNow - xCommandTime ) ) >= pxTimer->xTimerPeriodInTicks )\r
+ if( ( xTimeNow - xCommandTime ) >= pxTimer->xTimerPeriodInTicks )\r
{\r
/* The time between a command being issued and the command being\r
processed actually exceeds the timers period. */\r
portBASE_TYPE xTimerListsWereSwitched, xResult;\r
portTickType xTimeNow;\r
\r
- /* In this case the xTimerListsWereSwitched parameter is not used, but it\r
- must be present in the function call. */\r
- xTimeNow = prvSampleTimeNow( &xTimerListsWereSwitched );\r
-\r
- while( xQueueReceive( xTimerQueue, &xMessage, tmrNO_DELAY ) != pdFAIL )\r
+ while( xQueueReceive( xTimerQueue, &xMessage, tmrNO_DELAY ) != pdFAIL ) /*lint !e603 xMessage does not have to be initialised as it is passed out, not in, and it is not used unless xQueueReceive() returns pdTRUE. */\r
{\r
pxTimer = xMessage.pxTimer;\r
\r
- /* Is the timer already in a list of active timers? When the command\r
- is trmCOMMAND_PROCESS_TIMER_OVERFLOW, the timer will be NULL as the\r
- command is to the task rather than to an individual timer. */\r
- if( pxTimer != NULL )\r
+ if( listIS_CONTAINED_WITHIN( NULL, &( pxTimer->xTimerListItem ) ) == pdFALSE )\r
{\r
- if( listIS_CONTAINED_WITHIN( NULL, &( pxTimer->xTimerListItem ) ) == pdFALSE )\r
- {\r
- /* The timer is in a list, remove it. */\r
- uxListRemove( &( pxTimer->xTimerListItem ) );\r
- }\r
+ /* The timer is in a list, remove it. */\r
+ ( void ) uxListRemove( &( pxTimer->xTimerListItem ) );\r
}\r
\r
traceTIMER_COMMAND_RECEIVED( pxTimer, xMessage.xMessageID, xMessage.xMessageValue );\r
\r
+ /* In this case the xTimerListsWereSwitched parameter is not used, but \r
+ it must be present in the function call. prvSampleTimeNow() must be \r
+ called after the message is received from xTimerQueue so there is no \r
+ possibility of a higher priority task adding a message to the message\r
+ queue with a time that is ahead of the timer daemon task (because it\r
+ pre-empted the timer daemon task after the xTimeNow value was set). */\r
+ xTimeNow = prvSampleTimeNow( &xTimerListsWereSwitched );\r
+\r
switch( xMessage.xMessageID )\r
{\r
case tmrCOMMAND_START :\r
case tmrCOMMAND_CHANGE_PERIOD :\r
pxTimer->xTimerPeriodInTicks = xMessage.xMessageValue;\r
configASSERT( ( pxTimer->xTimerPeriodInTicks > 0 ) );\r
- prvInsertTimerInActiveList( pxTimer, ( xTimeNow + pxTimer->xTimerPeriodInTicks ), xTimeNow, xTimeNow );\r
+\r
+ /* The new period does not really have a reference, and can be\r
+ longer or shorter than the old one. The command time is \r
+ therefore set to the current time, and as the period cannot be\r
+ zero the next expiry time can only be in the future, meaning\r
+ (unlike for the xTimerStart() case above) there is no fail case\r
+ that needs to be handled here. */\r
+ ( void ) prvInsertTimerInActiveList( pxTimer, ( xTimeNow + pxTimer->xTimerPeriodInTicks ), xTimeNow, xTimeNow );\r
break;\r
\r
case tmrCOMMAND_DELETE :\r
\r
/* Remove the timer from the list. */\r
pxTimer = ( xTIMER * ) listGET_OWNER_OF_HEAD_ENTRY( pxCurrentTimerList );\r
- uxListRemove( &( pxTimer->xTimerListItem ) );\r
+ ( void ) uxListRemove( &( pxTimer->xTimerListItem ) );\r
\r
/* Execute its callback, then send a command to restart the timer if\r
it is an auto-reload timer. It cannot be restarted here as the lists\r
to include software timer functionality. If you want to include software timer\r
functionality then ensure configUSE_TIMERS is set to 1 in FreeRTOSConfig.h. */\r
#endif /* configUSE_TIMERS == 1 */\r
+\r
+\r
+\r