From b022dd3704628d755feee8ae88aaf7db442786f8 Mon Sep 17 00:00:00 2001 From: richardbarry Date: Mon, 28 Feb 2011 17:52:14 +0000 Subject: [PATCH] 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 --- Demo/WIN32-MSVC/FreeRTOSConfig.h | 13 ++++++++---- Demo/WIN32-MSVC/WIN32.suo | Bin 54784 -> 55296 bytes Demo/WIN32-MSVC/WIN32.vcxproj | 5 +++++ Demo/WIN32-MSVC/WIN32.vcxproj.filters | 15 +++++++++++++ Demo/WIN32-MSVC/main.c | 29 ++++++++++++++++++++++---- 5 files changed, 54 insertions(+), 8 deletions(-) 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 84fd5718cbc17eef3ab1bdc3cc25356bff2183a9..6f3cdfbcd0073334213a887a676be73334bef3e6 100644 GIT binary patch delta 8635 zcmeHMdstN05x-~IMGyoQP(a=Yiiik;h=Q;Sh*3~bP@{nITEwtCx-3Z4gvFScYCe=5 z+aygiig`D&k(<~iX_D2LnnWA(uy5PiFKL_DM@-_^#MFlV=I+8SR4w|M_MaTS-<~;h z?mds0IWu!EmZ#h-&$#W<3H2d;m&!9olB8@PjowgA>e7Qs0hRz6z*hqU10|?)fjpo9 zmOoDgo{>DI^_)rUpM%iNDKeNp=X zTEHKeLkrzg)x0ILxCg3rOx)*Q68IK~EZ_lv#l!E?CHFM3S56tTK&>(f+UT{=Q`wLg z`YC%}y!RRq2ZQi~Lc%kR(!Af!^h9F<&Ngret5v!yirrbyGFex_4F zrQk1LN(QA@`t+cZ<&Va%6e6B{V?rlI;nnq$5gTa3U|g8P8#2HO%3v9#)D;v?VF|I6 ztX9)gK~c2j$zb_XP?OLWKK;a=S$W2n>SzA(&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{liBm+Dw8khZf2ssm-1#pwLGF`3rz3=MV9j z0-F0MpkM(I<NV(Zzt!K4*Q@z2_z-n!*(XzpsxB))X#8OiPi-mK+-&bxq$}4eS>OnAT z*3J^9TFh2^ozB2&OUkPX5=!)@rfMy1gWqZ5colyUOu;Y-Zt9tWsER(S!dFniXH5^s zzen>#zQns92(tP-j&F`pW2R**F*oQN^=yO2Y+YggL504)rL4}*YOQR&(P3xXAL@yE z2tC1_B*^LmsOR~>0<+O*Hfa&8-dJbQHew1oK5g};@zt5nFYOd$_3K2PrNnPzUW%qL zBdstwAwMH6H6b}!txU)(OwLPCD)W>DnM#dDQ;_9iPIqwO^ zGS<~w&EJ}R2F(&lAked zN|+-F5~&9eR|xDrp^Re~icDK=wzl9cDKJ|)w38Nm3fIpA;<48)(udv(x+fHLb;53<5Uff@x~f13u%;|tp9?b zpYrdg|Bc7$9~Sge{{8e{;5}uOH2Pr@KAwzE=1Pe-J!J@z#y@fF + + + %(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( ;; ); +} -- 2.39.5