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