]> git.sur5r.net Git - freertos/blob - Demo/RX600_RX62N-RDK_IAR/main-full.c
Add STM32F0 demo.
[freertos] / Demo / RX600_RX62N-RDK_IAR / main-full.c
1 /*\r
2     FreeRTOS V7.1.0 - Copyright (C) 2011 Real Time Engineers Ltd.\r
3         \r
4 \r
5     ***************************************************************************\r
6      *                                                                       *\r
7      *    FreeRTOS tutorial books are available in pdf and paperback.        *\r
8      *    Complete, revised, and edited pdf reference manuals are also       *\r
9      *    available.                                                         *\r
10      *                                                                       *\r
11      *    Purchasing FreeRTOS documentation will not only help you, by       *\r
12      *    ensuring you get running as quickly as possible and with an        *\r
13      *    in-depth knowledge of how to use FreeRTOS, it will also help       *\r
14      *    the FreeRTOS project to continue with its mission of providing     *\r
15      *    professional grade, cross platform, de facto standard solutions    *\r
16      *    for microcontrollers - completely free of charge!                  *\r
17      *                                                                       *\r
18      *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *\r
19      *                                                                       *\r
20      *    Thank you for using FreeRTOS, and thank you for your support!      *\r
21      *                                                                       *\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 modification to the GPL is included to allow you to\r
31     distribute a combined work that includes FreeRTOS without being obliged to\r
32     provide the source code for proprietary components outside of the FreeRTOS\r
33     kernel.  FreeRTOS is distributed in the hope that it will be useful, but\r
34     WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
35     or 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 project includes a lot of tasks and tests and is therefore complex.\r
56  * If you would prefer a much simpler project to get started with then select\r
57  * the 'Blinky' build configuration within the Embedded Workbench IDE.\r
58  * ****************************************************************************\r
59  *\r
60  * Creates all the demo application tasks, then starts the scheduler.  The web\r
61  * documentation provides more details of the standard demo application tasks,\r
62  * which provide no particular functionality but do provide a good example of\r
63  * how to use the FreeRTOS API.  The tasks defined in flop.c are included in the\r
64  * set of standard demo tasks to ensure the floating point unit gets some\r
65  * exercise.\r
66  *\r
67  * In addition to the standard demo tasks, the following tasks and tests are\r
68  * defined and/or created within this file:\r
69  *\r
70  * Webserver ("uIP") task - This serves a number of dynamically generated WEB\r
71  * pages to a standard WEB browser.  The IP and MAC addresses are configured by\r
72  * constants defined at the bottom of FreeRTOSConfig.h.  Use either a standard\r
73  * Ethernet cable to connect through a hug, or a cross over (point to point)\r
74  * cable to connect directly.  Ensure the IP address used is compatible with the\r
75  * IP address of the machine running the browser - the easiest way to achieve\r
76  * this is to ensure the first three octets of the IP addresses are the same.\r
77  *\r
78  * "Reg test" tasks - These fill the registers with known values, then check\r
79  * that each register still contains its expected value.  Each task uses\r
80  * different values.  The tasks run with very low priority so get preempted\r
81  * very frequently.  A check variable is incremented on each iteration of the\r
82  * test loop.  A register containing an unexpected value is indicative of an\r
83  * error in the context switching mechanism and will result in a branch to a\r
84  * null loop - which in turn will prevent the check variable from incrementing\r
85  * any further and allow the check task (described below) to determine that an\r
86  * error has occurred.  The nature of the reg test tasks necessitates that they\r
87  * are written in assembly code.\r
88  *\r
89  * "Check" task - This only executes every five seconds but has a high priority\r
90  * to ensure it gets processor time.  Its main function is to check that all the\r
91  * standard demo tasks are still operational.  While no errors have been\r
92  * discovered the check task will toggle LED 5 every 5 seconds - the toggle\r
93  * rate increasing to 200ms being a visual indication that at least one task has\r
94  * reported unexpected behaviour.\r
95  *\r
96  * "High frequency timer test" - A high frequency periodic interrupt is\r
97  * generated using a timer - the interrupt is assigned a priority above\r
98  * configMAX_SYSCALL_INTERRUPT_PRIORITY so should not be effected by anything\r
99  * the kernel is doing.  The frequency and priority of the interrupt, in\r
100  * combination with other standard tests executed in this demo, should result\r
101  * in interrupts nesting at least 3 and probably 4 deep.  This test is only\r
102  * included in build configurations that have the optimiser switched on.  In\r
103  * optimised builds the count of high frequency ticks is used as the time base\r
104  * for the run time stats.\r
105  *\r
106  * *NOTE 1* If LED5 is toggling every 5 seconds then all the demo application\r
107  * tasks are executing as expected and no errors have been reported in any\r
108  * tasks.  The toggle rate increasing to 200ms indicates that at least one task\r
109  * has reported unexpected behaviour.\r
110  *\r
111  * *NOTE 2* vApplicationSetupTimerInterrupt() is called by the kernel to let\r
112  * the application set up a timer to generate the tick interrupt.  In this\r
113  * example a compare match timer is used for this purpose.\r
114  *\r
115  * *NOTE 3* The CPU must be in Supervisor mode when the scheduler is started.\r
116  * The PowerON_Reset_PC() supplied in resetprg.c with this demo has\r
117  * Change_PSW_PM_to_UserMode() commented out to ensure this is the case.\r
118  *\r
119  * *NOTE 4* The IntQueue common demo tasks test interrupt nesting and make use\r
120  * of all the 8bit timers (as two cascaded 16bit units).\r
121 */\r
122 \r
123 /* Standard includes. */\r
124 #include <string.h>\r
125 #include <stdio.h>\r
126 \r
127 /* Hardware specific includes. */\r
128 #include <iorx62n.h>\r
129 \r
130 /* Kernel includes. */\r
131 #include "FreeRTOS.h"\r
132 #include "task.h"\r
133 \r
134 /* Standard demo includes. */\r
135 #include "partest.h"\r
136 #include "flash.h"\r
137 #include "IntQueue.h"\r
138 #include "BlockQ.h"\r
139 #include "death.h"\r
140 #include "integer.h"\r
141 #include "blocktim.h"\r
142 #include "semtest.h"\r
143 #include "PollQ.h"\r
144 #include "GenQTest.h"\r
145 #include "QPeek.h"\r
146 #include "recmutex.h"\r
147 #include "flop.h"\r
148 \r
149 /* Values that are passed into the reg test tasks using the task parameter.  The\r
150 tasks check that the values are passed in correctly. */\r
151 #define mainREG_TEST_1_PARAMETER        ( 0x12121212UL )\r
152 #define mainREG_TEST_2_PARAMETER        ( 0x12345678UL )\r
153 \r
154 /* Priorities at which the tasks are created. */\r
155 #define mainCHECK_TASK_PRIORITY         ( configMAX_PRIORITIES - 1 )\r
156 #define mainQUEUE_POLL_PRIORITY         ( tskIDLE_PRIORITY + 1 )\r
157 #define mainSEM_TEST_PRIORITY           ( tskIDLE_PRIORITY + 1 )\r
158 #define mainBLOCK_Q_PRIORITY            ( tskIDLE_PRIORITY + 2 )\r
159 #define mainCREATOR_TASK_PRIORITY   ( tskIDLE_PRIORITY + 3 )\r
160 #define mainFLASH_TASK_PRIORITY         ( tskIDLE_PRIORITY + 1 )\r
161 #define mainuIP_TASK_PRIORITY           ( tskIDLE_PRIORITY + 2 )\r
162 #define mainINTEGER_TASK_PRIORITY   ( tskIDLE_PRIORITY )\r
163 #define mainGEN_QUEUE_TASK_PRIORITY     ( tskIDLE_PRIORITY )\r
164 #define mainFLOP_TASK_PRIORITY          ( tskIDLE_PRIORITY )\r
165 \r
166 /* The WEB server uses string handling functions, which in turn use a bit more\r
167 stack than most of the other tasks. */\r
168 #define mainuIP_STACK_SIZE                      ( configMINIMAL_STACK_SIZE * 3 )\r
169 \r
170 /* The LED toggled by the check task. */\r
171 #define mainCHECK_LED                           ( 5 )\r
172 \r
173 /* The rate at which mainCHECK_LED will toggle when all the tasks are running\r
174 without error.  Controlled by the check task as described at the top of this\r
175 file. */\r
176 #define mainNO_ERROR_CYCLE_TIME         ( 5000 / portTICK_RATE_MS )\r
177 \r
178 /* The rate at which mainCHECK_LED will toggle when an error has been reported\r
179 by at least one task.  Controlled by the check task as described at the top of\r
180 this file. */\r
181 #define mainERROR_CYCLE_TIME            ( 200 / portTICK_RATE_MS )\r
182 \r
183 /* For outputing debug console messages - just maps to printf. */\r
184 #ifdef DEBUG_BUILD\r
185         #define xPrintf( x )    printf( x )\r
186 #else\r
187         #define xPrintf( x )    ( void ) x\r
188 #endif\r
189 \r
190 /*\r
191  * vApplicationMallocFailedHook() will only be called if\r
192  * configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h.  It is a hook\r
193  * function that will execute if a call to pvPortMalloc() fails.\r
194  * pvPortMalloc() is called internally by the kernel whenever a task, queue or\r
195  * semaphore is created.  It is also called by various parts of the demo\r
196  * application.\r
197  */\r
198 void vApplicationMallocFailedHook( void );\r
199 \r
200 /*\r
201  * vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set to 1\r
202  * in FreeRTOSConfig.h.  It is a hook function that is called on each iteration\r
203  * of the idle task.  It is essential that code added to this hook function\r
204  * never attempts to block in any way (for example, call xQueueReceive() with\r
205  * a block time specified).  If the application makes use of the vTaskDelete()\r
206  * API function (as this demo application does) then it is also important that\r
207  * vApplicationIdleHook() is permitted to return to its calling function because\r
208  * it is the responsibility of the idle task to clean up memory allocated by the\r
209  * kernel to any task that has since been deleted.\r
210  */\r
211 void vApplicationIdleHook( void );\r
212 \r
213 /*\r
214  * vApplicationStackOverflowHook() will only be called if\r
215  * configCHECK_FOR_STACK_OVERFLOW is set to a non-zero value.  The handle and\r
216  * name of the offending task should be passed in the function parameters, but\r
217  * it is possible that the stack overflow will have corrupted these - in which\r
218  * case pxCurrentTCB can be inspected to find the same information.\r
219  */\r
220 void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName );\r
221 \r
222 /*\r
223  * The reg test tasks as described at the top of this file.\r
224  */\r
225 static void prvRegTest1Task( void *pvParameters );\r
226 static void prvRegTest2Task( void *pvParameters );\r
227 \r
228 /*\r
229  * The actual implementation of the reg test functionality, which, because of\r
230  * the direct register access, have to be in assembly.\r
231  */\r
232 extern void prvRegTest1Implementation( void );\r
233 extern void prvRegTest2Implementation( void );\r
234 \r
235 \r
236 /*\r
237  * The check task as described at the top of this file.\r
238  */\r
239 static void prvCheckTask( void *pvParameters );\r
240 \r
241 /*\r
242  * Contains the implementation of the WEB server.\r
243  */\r
244 extern void vuIP_Task( void *pvParameters );\r
245 \r
246 /*-----------------------------------------------------------*/\r
247 \r
248 /* Variables that are incremented on each iteration of the reg test tasks -\r
249 provided the tasks have not reported any errors.  The check task inspects these\r
250 variables to ensure they are still incrementing as expected.  If a variable\r
251 stops incrementing then it is likely that its associate task has stalled. */\r
252 unsigned long ulRegTest1CycleCount = 0UL, ulRegTest2CycleCount = 0UL;\r
253 \r
254 /* The status message that is displayed at the bottom of the "task stats" web\r
255 page, which is served by the uIP task.  This will report any errors picked up\r
256 by the reg test task. */\r
257 static const char *pcStatusMessage = NULL;\r
258 \r
259 /*-----------------------------------------------------------*/\r
260 \r
261 void main(void)\r
262 {\r
263 extern void HardwareSetup( void );\r
264 \r
265         /* Renesas provided CPU configuration routine.  The clocks are configured in\r
266         here. */\r
267         HardwareSetup();\r
268         \r
269         xPrintf( "http://www.FreeRTOS.org\r\n" );\r
270 \r
271         /* Start the reg test tasks which test the context switching mechanism. */\r
272         xTaskCreate( prvRegTest1Task, "RegTst1", configMINIMAL_STACK_SIZE, ( void * ) mainREG_TEST_1_PARAMETER, tskIDLE_PRIORITY, NULL );\r
273         xTaskCreate( prvRegTest2Task, "RegTst2", configMINIMAL_STACK_SIZE, ( void * ) mainREG_TEST_2_PARAMETER, tskIDLE_PRIORITY, NULL );\r
274 \r
275         /* The web server task. */\r
276         xTaskCreate( vuIP_Task, "uIP", mainuIP_STACK_SIZE, NULL, mainuIP_TASK_PRIORITY, NULL );\r
277 \r
278         /* Start the check task as described at the top of this file. */\r
279         xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE * 3, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
280 \r
281         /* Create the standard demo tasks. */\r
282         vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
283         vCreateBlockTimeTasks();\r
284         vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
285         vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
286         vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );\r
287         vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );\r
288         vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY );\r
289         vStartQueuePeekTasks();\r
290         vStartRecursiveMutexTasks();\r
291         vStartInterruptQueueTasks();\r
292         vStartMathTasks( mainFLOP_TASK_PRIORITY );\r
293 \r
294         /* The suicide tasks must be created last as they need to know how many\r
295         tasks were running prior to their creation in order to ascertain whether\r
296         or not the correct/expected number of tasks are running at any given time. */\r
297         vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );\r
298 \r
299         /* Start the tasks running. */\r
300         vTaskStartScheduler();\r
301 \r
302         /* If all is well we will never reach here as the scheduler will now be\r
303         running.  If we do reach here then it is likely that there was insufficient\r
304         heap available for the idle task to be created. */\r
305         for( ;; );\r
306 }\r
307 /*-----------------------------------------------------------*/\r
308 \r
309 static void prvCheckTask( void *pvParameters )\r
310 {\r
311 static volatile unsigned long ulLastRegTest1CycleCount = 0UL, ulLastRegTest2CycleCount = 0UL;\r
312 portTickType xNextWakeTime, xCycleFrequency = mainNO_ERROR_CYCLE_TIME;\r
313 extern void vSetupHighFrequencyTimer( void );\r
314 \r
315         /* If this is being executed then the kernel has been started.  Start the high\r
316         frequency timer test as described at the top of this file.  This is only\r
317         included in the optimised build configuration - otherwise it takes up too much\r
318         CPU time. */\r
319         #ifdef INCLUDE_HIGH_FREQUENCY_TIMER_TEST\r
320                 vSetupHighFrequencyTimer();\r
321         #endif\r
322 \r
323         /* Initialise xNextWakeTime - this only needs to be done once. */\r
324         xNextWakeTime = xTaskGetTickCount();\r
325 \r
326         for( ;; )\r
327         {\r
328                 /* Place this task in the blocked state until it is time to run again. */\r
329                 vTaskDelayUntil( &xNextWakeTime, xCycleFrequency );\r
330 \r
331                 /* Check the standard demo tasks are running without error. */\r
332                 if( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
333                 {\r
334                         /* Increase the rate at which this task cycles, which will increase the\r
335                         rate at which mainCHECK_LED flashes to give visual feedback that an error\r
336                         has occurred. */                        \r
337                         pcStatusMessage = "Error: GenQueue";\r
338                         xPrintf( pcStatusMessage );\r
339                 }\r
340                 \r
341                 if( xAreQueuePeekTasksStillRunning() != pdTRUE )\r
342                 {\r
343                         pcStatusMessage = "Error: QueuePeek\r\n";\r
344                         xPrintf( pcStatusMessage );\r
345                 }\r
346                 \r
347                 if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
348                 {\r
349                         pcStatusMessage = "Error: BlockQueue\r\n";\r
350                         xPrintf( pcStatusMessage );\r
351                 }\r
352                 \r
353                 if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
354                 {\r
355                         pcStatusMessage = "Error: BlockTime\r\n";\r
356                         xPrintf( pcStatusMessage );\r
357                 }\r
358                 \r
359                 if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
360                 {\r
361                         pcStatusMessage = "Error: SemTest\r\n";\r
362                         xPrintf( pcStatusMessage );\r
363                 }\r
364                 \r
365                 if( xArePollingQueuesStillRunning() != pdTRUE )\r
366                 {\r
367                         pcStatusMessage = "Error: PollQueue\r\n";\r
368                         xPrintf( pcStatusMessage );\r
369                 }\r
370                 \r
371                 if( xIsCreateTaskStillRunning() != pdTRUE )\r
372                 {\r
373                         pcStatusMessage = "Error: Death\r\n";\r
374                         xPrintf( pcStatusMessage );\r
375                 }\r
376                 \r
377                 if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
378                 {\r
379                         pcStatusMessage = "Error: IntMath\r\n";\r
380                         xPrintf( pcStatusMessage );\r
381                 }\r
382                 \r
383                 if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
384                 {\r
385                         pcStatusMessage = "Error: RecMutex\r\n";\r
386                         xPrintf( pcStatusMessage );\r
387                 }\r
388                 \r
389                 if( xAreIntQueueTasksStillRunning() != pdPASS )\r
390                 {\r
391                         pcStatusMessage = "Error: IntQueue\r\n";\r
392                         xPrintf( pcStatusMessage );\r
393                 }\r
394                 \r
395                 if( xAreMathsTaskStillRunning() != pdPASS )\r
396                 {\r
397                         pcStatusMessage = "Error: Flop\r\n";\r
398                         xPrintf( pcStatusMessage );\r
399                 }\r
400 \r
401                 /* Check the reg test tasks are still cycling.  They will stop incrementing\r
402                 their loop counters if they encounter an error. */\r
403                 if( ulRegTest1CycleCount == ulLastRegTest1CycleCount )\r
404                 {\r
405                         pcStatusMessage = "Error: RegTest1\r\n";\r
406                         xPrintf( pcStatusMessage );\r
407                 }\r
408 \r
409                 if( ulRegTest2CycleCount == ulLastRegTest2CycleCount )\r
410                 {\r
411                         pcStatusMessage = "Error: RegTest2\r\n";\r
412                         xPrintf( pcStatusMessage );\r
413                 }\r
414 \r
415                 ulLastRegTest1CycleCount = ulRegTest1CycleCount;\r
416                 ulLastRegTest2CycleCount = ulRegTest2CycleCount;\r
417 \r
418                 /* Toggle the check LED to give an indication of the system status.  If\r
419                 the LED toggles every 5 seconds then everything is ok.  A faster toggle\r
420                 indicates an error. */\r
421                 vParTestToggleLED( mainCHECK_LED );\r
422                 \r
423                 /* Ensure the LED toggles at a faster rate if an error has occurred. */\r
424                 if( pcStatusMessage != NULL )\r
425                 {\r
426                         xCycleFrequency = mainERROR_CYCLE_TIME;\r
427                 }\r
428         }\r
429 }\r
430 /*-----------------------------------------------------------*/\r
431 \r
432 /* The RX port uses this callback function to configure its tick interrupt.\r
433 This allows the application to choose the tick interrupt source. */\r
434 void vApplicationSetupTimerInterrupt( void )\r
435 {\r
436         /* Enable compare match timer 0. */\r
437         MSTP( CMT0 ) = 0;\r
438 \r
439         /* Interrupt on compare match. */\r
440         CMT0.CMCR.BIT.CMIE = 1;\r
441 \r
442         /* Set the compare match value. */\r
443         CMT0.CMCOR = ( unsigned short ) ( ( ( configPERIPHERAL_CLOCK_HZ / configTICK_RATE_HZ ) -1 ) / 8 );\r
444 \r
445         /* Divide the PCLK by 8. */\r
446         CMT0.CMCR.BIT.CKS = 0;\r
447 \r
448         /* Enable the interrupt... */\r
449         _IEN( _CMT0_CMI0 ) = 1;\r
450 \r
451         /* ...and set its priority to the application defined kernel priority. */\r
452         _IPR( _CMT0_CMI0 ) = configKERNEL_INTERRUPT_PRIORITY;\r
453 \r
454         /* Start the timer. */\r
455         CMT.CMSTR0.BIT.STR0 = 1;\r
456 }\r
457 /*-----------------------------------------------------------*/\r
458 \r
459 /* This function is explained by the comments above its prototype at the top\r
460 of this file. */\r
461 void vApplicationMallocFailedHook( void )\r
462 {\r
463         for( ;; );\r
464 }\r
465 /*-----------------------------------------------------------*/\r
466 \r
467 /* This function is explained by the comments above its prototype at the top\r
468 of this file. */\r
469 void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName )\r
470 {\r
471         for( ;; );\r
472 }\r
473 /*-----------------------------------------------------------*/\r
474 \r
475 /* This function is explained by the comments above its prototype at the top\r
476 of this file. */\r
477 void vApplicationIdleHook( void )\r
478 {\r
479 }\r
480 /*-----------------------------------------------------------*/\r
481 \r
482 /* This function is explained in the comments at the top of this file. */\r
483 static void prvRegTest1Task( void *pvParameters )\r
484 {\r
485         if( ( ( unsigned long ) pvParameters ) != mainREG_TEST_1_PARAMETER )\r
486         {\r
487                 /* The parameter did not contain the expected value. */\r
488                 for( ;; )\r
489                 {\r
490                         /* Stop the tick interrupt so its obvious something has gone wrong. */\r
491                         taskDISABLE_INTERRUPTS();\r
492                 }\r
493         }\r
494 \r
495         /* This is an asm function that never returns. */\r
496         prvRegTest1Implementation();\r
497 }\r
498 /*-----------------------------------------------------------*/\r
499 \r
500 /* This function is explained in the comments at the top of this file. */\r
501 static void prvRegTest2Task( void *pvParameters )\r
502 {\r
503         if( ( ( unsigned long ) pvParameters ) != mainREG_TEST_2_PARAMETER )\r
504         {\r
505                 /* The parameter did not contain the expected value. */\r
506                 for( ;; )\r
507                 {\r
508                         /* Stop the tick interrupt so its obvious something has gone wrong. */\r
509                         taskDISABLE_INTERRUPTS();\r
510                 }\r
511         }\r
512 \r
513         /* This is an asm function that never returns. */\r
514         prvRegTest2Implementation();\r
515 }\r
516 /*-----------------------------------------------------------*/\r
517 \r
518 char *pcGetTaskStatusMessage( void )\r
519 {\r
520         /* Not bothered about a critical section here although technically because of\r
521         the task priorities the pointer could change it will be atomic if not near\r
522         atomic and its not critical. */\r
523         if( pcStatusMessage == NULL )\r
524         {\r
525                 return "All tasks running without error";\r
526         }\r
527         else\r
528         {\r
529                 return ( char * ) pcStatusMessage;\r
530         }\r
531 }\r
532 /*-----------------------------------------------------------*/\r
533 \r
534 \r