]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/Common/Minimal/dynamic.c
Update version number ready for V8.2.1 release.
[freertos] / FreeRTOS / Demo / Common / Minimal / dynamic.c
index c72f5d3813392bf4d9cc303117057722afd413c8..481e89c73b95af3ed6b30f1211dd34f4a643390d 100644 (file)
@@ -1,60 +1,64 @@
 /*\r
-    FreeRTOS V7.5.3 - Copyright (C) 2013 Real Time Engineers Ltd.\r
+    FreeRTOS V8.2.1 - Copyright (C) 2015 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
 \r
-    ***************************************************************************\r
-     *                                                                       *\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
-     *    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
-     *    Thank you!                                                         *\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
 \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
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
+    >>!   obliged to provide the source code for proprietary components     !<<\r
+    >>!   outside of the FreeRTOS kernel.                                   !<<\r
+    ***************************************************************************\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
+    FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
     link: http://www.freertos.org/a00114.html\r
 \r
-    1 tab == 4 spaces!\r
-\r
     ***************************************************************************\r
      *                                                                       *\r
-     *    Having a problem?  Start by reading the FAQ "My application does   *\r
-     *    not run, what could be wrong?"                                     *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that is more than just the market leader, it     *\r
+     *    is the industry's de facto standard.                               *\r
      *                                                                       *\r
-     *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
+     *    Help yourself get started quickly while simultaneously helping     *\r
+     *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
+     *    tutorial book, reference manual, or both:                          *\r
+     *    http://www.FreeRTOS.org/Documentation                              *\r
      *                                                                       *\r
     ***************************************************************************\r
 \r
-    http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
-    license and Real Time Engineers Ltd. contact details.\r
+    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
+    the FAQ page "My application does not run, what could be wrong?".  Have you\r
+    defined configASSERT()?\r
+\r
+    http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+    embedded software for free we request you assist our global community by\r
+    participating in the support forum.\r
+\r
+    http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+    be as productive as possible as early as possible.  Now you can receive\r
+    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+    Ltd, and the world's leading authority on the world's leading RTOS.\r
 \r
     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\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
-    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
+    http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and commercial 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
@@ -144,37 +148,37 @@ static portTASK_FUNCTION_PROTO( vQueueSendWhenSuspendedTask, pvParameters );
 \r
 /* Demo task specific constants. */\r
 #define priSTACK_SIZE                          ( configMINIMAL_STACK_SIZE )\r
-#define priSLEEP_TIME                          ( ( portTickType ) 128 / portTICK_RATE_MS )\r
+#define priSLEEP_TIME                          ( ( TickType_t ) 128 / portTICK_PERIOD_MS )\r
 #define priLOOPS                                       ( 5 )\r
-#define priMAX_COUNT                           ( ( unsigned long ) 0xff )\r
-#define priNO_BLOCK                                    ( ( portTickType ) 0 )\r
+#define priMAX_COUNT                           ( ( uint32_t ) 0xff )\r
+#define priNO_BLOCK                                    ( ( TickType_t ) 0 )\r
 #define priSUSPENDED_QUEUE_LENGTH      ( 1 )\r
 \r
 /*-----------------------------------------------------------*/\r
 \r
 /* Handles to the two counter tasks.  These could be passed in as parameters\r
 to the controller task to prevent them having to be file scope. */\r
-static xTaskHandle xContinuousIncrementHandle, xLimitedIncrementHandle;\r
+static TaskHandle_t xContinuousIncrementHandle, xLimitedIncrementHandle;\r
 \r
 /* The shared counter variable.  This is passed in as a parameter to the two\r
 counter variables for demonstration purposes. */\r
-static volatile unsigned long ulCounter;\r
+static volatile uint32_t ulCounter;\r
 \r
 /* Variables used to check that the tasks are still operating without error.\r
 Each complete iteration of the controller task increments this variable\r
 provided no errors have been found.  The variable maintaining the same value\r
 is therefore indication of an error. */\r
-static volatile unsigned short usCheckVariable = ( unsigned short ) 0;\r
-static volatile portBASE_TYPE xSuspendedQueueSendError = pdFALSE;\r
-static volatile portBASE_TYPE xSuspendedQueueReceiveError = pdFALSE;\r
+static volatile uint16_t usCheckVariable = ( uint16_t ) 0;\r
+static volatile BaseType_t xSuspendedQueueSendError = pdFALSE;\r
+static volatile BaseType_t xSuspendedQueueReceiveError = pdFALSE;\r
 \r
 /* Queue used by the second test. */\r
-xQueueHandle xSuspendedTestQueue;\r
+QueueHandle_t xSuspendedTestQueue;\r
 \r
 /* The value the queue receive task expects to receive next.  This is file\r
 scope so xAreDynamicPriorityTasksStillRunning() can ensure it is still\r
 incrementing. */\r
-static unsigned long ulExpectedValue = ( unsigned long ) 0;\r
+static uint32_t ulExpectedValue = ( uint32_t ) 0;\r
 \r
 /*-----------------------------------------------------------*/\r
 /*\r
@@ -183,7 +187,7 @@ static unsigned long ulExpectedValue = ( unsigned long ) 0;
  */\r
 void vStartDynamicPriorityTasks( void )\r
 {\r
-       xSuspendedTestQueue = xQueueCreate( priSUSPENDED_QUEUE_LENGTH, sizeof( unsigned long ) );\r
+       xSuspendedTestQueue = xQueueCreate( priSUSPENDED_QUEUE_LENGTH, sizeof( uint32_t ) );\r
 \r
        /* vQueueAddToRegistry() adds the queue to the queue registry, if one is\r
        in use.  The queue registry is provided as a means for kernel aware\r
@@ -191,13 +195,13 @@ void vStartDynamicPriorityTasks( void )
        is not being used.  The call to vQueueAddToRegistry() will be removed\r
        by the pre-processor if configQUEUE_REGISTRY_SIZE is not defined or is\r
        defined to be less than 1. */\r
-       vQueueAddToRegistry( xSuspendedTestQueue, ( signed char * ) "Suspended_Test_Queue" );\r
+       vQueueAddToRegistry( xSuspendedTestQueue, "Suspended_Test_Queue" );\r
 \r
-       xTaskCreate( vContinuousIncrementTask, ( signed char * ) "CNT_INC", priSTACK_SIZE, ( void * ) &ulCounter, tskIDLE_PRIORITY, &xContinuousIncrementHandle );\r
-       xTaskCreate( vLimitedIncrementTask, ( signed char * ) "LIM_INC", priSTACK_SIZE, ( void * ) &ulCounter, tskIDLE_PRIORITY + 1, &xLimitedIncrementHandle );\r
-       xTaskCreate( vCounterControlTask, ( signed char * ) "C_CTRL", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
-       xTaskCreate( vQueueSendWhenSuspendedTask, ( signed char * ) "SUSP_TX", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
-       xTaskCreate( vQueueReceiveWhenSuspendedTask, ( signed char * ) "SUSP_RX", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
+       xTaskCreate( vContinuousIncrementTask, "CNT_INC", priSTACK_SIZE, ( void * ) &ulCounter, tskIDLE_PRIORITY, &xContinuousIncrementHandle );\r
+       xTaskCreate( vLimitedIncrementTask, "LIM_INC", priSTACK_SIZE, ( void * ) &ulCounter, tskIDLE_PRIORITY + 1, &xLimitedIncrementHandle );\r
+       xTaskCreate( vCounterControlTask, "C_CTRL", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
+       xTaskCreate( vQueueSendWhenSuspendedTask, "SUSP_TX", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
+       xTaskCreate( vQueueReceiveWhenSuspendedTask, "SUSP_RX", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
@@ -207,11 +211,11 @@ void vStartDynamicPriorityTasks( void )
  */\r
 static portTASK_FUNCTION( vLimitedIncrementTask, pvParameters )\r
 {\r
-unsigned long *pulCounter;\r
+uint32_t *pulCounter;\r
 \r
        /* Take a pointer to the shared variable from the parameters passed into\r
        the task. */\r
-       pulCounter = ( unsigned long * ) pvParameters;\r
+       pulCounter = ( uint32_t * ) pvParameters;\r
 \r
        /* This will run before the control task, so the first thing it does is\r
        suspend - the control task will resume it when ready. */\r
@@ -236,12 +240,12 @@ unsigned long *pulCounter;
  */\r
 static portTASK_FUNCTION( vContinuousIncrementTask, pvParameters )\r
 {\r
-volatile unsigned long *pulCounter;\r
-unsigned portBASE_TYPE uxOurPriority;\r
+volatile uint32_t *pulCounter;\r
+UBaseType_t uxOurPriority;\r
 \r
        /* Take a pointer to the shared variable from the parameters passed into\r
        the task. */\r
-       pulCounter = ( unsigned long * ) pvParameters;\r
+       pulCounter = ( uint32_t * ) pvParameters;\r
 \r
        /* Query our priority so we can raise it when exclusive access to the\r
        shared variable is required. */\r
@@ -272,7 +276,7 @@ unsigned portBASE_TYPE uxOurPriority;
  */\r
 static portTASK_FUNCTION( vCounterControlTask, pvParameters )\r
 {\r
-unsigned long ulLastCounter;\r
+uint32_t ulLastCounter;\r
 short sLoops;\r
 short sError = pdFALSE;\r
 \r
@@ -282,7 +286,7 @@ short sError = pdFALSE;
        for( ;; )\r
        {\r
                /* Start with the counter at zero. */\r
-               ulCounter = ( unsigned long ) 0;\r
+               ulCounter = ( uint32_t ) 0;\r
 \r
                /* First section : */\r
 \r
@@ -340,7 +344,7 @@ short sError = pdFALSE;
                vTaskSuspend( xContinuousIncrementHandle );\r
 \r
                /* Reset the variable. */\r
-               ulCounter = ( unsigned long ) 0;\r
+               ulCounter = ( uint32_t ) 0;\r
 \r
                #if( INCLUDE_eTaskGetState == 1 )\r
                {\r
@@ -391,7 +395,7 @@ short sError = pdFALSE;
 \r
 static portTASK_FUNCTION( vQueueSendWhenSuspendedTask, pvParameters )\r
 {\r
-static unsigned long ulValueToSend = ( unsigned long ) 0;\r
+static uint32_t ulValueToSend = ( uint32_t ) 0;\r
 \r
        /* Just to stop warning messages. */\r
        ( void ) pvParameters;\r
@@ -417,8 +421,8 @@ static unsigned long ulValueToSend = ( unsigned long ) 0;
 \r
 static portTASK_FUNCTION( vQueueReceiveWhenSuspendedTask, pvParameters )\r
 {\r
-unsigned long ulReceivedValue;\r
-portBASE_TYPE xGotValue;\r
+uint32_t ulReceivedValue;\r
+BaseType_t xGotValue;\r
 \r
        /* Just to stop warning messages. */\r
        ( void ) pvParameters;\r
@@ -470,13 +474,13 @@ portBASE_TYPE xGotValue;
 /*-----------------------------------------------------------*/\r
 \r
 /* Called to check that all the created tasks are still running without error. */\r
-portBASE_TYPE xAreDynamicPriorityTasksStillRunning( void )\r
+BaseType_t xAreDynamicPriorityTasksStillRunning( void )\r
 {\r
 /* Keep a history of the check variables so we know if it has been incremented\r
 since the last call. */\r
-static unsigned short usLastTaskCheck = ( unsigned short ) 0;\r
-static unsigned long ulLastExpectedValue = ( unsigned long ) 0U;\r
-portBASE_TYPE xReturn = pdTRUE;\r
+static uint16_t usLastTaskCheck = ( uint16_t ) 0;\r
+static uint32_t ulLastExpectedValue = ( uint32_t ) 0U;\r
+BaseType_t xReturn = pdTRUE;\r
 \r
        /* Check the tasks are still running by ensuring the check variable\r
        is still incrementing. */\r