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