]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/PC/main.c
3ab064052965be44a7768aecbdb3197d74b68b60
[freertos] / FreeRTOS / Demo / PC / main.c
1 /*\r
2     FreeRTOS V8.2.0rc1 - Copyright (C) 2014 Real Time Engineers Ltd.\r
3     All rights reserved\r
4 \r
5     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
6 \r
7     This file is part of the FreeRTOS distribution.\r
8 \r
9     FreeRTOS is free software; you can redistribute it and/or modify it under\r
10     the terms of the GNU General Public License (version 2) as published by the\r
11     Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.\r
12 \r
13     >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
14     >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
15     >>!   obliged to provide the source code for proprietary components     !<<\r
16     >>!   outside of the FreeRTOS kernel.                                   !<<\r
17 \r
18     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
19     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
20     FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
21     link: http://www.freertos.org/a00114.html\r
22 \r
23     1 tab == 4 spaces!\r
24 \r
25     ***************************************************************************\r
26      *                                                                       *\r
27      *    Having a problem?  Start by reading the FAQ "My application does   *\r
28      *    not run, what could be wrong?".  Have you defined configASSERT()?  *\r
29      *                                                                       *\r
30      *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
31      *                                                                       *\r
32     ***************************************************************************\r
33 \r
34     ***************************************************************************\r
35      *                                                                       *\r
36      *    FreeRTOS provides completely free yet professionally developed,    *\r
37      *    robust, strictly quality controlled, supported, and cross          *\r
38      *    platform software that is more than just the market leader, it     *\r
39      *    is the industry's de facto standard.                               *\r
40      *                                                                       *\r
41      *    Help yourself get started quickly while simultaneously helping     *\r
42      *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
43      *    tutorial book, reference manual, or both:                          *\r
44      *    http://www.FreeRTOS.org/Documentation                              *\r
45      *                                                                       *\r
46     ***************************************************************************\r
47 \r
48     ***************************************************************************\r
49      *                                                                       *\r
50      *   Investing in training allows your team to be as productive as       *\r
51      *   possible as early as possible, lowering your overall development    *\r
52      *   cost, and enabling you to bring a more robust product to market     *\r
53      *   earlier than would otherwise be possible.  Richard Barry is both    *\r
54      *   the architect and key author of FreeRTOS, and so also the world's   *\r
55      *   leading authority on what is the world's most popular real time     *\r
56      *   kernel for deeply embedded MCU designs.  Obtaining your training    *\r
57      *   from Richard ensures your team will gain directly from his in-depth *\r
58      *   product knowledge and years of usage experience.  Contact Real Time *\r
59      *   Engineers Ltd to enquire about the FreeRTOS Masterclass, presented  *\r
60      *   by Richard Barry:  http://www.FreeRTOS.org/contact\r
61      *                                                                       *\r
62     ***************************************************************************\r
63 \r
64     ***************************************************************************\r
65      *                                                                       *\r
66      *    You are receiving this top quality software for free.  Please play *\r
67      *    fair and reciprocate by reporting any suspected issues and         *\r
68      *    participating in the community forum:                              *\r
69      *    http://www.FreeRTOS.org/support                                    *\r
70      *                                                                       *\r
71      *    Thank you!                                                         *\r
72      *                                                                       *\r
73     ***************************************************************************\r
74 \r
75     http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
76     license and Real Time Engineers Ltd. contact details.\r
77 \r
78     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
79     including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
80     compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
81 \r
82     http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
83     Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
84 \r
85     http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
86     Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
87     licenses offer ticketed support, indemnification and commercial middleware.\r
88 \r
89     http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
90     engineered and independently SIL3 certified version for use in safety and\r
91     mission critical applications that require provable dependability.\r
92 \r
93     1 tab == 4 spaces!\r
94 */\r
95 \r
96 /**\r
97  * Creates all the demo application tasks and co-routines, then starts the \r
98  * scheduler.\r
99  *\r
100  * Main. c also creates a task called "Print".  This only executes every \r
101  * five seconds but has the highest priority so is guaranteed to get \r
102  * processor time.  Its main function is to check that all the other tasks \r
103  * are still operational.  Nearly all the tasks in the demo application \r
104  * maintain a unique count that is incremented each time the task successfully \r
105  * completes its function.  Should any error occur within the task the count is \r
106  * permanently halted.  The print task checks the count of each task to ensure \r
107  * it has changed since the last time the print task executed.  If any count is \r
108  * found not to have changed the print task displays an appropriate message.  \r
109  * If all the tasks are still incrementing their unique counts the print task \r
110  * displays an "OK" message.\r
111  *\r
112  * The LED flash tasks do not maintain a count as they already provide visual \r
113  * feedback of their status.\r
114  *\r
115  * The print task blocks on the queue into which messages that require \r
116  * displaying are posted.  It will therefore only block for the full 5 seconds\r
117  * if no messages are posted onto the queue.\r
118  *\r
119  * Main. c also provides a demonstration of how the trace visualisation utility\r
120  * can be used, and how the scheduler can be stopped.\r
121  *\r
122  * \page MainC main.c\r
123  * \ingroup DemoFiles\r
124  * <HR>\r
125  */\r
126 \r
127 #include <stdlib.h>\r
128 #include <conio.h>\r
129 #include "FreeRTOS.h"\r
130 #include "task.h"\r
131 #include "croutine.h"\r
132 #include "partest.h"\r
133 #include "serial.h"\r
134 \r
135 /* Demo file headers. */\r
136 #include "BlockQ.h"\r
137 #include "PollQ.h"\r
138 #include "death.h"\r
139 #include "crflash.h"\r
140 #include "flop.h"\r
141 #include "print.h"\r
142 #include "comtest.h"\r
143 #include "fileio.h"\r
144 #include "semtest.h"\r
145 #include "integer.h"\r
146 #include "dynamic.h"\r
147 #include "mevents.h"\r
148 #include "crhook.h"\r
149 #include "blocktim.h"\r
150 #include "AltBlock.h"\r
151 #include "GenQTest.h"\r
152 #include "QPeek.h"\r
153 #include "countsem.h"\r
154 #include "AltQTest.h"\r
155 #include "AltPollQ.h"\r
156 #include "AltBlckQ.h"\r
157 #include "RecMutex.h"\r
158 \r
159 /* Priority definitions for the tasks in the demo application. */\r
160 #define mainLED_TASK_PRIORITY           ( tskIDLE_PRIORITY + 1 )\r
161 #define mainCREATOR_TASK_PRIORITY       ( tskIDLE_PRIORITY + 3 )\r
162 #define mainPRINT_TASK_PRIORITY         ( tskIDLE_PRIORITY + 4 )\r
163 #define mainQUEUE_POLL_PRIORITY         ( tskIDLE_PRIORITY + 2 )\r
164 #define mainQUEUE_BLOCK_PRIORITY        ( tskIDLE_PRIORITY + 3 )\r
165 #define mainCOM_TEST_PRIORITY           ( tskIDLE_PRIORITY + 2 )\r
166 #define mainSEMAPHORE_TASK_PRIORITY     ( tskIDLE_PRIORITY + 1 )\r
167 #define mainGENERIC_QUEUE_PRIORITY      ( tskIDLE_PRIORITY )\r
168 \r
169 #define mainPRINT_STACK_SIZE            ( ( unsigned short ) 512 )\r
170 #define mainDEBUG_LOG_BUFFER_SIZE       ( ( unsigned short ) 20480 )\r
171 \r
172 /* The number of flash co-routines to create. */\r
173 #define mainNUM_FLASH_CO_ROUTINES       ( 8 )\r
174 \r
175 /* Task function for the "Print" task as described at the top of the file. */\r
176 static void vErrorChecks( void *pvParameters );\r
177 \r
178 /* Function that checks the unique count of all the other tasks as described at\r
179 the top of the file. */\r
180 static void prvCheckOtherTasksAreStillRunning( void );\r
181 \r
182 /* Key presses can be used to start/stop the trace visualisation utility or stop\r
183 the scheduler. */\r
184 static void     prvCheckForKeyPresses( void );\r
185 \r
186 /* Buffer used by the trace visualisation utility so only needed if the trace\r
187 being used. */\r
188 #if configUSE_TRACE_FACILITY == 1\r
189         static char pcWriteBuffer[ mainDEBUG_LOG_BUFFER_SIZE ];\r
190 #endif\r
191 \r
192 /* Constant definition used to turn on/off the pre-emptive scheduler. */\r
193 static const short sUsingPreemption = configUSE_PREEMPTION;\r
194 \r
195 /* Start the math tasks appropriate to the build.  The Borland port does\r
196 not yet support floating point so uses the integer equivalent. */\r
197 static void prvStartMathTasks( void );\r
198 \r
199 /* Check which ever tasks are relevant to this build. */\r
200 static portBASE_TYPE prvCheckMathTasksAreStillRunning( void );\r
201 \r
202 /* Used to demonstrate the "task switched in" callback function. */\r
203 static portBASE_TYPE prvExampleTaskHook( void * pvParameter );\r
204 \r
205 /* Just used to count the number of times the example task callback function is\r
206 called, and the number of times a queue send passes. */\r
207 static unsigned long long uxCheckTaskHookCallCount = 0;\r
208 static unsigned long long uxQueueSendPassedCount = 0;\r
209 \r
210 /*-----------------------------------------------------------*/\r
211 \r
212 short main( void )\r
213 {\r
214         /* Initialise hardware and utilities. */\r
215         vParTestInitialise();\r
216         vPrintInitialise();\r
217         \r
218         /* CREATE ALL THE DEMO APPLICATION TASKS. */\r
219         prvStartMathTasks();\r
220         vStartComTestTasks( mainCOM_TEST_PRIORITY, serCOM1, ser115200 );\r
221         vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
222         vStartBlockingQueueTasks( mainQUEUE_BLOCK_PRIORITY );\r
223         vCreateBlockTimeTasks();\r
224         vStartGenericQueueTasks( mainGENERIC_QUEUE_PRIORITY );\r
225         vStartSemaphoreTasks( mainSEMAPHORE_TASK_PRIORITY );\r
226         vStartDynamicPriorityTasks();\r
227         vStartMultiEventTasks();\r
228         vStartQueuePeekTasks();\r
229         vStartCountingSemaphoreTasks();\r
230         vStartAltGenericQueueTasks( mainGENERIC_QUEUE_PRIORITY );\r
231         vCreateAltBlockTimeTasks();\r
232         vStartAltBlockingQueueTasks( mainQUEUE_BLOCK_PRIORITY );        \r
233         vStartAltPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
234         vStartRecursiveMutexTasks();\r
235                 \r
236         /* Create the "Print" task as described at the top of the file. */\r
237         xTaskCreate( vErrorChecks, "Print", mainPRINT_STACK_SIZE, NULL, mainPRINT_TASK_PRIORITY, NULL );\r
238 \r
239         /* This task has to be created last as it keeps account of the number of tasks\r
240         it expects to see running. */\r
241         vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );\r
242 \r
243         /* Create the co-routines that flash the LED's. */\r
244         vStartFlashCoRoutines( mainNUM_FLASH_CO_ROUTINES );\r
245 \r
246         /* Create the co-routines that communicate with the tick hook. */\r
247         vStartHookCoRoutines();\r
248 \r
249         /* Set the scheduler running.  This function will not return unless a task\r
250         calls vTaskEndScheduler(). */\r
251         vTaskStartScheduler();\r
252 \r
253         return 1;\r
254 }\r
255 /*-----------------------------------------------------------*/\r
256 \r
257 static portBASE_TYPE prvExampleTaskHook( void * pvParameter )\r
258 {\r
259         if( pvParameter != ( void * ) 0xabcd )\r
260         {\r
261                 /* The parameter did not contain the value we expected, so cause an\r
262                 error to be detected by setting the call count back to zero. */\r
263                 uxCheckTaskHookCallCount = 0;\r
264         }\r
265         else\r
266         {\r
267                 /* Simply increment a number so we know the callback has been executed. */\r
268                 uxCheckTaskHookCallCount++;\r
269         }\r
270 \r
271         return 0;\r
272 }\r
273 /*-----------------------------------------------------------*/\r
274 \r
275 void vMainQueueSendPassed( void )\r
276 {\r
277         /* This is just an example implementation of the "queue send" trace hook. */\r
278         uxQueueSendPassedCount++;\r
279 }\r
280 /*-----------------------------------------------------------*/\r
281 \r
282 static void vErrorChecks( void *pvParameters )\r
283 {\r
284 TickType_t xExpectedWakeTime;\r
285 const TickType_t xPrintRate = ( TickType_t ) 5000 / portTICK_PERIOD_MS;\r
286 const long lMaxAllowableTimeDifference = ( long ) 0;\r
287 TickType_t xWakeTime;\r
288 long lTimeDifference;\r
289 const char *pcReceivedMessage;\r
290 const char * const pcTaskBlockedTooLongMsg = "Print task blocked too long!\r\n";\r
291 const char * const pcUnexpectedHookValueMsg = "Task hook has unexpected value!\r\n";\r
292 \r
293         ( void ) pvParameters;\r
294 \r
295         /* Register our callback function. */\r
296         vTaskSetApplicationTaskTag( NULL, prvExampleTaskHook );\r
297         \r
298         /* Just for test purposes. */\r
299         if( xTaskGetApplicationTaskTag( NULL ) != prvExampleTaskHook )\r
300         {\r
301                 vPrintDisplayMessage( &pcUnexpectedHookValueMsg );\r
302         }\r
303 \r
304         /* Loop continuously, blocking, then checking all the other tasks are still\r
305         running, before blocking once again.  This task blocks on the queue of\r
306         messages that require displaying so will wake either by its time out expiring,\r
307         or a message becoming available. */\r
308         for( ;; )\r
309         {\r
310                 /* Calculate the time we will unblock if no messages are received\r
311                 on the queue.  This is used to check that we have not blocked for too long. */\r
312                 xExpectedWakeTime = xTaskGetTickCount();\r
313                 xExpectedWakeTime += xPrintRate;\r
314 \r
315                 /* Block waiting for either a time out or a message to be posted that\r
316                 required displaying. */\r
317                 pcReceivedMessage = pcPrintGetNextMessage( xPrintRate );\r
318 \r
319                 /* Was a message received? */\r
320                 if( pcReceivedMessage == NULL )\r
321                 {\r
322                         /* A message was not received so we timed out, did we unblock at the\r
323                         expected time? */\r
324                         xWakeTime = xTaskGetTickCount();\r
325 \r
326                         /* Calculate the difference between the time we unblocked and the\r
327                         time we should have unblocked. */\r
328                         if( xWakeTime > xExpectedWakeTime )\r
329                         {\r
330                                 lTimeDifference = ( long ) ( xWakeTime - xExpectedWakeTime );\r
331                         }\r
332                         else\r
333                         {\r
334                                 lTimeDifference = ( long ) ( xExpectedWakeTime - xWakeTime );\r
335                         }\r
336 \r
337                         if( lTimeDifference > lMaxAllowableTimeDifference )\r
338                         {\r
339                                 /* We blocked too long - create a message that will get\r
340                                 printed out the next time around.  If we are not using\r
341                                 preemption then we won't expect the timing to be so\r
342                                 accurate. */\r
343                                 if( sUsingPreemption == pdTRUE )\r
344                                 {\r
345                                         vPrintDisplayMessage( &pcTaskBlockedTooLongMsg );\r
346                                 }\r
347                         }\r
348 \r
349                         /* Check the other tasks are still running, just in case. */\r
350                         prvCheckOtherTasksAreStillRunning();\r
351                 }\r
352                 else\r
353                 {\r
354                         /* We unblocked due to a message becoming available.  Send the message\r
355                         for printing. */\r
356                         vDisplayMessage( pcReceivedMessage );\r
357                 }\r
358 \r
359                 /* Key presses are used to invoke the trace visualisation utility, or end\r
360                 the program. */\r
361                 prvCheckForKeyPresses();\r
362         }\r
363 }\r
364 /*-----------------------------------------------------------*/\r
365 \r
366 static void     prvCheckForKeyPresses( void )\r
367 {\r
368 short sIn;\r
369 \r
370         taskENTER_CRITICAL();\r
371                 #ifdef DEBUG_BUILD\r
372                         /* kbhit can be used in .exe's that are executed from the command\r
373                         line, but not if executed through the debugger. */\r
374                         sIn = 0;\r
375                 #else\r
376                         sIn = kbhit();\r
377                 #endif\r
378         taskEXIT_CRITICAL();\r
379 \r
380         if( sIn )\r
381         {\r
382                 /* Key presses can be used to start/stop the trace utility, or end the \r
383                 program. */\r
384                 sIn = getch();\r
385                 switch( sIn )\r
386                 {\r
387                         /* Only define keys for turning on and off the trace if the trace\r
388                         is being used. */\r
389                         #if configUSE_TRACE_FACILITY == 1\r
390                                 case 't' :      vTaskList( pcWriteBuffer );\r
391                                                         vWriteMessageToDisk( pcWriteBuffer );\r
392                                                         break;\r
393                                 /* The legacy trace is no longer supported.  Use FreeRTOS+Trace instead\r
394                                 case 's' :      vTaskStartTrace( pcWriteBuffer, mainDEBUG_LOG_BUFFER_SIZE );\r
395                                                         break;\r
396 \r
397                                 case 'e' :      {\r
398                                                                 unsigned long ulBufferLength;\r
399                                                                 ulBufferLength = ulTaskEndTrace();\r
400                                                                 vWriteBufferToDisk( pcWriteBuffer, ulBufferLength );\r
401                                                         }\r
402                                                         break;\r
403                                 */\r
404                         #endif\r
405 \r
406                         default  :      vTaskEndScheduler();\r
407                                                 break;\r
408                 }\r
409         }\r
410 }\r
411 /*-----------------------------------------------------------*/\r
412 \r
413 static void prvCheckOtherTasksAreStillRunning( void )\r
414 {\r
415 static short sErrorHasOccurred = pdFALSE;\r
416 static unsigned long long uxLastHookCallCount = 0, uxLastQueueSendCount = 0;\r
417 \r
418         if( prvCheckMathTasksAreStillRunning() != pdTRUE )\r
419         {\r
420                 vDisplayMessage( "Maths task count unchanged!\r\n" );\r
421                 sErrorHasOccurred = pdTRUE;\r
422         }\r
423 \r
424         if( xAreComTestTasksStillRunning() != pdTRUE )\r
425         {\r
426                 vDisplayMessage( "Com test count unchanged!\r\n" );\r
427                 sErrorHasOccurred = pdTRUE;\r
428         }\r
429 \r
430         if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
431         {\r
432                 vDisplayMessage( "Blocking queues count unchanged!\r\n" );\r
433                 sErrorHasOccurred = pdTRUE;\r
434         }\r
435 \r
436         if( xAreAltBlockingQueuesStillRunning() != pdTRUE )\r
437         {\r
438                 vDisplayMessage( "Alt blocking queues count unchanged!\r\n" );\r
439                 sErrorHasOccurred = pdTRUE;\r
440         }\r
441 \r
442         if( xArePollingQueuesStillRunning() != pdTRUE )\r
443         {\r
444                 vDisplayMessage( "Polling queue count unchanged!\r\n" );\r
445                 sErrorHasOccurred = pdTRUE;\r
446         }\r
447 \r
448         if( xAreAltPollingQueuesStillRunning() != pdTRUE )\r
449         {\r
450                 vDisplayMessage( "Alt polling queue count unchanged!\r\n" );\r
451                 sErrorHasOccurred = pdTRUE;\r
452         }\r
453 \r
454         if( xIsCreateTaskStillRunning() != pdTRUE )\r
455         {\r
456                 vDisplayMessage( "Incorrect number of tasks running!\r\n" );\r
457                 sErrorHasOccurred = pdTRUE;\r
458         }\r
459 \r
460         if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
461         {\r
462                 vDisplayMessage( "Semaphore take count unchanged!\r\n" );\r
463                 sErrorHasOccurred = pdTRUE;\r
464         }\r
465 \r
466         if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
467         {\r
468                 vDisplayMessage( "Dynamic priority count unchanged!\r\n" );\r
469                 sErrorHasOccurred = pdTRUE;\r
470         }\r
471         \r
472         if( xAreMultiEventTasksStillRunning() != pdTRUE )\r
473         {\r
474                 vDisplayMessage( "Error in multi events tasks!\r\n" );\r
475                 sErrorHasOccurred = pdTRUE;\r
476         }\r
477 \r
478         if( xAreFlashCoRoutinesStillRunning() != pdTRUE )\r
479         {\r
480                 vDisplayMessage( "Error in co-routine flash tasks!\r\n" );\r
481                 sErrorHasOccurred = pdTRUE;\r
482         }\r
483 \r
484         if( xAreHookCoRoutinesStillRunning() != pdTRUE )\r
485         {\r
486                 vDisplayMessage( "Error in tick hook to co-routine communications!\r\n" );\r
487                 sErrorHasOccurred = pdTRUE;\r
488         }\r
489 \r
490         if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
491         {\r
492                 vDisplayMessage( "Error in block time test tasks!\r\n" );\r
493                 sErrorHasOccurred = pdTRUE;\r
494         }\r
495 \r
496         if( xAreAltBlockTimeTestTasksStillRunning() != pdTRUE )\r
497         {\r
498                 vDisplayMessage( "Error in fast block time test tasks!\r\n" );\r
499                 sErrorHasOccurred = pdTRUE;\r
500         }\r
501 \r
502         if( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
503         {\r
504                 vDisplayMessage( "Error in generic queue test task!\r\n" );\r
505                 sErrorHasOccurred = pdTRUE;             \r
506         }\r
507 \r
508         if( xAreAltGenericQueueTasksStillRunning() != pdTRUE )\r
509         {\r
510                 vDisplayMessage( "Error in fast generic queue test task!\r\n" );\r
511                 sErrorHasOccurred = pdTRUE;             \r
512         }\r
513 \r
514         if( xAreQueuePeekTasksStillRunning() != pdTRUE )\r
515         {\r
516                 vDisplayMessage( "Error in queue peek test task!\r\n" );\r
517                 sErrorHasOccurred = pdTRUE;\r
518         }\r
519 \r
520         if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )\r
521         {\r
522                 vDisplayMessage( "Error in counting semaphore demo task!\r\n" );\r
523                 sErrorHasOccurred = pdTRUE;\r
524         }\r
525 \r
526         if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
527         {\r
528                 vDisplayMessage( "Error in recursive mutex tasks!\r\n" );\r
529                 sErrorHasOccurred = pdTRUE;\r
530         }\r
531 \r
532         /* The hook function associated with this task is called each time the task\r
533         is switched in.  We therefore expect the number of times the callback \r
534         function has been executed to have increrment since the last time this \r
535         function executed. */\r
536         if( uxCheckTaskHookCallCount <= uxLastHookCallCount )\r
537         {\r
538                 vDisplayMessage( "Error in task hook call count!\r\n" );\r
539                 sErrorHasOccurred = pdTRUE;\r
540         }\r
541         else\r
542         {\r
543                 uxLastHookCallCount = uxCheckTaskHookCallCount;\r
544         }\r
545 \r
546         /* We would expect some queue sending to occur between calls of this \r
547         function. */\r
548         if( uxQueueSendPassedCount <= uxLastQueueSendCount )\r
549         {\r
550                 vDisplayMessage( "Error in queue send hook call count!\r\n" );\r
551                 sErrorHasOccurred = pdTRUE;\r
552         }\r
553         else\r
554         {\r
555                 uxLastQueueSendCount = uxQueueSendPassedCount;\r
556         }\r
557 \r
558         if( sErrorHasOccurred == pdFALSE )\r
559         {\r
560                 vDisplayMessage( "OK " );\r
561         }\r
562 }\r
563 /*-----------------------------------------------------------*/\r
564 \r
565 static void prvStartMathTasks( void )\r
566 {\r
567         #ifdef BCC_INDUSTRIAL_PC_PORT\r
568                 /* The Borland project does not yet support floating point. */\r
569                 vStartIntegerMathTasks( tskIDLE_PRIORITY );\r
570         #else\r
571                 vStartMathTasks( tskIDLE_PRIORITY );\r
572         #endif\r
573 }\r
574 /*-----------------------------------------------------------*/\r
575 \r
576 static portBASE_TYPE prvCheckMathTasksAreStillRunning( void )\r
577 {\r
578         #ifdef BCC_INDUSTRIAL_PC_PORT\r
579                 /* The Borland project does not yet support floating point. */\r
580                 return xAreIntegerMathsTaskStillRunning();\r
581         #else\r
582                 return xAreMathsTaskStillRunning();\r
583         #endif\r
584 }\r
585 /*-----------------------------------------------------------*/\r
586 \r
587 void vApplicationIdleHook( void )\r
588 {\r
589         /* The co-routines are executed in the idle task using the idle task \r
590         hook. */\r
591         vCoRoutineSchedule();\r
592 }\r
593 /*-----------------------------------------------------------*/\r
594 \r