Add the timer module demo code to the MSVC Win32 simulator demo.

pull/4/head
Richard Barry 14 years ago
parent 7b0841b1e9
commit 06899603f3

@ -67,13 +67,13 @@
#define configUSE_PREEMPTION 1 #define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 1 #define configUSE_IDLE_HOOK 1
#define configUSE_TICK_HOOK 0 #define configUSE_TICK_HOOK 1
#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. */ #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. */
#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. */ #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. */
#define configTOTAL_HEAP_SIZE ( ( size_t ) 0 ) /* This parameter has no effect when heap_3.c is included in the project. */ #define configTOTAL_HEAP_SIZE ( ( size_t ) 0 ) /* This parameter has no effect when heap_3.c is included in the project. */
#define configMAX_TASK_NAME_LEN ( 12 ) #define configMAX_TASK_NAME_LEN ( 12 )
#define configUSE_TRACE_FACILITY 1 #define configUSE_TRACE_FACILITY 1
#define configUSE_16_BIT_TICKS 0 #define configUSE_16_BIT_TICKS 1
#define configIDLE_SHOULD_YIELD 1 #define configIDLE_SHOULD_YIELD 1
#define configUSE_CO_ROUTINES 0 #define configUSE_CO_ROUTINES 0
#define configUSE_MUTEXES 1 #define configUSE_MUTEXES 1
@ -83,10 +83,12 @@
#define configQUEUE_REGISTRY_SIZE 0 #define configQUEUE_REGISTRY_SIZE 0
#define configUSE_MALLOC_FAILED_HOOK 1 #define configUSE_MALLOC_FAILED_HOOK 1
#define configUSE_APPLICATION_TASK_TAG 0 #define configUSE_APPLICATION_TASK_TAG 0
#define configUSE_COUNTING_SEMAPHORES 1
#define configUSE_ALTERNATIVE_API 1
#define configUSE_TIMERS 1 #define configUSE_TIMERS 1
#define configTIMER_TASK_PRIORITY 2 #define configTIMER_TASK_PRIORITY 2
#define configTIMER_QUEUE_LENGTH 3 #define configTIMER_QUEUE_LENGTH 20
#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 ) #define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 )
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 7 ) #define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 7 )
@ -110,4 +112,7 @@ to exclude the API function. */
#define INCLUDE_uxTaskGetStackHighWaterMark 1 #define INCLUDE_uxTaskGetStackHighWaterMark 1
#define INCLUDE_xTaskGetSchedulerState 1 #define INCLUDE_xTaskGetSchedulerState 1
extern void vAssertCalled( void );
#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled()
#endif /* FREERTOS_CONFIG_H */ #endif /* FREERTOS_CONFIG_H */

Binary file not shown.

@ -125,14 +125,17 @@
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\Source\portable\MemMang\heap_3.c" /> <ClCompile Include="..\..\Source\portable\MemMang\heap_3.c" />
<ClCompile Include="..\..\Source\timers.c" />
<ClCompile Include="..\Common\Minimal\BlockQ.c" /> <ClCompile Include="..\Common\Minimal\BlockQ.c" />
<ClCompile Include="..\Common\Minimal\blocktim.c" /> <ClCompile Include="..\Common\Minimal\blocktim.c" />
<ClCompile Include="..\Common\Minimal\countsem.c" />
<ClCompile Include="..\Common\Minimal\flop.c" /> <ClCompile Include="..\Common\Minimal\flop.c" />
<ClCompile Include="..\Common\Minimal\GenQTest.c" /> <ClCompile Include="..\Common\Minimal\GenQTest.c" />
<ClCompile Include="..\Common\Minimal\integer.c" /> <ClCompile Include="..\Common\Minimal\integer.c" />
<ClCompile Include="..\Common\Minimal\PollQ.c" /> <ClCompile Include="..\Common\Minimal\PollQ.c" />
<ClCompile Include="..\Common\Minimal\QPeek.c" /> <ClCompile Include="..\Common\Minimal\QPeek.c" />
<ClCompile Include="..\Common\Minimal\semtest.c" /> <ClCompile Include="..\Common\Minimal\semtest.c" />
<ClCompile Include="..\Common\Minimal\timerdemo.c" />
<ClCompile Include="DemosModifiedForLowTickRate\recmutex.c" /> <ClCompile Include="DemosModifiedForLowTickRate\recmutex.c" />
<ClCompile Include="main.c"> <ClCompile Include="main.c">
<AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
@ -161,6 +164,8 @@
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\..\Source\include\timers.h" />
<ClInclude Include="..\..\Source\include\timer_test.h" />
<ClInclude Include="..\..\Source\portable\MSVC-MingW\portmacro.h" /> <ClInclude Include="..\..\Source\portable\MSVC-MingW\portmacro.h" />
<ClInclude Include="FreeRTOSConfig.h" /> <ClInclude Include="FreeRTOSConfig.h" />
<ClInclude Include="..\..\Source\include\croutine.h" /> <ClInclude Include="..\..\Source\include\croutine.h" />

@ -79,6 +79,15 @@
<ClCompile Include="DemosModifiedForLowTickRate\recmutex.c"> <ClCompile Include="DemosModifiedForLowTickRate\recmutex.c">
<Filter>Demo App Source\Common Demo Tasks\ModifiedForLowTickRate</Filter> <Filter>Demo App Source\Common Demo Tasks\ModifiedForLowTickRate</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\Source\timers.c">
<Filter>FreeRTOS Source\Source</Filter>
</ClCompile>
<ClCompile Include="..\Common\Minimal\timerdemo.c">
<Filter>Demo App Source\Common Demo Tasks</Filter>
</ClCompile>
<ClCompile Include="..\Common\Minimal\countsem.c">
<Filter>Demo App Source\Common Demo Tasks</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="FreeRTOSConfig.h"> <ClInclude Include="FreeRTOSConfig.h">
@ -111,5 +120,11 @@
<ClInclude Include="..\..\Source\portable\MSVC-MingW\portmacro.h"> <ClInclude Include="..\..\Source\portable\MSVC-MingW\portmacro.h">
<Filter>FreeRTOS Source\Include</Filter> <Filter>FreeRTOS Source\Include</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\Source\include\timers.h">
<Filter>FreeRTOS Source\Include</Filter>
</ClInclude>
<ClInclude Include="..\..\Source\include\timer_test.h">
<Filter>FreeRTOS Source\Include</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -97,6 +97,7 @@
#include "recmutex.h" #include "recmutex.h"
#include "flop.h" #include "flop.h"
#include "TimerDemo.h" #include "TimerDemo.h"
#include "countsem.h"
/* Priorities at which the tasks are created. */ /* Priorities at which the tasks are created. */
#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) #define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
@ -110,7 +111,7 @@
#define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) #define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )
#define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY ) #define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY )
#define mainTIMER_FREQUENCY ( configTICK_RATE_HZ ) #define mainTIMER_TEST_PERIOD ( 50 )
/* Task function prototypes. */ /* Task function prototypes. */
static void prvCheckTask( void *pvParameters ); static void prvCheckTask( void *pvParameters );
@ -131,7 +132,8 @@ int main( void )
vStartQueuePeekTasks(); vStartQueuePeekTasks();
vStartMathTasks( mainFLOP_TASK_PRIORITY ); vStartMathTasks( mainFLOP_TASK_PRIORITY );
vStartRecursiveMutexTasks(); vStartRecursiveMutexTasks();
vStartTimerDemoTask( mainTIMER_FREQUENCY ); vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
vStartCountingSemaphoreTasks();
/* Start the scheduler itself. */ /* Start the scheduler itself. */
vTaskStartScheduler(); vTaskStartScheduler();
@ -145,7 +147,7 @@ int main( void )
static void prvCheckTask( void *pvParameters ) static void prvCheckTask( void *pvParameters )
{ {
portTickType xNextWakeTime; portTickType xNextWakeTime;
const portTickType xCycleFrequency = 5000 / portTICK_RATE_MS; const portTickType xCycleFrequency = 1000 / portTICK_RATE_MS;
char *pcStatusMessage = "OK"; char *pcStatusMessage = "OK";
/* Just to remove compiler warning. */ /* Just to remove compiler warning. */
@ -160,7 +162,7 @@ char *pcStatusMessage = "OK";
vTaskDelayUntil( &xNextWakeTime, xCycleFrequency ); vTaskDelayUntil( &xNextWakeTime, xCycleFrequency );
/* Check the standard demo tasks are running without error. */ /* Check the standard demo tasks are running without error. */
if( xAreTimerDemoTasksStillRunning() != pdTRUE ) if( xAreTimerDemoTasksStillRunning( xCycleFrequency ) != pdTRUE )
{ {
pcStatusMessage = "Error: TimerDemo"; pcStatusMessage = "Error: TimerDemo";
} }
@ -196,6 +198,10 @@ char *pcStatusMessage = "OK";
{ {
pcStatusMessage = "Error: RecMutex"; pcStatusMessage = "Error: RecMutex";
} }
else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )
{
pcStatusMessage = "Error: CountSem";
}
/* This is the only task that uses stdout so its ok to call printf() /* This is the only task that uses stdout so its ok to call printf()
directly. */ directly. */
@ -226,4 +232,19 @@ void vApplicationStackOverflowHook( void )
/* Can be implemented if required, but not required in this /* Can be implemented if required, but not required in this
environment and running this demo. */ environment and running this demo. */
} }
/*-----------------------------------------------------------*/
void vApplicationTickHook( void )
{
/* Call the periodic timer test, which tests the timer API functions that
can be called from an ISR. */
vTimerPeriodicISRTests();
}
/*-----------------------------------------------------------*/
void vAssertCalled( void )
{
taskDISABLE_INTERRUPTS();
for( ;; );
}

Loading…
Cancel
Save