]> git.sur5r.net Git - freertos/blobdiff - Demo/RX600_RX62N-MDK_Renesas/RTOSDemo/main-full.c
Update the RX MDK demo to include the web server. Minor tidy up to the RDK version...
[freertos] / Demo / RX600_RX62N-MDK_Renesas / RTOSDemo / main-full.c
index 4e82be88e97733708feb23181ae55d07d242badd..95216b40db4709692bc75b05af32b56f0581bab5 100644 (file)
@@ -147,6 +147,10 @@ tasks check that the values are passed in correctly. */
 #define mainGEN_QUEUE_TASK_PRIORITY    ( tskIDLE_PRIORITY )\r
 #define mainFLOP_TASK_PRIORITY         ( tskIDLE_PRIORITY )\r
 \r
+/* The WEB server uses string handling functions, which in turn use a bit more\r
+stack than most of the other tasks. */\r
+#define mainuIP_STACK_SIZE                     ( configMINIMAL_STACK_SIZE * 3 )\r
+\r
 /* The LED toggled by the check task. */\r
 #define mainCHECK_LED                          ( 5 )\r
 \r
@@ -215,12 +219,23 @@ static void prvRegTest2Implementation( void );
  */\r
 static void prvCheckTask( void *pvParameters );\r
 \r
+/*\r
+ * Contains the implementation of the WEB server.\r
+ */\r
+extern void vuIP_Task( void *pvParameters );\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
 /* Variables that are incremented on each iteration of the reg test tasks -\r
 provided the tasks have not reported any errors.  The check task inspects these\r
 variables to ensure they are still incrementing as expected.  If a variable\r
 stops incrementing then it is likely that its associate task has stalled. */\r
 unsigned long ulRegTest1CycleCount = 0UL, ulRegTest2CycleCount = 0UL;\r
 \r
+/* The status message that is displayed at the bottom of the "task stats" web\r
+page, which is served by the uIP task. */\r
+const char *pcStatusMessage = "All tasks executing without error.";\r
+\r
 /*-----------------------------------------------------------*/\r
 \r
 void main(void)\r
@@ -231,10 +246,16 @@ extern void HardwareSetup( void );
        here. */\r
        HardwareSetup();\r
 \r
+       /* Turn all LEDs off. */\r
+       vParTestInitialise();\r
+\r
        /* Start the reg test tasks which test the context switching mechanism. */\r
        xTaskCreate( prvRegTest1Task, "RegTst1", configMINIMAL_STACK_SIZE, ( void * ) mainREG_TEST_1_PARAMETER, tskIDLE_PRIORITY, NULL );\r
        xTaskCreate( prvRegTest2Task, "RegTst2", configMINIMAL_STACK_SIZE, ( void * ) mainREG_TEST_2_PARAMETER, tskIDLE_PRIORITY, NULL );\r
 \r
+       /* The web server task. */\r
+       xTaskCreate( vuIP_Task, "uIP", mainuIP_STACK_SIZE, NULL, mainuIP_TASK_PRIORITY, NULL );\r
+\r
        /* Start the check task as described at the top of this file. */\r
        xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE * 3, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
 \r
@@ -273,7 +294,6 @@ portTickType xNextWakeTime, xCycleFrequency = mainNO_ERROR_CYCLE_TIME;
 extern void vSetupHighFrequencyTimer( void );\r
 extern volatile unsigned short usMaxJitter;\r
 volatile unsigned long ulActualJitter = 0;\r
-static char cErrorText[ 100 ];\r
 \r
        /* If this is being executed then the kernel has been started.  Start the high\r
        frequency timer test as described at the top of this file.  This is only\r
@@ -298,57 +318,57 @@ static char cErrorText[ 100 ];
                        rate at which mainCHECK_LED flashes to give visual feedback that an error\r
                        has occurred. */\r
                        xCycleFrequency = mainERROR_CYCLE_TIME;\r
-                       strcpy( cErrorText, "Error: GenQueue" );\r
+                       pcStatusMessage = "Error: GenQueue";\r
                }\r
                else if( xAreQueuePeekTasksStillRunning() != pdTRUE )\r
                {\r
                        xCycleFrequency = mainERROR_CYCLE_TIME;\r
-                       strcpy( cErrorText, "Error: QueuePeek" );\r
+                       pcStatusMessage = "Error: QueuePeek";\r
                }\r
                else if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
                {\r
                        xCycleFrequency = mainERROR_CYCLE_TIME;\r
-                       strcpy( cErrorText, "Error: BlockQueue" );\r
+                       pcStatusMessage = "Error: BlockQueue";\r
                }\r
                else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
                {\r
                        xCycleFrequency = mainERROR_CYCLE_TIME;\r
-                       strcpy( cErrorText, "Error: BlockTime" );\r
+                       pcStatusMessage = "Error: BlockTime";\r
                }\r
                else if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
                {\r
                        xCycleFrequency = mainERROR_CYCLE_TIME;\r
-                       strcpy( cErrorText, "Error: SemTest" );\r
+                       pcStatusMessage = "Error: SemTest";\r
                }\r
                else if( xArePollingQueuesStillRunning() != pdTRUE )\r
                {\r
                        xCycleFrequency = mainERROR_CYCLE_TIME;\r
-                       strcpy( cErrorText, "Error: PollQueue" );\r
+                       pcStatusMessage = "Error: PollQueue";\r
                }\r
                else if( xIsCreateTaskStillRunning() != pdTRUE )\r
                {\r
                        xCycleFrequency = mainERROR_CYCLE_TIME;\r
-                       strcpy( cErrorText, "Error: Death" );\r
+                       pcStatusMessage = "Error: Death";\r
                }\r
                else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
                {\r
                        xCycleFrequency = mainERROR_CYCLE_TIME;\r
-                       strcpy( cErrorText, "Error: IntMath" );\r
+                       pcStatusMessage = "Error: IntMath";\r
                }\r
                else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
                {\r
                        xCycleFrequency = mainERROR_CYCLE_TIME;\r
-                       strcpy( cErrorText, "Error: RecMutex" );\r
+                       pcStatusMessage = "Error: RecMutex";\r
                }\r
                else if( xAreIntQueueTasksStillRunning() != pdPASS )\r
                {\r
                        xCycleFrequency = mainERROR_CYCLE_TIME;\r
-                       strcpy( cErrorText, "Error: IntQueue" );\r
+                       pcStatusMessage = "Error: IntQueue";\r
                }\r
                else if( xAreMathsTaskStillRunning() != pdPASS )\r
                {\r
                        xCycleFrequency = mainERROR_CYCLE_TIME;\r
-                       strcpy( cErrorText, "Error: Flop" );\r
+                       pcStatusMessage = "Error: Flop";\r
                }\r
 \r
                /* Check the reg test tasks are still cycling.  They will stop incrementing\r
@@ -356,13 +376,13 @@ static char cErrorText[ 100 ];
                if( ulRegTest1CycleCount == ulLastRegTest1CycleCount )\r
                {\r
                        xCycleFrequency = mainERROR_CYCLE_TIME;\r
-                       strcpy( cErrorText, "Error: RegTest1" );\r
+                       pcStatusMessage = "Error: RegTest1";\r
                }\r
 \r
                if( ulRegTest2CycleCount == ulLastRegTest2CycleCount )\r
                {\r
                        xCycleFrequency = mainERROR_CYCLE_TIME;\r
-                       strcpy( cErrorText, "Error: RegTest2" );\r
+                       pcStatusMessage = "Error: RegTest2";\r
                }\r
 \r
                ulLastRegTest1CycleCount = ulRegTest1CycleCount;\r
@@ -631,8 +651,14 @@ RegTest2Error:
        ; - causing the check task to indicate the error.\r
        BRA RegTest2Error\r
 }\r
+/*-----------------------------------------------------------*/\r
 \r
-\r
-\r
+char *pcGetTaskStatusMessage( void )\r
+{\r
+       /* Not bothered about a critical section here.  This just returns a string\r
+       that is displaed on the "Task Stats" WEB page served by this demo. */\r
+       return ( char * ) pcStatusMessage;\r
+}\r
+/*-----------------------------------------------------------*/\r
 \r
 \r