]> git.sur5r.net Git - freertos/commitdiff
Add a few extra standard demo tasks to the Win32 demo.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Tue, 13 Dec 2011 11:38:58 +0000 (11:38 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Tue, 13 Dec 2011 11:38:58 +0000 (11:38 +0000)
Make use of the new trace specific function calls from the Win32 demo - just to check the function as expected.

git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1657 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Demo/WIN32-MSVC/WIN32.suo
Demo/WIN32-MSVC/WIN32.vcxproj
Demo/WIN32-MSVC/WIN32.vcxproj.filters
Demo/WIN32-MSVC/main.c

index d5a322bb84675b31730bde6bd5d18fcce71c3017..2f4e676f815705edd3324a637654cc54ad584078 100644 (file)
Binary files a/Demo/WIN32-MSVC/WIN32.suo and b/Demo/WIN32-MSVC/WIN32.suo differ
index 3d96fb03d2e06f1ae594a5e8cfcf55e61f8ae449..9944c4b78cb33ed46ed9830ec34dc6031f7e5346 100644 (file)
@@ -67,6 +67,7 @@
       <SuppressStartupBanner>true</SuppressStartupBanner>\r
       <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r
       <DisableLanguageExtensions>false</DisableLanguageExtensions>\r
+      <AdditionalOptions>/wd4210 %(AdditionalOptions)</AdditionalOptions>\r
     </ClCompile>\r
     <ResourceCompile>\r
       <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
     <ClCompile Include="..\Common\Minimal\BlockQ.c" />\r
     <ClCompile Include="..\Common\Minimal\blocktim.c" />\r
     <ClCompile Include="..\Common\Minimal\countsem.c" />\r
+    <ClCompile Include="..\Common\Minimal\death.c" />\r
+    <ClCompile Include="..\Common\Minimal\dynamic.c" />\r
     <ClCompile Include="..\Common\Minimal\flop.c" />\r
     <ClCompile Include="..\Common\Minimal\GenQTest.c" />\r
     <ClCompile Include="..\Common\Minimal\integer.c" />\r
index 6ce6aed38549c27defea4db31ead323b0e9c4475..e32e36837ecf28f399449be45bf8f80f411e1eda 100644 (file)
     <ClCompile Include="..\Common\Minimal\countsem.c">\r
       <Filter>Demo App Source\Common Demo Tasks</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="..\Common\Minimal\death.c">\r
+      <Filter>Demo App Source\Common Demo Tasks</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\Common\Minimal\dynamic.c">\r
+      <Filter>Demo App Source\Common Demo Tasks</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="FreeRTOSConfig.h">\r
index cf80942a81b1e1de0cc4d47dcfea6e5a577c8044..bb0116498f68415efd2949c170c1875ddcea854d 100644 (file)
 #include "flop.h"\r
 #include "TimerDemo.h"\r
 #include "countsem.h"\r
+#include "death.h"\r
+#include "dynamic.h"\r
 \r
 /* Priorities at which the tasks are created. */\r
 #define mainCHECK_TASK_PRIORITY                ( configMAX_PRIORITIES - 1 )\r
@@ -121,9 +123,9 @@ static void prvCheckTask( void *pvParameters );
 /* The variable into which error messages are latched. */\r
 static char *pcStatusMessage = "OK";\r
 \r
-/* This semaphore is created purely to test using the vSemaphoreDelete() API\r
-function.  It has no other purpose. */\r
-static xSemaphoreHandle xSemaphoreToDelete = NULL;\r
+/* This semaphore is created purely to test using the vSemaphoreDelete() and\r
+semaphore tracing API functions.  It has no other purpose. */\r
+static xSemaphoreHandle xMutexToDelete = NULL;\r
 \r
 /*-----------------------------------------------------------*/\r
 \r
@@ -143,10 +145,17 @@ int main( void )
        vStartRecursiveMutexTasks();\r
        vStartTimerDemoTask( mainTIMER_TEST_PERIOD );\r
        vStartCountingSemaphoreTasks();\r
+       vStartDynamicPriorityTasks();\r
+\r
+       /* The suicide tasks must be created last as they need to know how many\r
+       tasks were running prior to their creation.  This then allows them to \r
+       ascertain whether or not the correct/expected number of tasks are running at \r
+       any given time. */\r
+       vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );\r
 \r
        /* Create the semaphore that will be deleted in the idle task hook.  This\r
        is done purely to test the use of vSemaphoreDelete(). */\r
-       xSemaphoreToDelete = xSemaphoreCreateMutex();\r
+       xMutexToDelete = xSemaphoreCreateMutex();\r
 \r
        /* Start the scheduler itself. */\r
        vTaskStartScheduler();\r
@@ -214,6 +223,14 @@ const portTickType xCycleFrequency = 1000 / portTICK_RATE_MS;
                {\r
                        pcStatusMessage = "Error: CountSem";\r
                }\r
+               else if( xIsCreateTaskStillRunning() != pdTRUE )\r
+               {\r
+                       pcStatusMessage = "Error: Death";\r
+               }\r
+               else if( xAreDynamicPriorityTasksStillRunning() != pdPASS )\r
+               {\r
+                       pcStatusMessage = "Error: Dynamic\r\n";\r
+               }\r
 \r
                /* This is the only task that uses stdout so its ok to call printf() \r
                directly. */\r
@@ -227,15 +244,27 @@ void vApplicationIdleHook( void )
 const unsigned long ulMSToSleep = 5;\r
 xTaskHandle xIdleTaskHandle, xTimerTaskHandle;\r
 signed char *pcTaskName;\r
+const unsigned char ucConstQueueNumber = 0xaaU, ucConstTaskNumber = 0x55U;\r
+\r
+/* These three functions are only meant for use by trace code, and not for\r
+direct use from application code, hence their prototypes are not in queue.h. */\r
+extern void vQueueSetQueueNumber( xQueueHandle pxQueue, unsigned char ucQueueNumber );\r
+extern unsigned char ucQueueGetQueueNumber( xQueueHandle pxQueue );\r
+extern unsigned char ucQueueGetQueueType( xQueueHandle pxQueue );\r
+extern void vTaskSetTaskNumber( xTaskHandle xTask, unsigned portBASE_TYPE uxHandle );\r
+extern unsigned portBASE_TYPE uxTaskGetTaskNumber( xTaskHandle xTask );\r
 \r
        /* Sleep to reduce CPU load, but don't sleep indefinitely in case there are\r
        tasks waiting to be terminated by the idle task. */\r
        Sleep( ulMSToSleep );\r
 \r
        /* Demonstrate the use of the xTimerGetTimerDaemonTaskHandle() and \r
-       xTaskGetIdleTaskHandle() functions. */\r
+       xTaskGetIdleTaskHandle() functions.  Also try using the function that sets\r
+       the task number. */\r
        xIdleTaskHandle = xTaskGetIdleTaskHandle();\r
        xTimerTaskHandle = xTimerGetTimerDaemonTaskHandle();\r
+       vTaskSetTaskNumber( xIdleTaskHandle, ( unsigned long ) ucConstTaskNumber );\r
+       configASSERT( uxTaskGetTaskNumber( xIdleTaskHandle ) == ucConstTaskNumber );\r
 \r
        /* This is the idle hook, so the current task handle should equal the \r
        returned idle task handle. */\r
@@ -251,14 +280,24 @@ signed char *pcTaskName;
                pcStatusMessage = "Error:  Returned timer task handle was incorrect";\r
        }\r
 \r
-       /* If xSemaphoreToDelete has not already been deleted, then delete it now.\r
+       /* If xMutexToDelete has not already been deleted, then delete it now.\r
        This is done purely to demonstrate the use of, and test, the \r
        vSemaphoreDelete() macro.  Care must be taken not to delete a semaphore\r
        that has tasks blocked on it. */\r
-       if( xSemaphoreToDelete != NULL )\r
+       if( xMutexToDelete != NULL )\r
        {\r
-               vSemaphoreDelete( xSemaphoreToDelete );\r
-               xSemaphoreToDelete = NULL;\r
+               /* Before deleting the semaphore, test the function used to set its\r
+               number.  This would normally only be done from trace software, rather\r
+               than application code. */\r
+               vQueueSetQueueNumber( xMutexToDelete, ucConstQueueNumber );\r
+\r
+               /* Before deleting the semaphore, test the functions used to get its\r
+               type and number.  Again, these would normally only be done from trace\r
+               software, rather than application code. */\r
+               configASSERT( ucQueueGetQueueNumber( xMutexToDelete ) == ucConstQueueNumber );\r
+               configASSERT( ucQueueGetQueueType( xMutexToDelete ) == queueQUEUE_TYPE_MUTEX );\r
+               vSemaphoreDelete( xMutexToDelete );\r
+               xMutexToDelete = NULL;\r
        }\r
 }\r
 /*-----------------------------------------------------------*/\r