From: richardbarry Date: Mon, 28 Feb 2011 17:52:14 +0000 (+0000) Subject: Add the timer module demo code to the MSVC Win32 simulator demo. X-Git-Tag: V7.0.0~37 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b022dd3704628d755feee8ae88aaf7db442786f8;p=freertos Add the timer module demo code to the MSVC Win32 simulator demo. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1312 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- diff --git a/Demo/WIN32-MSVC/FreeRTOSConfig.h b/Demo/WIN32-MSVC/FreeRTOSConfig.h index 458bf46b4..76717a715 100644 --- a/Demo/WIN32-MSVC/FreeRTOSConfig.h +++ b/Demo/WIN32-MSVC/FreeRTOSConfig.h @@ -67,13 +67,13 @@ #define configUSE_PREEMPTION 1 #define configUSE_IDLE_HOOK 1 -#define configUSE_TICK_HOOK 0 -#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 configUSE_TICK_HOOK 1 +#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 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 configUSE_TRACE_FACILITY 1 -#define configUSE_16_BIT_TICKS 0 +#define configUSE_16_BIT_TICKS 1 #define configIDLE_SHOULD_YIELD 1 #define configUSE_CO_ROUTINES 0 #define configUSE_MUTEXES 1 @@ -83,10 +83,12 @@ #define configQUEUE_REGISTRY_SIZE 0 #define configUSE_MALLOC_FAILED_HOOK 1 #define configUSE_APPLICATION_TASK_TAG 0 +#define configUSE_COUNTING_SEMAPHORES 1 +#define configUSE_ALTERNATIVE_API 1 #define configUSE_TIMERS 1 #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 configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 7 ) @@ -110,4 +112,7 @@ to exclude the API function. */ #define INCLUDE_uxTaskGetStackHighWaterMark 1 #define INCLUDE_xTaskGetSchedulerState 1 +extern void vAssertCalled( void ); +#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled() + #endif /* FREERTOS_CONFIG_H */ diff --git a/Demo/WIN32-MSVC/WIN32.suo b/Demo/WIN32-MSVC/WIN32.suo index 84fd5718c..6f3cdfbcd 100644 Binary files a/Demo/WIN32-MSVC/WIN32.suo and b/Demo/WIN32-MSVC/WIN32.suo differ diff --git a/Demo/WIN32-MSVC/WIN32.vcxproj b/Demo/WIN32-MSVC/WIN32.vcxproj index ee994e1da..3d96fb03d 100644 --- a/Demo/WIN32-MSVC/WIN32.vcxproj +++ b/Demo/WIN32-MSVC/WIN32.vcxproj @@ -125,14 +125,17 @@ + + + %(AdditionalIncludeDirectories) @@ -161,6 +164,8 @@ + + diff --git a/Demo/WIN32-MSVC/WIN32.vcxproj.filters b/Demo/WIN32-MSVC/WIN32.vcxproj.filters index 1a088b2ed..6ce6aed38 100644 --- a/Demo/WIN32-MSVC/WIN32.vcxproj.filters +++ b/Demo/WIN32-MSVC/WIN32.vcxproj.filters @@ -79,6 +79,15 @@ Demo App Source\Common Demo Tasks\ModifiedForLowTickRate + + FreeRTOS Source\Source + + + Demo App Source\Common Demo Tasks + + + Demo App Source\Common Demo Tasks + @@ -111,5 +120,11 @@ FreeRTOS Source\Include + + FreeRTOS Source\Include + + + FreeRTOS Source\Include + \ No newline at end of file diff --git a/Demo/WIN32-MSVC/main.c b/Demo/WIN32-MSVC/main.c index 4ce366beb..6bac8ac64 100644 --- a/Demo/WIN32-MSVC/main.c +++ b/Demo/WIN32-MSVC/main.c @@ -97,6 +97,7 @@ #include "recmutex.h" #include "flop.h" #include "TimerDemo.h" +#include "countsem.h" /* Priorities at which the tasks are created. */ #define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) @@ -110,7 +111,7 @@ #define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY ) #define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY ) -#define mainTIMER_FREQUENCY ( configTICK_RATE_HZ ) +#define mainTIMER_TEST_PERIOD ( 50 ) /* Task function prototypes. */ static void prvCheckTask( void *pvParameters ); @@ -131,7 +132,8 @@ int main( void ) vStartQueuePeekTasks(); vStartMathTasks( mainFLOP_TASK_PRIORITY ); vStartRecursiveMutexTasks(); - vStartTimerDemoTask( mainTIMER_FREQUENCY ); + vStartTimerDemoTask( mainTIMER_TEST_PERIOD ); + vStartCountingSemaphoreTasks(); /* Start the scheduler itself. */ vTaskStartScheduler(); @@ -145,7 +147,7 @@ int main( void ) static void prvCheckTask( void *pvParameters ) { portTickType xNextWakeTime; -const portTickType xCycleFrequency = 5000 / portTICK_RATE_MS; +const portTickType xCycleFrequency = 1000 / portTICK_RATE_MS; char *pcStatusMessage = "OK"; /* Just to remove compiler warning. */ @@ -160,7 +162,7 @@ char *pcStatusMessage = "OK"; vTaskDelayUntil( &xNextWakeTime, xCycleFrequency ); /* Check the standard demo tasks are running without error. */ - if( xAreTimerDemoTasksStillRunning() != pdTRUE ) + if( xAreTimerDemoTasksStillRunning( xCycleFrequency ) != pdTRUE ) { pcStatusMessage = "Error: TimerDemo"; } @@ -196,6 +198,10 @@ char *pcStatusMessage = "OK"; { pcStatusMessage = "Error: RecMutex"; } + else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE ) + { + pcStatusMessage = "Error: CountSem"; + } /* This is the only task that uses stdout so its ok to call printf() directly. */ @@ -226,4 +232,19 @@ void vApplicationStackOverflowHook( void ) /* Can be implemented if required, but not required in this 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( ;; ); +}