]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/Common/Minimal/flop.c
Common demo tasks:
[freertos] / FreeRTOS / Demo / Common / Minimal / flop.c
index 6411a1df01fc801f6b9567dfd5d806046bcbb856..2b6e4addc855ed1976c7fce554a400dd36681b4b 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-    FreeRTOS V7.5.3 - Copyright (C) 2013 Real Time Engineers Ltd. \r
+    FreeRTOS V8.0.1 - Copyright (C) 2014 Real Time Engineers Ltd.\r
     All rights reserved\r
 \r
     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\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
+    >>!   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
 */\r
 \r
 /*\r
- * Creates eight tasks, each of which loops continuously performing a floating \r
+ * Creates eight tasks, each of which loops continuously performing a floating\r
  * point calculation.\r
  *\r
  * All the tasks run at the idle priority and never block or yield.  This causes\r
- * all eight tasks to time slice with the idle task.  Running at the idle \r
- * priority means that these tasks will get pre-empted any time another task is \r
- * ready to run or a time slice occurs.  More often than not the pre-emption \r
- * will occur mid calculation, creating a good test of the schedulers context \r
- * switch mechanism - a calculation producing an unexpected result could be a \r
+ * all eight tasks to time slice with the idle task.  Running at the idle\r
+ * priority means that these tasks will get pre-empted any time another task is\r
+ * ready to run or a time slice occurs.  More often than not the pre-emption\r
+ * will occur mid calculation, creating a good test of the schedulers context\r
+ * switch mechanism - a calculation producing an unexpected result could be a\r
  * symptom of a corruption in the context of a task.\r
  */\r
 \r
@@ -98,23 +98,23 @@ static portTASK_FUNCTION_PROTO( vCompetingMathTask4, pvParameters );
 \r
 /* These variables are used to check that all the tasks are still running.  If a\r
 task gets a calculation wrong it will stop setting its check variable. */\r
-static volatile unsigned short usTaskCheck[ mathNUMBER_OF_TASKS ] = { ( unsigned short ) 0 };\r
+static volatile uint16_t usTaskCheck[ mathNUMBER_OF_TASKS ] = { ( uint16_t ) 0 };\r
 \r
 /*-----------------------------------------------------------*/\r
 \r
-void vStartMathTasks( unsigned portBASE_TYPE uxPriority )\r
+void vStartMathTasks( UBaseType_t uxPriority )\r
 {\r
-       xTaskCreate( vCompetingMathTask1, ( signed char * ) "Math1", mathSTACK_SIZE, ( void * ) &( usTaskCheck[ 0 ] ), uxPriority, NULL );\r
-       xTaskCreate( vCompetingMathTask2, ( signed char * ) "Math2", mathSTACK_SIZE, ( void * ) &( usTaskCheck[ 1 ] ), uxPriority, NULL );\r
-       xTaskCreate( vCompetingMathTask3, ( signed char * ) "Math3", mathSTACK_SIZE, ( void * ) &( usTaskCheck[ 2 ] ), uxPriority, NULL );\r
-       xTaskCreate( vCompetingMathTask4, ( signed char * ) "Math4", mathSTACK_SIZE, ( void * ) &( usTaskCheck[ 3 ] ), uxPriority, NULL );\r
+       xTaskCreate( vCompetingMathTask1, "Math1", mathSTACK_SIZE, ( void * ) &( usTaskCheck[ 0 ] ), uxPriority, NULL );\r
+       xTaskCreate( vCompetingMathTask2, "Math2", mathSTACK_SIZE, ( void * ) &( usTaskCheck[ 1 ] ), uxPriority, NULL );\r
+       xTaskCreate( vCompetingMathTask3, "Math3", mathSTACK_SIZE, ( void * ) &( usTaskCheck[ 2 ] ), uxPriority, NULL );\r
+       xTaskCreate( vCompetingMathTask4, "Math4", mathSTACK_SIZE, ( void * ) &( usTaskCheck[ 3 ] ), uxPriority, NULL );\r
 }\r
 /*-----------------------------------------------------------*/\r
 \r
 static portTASK_FUNCTION( vCompetingMathTask1, pvParameters )\r
 {\r
 volatile portDOUBLE d1, d2, d3, d4;\r
-volatile unsigned short *pusTaskCheckVariable;\r
+volatile uint16_t *pusTaskCheckVariable;\r
 volatile portDOUBLE dAnswer;\r
 short sError = pdFALSE;\r
 \r
@@ -131,7 +131,7 @@ short sError = pdFALSE;
 \r
        /* The variable this task increments to show it is still running is passed in\r
        as the parameter. */\r
-       pusTaskCheckVariable = ( unsigned short * ) pvParameters;\r
+       pusTaskCheckVariable = ( uint16_t * ) pvParameters;\r
 \r
        /* Keep performing a calculation and checking the result against a constant. */\r
        for(;;)\r
@@ -172,7 +172,7 @@ short sError = pdFALSE;
 static portTASK_FUNCTION( vCompetingMathTask2, pvParameters )\r
 {\r
 volatile portDOUBLE d1, d2, d3, d4;\r
-volatile unsigned short *pusTaskCheckVariable;\r
+volatile uint16_t *pusTaskCheckVariable;\r
 volatile portDOUBLE dAnswer;\r
 short sError = pdFALSE;\r
 \r
@@ -190,7 +190,7 @@ short sError = pdFALSE;
 \r
        /* The variable this task increments to show it is still running is passed in\r
        as the parameter. */\r
-       pusTaskCheckVariable = ( unsigned short * ) pvParameters;\r
+       pusTaskCheckVariable = ( uint16_t * ) pvParameters;\r
 \r
        /* Keep performing a calculation and checking the result against a constant. */\r
        for( ;; )\r
@@ -230,7 +230,7 @@ short sError = pdFALSE;
 static portTASK_FUNCTION( vCompetingMathTask3, pvParameters )\r
 {\r
 volatile portDOUBLE *pdArray, dTotal1, dTotal2, dDifference;\r
-volatile unsigned short *pusTaskCheckVariable;\r
+volatile uint16_t *pusTaskCheckVariable;\r
 const size_t xArraySize = 10;\r
 size_t xPosition;\r
 short sError = pdFALSE;\r
@@ -242,7 +242,7 @@ short sError = pdFALSE;
 \r
        /* The variable this task increments to show it is still running is passed in\r
        as the parameter. */\r
-       pusTaskCheckVariable = ( unsigned short * ) pvParameters;\r
+       pusTaskCheckVariable = ( uint16_t * ) pvParameters;\r
 \r
        pdArray = ( portDOUBLE * ) pvPortMalloc( xArraySize * sizeof( portDOUBLE ) );\r
 \r
@@ -293,7 +293,7 @@ short sError = pdFALSE;
 static portTASK_FUNCTION( vCompetingMathTask4, pvParameters )\r
 {\r
 volatile portDOUBLE *pdArray, dTotal1, dTotal2, dDifference;\r
-volatile unsigned short *pusTaskCheckVariable;\r
+volatile uint16_t *pusTaskCheckVariable;\r
 const size_t xArraySize = 10;\r
 size_t xPosition;\r
 short sError = pdFALSE;\r
@@ -305,7 +305,7 @@ short sError = pdFALSE;
 \r
        /* The variable this task increments to show it is still running is passed in\r
        as the parameter. */\r
-       pusTaskCheckVariable = ( unsigned short * ) pvParameters;\r
+       pusTaskCheckVariable = ( uint16_t * ) pvParameters;\r
 \r
        pdArray = ( portDOUBLE * ) pvPortMalloc( xArraySize * sizeof( portDOUBLE ) );\r
 \r
@@ -354,9 +354,9 @@ short sError = pdFALSE;
 /*-----------------------------------------------------------*/\r
 \r
 /* This is called to check that all the created tasks are still running. */\r
-portBASE_TYPE xAreMathsTaskStillRunning( void )\r
+BaseType_t xAreMathsTaskStillRunning( void )\r
 {\r
-portBASE_TYPE xReturn = pdPASS, xTask;\r
+BaseType_t xReturn = pdPASS, xTask;\r
 \r
        /* Check the maths tasks are still running by ensuring their check variables\r
        have been set to pdPASS. */\r
@@ -375,7 +375,7 @@ portBASE_TYPE xReturn = pdPASS, xTask;
                        usTaskCheck[ xTask ] = pdFALSE;\r
                }\r
        }\r
-               \r
+\r
        return xReturn;\r
 }\r
 \r