]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/MB91460_Softune/SRC/main.c
Update version number to 8.1.2 after moving the defaulting of configUSE_PORT_OPTIMISE...
[freertos] / FreeRTOS / Demo / MB91460_Softune / SRC / main.c
index 123838c16c521f2092cfee965f72b663643a49cf..463d7e5b208c27b263c4c698d4570c8ad5fad3c2 100644 (file)
@@ -1,5 +1,6 @@
 /*\r
-    FreeRTOS V7.5.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
+    FreeRTOS V8.1.2 - 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
 \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
  * In addition to the standard demo tasks, the follow demo specific tasks are\r
  * create:\r
  *\r
- * The "Check" task.  This only executes every three seconds but has the highest \r
- * priority so is guaranteed to get processor time.  Its main function is to \r
- * check that all the other tasks are still operational.  Most tasks maintain \r
- * a unique count that is incremented each time the task successfully completes \r
- * its function.  Should any error occur within such a task the count is \r
- * permanently halted.  The check task inspects the count of each task to ensure \r
- * it has changed since the last time the check task executed.  If all the count \r
- * variables have changed all the tasks are still executing error free, and the \r
- * check task toggles the onboard LED.  Should any task contain an error at any time \r
+ * The "Check" task.  This only executes every three seconds but has the highest\r
+ * priority so is guaranteed to get processor time.  Its main function is to\r
+ * check that all the other tasks are still operational.  Most tasks maintain\r
+ * a unique count that is incremented each time the task successfully completes\r
+ * its function.  Should any error occur within such a task the count is\r
+ * permanently halted.  The check task inspects the count of each task to ensure\r
+ * it has changed since the last time the check task executed.  If all the count\r
+ * variables have changed all the tasks are still executing error free, and the\r
+ * check task toggles the onboard LED.  Should any task contain an error at any time\r
  * the LED toggle rate will change from 3 seconds to 500ms.\r
  *\r
  * The "Register Check" tasks.  These tasks fill the CPU registers with known\r
@@ -87,7 +88,7 @@
  * context switch mechanism.  The register check tasks operate at low priority\r
  * so are switched in and out frequently.\r
  *\r
- * The "Trace Utility" task.  This can be used to obtain trace and debug \r
+ * The "Trace Utility" task.  This can be used to obtain trace and debug\r
  * information via UART5.\r
  */\r
 \r
 #include "taskutility.h"\r
 #include "partest.h"\r
 #include "crflash.h"\r
-       \r
+\r
 /* Demo task priorities. */\r
 #define mainWATCHDOG_TASK_PRIORITY             ( tskIDLE_PRIORITY + 5 )\r
 #define mainCHECK_TASK_PRIORITY                        ( tskIDLE_PRIORITY + 4 )\r
 #define mainGENERIC_QUEUE_PRIORITY             ( tskIDLE_PRIORITY )\r
 \r
 /* Baud rate used by the COM test tasks. */\r
-#define mainCOM_TEST_BAUD_RATE                 ( ( unsigned portLONG ) 19200 )\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 LEDs]*/\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 total number of LEDs available. */\r
 #define mainNO_CO_ROUTINE_LEDs ( 8 )\r
@@ -156,20 +157,20 @@ LCD represent LEDs]*/
 \r
 /*---------------------------------------------------------------------------*/\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 prvErrorChecks( void *pvParameters );\r
 \r
 /*\r
  * Called by the Check task.  Returns pdPASS if all the other tasks are found\r
  * to be operating without error - otherwise returns pdFAIL.\r
  */\r
-static portSHORT prvCheckOtherTasksAreStillRunning( void );\r
+static short prvCheckOtherTasksAreStillRunning( void );\r
 \r
-/* \r
- * Setup the microcontroller as used by this demo. \r
+/*\r
+ * Setup the microcontroller as used by this demo.\r
  */\r
 static void prvSetupHardware( void );\r
 \r
@@ -184,57 +185,57 @@ static void vSecondRegisterTestTask( void *pvParameters );
 \r
 /*---------------------------------------------------------------------------*/\r
 \r
-/* The variable that is set to true should an error be found in one of the \r
+/* The variable that is set to true should an error be found in one of the\r
 register test tasks. */\r
-unsigned portLONG ulRegTestError = pdFALSE;\r
+unsigned long ulRegTestError = pdFALSE;\r
 \r
 /*---------------------------------------------------------------------------*/\r
 \r
 /* Start all the demo application tasks, then start the scheduler. */\r
 void main(void)\r
 {\r
-       /* Initialise the hardware ready for the demo. */       \r
+       /* Initialise the hardware ready for the demo. */\r
        prvSetupHardware();\r
 \r
        /* Start the standard demo application tasks. */\r
-       vStartLEDFlashTasks( mainLED_TASK_PRIORITY );   \r
+       vStartLEDFlashTasks( mainLED_TASK_PRIORITY );\r
        vStartIntegerMathTasks( tskIDLE_PRIORITY );\r
        vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED - 1 );\r
        vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
-       vStartBlockingQueueTasks ( mainQUEUE_BLOCK_PRIORITY );  \r
-       vStartDynamicPriorityTasks();   \r
-       vStartMathTasks( tskIDLE_PRIORITY );    \r
+       vStartBlockingQueueTasks ( mainQUEUE_BLOCK_PRIORITY );\r
+       vStartDynamicPriorityTasks();\r
+       vStartMathTasks( tskIDLE_PRIORITY );\r
        vStartGenericQueueTasks( mainGENERIC_QUEUE_PRIORITY );\r
        vStartQueuePeekTasks();\r
        vCreateBlockTimeTasks();\r
        vStartFlashCoRoutines( mainNUM_FLASH_CO_ROUTINES );\r
 \r
        /* Start the 'Check' task which is defined in this file. */\r
-       xTaskCreate( prvErrorChecks, ( signed portCHAR * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );    \r
+       xTaskCreate( prvErrorChecks, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
 \r
        /* Start the 'Register Test' tasks as described at the top of this file. */\r
-       xTaskCreate( vFirstRegisterTestTask, ( signed portCHAR * ) "Reg1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
-       xTaskCreate( vSecondRegisterTestTask, ( signed portCHAR * ) "Reg2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
+       xTaskCreate( vFirstRegisterTestTask, "Reg1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
+       xTaskCreate( vSecondRegisterTestTask, "Reg2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
 \r
-       /* Start the task that write trace information to the UART. */  \r
+       /* Start the task that write trace information to the UART. */\r
        vUtilityStartTraceTask( mainUTILITY_TASK_PRIORITY );\r
 \r
        /* If we are going to service the watchdog from within a task, then create\r
-       the task here. */       \r
-       #if WATCHDOG == WTC_IN_TASK     \r
+       the task here. */\r
+       #if WATCHDOG == WTC_IN_TASK\r
                vStartWatchdogTask( mainWATCHDOG_TASK_PRIORITY );\r
-       #endif          \r
-       \r
+       #endif\r
+\r
        /* The suicide tasks must be started last as they record the number of other\r
        tasks that exist within the system.  The value is then used to ensure at run\r
        time the number of tasks that exists is within expected bounds. */\r
        vCreateSuicidalTasks( mainDEATH_PRIORITY );\r
 \r
        /* Now start the scheduler.  Following this call the created tasks should\r
-       be executing. */        \r
+       be executing. */\r
        vTaskStartScheduler( );\r
-       \r
-       /* vTaskStartScheduler() will only return if an error occurs while the \r
+\r
+       /* vTaskStartScheduler() will only return if an error occurs while the\r
        idle task is being created. */\r
        for( ;; );\r
 }\r
@@ -242,7 +243,7 @@ void main(void)
 \r
 static void prvErrorChecks( void *pvParameters )\r
 {\r
-portTickType xDelayPeriod = mainNO_ERROR_CHECK_DELAY, xLastExecutionTime;\r
+TickType_t xDelayPeriod = mainNO_ERROR_CHECK_DELAY, xLastExecutionTime;\r
 \r
        /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()\r
        works correctly. */\r
@@ -253,7 +254,7 @@ portTickType xDelayPeriod = mainNO_ERROR_CHECK_DELAY, xLastExecutionTime;
        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
                /* Perform this check every mainCHECK_DELAY milliseconds. */\r
                vTaskDelayUntil( &xLastExecutionTime, xDelayPeriod );\r
@@ -261,7 +262,7 @@ portTickType xDelayPeriod = mainNO_ERROR_CHECK_DELAY, xLastExecutionTime;
                /* 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
@@ -273,12 +274,12 @@ portTickType xDelayPeriod = mainNO_ERROR_CHECK_DELAY, xLastExecutionTime;
 }\r
 /*-----------------------------------------------------------*/\r
 \r
-static portSHORT prvCheckOtherTasksAreStillRunning( void )\r
+static short prvCheckOtherTasksAreStillRunning( void )\r
 {\r
 portBASE_TYPE lReturn = pdPASS;\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. */\r
@@ -292,42 +293,42 @@ portBASE_TYPE lReturn = pdPASS;
        {\r
                lReturn = pdFAIL;\r
        }\r
-       \r
+\r
        if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
        {\r
                lReturn = pdFAIL;\r
        }\r
-       \r
+\r
        if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
        {\r
                lReturn = pdFAIL;\r
        }\r
-       \r
+\r
        if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
        {\r
                lReturn = pdFAIL;\r
        }\r
-       \r
+\r
        if( xAreMathsTaskStillRunning() != pdTRUE )\r
        {\r
                lReturn = pdFAIL;\r
        }\r
-       \r
+\r
        if( xIsCreateTaskStillRunning() != pdTRUE )\r
        {\r
                lReturn = pdFAIL;\r
        }\r
-       \r
+\r
        if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
        {\r
                lReturn = pdFAIL;\r
        }\r
-       \r
+\r
        if ( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
        {\r
                lReturn = pdFAIL;\r
        }\r
-       \r
+\r
        if ( xAreQueuePeekTasksStillRunning() != pdTRUE )\r
        {\r
                lReturn = pdFAIL;\r
@@ -355,7 +356,7 @@ static void prvSetupHardware( void )
        vParTestInitialise();\r
 \r
        /* If we are going to use the watchdog, then initialise it now. */\r
-       #if WATCHDOG != WTC_NONE        \r
+       #if WATCHDOG != WTC_NONE\r
                InitWatchdog();\r
        #endif\r
 }\r
@@ -404,7 +405,7 @@ static void prvSetupHardware( void )
 \r
 static void vFirstRegisterTestTask( void *pvParameters )\r
 {\r
-extern volatile unsigned portLONG ulCriticalNesting;\r
+extern volatile unsigned long ulCriticalNesting;\r
 \r
        /* Fills the registers with known values (different to the values\r
        used in vSecondRegisterTestTask()), then checks that the registers still\r
@@ -428,7 +429,7 @@ extern volatile unsigned portLONG ulCriticalNesting;
                        LDI     #0xbbbbbbbb, R10\r
                        LDI     #0xcccccccc, R11\r
                        LDI     #0xdddddddd, R12\r
-                       \r
+\r
                        ;Check each register still contains the expected value.\r
                        LDI #0x11111111, R13\r
                        CMP R13, R0\r
@@ -487,7 +488,7 @@ extern volatile unsigned portLONG ulCriticalNesting;
                First_Set_Error:\r
 \r
                        ; Latch that an error has occurred.\r
-                       LDI #_ulRegTestError, R0                        \r
+                       LDI #_ulRegTestError, R0\r
                        LDI #0x00000001, R1\r
                        ST R1, @R0\r
 \r
@@ -502,7 +503,7 @@ extern volatile unsigned portLONG ulCriticalNesting;
 \r
 static void vSecondRegisterTestTask( void *pvParameters )\r
 {\r
-extern volatile unsigned portLONG ulCriticalNesting;\r
+extern volatile unsigned long ulCriticalNesting;\r
 \r
        /* Fills the registers with known values (different to the values\r
        used in vFirstRegisterTestTask()), then checks that the registers still\r
@@ -528,7 +529,7 @@ extern volatile unsigned portLONG ulCriticalNesting;
                        LDI     #0xbbbbbbbb, R11\r
                        LDI     #0xcccccccc, R12\r
                        LDI     #0xdddddddd, R0\r
-                       \r
+\r
                        ;Check each register still contains the expected value.\r
                        LDI #0x11111111, R13\r
                        CMP R13, R1\r
@@ -591,7 +592,7 @@ extern volatile unsigned portLONG ulCriticalNesting;
                Second_Set_Error:\r
 \r
                        ; Latch that an error has occurred.\r
-                       LDI #_ulRegTestError, R0                        \r
+                       LDI #_ulRegTestError, R0\r
                        LDI #0x00000001, R1\r
                        ST R1, @R0\r
 \r