]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/msp430_CrossWorks/main.c
Update version number ready for release.
[freertos] / FreeRTOS / Demo / msp430_CrossWorks / main.c
index 944347f98c93f28f0f0516172b65d217d1604d74..9fb9d49f7695d6a020925e9f769bba7335a27b3c 100644 (file)
@@ -1,48 +1,41 @@
 /*\r
-    FreeRTOS V7.3.0 - Copyright (C) 2012 Real Time Engineers Ltd.\r
+    FreeRTOS V8.0.1 - Copyright (C) 2014 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     !<<\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 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
+    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
-    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.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
  * Creates all the demo application tasks, then starts the scheduler.  The WEB\r
  * documentation provides more details of the demo application tasks.\r
- * \r
+ *\r
  * This demo is configured to execute on the ES449 prototyping board from\r
  * SoftBaugh. The ES449 has a built in LCD display and a single built in user\r
  * LED.  Therefore, in place of flashing an LED, the 'flash' and 'check' tasks\r
  * toggle '*' characters on the LCD.  The left most '*' represents LED 0, the\r
  * next LED 1, etc.\r
  *\r
- * Main. c also creates a task called 'Check'.  This only executes every three \r
- * seconds but has the highest priority so is guaranteed to get processor time.  \r
- * Its main function is to check that all the other tasks are still operational.  \r
- * Each task that does not flash an LED maintains a unique count that is \r
- * incremented each time the task successfully completes its function.  Should \r
- * any error occur within such a task the count is permanently halted.  The \r
+ * Main. c also creates a task called 'Check'.  This only executes every three\r
+ * seconds but has the highest priority so is guaranteed to get processor time.\r
+ * Its main function is to check that all the other tasks are still operational.\r
+ * Each task that does not flash an LED maintains a unique count that is\r
+ * incremented each time the task successfully completes its function.  Should\r
+ * any error occur within such a task the count is permanently halted.  The\r
  * 'check' task inspects the count of each task to ensure it has changed since\r
- * the last time the check task executed.  If all the count variables have \r
+ * the last time the check task executed.  If all the count variables have\r
  * changed all the tasks are still executing error free, and the check task\r
- * toggles an LED with a three second period.  Should any task contain an error \r
+ * toggles an LED with a three second period.  Should any task contain an error\r
  * at any time the LED toggle rate will increase to 500ms.\r
  *\r
  * Please read the documentation for the MSP430 port available on\r
@@ -124,13 +121,13 @@ the '*' characters on the LCD represent LED's] */
 /* Baud rate used by the COM test tasks. */\r
 #define mainCOM_TEST_BAUD_RATE                 ( ( unsigned long ) 19200 )\r
 \r
-/* The frequency at which the 'Check' tasks executes.  See the comments at the \r
+/* The frequency at which the 'Check' tasks executes.  See the comments at the\r
 top of the page.  When the system is operating error free the 'Check' task\r
 toggles an LED every three seconds.  If an error is discovered in any task the\r
-rate is increased to 500 milliseconds.  [in this case the '*' characters on the \r
+rate is increased to 500 milliseconds.  [in this case the '*' characters on the\r
 LCD represent LED's]*/\r
-#define mainNO_ERROR_CHECK_DELAY               ( ( portTickType ) 3000 / portTICK_RATE_MS  )\r
-#define mainERROR_CHECK_DELAY                  ( ( portTickType ) 500 / portTICK_RATE_MS  )\r
+#define mainNO_ERROR_CHECK_DELAY               ( ( TickType_t ) 3000 / portTICK_PERIOD_MS  )\r
+#define mainERROR_CHECK_DELAY                  ( ( TickType_t ) 500 / portTICK_PERIOD_MS  )\r
 \r
 /* The constants used in the calculation. */\r
 #define intgCONST1                             ( ( long ) 123 )\r
@@ -139,10 +136,10 @@ LCD represent LED's]*/
 #define intgCONST4                             ( ( long ) 7 )\r
 #define intgEXPECTED_ANSWER            ( ( ( intgCONST1 + intgCONST2 ) * intgCONST3 ) / intgCONST4 )\r
 \r
-/* \r
+/*\r
  * The function that implements the Check task.  See the comments at the head\r
  * of the page for implementation details.\r
- */ \r
+ */\r
 static void vErrorChecks( void *pvParameters );\r
 \r
 /*\r
@@ -151,7 +148,7 @@ static void vErrorChecks( void *pvParameters );
  */\r
 static short prvCheckOtherTasksAreStillRunning( void );\r
 \r
-/* \r
+/*\r
  * Perform the hardware setup required by the ES449 in order to run the demo\r
  * application.\r
  */\r
@@ -179,7 +176,7 @@ int main( void )
        vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
 \r
        /* Start the 'Check' task which is defined in this file. */\r
-       xTaskCreate( vErrorChecks, ( const signed char * const ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );      \r
+       xTaskCreate( vErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
 \r
        /* Start the scheduler. */\r
        vTaskStartScheduler();\r
@@ -192,21 +189,21 @@ int main( void )
 \r
 static portTASK_FUNCTION( vErrorChecks, pvParameters )\r
 {\r
-portTickType xDelayPeriod = mainNO_ERROR_CHECK_DELAY;\r
+TickType_t xDelayPeriod = mainNO_ERROR_CHECK_DELAY;\r
 \r
        /* Cycle for ever, delaying then checking all the other tasks are still\r
        operating without error. */\r
        for( ;; )\r
        {\r
                /* Wait until it is time to check again.  The time we wait here depends\r
-               on whether an error has been detected or not.  When an error is \r
+               on whether an error has been detected or not.  When an error is\r
                detected the time is shortened resulting in a faster LED flash rate. */\r
                vTaskDelay( xDelayPeriod );\r
 \r
                /* See if the other tasks are all ok. */\r
                if( prvCheckOtherTasksAreStillRunning() != pdPASS )\r
                {\r
-                       /* An error occurred in one of the tasks so shorten the delay \r
+                       /* An error occurred in one of the tasks so shorten the delay\r
                        period - which has the effect of increasing the frequency of the\r
                        LED toggle. */\r
                        xDelayPeriod = mainERROR_CHECK_DELAY;\r
@@ -224,7 +221,7 @@ static short sNoErrorFound = pdTRUE;
 static unsigned long ulLastIdleLoopCount = 0UL;\r
 \r
        /* The demo tasks maintain a count that increments every cycle of the task\r
-       provided that the task has never encountered an error.  This function \r
+       provided that the task has never encountered an error.  This function\r
        checks the counts maintained by the tasks to ensure they are still being\r
        incremented.  A count remaining at the same value between calls therefore\r
        indicates that an error has been detected.  Only tasks that do not flash\r
@@ -258,7 +255,7 @@ static unsigned long ulLastIdleLoopCount = 0UL;
     {\r
         ulLastIdleLoopCount = ulIdleLoops;\r
     }\r
-       \r
+\r
        return sNoErrorFound;\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -269,10 +266,10 @@ static void prvSetupHardware( void )
        WDTCTL = WDTPW + WDTHOLD;\r
 \r
        /* Setup DCO+ for ( xtal * D * (N + 1) ) operation. */\r
-       FLL_CTL0 |= DCOPLUS + XCAP18PF; \r
+       FLL_CTL0 |= DCOPLUS + XCAP18PF;\r
 \r
        /* X2 DCO frequency, 8MHz nominal DCO */\r
-       SCFI0 |= FN_4;                  \r
+       SCFI0 |= FN_4;\r
 \r
        /* (121+1) x 32768 x 2 = 7.99 Mhz */\r
        SCFQCTL = mainMAX_FREQUENCY;\r
@@ -316,8 +313,8 @@ volatile signed portBASE_TYPE *pxTaskHasExecuted;
                lValue *= intgCONST3;\r
                lValue /= intgCONST4;\r
 \r
-               /* If the calculation is found to be incorrect we stop setting the \r
-               TaskHasExecuted variable so the check task can see an error has \r
+               /* If the calculation is found to be incorrect we stop setting the\r
+               TaskHasExecuted variable so the check task can see an error has\r
                occurred. */\r
                if( lValue != intgEXPECTED_ANSWER ) /*lint !e774 volatile used to prevent this being optimised out. */\r
                {\r