]> 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 4c27b476a89908c0168394185734fce05e1424f9..9fb9d49f7695d6a020925e9f769bba7335a27b3c 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
  * 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
@@ -121,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
@@ -136,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
@@ -148,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
@@ -176,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
@@ -189,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
@@ -221,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
@@ -255,7 +255,7 @@ static unsigned long ulLastIdleLoopCount = 0UL;
     {\r
         ulLastIdleLoopCount = ulIdleLoops;\r
     }\r
-       \r
+\r
        return sNoErrorFound;\r
 }\r
 /*-----------------------------------------------------------*/\r
@@ -266,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
@@ -313,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