]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/RX200_RX231-RSK_GCC_e2studio_IAR/src/Full_Demo/main_full.c
Update version number in readiness for V10.3.0 release. Sync SVN with reviewed releas...
[freertos] / FreeRTOS / Demo / RX200_RX231-RSK_GCC_e2studio_IAR / src / Full_Demo / main_full.c
index 4417b3017383e1582bd0ab7d245095509b06df20..1173ab534a6a654139a5ab6207aa58b9ed542830 100644 (file)
@@ -1,71 +1,29 @@
 /*\r
-    FreeRTOS V8.2.2 - 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
-    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
-    ***************************************************************************\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 on the following\r
-    link: http://www.freertos.org/a00114.html\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
-    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.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
+ * FreeRTOS Kernel V10.3.0\r
+ * Copyright (C) 2020 Amazon.com, Inc. or its affiliates.  All Rights Reserved.\r
+ *\r
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\r
+ * this software and associated documentation files (the "Software"), to deal in\r
+ * the Software without restriction, including without limitation the rights to\r
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r
+ * the Software, and to permit persons to whom the Software is furnished to do so,\r
+ * subject to the following conditions:\r
+ *\r
+ * The above copyright notice and this permission notice shall be included in all\r
+ * copies or substantial portions of the Software.\r
+ *\r
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+ *\r
+ * http://www.FreeRTOS.org\r
+ * http://aws.amazon.com/freertos\r
+ *\r
+ * 1 tab == 4 spaces!\r
+ */\r
 \r
 /******************************************************************************\r
  * NOTE 1:  This project provides two demo applications.  A simple blinky\r
@@ -81,7 +39,7 @@
  *\r
  ******************************************************************************\r
  *\r
- * main_full() creates all the demo application tasks and software timers, then\r
+ * main_full() creates a set of demo application tasks and software timers, then\r
  * starts the scheduler.  The web documentation provides more details of the\r
  * standard demo application tasks, which provide no particular functionality,\r
  * but do provide a good example of how to use the FreeRTOS API.\r
  * error in the context switching mechanism.\r
  *\r
  * "Check" task - The check task period is initially set to three seconds.  The\r
- * task checks that all the standard demo tasks, and the register check tasks,\r
- * are not only still executing, but are executing without reporting any errors.\r
- * If the check task discovers that a task has either stalled, or reported an\r
- * error, then it changes its own execution period from the initial three\r
- * seconds, to just 200ms.  The check task also toggles an LED each time it is\r
- * called.  This provides a visual indication of the system status:  If the LED\r
- * toggles every three seconds, then no issues have been discovered.  If the LED\r
- * toggles every 200ms, then an issue has been discovered with at least one\r
- * task.\r
+ * task checks that all the standard demo tasks are not only still executing,\r
+ * but are executing without reporting any errors.  If the check task discovers\r
+ * that a task has either stalled, or reported an error, then it changes its own\r
+ * execution period from the initial three seconds, to just 200ms.  The check\r
+ * task also toggles an LED on each iteration of its loop.  This provides a\r
+ * visual indication of the system status:  If the LED toggles every three\r
+ * seconds, then no issues have been discovered.  If the LED toggles every\r
+ * 200ms, then an issue has been discovered with at least one task.\r
  */\r
 \r
 /* Standard includes. */\r
 #define mainCREATOR_TASK_PRIORITY                      ( tskIDLE_PRIORITY + 3UL )\r
 #define mainFLOP_TASK_PRIORITY                         ( tskIDLE_PRIORITY )\r
 #define mainUART_COMMAND_CONSOLE_STACK_SIZE    ( configMINIMAL_STACK_SIZE * 3UL )\r
-#define mainCOM_TEST_TASK_PRIORITY                     ( tskIDLE_PRIORITY + 2 )\r
 #define mainCHECK_TASK_PRIORITY                                ( configMAX_PRIORITIES - 1 )\r
 #define mainQUEUE_OVERWRITE_PRIORITY           ( tskIDLE_PRIORITY )\r
 \r
-/* The priority used by the UART command console task. */\r
-#define mainUART_COMMAND_CONSOLE_TASK_PRIORITY ( configMAX_PRIORITIES - 2 )\r
-\r
-/* A block time of zero simply means "don't block". */\r
-#define mainDONT_BLOCK                                         ( 0UL )\r
-\r
-/* The period after which the check timer will expire, in ms, provided no errors\r
-have been reported by any of the standard demo tasks.  ms are converted to the\r
-equivalent in ticks using the portTICK_PERIOD_MS constant. */\r
-#define mainNO_ERROR_CHECK_TASK_PERIOD         ( 3000UL / portTICK_PERIOD_MS )\r
+/* The period of the check task, in ms, provided no errors have been reported by\r
+any of the standard demo tasks.  ms are converted to the equivalent in ticks\r
+using the portTICK_PERIOD_MS constant. */\r
+#define mainNO_ERROR_CHECK_TASK_PERIOD         pdMS_TO_TICKS( 3000UL )\r
 \r
-/* The period at which the check timer will expire, in ms, if an error has been\r
-reported in one of the standard demo tasks.  ms are converted to the equivalent\r
-in ticks using the portTICK_PERIOD_MS constant. */\r
-#define mainERROR_CHECK_TASK_PERIOD            ( 200UL / portTICK_PERIOD_MS )\r
+/* The period of the check task, in ms, if an error has been reported in one of\r
+the standard demo tasks.  ms are converted to the equivalent in ticks using the\r
+portTICK_PERIOD_MS constant. */\r
+#define mainERROR_CHECK_TASK_PERIOD            pdMS_TO_TICKS( 200UL )\r
 \r
 /* Parameters that are passed into the register check tasks solely for the\r
 purpose of ensuring parameters are passed into tasks correctly. */\r
-#define mainREG_TEST_1_PARAMETER       ( ( void * ) 0x12121212UL )\r
-#define mainREG_TEST_2_PARAMETER       ( ( void * ) 0x12345678UL )\r
+#define mainREG_TEST_1_PARAMETER                       ( ( void * ) 0x12121212UL )\r
+#define mainREG_TEST_2_PARAMETER                       ( ( void * ) 0x12345678UL )\r
 \r
 /* The base period used by the timer test tasks. */\r
 #define mainTIMER_TEST_PERIOD                          ( 50 )\r
@@ -218,9 +168,6 @@ then the register check tasks have not discovered any errors.  If a variable
 stops incrementing, then an error has been found. */\r
 volatile unsigned long ulRegTest1LoopCounter = 0UL, ulRegTest2LoopCounter = 0UL;\r
 \r
-/* String for display in the web server.  It is set to an error message if the\r
-check task detects an error.  */\r
-const char *pcStatusMessage = "All tasks running without error";\r
 /*-----------------------------------------------------------*/\r
 \r
 void main_full( void )\r
@@ -248,7 +195,7 @@ void main_full( void )
        xTaskCreate( prvRegTest2Task, "RegTst2", configMINIMAL_STACK_SIZE, mainREG_TEST_2_PARAMETER, tskIDLE_PRIORITY, NULL );\r
 \r
        /* Create the task that just adds a little random behaviour. */\r
-       xTaskCreate( prvPseudoRandomiser, "Rnd", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL );\r
+       xTaskCreate( prvPseudoRandomiser, "Rnd", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 2, NULL );\r
 \r
        /* Create the task that performs the 'check' functionality,     as described at\r
        the top of this file. */\r
@@ -264,12 +211,10 @@ void main_full( void )
 \r
        /* If all is well, the scheduler will now be running, and the following\r
        line will never be reached.  If the following line does execute, then\r
-       there was either insufficient FreeRTOS heap memory available for the idle\r
-       and/or timer tasks to be created, or vTaskStartScheduler() was called from\r
-       User mode.  See the memory management section on the FreeRTOS web site for\r
-       more details on the FreeRTOS heap http://www.freertos.org/a00111.html.  The\r
-       mode from which main() is called is set in the C start up code and must be\r
-       a privileged mode (not user mode). */\r
+       there was insufficient FreeRTOS heap memory available for the Idle and/or\r
+       timer tasks to be created.  See the memory management section on the\r
+       FreeRTOS web site for more details on the FreeRTOS heap\r
+       http://www.freertos.org/a00111.html. */\r
        for( ;; );\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -402,7 +347,6 @@ unsigned long ulErrorFound = pdFALSE;
                        gone wrong (it might just be that the loop back connector required\r
                        by the comtest tasks has not been fitted). */\r
                        xDelayPeriod = mainERROR_CHECK_TASK_PERIOD;\r
-                       pcStatusMessage = "Error found in at least one task.";\r
                }\r
        }\r
 }\r
@@ -410,7 +354,7 @@ unsigned long ulErrorFound = pdFALSE;
 \r
 static void prvPseudoRandomiser( void *pvParameters )\r
 {\r
-const uint32_t ulMultiplier = 0x015a4e35UL, ulIncrement = 1UL, ulMinDelay = ( 35 / portTICK_PERIOD_MS );\r
+const uint32_t ulMultiplier = 0x015a4e35UL, ulIncrement = 1UL, ulMinDelay = pdMS_TO_TICKS( 35 );\r
 volatile uint32_t ulNextRand = ( uint32_t ) &pvParameters, ulValue;\r
 \r
        /* This task does nothing other than ensure there is a little bit of\r