]> git.sur5r.net Git - freertos/blobdiff - Demo/WIN32-MSVC/main.c
Updated the Win32 MSVC demo files.
[freertos] / Demo / WIN32-MSVC / main.c
index 6685e2fede2dbba8c1003486f68c79f89940663f..a8f09742dde1efa9ecc69a9412499ca930125232 100644 (file)
     licensing and training services.\r
 */\r
 \r
+/*\r
+ *******************************************************************************\r
+ * -NOTE- The Win32 port is a simulation (or is that emulation?) only!  Do not\r
+ * expect to get real time behaviour from the Win32 port or this demo\r
+ * application.  It is provided as a convenient development and demonstration\r
+ * test bed only.  Also, at the time of writing, a method of deleting theads \r
+ * has not been implemented, although doing so would be trivial so this\r
+ * functionality might be added in at a later date.  At present, calling \r
+ * vTaskDelete() will delete the real time task from FreeRTOS but not the Win32\r
+ * thread in which the task was executing.  DO NOT CALL vTaskDelete() when using \r
+ * the Win32 port!  This was tested using Windows XP on a dual core laptop.\r
+ *\r
+ * - READ THE WEB DOCUMENTATION FOR THIS PORT FOR MORE INFORMATION ON USING IT -\r
+ *******************************************************************************\r
+ *\r
+ * main() creates all the demo application tasks, then starts the scheduler.  \r
+ * The web documentation provides more details of the standard demo application \r
+ * tasks, which provide no particular functionality but do provide a good \r
+ * example of how to use the FreeRTOS API.\r
+ *\r
+ * In addition to the standard demo tasks, the following tasks and tests are\r
+ * defined and/or created within this file:\r
+ *\r
+ * "Check" task - This only executes every five seconds but has a high priority\r
+ * to ensure it gets processor time.  Its main function is to check that all the\r
+ * standard demo tasks are still operational.  While no errors have been\r
+ * discovered the check task will print out "OK" and the current simulated tick\r
+ * time.  If an error is discovered in the execution of a task then the check\r
+ * task will print out an appropriate error message.\r
+ *\r
+ */\r
+\r
+\r
 /* Standard includes. */\r
 #include <stdio.h>\r
 \r
@@ -64,7 +97,6 @@
 #include "BlockQ.h"\r
 #include "death.h"\r
 #include "integer.h"\r
-//#include "blocktim.h"\r
 #include "semtest.h"\r
 #include "PollQ.h"\r
 #include "GenQTest.h"\r
@@ -94,14 +126,6 @@ static xQueueHandle xStdoutQueue = NULL;
 /* Task function prototypes. */\r
 static void prvCheckTask( void *pvParameters );\r
 \r
-/* Create a queue on which console output strings can be posted, then start the\r
-task that processes the queue - printf()'ing each string that is received. */\r
-static void prvStartStdoutTask( void );\r
-\r
-/* Post a message for output by the stdout task.  Basically queues the message\r
-pointed to by pcTextToPrint for output to stdout in a thread safe manner. */\r
-void vMainConsolePrint( const char *pcTextToPrint, portTickType xTicksToWait );\r
-\r
 /*-----------------------------------------------------------*/\r
 \r
 int main( void )\r
@@ -111,14 +135,13 @@ int main( void )
 \r
        /* Create the standard demo tasks. */\r
        vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
-//     vCreateBlockTimeTasks();\r
        vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
        vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
        vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );\r
        vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );\r
        vStartQueuePeekTasks();\r
-       vStartRecursiveMutexTasks();\r
        vStartMathTasks( mainFLOP_TASK_PRIORITY );\r
+       vStartRecursiveMutexTasks();\r
 \r
        /* Start the scheduler itself. */\r
        vTaskStartScheduler();\r
@@ -134,7 +157,6 @@ static void prvCheckTask( void *pvParameters )
 portTickType xNextWakeTime;\r
 const portTickType xCycleFrequency = 5000 / portTICK_RATE_MS;\r
 char *pcStatusMessage = "OK";\r
-long lCycleCount = 0;\r
 \r
        /* Just to remove compiler warning. */\r
        ( void ) pvParameters;\r
@@ -164,10 +186,6 @@ long lCycleCount = 0;
                {\r
                        pcStatusMessage = "Error: BlockQueue";\r
                }\r
-//             else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
-//             {\r
-//                     pcStatusMessage = "Error: BlockTime";\r
-//             }\r
            else if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
            {\r
                        pcStatusMessage = "Error: SemTest";\r
@@ -175,15 +193,15 @@ long lCycleCount = 0;
            else if( xArePollingQueuesStillRunning() != pdTRUE )\r
            {\r
                        pcStatusMessage = "Error: PollQueue";\r
-           }\r
-           else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
-           {\r
-                       pcStatusMessage = "Error: RecMutex";\r
            }\r
                else if( xAreMathsTaskStillRunning() != pdPASS )\r
                {\r
                        pcStatusMessage = "Error: Flop";\r
                }\r
+           else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
+           {\r
+                       pcStatusMessage = "Error: RecMutex";\r
+               }\r
 \r
                /* This is the only task that uses stdout so its ok to call printf() \r
                directly. */\r