]> git.sur5r.net Git - freertos/commitdiff
Add the timer module demo code to the MSVC Win32 simulator demo.
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Mon, 28 Feb 2011 17:52:14 +0000 (17:52 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Mon, 28 Feb 2011 17:52:14 +0000 (17:52 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1312 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

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

index 458bf46b4c59ad32c85e47a87a6a06b580ee6589..76717a7155d93afc08a243f59cc6761615357cf8 100644 (file)
 \r
 #define configUSE_PREEMPTION                   1\r
 #define configUSE_IDLE_HOOK                            1\r
-#define configUSE_TICK_HOOK                            0\r
-#define configTICK_RATE_HZ                             ( 50 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */\r
+#define configUSE_TICK_HOOK                            1\r
+#define configTICK_RATE_HZ                             ( 1000 ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */\r
 #define configMINIMAL_STACK_SIZE               ( ( unsigned short ) 50 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */\r
 #define configTOTAL_HEAP_SIZE                  ( ( size_t ) 0 ) /* This parameter has no effect when heap_3.c is included in the project. */\r
 #define configMAX_TASK_NAME_LEN                        ( 12 )\r
 #define configUSE_TRACE_FACILITY               1\r
-#define configUSE_16_BIT_TICKS                 0\r
+#define configUSE_16_BIT_TICKS                 1\r
 #define configIDLE_SHOULD_YIELD                        1\r
 #define configUSE_CO_ROUTINES                  0\r
 #define configUSE_MUTEXES                              1\r
 #define configQUEUE_REGISTRY_SIZE              0\r
 #define configUSE_MALLOC_FAILED_HOOK   1\r
 #define configUSE_APPLICATION_TASK_TAG 0\r
+#define configUSE_COUNTING_SEMAPHORES  1\r
+#define configUSE_ALTERNATIVE_API              1\r
 \r
 #define configUSE_TIMERS                               1\r
 #define configTIMER_TASK_PRIORITY              2\r
-#define configTIMER_QUEUE_LENGTH               3\r
+#define configTIMER_QUEUE_LENGTH               20\r
 #define configTIMER_TASK_STACK_DEPTH   ( configMINIMAL_STACK_SIZE * 2 )\r
 \r
 #define configMAX_PRIORITIES                   ( ( unsigned portBASE_TYPE ) 7 )\r
@@ -110,4 +112,7 @@ to exclude the API function. */
 #define INCLUDE_uxTaskGetStackHighWaterMark    1\r
 #define INCLUDE_xTaskGetSchedulerState         1\r
 \r
+extern void vAssertCalled( void );\r
+#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled()\r
+\r
 #endif /* FREERTOS_CONFIG_H */\r
index 84fd5718cbc17eef3ab1bdc3cc25356bff2183a9..6f3cdfbcd0073334213a887a676be73334bef3e6 100644 (file)
Binary files a/Demo/WIN32-MSVC/WIN32.suo and b/Demo/WIN32-MSVC/WIN32.suo differ
index ee994e1dabb5b47c7738ff3f780c48fb7ff6ebaf..3d96fb03d2e06f1ae594a5e8cfcf55e61f8ae449 100644 (file)
   </ItemDefinitionGroup>\r
   <ItemGroup>\r
     <ClCompile Include="..\..\Source\portable\MemMang\heap_3.c" />\r
+    <ClCompile Include="..\..\Source\timers.c" />\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\flop.c" />\r
     <ClCompile Include="..\Common\Minimal\GenQTest.c" />\r
     <ClCompile Include="..\Common\Minimal\integer.c" />\r
     <ClCompile Include="..\Common\Minimal\PollQ.c" />\r
     <ClCompile Include="..\Common\Minimal\QPeek.c" />\r
     <ClCompile Include="..\Common\Minimal\semtest.c" />\r
+    <ClCompile Include="..\Common\Minimal\timerdemo.c" />\r
     <ClCompile Include="DemosModifiedForLowTickRate\recmutex.c" />\r
     <ClCompile Include="main.c">\r
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>\r
     </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
+    <ClInclude Include="..\..\Source\include\timers.h" />\r
+    <ClInclude Include="..\..\Source\include\timer_test.h" />\r
     <ClInclude Include="..\..\Source\portable\MSVC-MingW\portmacro.h" />\r
     <ClInclude Include="FreeRTOSConfig.h" />\r
     <ClInclude Include="..\..\Source\include\croutine.h" />\r
index 1a088b2ed9b760cbce20d626fad7bea0dde4c904..6ce6aed38549c27defea4db31ead323b0e9c4475 100644 (file)
     <ClCompile Include="DemosModifiedForLowTickRate\recmutex.c">\r
       <Filter>Demo App Source\Common Demo Tasks\ModifiedForLowTickRate</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="..\..\Source\timers.c">\r
+      <Filter>FreeRTOS Source\Source</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\Common\Minimal\timerdemo.c">\r
+      <Filter>Demo App Source\Common Demo Tasks</Filter>\r
+    </ClCompile>\r
+    <ClCompile Include="..\Common\Minimal\countsem.c">\r
+      <Filter>Demo App Source\Common Demo Tasks</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClInclude Include="FreeRTOSConfig.h">\r
     <ClInclude Include="..\..\Source\portable\MSVC-MingW\portmacro.h">\r
       <Filter>FreeRTOS Source\Include</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="..\..\Source\include\timers.h">\r
+      <Filter>FreeRTOS Source\Include</Filter>\r
+    </ClInclude>\r
+    <ClInclude Include="..\..\Source\include\timer_test.h">\r
+      <Filter>FreeRTOS Source\Include</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
 </Project>
\ No newline at end of file
index 4ce366bebce65a9c285a1278ff9533e9476c5161..6bac8ac64381aef25d91847c3cfa3807acffc22e 100644 (file)
@@ -97,6 +97,7 @@
 #include "recmutex.h"\r
 #include "flop.h"\r
 #include "TimerDemo.h"\r
+#include "countsem.h"\r
 \r
 /* Priorities at which the tasks are created. */\r
 #define mainCHECK_TASK_PRIORITY                ( configMAX_PRIORITIES - 1 )\r
 #define mainGEN_QUEUE_TASK_PRIORITY    ( tskIDLE_PRIORITY )\r
 #define mainFLOP_TASK_PRIORITY         ( tskIDLE_PRIORITY )\r
 \r
-#define mainTIMER_FREQUENCY                    ( configTICK_RATE_HZ )\r
+#define mainTIMER_TEST_PERIOD                  ( 50 )\r
 \r
 /* Task function prototypes. */\r
 static void prvCheckTask( void *pvParameters );\r
@@ -131,7 +132,8 @@ int main( void )
        vStartQueuePeekTasks();\r
        vStartMathTasks( mainFLOP_TASK_PRIORITY );\r
        vStartRecursiveMutexTasks();\r
-       vStartTimerDemoTask( mainTIMER_FREQUENCY );\r
+       vStartTimerDemoTask( mainTIMER_TEST_PERIOD );\r
+       vStartCountingSemaphoreTasks();\r
 \r
        /* Start the scheduler itself. */\r
        vTaskStartScheduler();\r
@@ -145,7 +147,7 @@ int main( void )
 static void prvCheckTask( void *pvParameters )\r
 {\r
 portTickType xNextWakeTime;\r
-const portTickType xCycleFrequency = 5000 / portTICK_RATE_MS;\r
+const portTickType xCycleFrequency = 1000 / portTICK_RATE_MS;\r
 char *pcStatusMessage = "OK";\r
 \r
        /* Just to remove compiler warning. */\r
@@ -160,7 +162,7 @@ char *pcStatusMessage = "OK";
                vTaskDelayUntil( &xNextWakeTime, xCycleFrequency );\r
 \r
                /* Check the standard demo tasks are running without error. */\r
-               if( xAreTimerDemoTasksStillRunning() != pdTRUE )\r
+               if( xAreTimerDemoTasksStillRunning( xCycleFrequency ) != pdTRUE )\r
                {\r
                        pcStatusMessage = "Error: TimerDemo";\r
                }\r
@@ -196,6 +198,10 @@ char *pcStatusMessage = "OK";
            {\r
                        pcStatusMessage = "Error: RecMutex";\r
                }\r
+               else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )\r
+               {\r
+                       pcStatusMessage = "Error: CountSem";\r
+               }\r
 \r
                /* This is the only task that uses stdout so its ok to call printf() \r
                directly. */\r
@@ -226,4 +232,19 @@ void vApplicationStackOverflowHook( void )
        /* Can be implemented if required, but not required in this \r
        environment and running this demo. */\r
 }\r
+/*-----------------------------------------------------------*/\r
+\r
+void vApplicationTickHook( void )\r
+{\r
+       /* Call the periodic timer test, which tests the timer API functions that\r
+       can be called from an ISR. */\r
+       vTimerPeriodicISRTests();\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vAssertCalled( void )\r
+{\r
+       taskDISABLE_INTERRUPTS();\r
+       for( ;; );\r
+}\r
 \r