]> git.sur5r.net Git - freertos/blob - Demo/CORTEX_A2F200_SoftConsole/main-full.c
Add in basic uIP files into the A2F demo. Ping is working, but nothing else has...
[freertos] / Demo / CORTEX_A2F200_SoftConsole / main-full.c
1 /*\r
2     FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd.\r
3 \r
4     ***************************************************************************\r
5     *                                                                         *\r
6     * If you are:                                                             *\r
7     *                                                                         *\r
8     *    + New to FreeRTOS,                                                   *\r
9     *    + Wanting to learn FreeRTOS or multitasking in general quickly       *\r
10     *    + Looking for basic training,                                        *\r
11     *    + Wanting to improve your FreeRTOS skills and productivity           *\r
12     *                                                                         *\r
13     * then take a look at the FreeRTOS books - available as PDF or paperback  *\r
14     *                                                                         *\r
15     *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *\r
16     *                  http://www.FreeRTOS.org/Documentation                  *\r
17     *                                                                         *\r
18     * A pdf reference manual is also available.  Both are usually delivered   *\r
19     * to your inbox within 20 minutes to two hours when purchased between 8am *\r
20     * and 8pm GMT (although please allow up to 24 hours in case of            *\r
21     * exceptional circumstances).  Thank you for your support!                *\r
22     *                                                                         *\r
23     ***************************************************************************\r
24 \r
25     This file is part of the FreeRTOS distribution.\r
26 \r
27     FreeRTOS is free software; you can redistribute it and/or modify it under\r
28     the terms of the GNU General Public License (version 2) as published by the\r
29     Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
30     ***NOTE*** The exception to the GPL is included to allow you to distribute\r
31     a combined work that includes FreeRTOS without being obliged to provide the\r
32     source code for proprietary components outside of the FreeRTOS kernel.\r
33     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT\r
34     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r
35     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for\r
36     more details. You should have received a copy of the GNU General Public\r
37     License and the FreeRTOS license exception along with FreeRTOS; if not it\r
38     can be viewed here: http://www.freertos.org/a00114.html and also obtained\r
39     by writing to Richard Barry, contact details for whom are available on the\r
40     FreeRTOS WEB site.\r
41 \r
42     1 tab == 4 spaces!\r
43 \r
44     http://www.FreeRTOS.org - Documentation, latest information, license and\r
45     contact details.\r
46 \r
47     http://www.SafeRTOS.com - A version that is certified for use in safety\r
48     critical systems.\r
49 \r
50     http://www.OpenRTOS.com - Commercial support, development, porting,\r
51     licensing and training services.\r
52 */\r
53 \r
54 /*\r
55 * This simple demo project runs on the STM32 Discovery board, which is\r
56 * populated with an STM32F100RB Cortex-M3 microcontroller.  The discovery board \r
57 * makes an ideal low cost evaluation platform, but the 8K of RAM provided on the\r
58 * STM32F100RB does not allow the simple application to demonstrate all of all the \r
59 * FreeRTOS kernel features.  Therefore, this simple demo only actively \r
60 * demonstrates task, queue, timer and interrupt functionality.  In addition, the \r
61 * demo is configured to include malloc failure, idle and stack overflow hook \r
62 * functions.\r
63\r
64 * The idle hook function:\r
65 * The idle hook function queries the amount of FreeRTOS heap space that is\r
66 * remaining (see vApplicationIdleHook() defined in this file).  The demo \r
67 * application is configured use 7K or the available 8K of RAM as the FreeRTOS heap.\r
68 * Memory is only allocated from this heap during initialisation, and this demo \r
69 * only actually uses 1.6K bytes of the configured 7K available - leaving 5.4K \r
70 * bytes of heap space unallocated.\r
71\r
72 * The main() Function:\r
73 * main() creates one software timer, one queue, and two tasks.  It then starts the\r
74 * scheduler.\r
75\r
76 * The Queue Send Task:\r
77 * The queue send task is implemented by the prvQueueSendTask() function in this \r
78 * file.  prvQueueSendTask() sits in a loop that causes it to repeatedly block for \r
79 * 200 milliseconds, before sending the value 100 to the queue that was created \r
80 * within main().  Once the value is sent, the task loops back around to block for\r
81 * another 200 milliseconds.\r
82\r
83 * The Queue Receive Task:\r
84 * The queue receive task is implemented by the prvQueueReceiveTask() function\r
85 * in this file.  prvQueueReceiveTask() sits in a loop that causes repeatedly \r
86 * attempt to read data from the queue that was created within main().  When data \r
87 * is received, the task checks the value of the data, and if the value equals \r
88 * the expected 100, toggles the green LED.  The 'block time' parameter passed to \r
89 * the queue receive function specifies that the task should be held in the Blocked \r
90 * state indefinitely to wait for data to be available on the queue.  The queue \r
91 * receive task will only leave the Blocked state when the queue send task writes \r
92 * to the queue.  As the queue send task writes to the queue every 200 \r
93 * milliseconds, the queue receive task leaves the Blocked state every 200 \r
94 * milliseconds, and therefore toggles the green LED every 200 milliseconds.\r
95\r
96 * The LED Software Timer and the Button Interrupt:\r
97 * The user button B1 is configured to generate an interrupt each time it is\r
98 * pressed.  The interrupt service routine switches the red LED on, and resets the \r
99 * LED software timer.  The LED timer has a 5000 millisecond (5 second) period, and\r
100 * uses a callback function that is defined to just turn the red LED off.  \r
101 * Therefore, pressing the user button will turn the red LED on, and the LED will \r
102 * remain on until a full five seconds pass without the button being pressed.\r
103 */\r
104 \r
105 /* Kernel includes. */\r
106 #include "FreeRTOS.h"\r
107 #include "task.h"\r
108 #include "queue.h"\r
109 #include "timers.h"\r
110 \r
111 /* Microsemi drivers/libraries includes. */\r
112 #include "mss_gpio.h"\r
113 #include "mss_watchdog.h"\r
114 #include "OLED.h"\r
115 \r
116 /* Common demo includes. */\r
117 #include "partest.h"\r
118 #include "flash.h"\r
119 #include "BlockQ.h"\r
120 #include "death.h"\r
121 #include "blocktim.h"\r
122 #include "semtest.h"\r
123 #include "GenQTest.h"\r
124 #include "QPeek.h"\r
125 #include "recmutex.h"\r
126 #include "TimerDemo.h"\r
127 \r
128 /* Priorities at which the tasks are created. */\r
129 #define mainQUEUE_RECEIVE_TASK_PRIORITY         ( tskIDLE_PRIORITY + 2 )\r
130 #define mainQUEUE_SEND_TASK_PRIORITY            ( tskIDLE_PRIORITY + 1 )\r
131 \r
132 /* The rate at which data is sent to the queue, specified in milliseconds, and\r
133 converted to ticks using the portTICK_RATE_MS constant. */\r
134 #define mainQUEUE_SEND_FREQUENCY_MS                     ( 200 / portTICK_RATE_MS )\r
135 \r
136 /* The number of items the queue can hold.  This is 1 as the receive task\r
137 will remove items as they are added, meaning the send task should always find\r
138 the queue empty. */\r
139 #define mainQUEUE_LENGTH                        ( 1 )\r
140 \r
141 #define mainCHECK_LED                           0x07UL\r
142 #define mainTIMER_CONTROLLED_LED        0x06UL\r
143 #define mainTASK_CONTROLLED_LED         0x05UL\r
144 \r
145 #define mainTIMER_TEST_PERIOD           ( 50 )\r
146 \r
147 #define mainCHECK_TASK_PRIORITY         ( configMAX_PRIORITIES - 1 )\r
148 #define mainQUEUE_POLL_PRIORITY         ( tskIDLE_PRIORITY + 1 )\r
149 #define mainSEM_TEST_PRIORITY           ( tskIDLE_PRIORITY + 1 )\r
150 #define mainBLOCK_Q_PRIORITY            ( tskIDLE_PRIORITY + 2 )\r
151 #define mainCREATOR_TASK_PRIORITY   ( tskIDLE_PRIORITY + 3 )\r
152 #define mainFLASH_TASK_PRIORITY         ( tskIDLE_PRIORITY + 1 )\r
153 #define mainuIP_TASK_PRIORITY           ( tskIDLE_PRIORITY + 2 )\r
154 #define mainINTEGER_TASK_PRIORITY   ( tskIDLE_PRIORITY )\r
155 #define mainGEN_QUEUE_TASK_PRIORITY     ( tskIDLE_PRIORITY )\r
156 \r
157 /* The WEB server uses string handling functions, which in turn use a bit more\r
158 stack than most of the other tasks. */\r
159 #define mainuIP_STACK_SIZE                      ( configMINIMAL_STACK_SIZE * 3 )\r
160 \r
161 /*-----------------------------------------------------------*/\r
162 \r
163 /*\r
164  * Setup the NVIC, LED outputs, and button inputs.\r
165  */\r
166 static void prvSetupHardware( void );\r
167 \r
168 /*\r
169  * The tasks as described in the comments at the top of this file.\r
170  */\r
171 static void prvQueueReceiveTask( void *pvParameters );\r
172 static void prvQueueSendTask( void *pvParameters );\r
173 \r
174 /*\r
175  * The LED timer callback function.  This does nothing but switch the red LED \r
176  * off.\r
177  */\r
178 static void vLEDTimerCallback( xTimerHandle xTimer );\r
179 \r
180 static void vCheckTimerCallback( xTimerHandle xTimer );\r
181 \r
182 /*\r
183  * This is not a 'standard' partest function, so the prototype is not in\r
184  * partest.h.
185  */\r
186 void vParTestSetLEDFromISR( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue );\r
187 \r
188 /*\r
189  * Contains the implementation of the WEB server.\r
190  */\r
191 extern void vuIP_Task( void *pvParameters );\r
192 \r
193 /*-----------------------------------------------------------*/\r
194 \r
195 /* The queue used by both tasks. */\r
196 static xQueueHandle xQueue = NULL;\r
197 \r
198 /* The LED software timer.  This uses vLEDTimerCallback() as its callback\r
199 function. */\r
200 static xTimerHandle xLEDTimer = NULL;\r
201 \r
202 static xTimerHandle xCheckTimer = NULL;\r
203 \r
204 /* The status message that is displayed at the bottom of the "task stats" web\r
205 page, which is served by the uIP task.  This will report any errors picked up\r
206 by the reg test task. */\r
207 static const char *pcStatusMessage = NULL;\r
208 \r
209 \r
210 /*-----------------------------------------------------------*/\r
211 \r
212 int main(void)\r
213 {\r
214         /* Configure the NVIC, LED outputs and button inputs. */\r
215         prvSetupHardware();\r
216 \r
217         /* Create the queue. */\r
218         xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) );\r
219 \r
220         if( xQueue != NULL )\r
221         {\r
222                 /* Start the two tasks as described in the comments at the top of this\r
223                 file. */\r
224                 xTaskCreate( prvQueueReceiveTask, ( signed char * ) "Rx", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_RECEIVE_TASK_PRIORITY, NULL );\r
225                 xTaskCreate( prvQueueSendTask, ( signed char * ) "TX", configMINIMAL_STACK_SIZE, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );\r
226 \r
227                 /* Create the software timer that is responsible for turning off the LED \r
228                 if the button is not pushed within 5000ms, as described at the top of \r
229                 this file. */\r
230                 xLEDTimer = xTimerCreate(       ( const signed char * ) "LEDTimer", /* A text name, purely to help debugging. */\r
231                                                                         ( 5000 / portTICK_RATE_MS ),            /* The timer period, in this case 5000ms (5s). */\r
232                                                                         pdFALSE,                                                        /* This is a one shot timer, so xAutoReload is set to pdFALSE. */\r
233                                                                         ( void * ) 0,                                           /* The ID is not used, so can be set to anything. */\r
234                                                                         vLEDTimerCallback                                       /* The callback function that switches the LED off. */\r
235                                                                 );\r
236 \r
237                 xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer",       /* A text name, purely to help debugging. */\r
238                                                                         ( 3000 / portTICK_RATE_MS ),                    /* The timer period, in this case 3000ms (3s). */\r
239                                                                         pdTRUE,                                                                 /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */\r
240                                                                         ( void * ) 0,                                                   /* The ID is not used, so can be set to anything. */\r
241                                                                         vCheckTimerCallback                                             /* The callback function that inspects the status of all the other tasks. */\r
242                                                                   );\r
243 \r
244                 vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
245                 vCreateBlockTimeTasks();\r
246                 vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
247                 vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );\r
248                 vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY );\r
249                 vStartQueuePeekTasks();\r
250                 vStartRecursiveMutexTasks();\r
251                 vStartTimerDemoTask( mainTIMER_TEST_PERIOD );\r
252 \r
253                 /* The web server task. */\r
254                 xTaskCreate( vuIP_Task, ( signed char * ) "uIP", mainuIP_STACK_SIZE, NULL, mainuIP_TASK_PRIORITY, NULL );\r
255 \r
256 \r
257                 /* Start the tasks and timer running. */\r
258                 vTaskStartScheduler();\r
259         }\r
260 \r
261         /* If all is well, the scheduler will now be running, and the following line\r
262         will never be reached.  If the following line does execute, then there was\r
263         insufficient FreeRTOS heap memory available for the idle and/or timer tasks\r
264         to be created.  See the memory management section on the FreeRTOS web site\r
265         for more details. */\r
266         for( ;; );\r
267 }\r
268 /*-----------------------------------------------------------*/\r
269 \r
270 static void vCheckTimerCallback( xTimerHandle xTimer )\r
271 {\r
272         /* Check the standard demo tasks are running without error. */\r
273         if( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
274         {\r
275                 /* Increase the rate at which this task cycles, which will increase the\r
276                 rate at which mainCHECK_LED flashes to give visual feedback that an error\r
277                 has occurred. */\r
278                 pcStatusMessage = "Error: GenQueue";\r
279 //              xPrintf( pcStatusMessage );\r
280         }\r
281 \r
282         if( xAreQueuePeekTasksStillRunning() != pdTRUE )\r
283         {\r
284                 pcStatusMessage = "Error: QueuePeek\r\n";\r
285 //              xPrintf( pcStatusMessage );\r
286         }\r
287 \r
288         if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
289         {\r
290                 pcStatusMessage = "Error: BlockQueue\r\n";\r
291 //              xPrintf( pcStatusMessage );\r
292         }\r
293 \r
294         if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
295         {\r
296                 pcStatusMessage = "Error: BlockTime\r\n";\r
297 //              xPrintf( pcStatusMessage );\r
298         }\r
299 \r
300         if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
301         {\r
302                 pcStatusMessage = "Error: SemTest\r\n";\r
303 //              xPrintf( pcStatusMessage );\r
304         }\r
305 \r
306         if( xIsCreateTaskStillRunning() != pdTRUE )\r
307         {\r
308                 pcStatusMessage = "Error: Death\r\n";\r
309 //              xPrintf( pcStatusMessage );\r
310         }\r
311 \r
312         if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
313         {\r
314                 pcStatusMessage = "Error: RecMutex\r\n";\r
315 //              xPrintf( pcStatusMessage );\r
316         }\r
317 \r
318         if( xAreTimerDemoTasksStillRunning( ( 3000 / portTICK_RATE_MS ) ) != pdTRUE )\r
319         {\r
320                 pcStatusMessage = "Error: TimerDemo";\r
321         }\r
322 \r
323         /* Toggle the check LED to give an indication of the system status.  If\r
324         the LED toggles every 5 seconds then everything is ok.  A faster toggle\r
325         indicates an error. */\r
326         vParTestToggleLED( mainCHECK_LED );\r
327 \r
328         if( pcStatusMessage != NULL )\r
329         {\r
330                 /* The block time is set to zero as a timer callback must *never*\r
331                 attempt to block. */\r
332                 xTimerChangePeriod( xCheckTimer, ( 500 / portTICK_RATE_MS ), 0 );\r
333         }\r
334 }\r
335 /*-----------------------------------------------------------*/\r
336 \r
337 static void vLEDTimerCallback( xTimerHandle xTimer )\r
338 {\r
339         /* The timer has expired - so no button pushes have occurred in the last\r
340         five seconds - turn the LED off.  NOTE - accessing the LED port should use\r
341         a critical section because it is accessed from multiple tasks, and the\r
342         button interrupt - in this trivial case, for simplicity, the critical\r
343         section is omitted. */\r
344         vParTestSetLED( mainTIMER_CONTROLLED_LED, pdFALSE );\r
345 }\r
346 /*-----------------------------------------------------------*/\r
347 \r
348 /* The ISR executed when the user button is pushed. */\r
349 void GPIO8_IRQHandler( void )\r
350 {\r
351 portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;\r
352 \r
353         /* The button was pushed, so ensure the LED is on before resetting the\r
354         LED timer.  The LED timer will turn the LED off if the button is not\r
355         pushed within 5000ms. */\r
356         vParTestSetLEDFromISR( mainTIMER_CONTROLLED_LED, pdTRUE );\r
357 \r
358         /* This interrupt safe FreeRTOS function can be called from this interrupt\r
359         because the interrupt priority is below the\r
360         configMAX_SYSCALL_INTERRUPT_PRIORITY setting in FreeRTOSConfig.h. */\r
361         xTimerResetFromISR( xLEDTimer, &xHigherPriorityTaskWoken );\r
362 \r
363         /* Clear the interrupt before leaving. */\r
364     MSS_GPIO_clear_irq( MSS_GPIO_8 );\r
365 \r
366         /* If calling xTimerResetFromISR() caused a task (in this case the timer\r
367         service/daemon task) to unblock, and the unblocked task has a priority\r
368         higher than or equal to the task that was interrupted, then\r
369         xHigherPriorityTaskWoken will now be set to pdTRUE, and calling\r
370         portEND_SWITCHING_ISR() will ensure the unblocked task runs next. */\r
371         portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );\r
372 }\r
373 /*-----------------------------------------------------------*/\r
374 \r
375 static void prvQueueSendTask( void *pvParameters )\r
376 {\r
377 portTickType xNextWakeTime;\r
378 const unsigned long ulValueToSend = 100UL;\r
379 \r
380         /* The suicide tasks must be created last as they need to know how many\r
381         tasks were running prior to their creation in order to ascertain whether\r
382         or not the correct/expected number of tasks are running at any given time. */\r
383         vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );\r
384 \r
385         xTimerStart( xCheckTimer, portMAX_DELAY );\r
386 \r
387         /* Initialise xNextWakeTime - this only needs to be done once. */\r
388         xNextWakeTime = xTaskGetTickCount();\r
389 \r
390         for( ;; )\r
391         {\r
392                 /* Place this task in the blocked state until it is time to run again.\r
393                 The block time is specified in ticks, the constant used converts ticks\r
394                 to ms.  While in the Blocked state this task will not consume any CPU\r
395                 time. */\r
396                 vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS );\r
397 \r
398                 /* Send to the queue - causing the queue receive task to unblock and\r
399                 toggle an LED.  0 is used as the block time so the sending operation\r
400                 will not block - it shouldn't need to block as the queue should always\r
401                 be empty at this point in the code. */\r
402                 xQueueSend( xQueue, &ulValueToSend, 0 );\r
403         }\r
404 }\r
405 /*-----------------------------------------------------------*/\r
406 \r
407 static void prvQueueReceiveTask( void *pvParameters )\r
408 {\r
409 unsigned long ulReceivedValue;\r
410 \r
411         for( ;; )\r
412         {\r
413                 /* Wait until something arrives in the queue - this task will block\r
414                 indefinitely provided INCLUDE_vTaskSuspend is set to 1 in\r
415                 FreeRTOSConfig.h. */\r
416                 xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY );\r
417 \r
418                 /*  To get here something must have been received from the queue, but\r
419                 is it the expected value?  If it is, toggle the green LED. */\r
420                 if( ulReceivedValue == 100UL )\r
421                 {\r
422                         /* NOTE - accessing the LED port should use a critical section\r
423                         because it is accessed from multiple tasks, and the button interrupt \r
424                         - in this trivial case, for simplicity, the critical section is \r
425                         omitted. */\r
426                         vParTestToggleLED( mainTASK_CONTROLLED_LED );\r
427                 }\r
428         }\r
429 }\r
430 /*-----------------------------------------------------------*/\r
431 \r
432 static void prvSetupHardware( void )\r
433 {\r
434         /* Disable the Watch Dog Timer */\r
435         MSS_WD_disable( );\r
436 \r
437         /* Configure the GPIO for the LEDs. */\r
438         vParTestInitialise();\r
439 \r
440         /* Initialise the display. */\r
441     OLED_init();\r
442 \r
443         /* Setup the GPIO and the NVIC for the switch used in this simple demo. */\r
444         NVIC_SetPriority( GPIO8_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );\r
445     NVIC_EnableIRQ( GPIO8_IRQn );\r
446     MSS_GPIO_config( MSS_GPIO_8, MSS_GPIO_INPUT_MODE | MSS_GPIO_IRQ_EDGE_NEGATIVE );\r
447     MSS_GPIO_enable_irq( MSS_GPIO_8 );\r
448 \r
449     /* Setup the EMAC and the NVIC for MAC interrupts. */\r
450     NVIC_SetPriority( EthernetMAC_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );\r
451     NVIC_EnableIRQ( EthernetMAC_IRQn );\r
452 }\r
453 /*-----------------------------------------------------------*/\r
454 \r
455 void vApplicationMallocFailedHook( void )\r
456 {\r
457         /* Called if a call to pvPortMalloc() fails because there is insufficient\r
458         free memory available in the FreeRTOS heap.  pvPortMalloc() is called\r
459         internally by FreeRTOS API functions that create tasks, queues, software \r
460         timers, and semaphores.  The size of the FreeRTOS heap is set by the\r
461         configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */\r
462         for( ;; );\r
463 }\r
464 /*-----------------------------------------------------------*/\r
465 \r
466 void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName )\r
467 {\r
468         ( void ) pcTaskName;\r
469         ( void ) pxTask;\r
470 \r
471         /* Run time stack overflow checking is performed if\r
472         configconfigCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2.  This hook\r
473         function is called if a stack overflow is detected. */\r
474         taskDISABLE_INTERRUPTS();\r
475         for( ;; );\r
476 }\r
477 /*-----------------------------------------------------------*/\r
478 \r
479 void vApplicationIdleHook( void )\r
480 {\r
481 volatile size_t xFreeStackSpace;\r
482 \r
483         /* This function is called on each cycle of the idle task.  In this case it\r
484         does nothing useful, other than report the amout of FreeRTOS heap that \r
485         remains unallocated. */\r
486         xFreeStackSpace = xPortGetFreeHeapSize();\r
487 \r
488         if( xFreeStackSpace > 100 )\r
489         {\r
490                 /* By now, the kernel has allocated everything it is going to, so\r
491                 if there is a lot of heap remaining unallocated then\r
492                 the value of configTOTAL_HEAP_SIZE in FreeRTOSConfig.h can be\r
493                 reduced accordingly. */\r
494         }\r
495 }\r
496 /*-----------------------------------------------------------*/\r
497 \r
498 char *pcGetTaskStatusMessage( void )\r
499 {\r
500         /* Not bothered about a critical section here although technically because of\r
501         the task priorities the pointer could change it will be atomic if not near\r
502         atomic and its not critical. */\r
503         if( pcStatusMessage == NULL )\r
504         {\r
505                 return "All tasks running without error";\r
506         }\r
507         else\r
508         {\r
509                 return ( char * ) pcStatusMessage;\r
510         }\r
511 }\r
512 \r
513 \r