]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/WIN32-MSVC/main.c
Add xQueueOverwrite() and a common demo task to demonstrate its use.
[freertos] / FreeRTOS / Demo / WIN32-MSVC / main.c
1 /*\r
2     FreeRTOS V7.4.2 - Copyright (C) 2013 Real Time Engineers Ltd.\r
3 \r
4     FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME.  PLEASE VISIT\r
5     http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
6 \r
7     ***************************************************************************\r
8      *                                                                       *\r
9      *    FreeRTOS tutorial books are available in pdf and paperback.        *\r
10      *    Complete, revised, and edited pdf reference manuals are also       *\r
11      *    available.                                                         *\r
12      *                                                                       *\r
13      *    Purchasing FreeRTOS documentation will not only help you, by       *\r
14      *    ensuring you get running as quickly as possible and with an        *\r
15      *    in-depth knowledge of how to use FreeRTOS, it will also help       *\r
16      *    the FreeRTOS project to continue with its mission of providing     *\r
17      *    professional grade, cross platform, de facto standard solutions    *\r
18      *    for microcontrollers - completely free of charge!                  *\r
19      *                                                                       *\r
20      *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *\r
21      *                                                                       *\r
22      *    Thank you for using FreeRTOS, and thank you for your support!      *\r
23      *                                                                       *\r
24     ***************************************************************************\r
25 \r
26 \r
27     This file is part of the FreeRTOS distribution.\r
28 \r
29     FreeRTOS is free software; you can redistribute it and/or modify it under\r
30     the terms of the GNU General Public License (version 2) as published by the\r
31     Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
32 \r
33     >>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to\r
34     distribute a combined work that includes FreeRTOS without being obliged to\r
35     provide the source code for proprietary components outside of the FreeRTOS\r
36     kernel.\r
37 \r
38     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
39     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
40     FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\r
41     details. You should have received a copy of the GNU General Public License\r
42     and the FreeRTOS license exception along with FreeRTOS; if not it can be\r
43     viewed here: http://www.freertos.org/a00114.html and also obtained by\r
44     writing to Real Time Engineers Ltd., contact details for whom are available\r
45     on the FreeRTOS WEB site.\r
46 \r
47     1 tab == 4 spaces!\r
48 \r
49     ***************************************************************************\r
50      *                                                                       *\r
51      *    Having a problem?  Start by reading the FAQ "My application does   *\r
52      *    not run, what could be wrong?"                                     *\r
53      *                                                                       *\r
54      *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
55      *                                                                       *\r
56     ***************************************************************************\r
57 \r
58 \r
59     http://www.FreeRTOS.org - Documentation, books, training, latest versions, \r
60     license and Real Time Engineers Ltd. contact details.\r
61 \r
62     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
63     including FreeRTOS+Trace - an indispensable productivity tool, and our new\r
64     fully thread aware and reentrant UDP/IP stack.\r
65 \r
66     http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High \r
67     Integrity Systems, who sell the code with commercial support, \r
68     indemnification and middleware, under the OpenRTOS brand.\r
69     \r
70     http://www.SafeRTOS.com - High Integrity Systems also provide a safety \r
71     engineered and independently SIL3 certified version for use in safety and \r
72     mission critical applications that require provable dependability.\r
73 */\r
74 \r
75 /*\r
76  *******************************************************************************\r
77  * -NOTE- The Win32 port is a simulation (or is that emulation?) only!  Do not\r
78  * expect to get real time behaviour from the Win32 port or this demo\r
79  * application.  It is provided as a convenient development and demonstration\r
80  * test bed only.  This was tested using Windows XP on a dual core laptop.\r
81  *\r
82  * In this example, one simulated millisecond will take approximately 40ms to\r
83  * execute, and Windows will not be running the FreeRTOS simulator threads\r
84  * continuously, so the timing information in the FreeRTOS+Trace logs have no\r
85  * meaningful units.  See the documentation page for the Windows simulator for\r
86  * an explanation of the slow timing:\r
87  * http://www.freertos.org/FreeRTOS-Windows-Simulator-Emulator-for-Visual-Studio-and-Eclipse-MingW.html\r
88  * - READ THE WEB DOCUMENTATION FOR THIS PORT FOR MORE INFORMATION ON USING IT -\r
89  *******************************************************************************\r
90  *\r
91  * main() creates all the demo application tasks, then starts the scheduler.  \r
92  * The web documentation provides more details of the standard demo application \r
93  * tasks, which provide no particular functionality but do provide a good \r
94  * example of how to use the FreeRTOS API.\r
95  *\r
96  * In addition to the standard demo tasks, the following tasks and tests are\r
97  * defined and/or created within this file:\r
98  *\r
99  * "Check" task - This only executes every five seconds but has a high priority\r
100  * to ensure it gets processor time.  Its main function is to check that all the\r
101  * standard demo tasks are still operational.  While no errors have been\r
102  * discovered the check task will print out "OK" and the current simulated tick\r
103  * time.  If an error is discovered in the execution of a task then the check\r
104  * task will print out an appropriate error message.\r
105  *\r
106  */\r
107 \r
108 \r
109 /* Standard includes. */\r
110 #include <stdio.h>\r
111 #include <stdlib.h>\r
112 #include <conio.h>\r
113 \r
114 /* Kernel includes. */\r
115 #include <FreeRTOS.h>\r
116 #include "task.h"\r
117 #include "queue.h"\r
118 #include "timers.h"\r
119 #include "semphr.h"\r
120 \r
121 /* Standard demo includes. */\r
122 #include "BlockQ.h"\r
123 #include "integer.h"\r
124 #include "semtest.h"\r
125 #include "PollQ.h"\r
126 #include "GenQTest.h"\r
127 #include "QPeek.h"\r
128 #include "recmutex.h"\r
129 #include "flop.h"\r
130 #include "TimerDemo.h"\r
131 #include "countsem.h"\r
132 #include "death.h"\r
133 #include "dynamic.h"\r
134 #include "QueueSet.h"\r
135 #include "QueueOverwrite.h"\r
136 \r
137 /* Priorities at which the tasks are created. */\r
138 #define mainCHECK_TASK_PRIORITY                 ( configMAX_PRIORITIES - 1 )\r
139 #define mainQUEUE_POLL_PRIORITY                 ( tskIDLE_PRIORITY + 1 )\r
140 #define mainSEM_TEST_PRIORITY                   ( tskIDLE_PRIORITY + 1 )\r
141 #define mainBLOCK_Q_PRIORITY                    ( tskIDLE_PRIORITY + 2 )\r
142 #define mainCREATOR_TASK_PRIORITY               ( tskIDLE_PRIORITY + 3 )\r
143 #define mainFLASH_TASK_PRIORITY                 ( tskIDLE_PRIORITY + 1 )\r
144 #define mainuIP_TASK_PRIORITY                   ( tskIDLE_PRIORITY + 2 )\r
145 #define mainINTEGER_TASK_PRIORITY               ( tskIDLE_PRIORITY )\r
146 #define mainGEN_QUEUE_TASK_PRIORITY             ( tskIDLE_PRIORITY )\r
147 #define mainFLOP_TASK_PRIORITY                  ( tskIDLE_PRIORITY )\r
148 #define mainQUEUE_OVERWRITE_PRIORITY    ( tskIDLE_PRIORITY )\r
149 \r
150 #define mainTIMER_TEST_PERIOD                   ( 50 )\r
151 \r
152 /* Task function prototypes. */\r
153 static void prvCheckTask( void *pvParameters );\r
154 \r
155 /* A task that is created from the idle task to test the functionality of \r
156 eTaskStateGet(). */\r
157 static void prvTestTask( void *pvParameters );\r
158 \r
159 /*\r
160  * Writes trace data to a disk file when the trace recording is stopped.\r
161  * This function will simply overwrite any trace files that already exist.\r
162  */\r
163 static void prvSaveTraceFile( void );\r
164 \r
165 /*\r
166  * Called from the idle task hook function to demonstrate a few utility\r
167  * functions that are not demonstrated by any of the standard demo tasks.\r
168  */\r
169 static void prvDemonstrateTaskStateAndHandleGetFunctions( void );\r
170 \r
171 /*-----------------------------------------------------------*/\r
172 \r
173 /* The variable into which error messages are latched. */\r
174 static char *pcStatusMessage = "OK";\r
175 \r
176 /* This semaphore is created purely to test using the vSemaphoreDelete() and\r
177 semaphore tracing API functions.  It has no other purpose. */\r
178 static xSemaphoreHandle xMutexToDelete = NULL;\r
179 \r
180 /* The user trace event posted to the trace recording on each tick interrupt.\r
181 Note tick events will not appear in the trace recording with regular period\r
182 because this project runs in a Windows simulator, and does not therefore\r
183 exhibit deterministic behaviour. */\r
184 traceLabel xTickTraceUserEvent;\r
185 \r
186 /*-----------------------------------------------------------*/\r
187 \r
188 int main( void )\r
189 {\r
190         /* Initialise the trace recorder and create the label used to post user\r
191         events to the trace recording on each tick interrupt. */\r
192         vTraceInitTraceData();\r
193         xTickTraceUserEvent = xTraceOpenLabel( "tick" );\r
194 \r
195         /* Start the check task as described at the top of this file. */\r
196         xTaskCreate( prvCheckTask, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
197 \r
198         /* Create the standard demo tasks. */\r
199         vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
200         vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
201         vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
202         vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );\r
203         vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );\r
204         vStartQueuePeekTasks();\r
205         vStartMathTasks( mainFLOP_TASK_PRIORITY );\r
206         vStartRecursiveMutexTasks();\r
207         vStartTimerDemoTask( mainTIMER_TEST_PERIOD );\r
208         vStartCountingSemaphoreTasks();\r
209         vStartDynamicPriorityTasks();\r
210         vStartQueueSetTasks();\r
211         vStartQueueOverwriteTask( mainQUEUE_OVERWRITE_PRIORITY );\r
212 \r
213         /* The suicide tasks must be created last as they need to know how many\r
214         tasks were running prior to their creation.  This then allows them to \r
215         ascertain whether or not the correct/expected number of tasks are running at \r
216         any given time. */\r
217         vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );\r
218 \r
219         /* Create the semaphore that will be deleted in the idle task hook.  This\r
220         is done purely to test the use of vSemaphoreDelete(). */\r
221         xMutexToDelete = xSemaphoreCreateMutex();\r
222 \r
223         /* Start the trace recording - the recording is written to a file if\r
224         configASSERT() is called. */\r
225         printf( "\r\nTrace started.  Hit a key to dump trace file to disk.\r\n" );\r
226         uiTraceStart();\r
227 \r
228         /* Start the scheduler itself. */\r
229         vTaskStartScheduler();\r
230 \r
231     /* Should never get here unless there was not enough heap space to create \r
232         the idle and other system tasks. */\r
233     return 0;\r
234 }\r
235 /*-----------------------------------------------------------*/\r
236 \r
237 static void prvCheckTask( void *pvParameters )\r
238 {\r
239 portTickType xNextWakeTime;\r
240 const portTickType xCycleFrequency = 1000 / portTICK_RATE_MS;\r
241 \r
242         /* Just to remove compiler warning. */\r
243         ( void ) pvParameters;\r
244 \r
245         /* Initialise xNextWakeTime - this only needs to be done once. */\r
246         xNextWakeTime = xTaskGetTickCount();\r
247 \r
248         for( ;; )\r
249         {\r
250                 /* Place this task in the blocked state until it is time to run again. */\r
251                 vTaskDelayUntil( &xNextWakeTime, xCycleFrequency );\r
252 \r
253                 /* Check the standard demo tasks are running without error. */\r
254                 if( xAreTimerDemoTasksStillRunning( xCycleFrequency ) != pdTRUE )\r
255                 {\r
256                         pcStatusMessage = "Error: TimerDemo";\r
257                 }\r
258             else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
259             {\r
260                         pcStatusMessage = "Error: IntMath";\r
261             }   \r
262                 else if( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
263                 {                       \r
264                         pcStatusMessage = "Error: GenQueue";\r
265                 }\r
266                 else if( xAreQueuePeekTasksStillRunning() != pdTRUE )\r
267                 {\r
268                         pcStatusMessage = "Error: QueuePeek";\r
269                 }\r
270                 else if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
271                 {\r
272                         pcStatusMessage = "Error: BlockQueue";\r
273                 }\r
274             else if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
275             {\r
276                         pcStatusMessage = "Error: SemTest";\r
277             }\r
278             else if( xArePollingQueuesStillRunning() != pdTRUE )\r
279             {\r
280                         pcStatusMessage = "Error: PollQueue";\r
281             }\r
282                 else if( xAreMathsTaskStillRunning() != pdPASS )\r
283                 {\r
284                         pcStatusMessage = "Error: Flop";\r
285                 }\r
286             else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
287             {\r
288                         pcStatusMessage = "Error: RecMutex";\r
289                 }\r
290                 else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )\r
291                 {\r
292                         pcStatusMessage = "Error: CountSem";\r
293                 }\r
294                 else if( xIsCreateTaskStillRunning() != pdTRUE )\r
295                 {\r
296                         pcStatusMessage = "Error: Death";\r
297                 }\r
298                 else if( xAreDynamicPriorityTasksStillRunning() != pdPASS )\r
299                 {\r
300                         pcStatusMessage = "Error: Dynamic\r\n";\r
301                 }\r
302                 else if( xAreQueueSetTasksStillRunning() != pdPASS )\r
303                 {\r
304                         pcStatusMessage = "Error: Queue set\r\n";\r
305                 }\r
306                 else if( xIsQueueOverwriteTaskStillRunning() != pdPASS )\r
307                 {\r
308                         pcStatusMessage = "Error: Queue overwrite\r\n";\r
309                 }\r
310 \r
311                 /* This is the only task that uses stdout so its ok to call printf() \r
312                 directly. */\r
313                 printf( "%s - %d\r\n", pcStatusMessage, xTaskGetTickCount() );\r
314         }\r
315 }\r
316 /*-----------------------------------------------------------*/\r
317 \r
318 static void prvTestTask( void *pvParameters )\r
319 {\r
320 const unsigned long ulMSToSleep = 5;\r
321 \r
322         /* Just to remove compiler warnings. */\r
323         ( void ) pvParameters;\r
324 \r
325         /* This task is just used to test the eTaskStateGet() function.  It\r
326         does not have anything to do. */\r
327         for( ;; )\r
328         {\r
329                 /* Sleep to reduce CPU load, but don't sleep indefinitely in case there are\r
330                 tasks waiting to be terminated by the idle task. */\r
331                 Sleep( ulMSToSleep );\r
332         }\r
333 }\r
334 /*-----------------------------------------------------------*/\r
335 \r
336 void vApplicationIdleHook( void )\r
337 {\r
338 const unsigned long ulMSToSleep = 15;\r
339 const unsigned char ucConstQueueNumber = 0xaaU;\r
340 void *pvAllocated;\r
341 static portBASE_TYPE xTraceRunning = pdTRUE;\r
342 \r
343 /* These three functions are only meant for use by trace code, and not for\r
344 direct use from application code, hence their prototypes are not in queue.h. */\r
345 extern void vQueueSetQueueNumber( xQueueHandle pxQueue, unsigned char ucQueueNumber );\r
346 extern unsigned char ucQueueGetQueueNumber( xQueueHandle pxQueue );\r
347 extern unsigned char ucQueueGetQueueType( xQueueHandle pxQueue );\r
348 extern void vTaskSetTaskNumber( xTaskHandle xTask, unsigned portBASE_TYPE uxHandle );\r
349 extern unsigned portBASE_TYPE uxTaskGetTaskNumber( xTaskHandle xTask );\r
350 \r
351         /* Sleep to reduce CPU load, but don't sleep indefinitely in case there are\r
352         tasks waiting to be terminated by the idle task. */\r
353         Sleep( ulMSToSleep );\r
354 \r
355         /* Demonstrate a few utility functions that are not demonstrated by any of\r
356         the standard demo tasks. */\r
357         prvDemonstrateTaskStateAndHandleGetFunctions();\r
358 \r
359         /* If xMutexToDelete has not already been deleted, then delete it now.\r
360         This is done purely to demonstrate the use of, and test, the \r
361         vSemaphoreDelete() macro.  Care must be taken not to delete a semaphore\r
362         that has tasks blocked on it. */\r
363         if( xMutexToDelete != NULL )\r
364         {\r
365                 /* Before deleting the semaphore, test the function used to set its\r
366                 number.  This would normally only be done from trace software, rather\r
367                 than application code. */\r
368                 vQueueSetQueueNumber( xMutexToDelete, ucConstQueueNumber );\r
369 \r
370                 /* Before deleting the semaphore, test the functions used to get its\r
371                 type and number.  Again, these would normally only be done from trace\r
372                 software, rather than application code. */\r
373                 configASSERT( ucQueueGetQueueNumber( xMutexToDelete ) == ucConstQueueNumber );\r
374                 configASSERT( ucQueueGetQueueType( xMutexToDelete ) == queueQUEUE_TYPE_MUTEX );\r
375                 vSemaphoreDelete( xMutexToDelete );\r
376                 xMutexToDelete = NULL;\r
377         }\r
378 \r
379         /* Exercise heap_4 a bit.  The malloc failed hook will trap failed \r
380         allocations so there is no need to test here. */\r
381         pvAllocated = pvPortMalloc( ( rand() % 100 ) + 1 );\r
382         vPortFree( pvAllocated );\r
383 \r
384         if( _kbhit() != pdFALSE )\r
385         {\r
386                 if( xTraceRunning == pdTRUE )\r
387                 {\r
388                         prvSaveTraceFile();\r
389                         xTraceRunning = pdFALSE;\r
390                 }\r
391         }\r
392 }\r
393 /*-----------------------------------------------------------*/\r
394 \r
395 void vApplicationMallocFailedHook( void )\r
396 {\r
397         vAssertCalled();\r
398 }\r
399 /*-----------------------------------------------------------*/\r
400 \r
401 void vApplicationStackOverflowHook( void )\r
402 {\r
403         /* Can be implemented if required, but not required in this \r
404         environment and running this demo. */\r
405 }\r
406 /*-----------------------------------------------------------*/\r
407 \r
408 void vApplicationTickHook( void )\r
409 {\r
410         /* Call the periodic timer test, which tests the timer API functions that\r
411         can be called from an ISR. */\r
412         vTimerPeriodicISRTests();\r
413 \r
414         /* Write to a queue that is in use as part of the queue set demo to \r
415         demonstrate using queue sets from an ISR. */\r
416         vQueueSetAccessQueueSetFromISR();\r
417 \r
418         /* Write a user event to the trace log.  \r
419         Note tick events will not appear in the trace recording with regular period\r
420         because this project runs in a Windows simulator, and does not therefore\r
421         exhibit deterministic behaviour. */\r
422         vTraceUserEvent( xTickTraceUserEvent );\r
423 }\r
424 /*-----------------------------------------------------------*/\r
425 \r
426 void vAssertCalled( void )\r
427 {\r
428         taskDISABLE_INTERRUPTS();\r
429 \r
430         /* Stop the trace recording. */\r
431         vTraceStop();\r
432         prvSaveTraceFile();\r
433                 \r
434         for( ;; );\r
435 }\r
436 /*-----------------------------------------------------------*/\r
437 \r
438 static void prvSaveTraceFile( void )\r
439 {\r
440 FILE* pxOutputFile;\r
441 \r
442         fopen_s( &pxOutputFile, "Trace.dump", "wb");\r
443 \r
444         if( pxOutputFile != NULL )\r
445         {\r
446                 fwrite( RecorderDataPtr, sizeof( RecorderDataType ), 1, pxOutputFile );\r
447                 fclose( pxOutputFile );\r
448                 printf( "\r\nTrace output saved to Trace.dump\r\n" );\r
449         }\r
450         else\r
451         {\r
452                 printf( "\r\nFailed to create trace dump file\r\n" );\r
453         }\r
454 }\r
455 /*-----------------------------------------------------------*/\r
456 \r
457 static void prvDemonstrateTaskStateAndHandleGetFunctions( void )\r
458 {\r
459 xTaskHandle xIdleTaskHandle, xTimerTaskHandle;\r
460 const unsigned char ucConstTaskNumber = 0x55U;\r
461 signed char *pcTaskName;\r
462 static portBASE_TYPE xPerformedOneShotTests = pdFALSE;\r
463 xTaskHandle xTestTask;\r
464 \r
465         /* Demonstrate the use of the xTimerGetTimerDaemonTaskHandle() and \r
466         xTaskGetIdleTaskHandle() functions.  Also try using the function that sets\r
467         the task number. */\r
468         xIdleTaskHandle = xTaskGetIdleTaskHandle();\r
469         xTimerTaskHandle = xTimerGetTimerDaemonTaskHandle();\r
470         vTaskSetTaskNumber( xIdleTaskHandle, ( unsigned long ) ucConstTaskNumber );\r
471         configASSERT( uxTaskGetTaskNumber( xIdleTaskHandle ) == ucConstTaskNumber );\r
472 \r
473         /* This is the idle hook, so the current task handle should equal the \r
474         returned idle task handle. */\r
475         if( xTaskGetCurrentTaskHandle() != xIdleTaskHandle )\r
476         {\r
477                 pcStatusMessage = "Error:  Returned idle task handle was incorrect";\r
478         }\r
479 \r
480         /* Check the timer task handle was returned correctly. */\r
481         pcTaskName = pcTaskGetTaskName( xTimerTaskHandle );\r
482         if( strcmp( pcTaskName, "Tmr Svc" ) != 0 )\r
483         {\r
484                 pcStatusMessage = "Error:  Returned timer task handle was incorrect";\r
485         }\r
486 \r
487         /* This task is running, make sure it's state is returned as running. */\r
488         if( eTaskStateGet( xIdleTaskHandle ) != eRunning )\r
489         {\r
490                 pcStatusMessage = "Error:  Returned idle task state was incorrect";\r
491         }\r
492 \r
493         /* If this task is running, then the timer task must be blocked. */\r
494         if( eTaskStateGet( xTimerTaskHandle ) != eBlocked )\r
495         {\r
496                 pcStatusMessage = "Error:  Returned timer task state was incorrect";\r
497         }\r
498 \r
499         /* Other tests that should only be performed once follow.  The test task\r
500         is not created on each iteration because to do so would cause the death\r
501         task to report an error (too many tasks running). */\r
502         if( xPerformedOneShotTests == pdFALSE )\r
503         {\r
504                 /* Don't run this part of the test again. */\r
505                 xPerformedOneShotTests = pdTRUE;\r
506 \r
507                 /* Create a test task to use to test other eTaskStateGet() return values. */\r
508                 if( xTaskCreate( prvTestTask, "Test", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, &xTestTask ) == pdPASS )\r
509                 {\r
510                         /* If this task is running, the test task must be in the ready state. */\r
511                         if( eTaskStateGet( xTestTask ) != eReady )\r
512                         {\r
513                                 pcStatusMessage = "Error: Returned test task state was incorrect 1";\r
514                         }\r
515 \r
516                         /* Now suspend the test task and check its state is reported correctly. */\r
517                         vTaskSuspend( xTestTask );\r
518                         if( eTaskStateGet( xTestTask ) != eSuspended )\r
519                         {\r
520                                 pcStatusMessage = "Error: Returned test task state was incorrect 2";\r
521                         }\r
522 \r
523                         /* Now delete the task and check its state is reported correctly. */\r
524                         vTaskDelete( xTestTask );\r
525                         if( eTaskStateGet( xTestTask ) != eDeleted )\r
526                         {\r
527                                 pcStatusMessage = "Error: Returned test task state was incorrect 3";\r
528                         }\r
529                 }\r
530         }\r
531 }\r
532 \r