]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/msp430_CrossWorks/main.c
Update version number to 9.0.0rc2.
[freertos] / FreeRTOS / Demo / msp430_CrossWorks / main.c
index 5b361f27cac3ee08092c5d2d4eeb7902df90fe95..08eee305e76591f7a8755746cc775406f9a4a089 100644 (file)
@@ -1,59 +1,64 @@
 /*\r
-    FreeRTOS V7.5.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
+    FreeRTOS V9.0.0rc2 - Copyright (C) 2016 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
+    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
 /*\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
@@ -120,13 +125,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
@@ -135,10 +140,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
@@ -147,7 +152,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
@@ -175,7 +180,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
@@ -188,21 +193,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
@@ -220,7 +225,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
@@ -254,7 +259,7 @@ static unsigned long ulLastIdleLoopCount = 0UL;
     {\r
         ulLastIdleLoopCount = ulIdleLoops;\r
     }\r
-       \r
+\r
        return sNoErrorFound;\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -265,10 +270,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
@@ -312,8 +317,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