]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/Common/Minimal/blocktim.c
Update version numbers in preparation for V8.2.0 release candidate 1.
[freertos] / FreeRTOS / Demo / Common / Minimal / blocktim.c
index e8a4af8ad13fbe39e13cf264ac8763a5611cbba4..cb2533d989fdabb786963ee0f2c8a3fa17630252 100644 (file)
@@ -1,67 +1,96 @@
 /*\r
 /*\r
-    FreeRTOS V7.2.0 - Copyright (C) 2012 Real Time Engineers Ltd.\r
-       \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
-     *                                                                       *\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
-     *                                                                       *\r
-     *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *\r
-     *                                                                       *\r
-     *    Thank you for using FreeRTOS, and thank you for your support!      *\r
-     *                                                                       *\r
-    ***************************************************************************\r
+    FreeRTOS V8.2.0rc1 - Copyright (C) 2014 Real Time Engineers Ltd.\r
+    All rights reserved\r
 \r
 \r
+    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\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
 \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     !<<\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
+    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 on the following\r
+    link: http://www.freertos.org/a00114.html\r
 \r
     1 tab == 4 spaces!\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
      *    Having a problem?  Start by reading the FAQ "My application does   *\r
-     *    not run, what could be wrong?                                      *\r
+     *    not run, what could be wrong?".  Have you defined configASSERT()?  *\r
      *                                                                       *\r
      *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
      *                                                                       *\r
     ***************************************************************************\r
 \r
      *                                                                       *\r
      *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
      *                                                                       *\r
     ***************************************************************************\r
 \r
-    \r
-    http://www.FreeRTOS.org - Documentation, training, latest information, \r
-    license and contact details.\r
-    \r
+    ***************************************************************************\r
+     *                                                                       *\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
+     *    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
+    ***************************************************************************\r
+     *                                                                       *\r
+     *   Investing in training allows your team to be as productive as       *\r
+     *   possible as early as possible, lowering your overall development    *\r
+     *   cost, and enabling you to bring a more robust product to market     *\r
+     *   earlier than would otherwise be possible.  Richard Barry is both    *\r
+     *   the architect and key author of FreeRTOS, and so also the world's   *\r
+     *   leading authority on what is the world's most popular real time     *\r
+     *   kernel for deeply embedded MCU designs.  Obtaining your training    *\r
+     *   from Richard ensures your team will gain directly from his in-depth *\r
+     *   product knowledge and years of usage experience.  Contact Real Time *\r
+     *   Engineers Ltd to enquire about the FreeRTOS Masterclass, presented  *\r
+     *   by Richard Barry:  http://www.FreeRTOS.org/contact\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    You are receiving this top quality software for free.  Please play *\r
+     *    fair and reciprocate by reporting any suspected issues and         *\r
+     *    participating in the community forum:                              *\r
+     *    http://www.FreeRTOS.org/support                                    *\r
+     *                                                                       *\r
+     *    Thank you!                                                         *\r
+     *                                                                       *\r
+    ***************************************************************************\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
     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
 \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.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
+    mission critical applications that require provable dependability.\r
+\r
+    1 tab == 4 spaces!\r
 */\r
 \r
 /*\r
 */\r
 \r
 /*\r
 \r
 /* Task behaviour. */\r
 #define bktQUEUE_LENGTH                                ( 5 )\r
 \r
 /* Task behaviour. */\r
 #define bktQUEUE_LENGTH                                ( 5 )\r
-#define bktSHORT_WAIT                          ( ( ( portTickType ) 20 ) / portTICK_RATE_MS )\r
+#define bktSHORT_WAIT                          ( ( ( TickType_t ) 20 ) / portTICK_PERIOD_MS )\r
 #define bktPRIMARY_BLOCK_TIME          ( 10 )\r
 #define bktALLOWABLE_MARGIN                    ( 15 )\r
 #define bktTIME_TO_BLOCK                       ( 175 )\r
 #define bktPRIMARY_BLOCK_TIME          ( 10 )\r
 #define bktALLOWABLE_MARGIN                    ( 15 )\r
 #define bktTIME_TO_BLOCK                       ( 175 )\r
-#define bktDONT_BLOCK                          ( ( portTickType ) 0 )\r
-#define bktRUN_INDICATOR                       ( ( unsigned portBASE_TYPE ) 0x55 )\r
+#define bktDONT_BLOCK                          ( ( TickType_t ) 0 )\r
+#define bktRUN_INDICATOR                       ( ( UBaseType_t ) 0x55 )\r
 \r
 /* The queue on which the tasks block. */\r
 \r
 /* The queue on which the tasks block. */\r
-static xQueueHandle xTestQueue;\r
+static QueueHandle_t xTestQueue;\r
 \r
 /* Handle to the secondary task is required by the primary task for calls\r
 to vTaskSuspend/Resume(). */\r
 \r
 /* Handle to the secondary task is required by the primary task for calls\r
 to vTaskSuspend/Resume(). */\r
-static xTaskHandle xSecondary;\r
+static TaskHandle_t xSecondary;\r
 \r
 /* Used to ensure that tasks are still executing without error. */\r
 \r
 /* Used to ensure that tasks are still executing without error. */\r
-static volatile portBASE_TYPE xPrimaryCycles = 0, xSecondaryCycles = 0;\r
-static volatile portBASE_TYPE xErrorOccurred = pdFALSE;\r
+static volatile BaseType_t xPrimaryCycles = 0, xSecondaryCycles = 0;\r
+static volatile BaseType_t xErrorOccurred = pdFALSE;\r
 \r
 /* Provides a simple mechanism for the primary task to know when the\r
 secondary task has executed. */\r
 \r
 /* Provides a simple mechanism for the primary task to know when the\r
 secondary task has executed. */\r
-static volatile unsigned portBASE_TYPE xRunIndicator;\r
+static volatile UBaseType_t xRunIndicator;\r
 \r
 /* The two test tasks.  Their behaviour is commented within the files. */\r
 static void vPrimaryBlockTimeTestTask( void *pvParameters );\r
 \r
 /* The two test tasks.  Their behaviour is commented within the files. */\r
 static void vPrimaryBlockTimeTestTask( void *pvParameters );\r
@@ -120,7 +149,7 @@ static void vSecondaryBlockTimeTestTask( void *pvParameters );
 void vCreateBlockTimeTasks( void )\r
 {\r
        /* Create the queue on which the two tasks block. */\r
 void vCreateBlockTimeTasks( void )\r
 {\r
        /* Create the queue on which the two tasks block. */\r
-    xTestQueue = xQueueCreate( bktQUEUE_LENGTH, sizeof( portBASE_TYPE ) );\r
+    xTestQueue = xQueueCreate( bktQUEUE_LENGTH, sizeof( BaseType_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
 \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
@@ -128,19 +157,19 @@ void vCreateBlockTimeTasks( 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
        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( xTestQueue, ( signed char * ) "Block_Time_Queue" );\r
+       vQueueAddToRegistry( xTestQueue, "Block_Time_Queue" );\r
 \r
        /* Create the two test tasks. */\r
 \r
        /* Create the two test tasks. */\r
-       xTaskCreate( vPrimaryBlockTimeTestTask, ( signed char * )"BTest1", configMINIMAL_STACK_SIZE, NULL, bktPRIMARY_PRIORITY, NULL );\r
-       xTaskCreate( vSecondaryBlockTimeTestTask, ( signed char * )"BTest2", configMINIMAL_STACK_SIZE, NULL, bktSECONDARY_PRIORITY, &xSecondary );\r
+       xTaskCreate( vPrimaryBlockTimeTestTask, "BTest1", configMINIMAL_STACK_SIZE, NULL, bktPRIMARY_PRIORITY, NULL );\r
+       xTaskCreate( vSecondaryBlockTimeTestTask, "BTest2", configMINIMAL_STACK_SIZE, NULL, bktSECONDARY_PRIORITY, &xSecondary );\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
 static void vPrimaryBlockTimeTestTask( void *pvParameters )\r
 {\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
 static void vPrimaryBlockTimeTestTask( void *pvParameters )\r
 {\r
-portBASE_TYPE xItem, xData;\r
-portTickType xTimeWhenBlocking;\r
-portTickType xTimeToBlock, xBlockedTime;\r
+BaseType_t xItem, xData;\r
+TickType_t xTimeWhenBlocking;\r
+TickType_t xTimeToBlock, xBlockedTime;\r
 \r
        ( void ) pvParameters;\r
 \r
 \r
        ( void ) pvParameters;\r
 \r
@@ -154,7 +183,7 @@ portTickType xTimeToBlock, xBlockedTime;
                {\r
                        /* The queue is empty. Attempt to read from the queue using a block\r
                        time.  When we wake, ensure the delta in time is as expected. */\r
                {\r
                        /* The queue is empty. Attempt to read from the queue using a block\r
                        time.  When we wake, ensure the delta in time is as expected. */\r
-                       xTimeToBlock = bktPRIMARY_BLOCK_TIME << xItem;\r
+                       xTimeToBlock = ( TickType_t ) ( bktPRIMARY_BLOCK_TIME << xItem );\r
 \r
                        xTimeWhenBlocking = xTaskGetTickCount();\r
 \r
 \r
                        xTimeWhenBlocking = xTaskGetTickCount();\r
 \r
@@ -205,7 +234,7 @@ portTickType xTimeToBlock, xBlockedTime;
                {\r
                        /* The queue is full. Attempt to write to the queue using a block\r
                        time.  When we wake, ensure the delta in time is as expected. */\r
                {\r
                        /* The queue is full. Attempt to write to the queue using a block\r
                        time.  When we wake, ensure the delta in time is as expected. */\r
-                       xTimeToBlock = bktPRIMARY_BLOCK_TIME << xItem;\r
+                       xTimeToBlock = ( TickType_t ) ( bktPRIMARY_BLOCK_TIME << xItem );\r
 \r
                        xTimeWhenBlocking = xTaskGetTickCount();\r
 \r
 \r
                        xTimeWhenBlocking = xTaskGetTickCount();\r
 \r
@@ -389,8 +418,8 @@ portTickType xTimeToBlock, xBlockedTime;
 \r
 static void vSecondaryBlockTimeTestTask( void *pvParameters )\r
 {\r
 \r
 static void vSecondaryBlockTimeTestTask( void *pvParameters )\r
 {\r
-portTickType xTimeWhenBlocking, xBlockedTime;\r
-portBASE_TYPE xData;\r
+TickType_t xTimeWhenBlocking, xBlockedTime;\r
+BaseType_t xData;\r
 \r
        ( void ) pvParameters;\r
 \r
 \r
        ( void ) pvParameters;\r
 \r
@@ -477,10 +506,10 @@ portBASE_TYPE xData;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-portBASE_TYPE xAreBlockTimeTestTasksStillRunning( void )\r
+BaseType_t xAreBlockTimeTestTasksStillRunning( void )\r
 {\r
 {\r
-static portBASE_TYPE xLastPrimaryCycleCount = 0, xLastSecondaryCycleCount = 0;\r
-portBASE_TYPE xReturn = pdPASS;\r
+static BaseType_t xLastPrimaryCycleCount = 0, xLastSecondaryCycleCount = 0;\r
+BaseType_t xReturn = pdPASS;\r
 \r
        /* Have both tasks performed at least one cycle since this function was\r
        last called? */\r
 \r
        /* Have both tasks performed at least one cycle since this function was\r
        last called? */\r