]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/NiosII_CycloneIII_DBC3C40_GCC/RTOSDemo/main.c
2eff70da3dda91b0c942be572b5d1ef773f84315
[freertos] / FreeRTOS / Demo / NiosII_CycloneIII_DBC3C40_GCC / RTOSDemo / main.c
1 /*\r
2     FreeRTOS V7.4.2 - Copyright (C) 2013 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 \r
33     >>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to\r
34     distribute a combined work that includes FreeRTOS without being obliged to\r
35     provide the source code for proprietary components outside of the FreeRTOS\r
36     kernel.\r
37 \r
38     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
39     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
40     FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\r
41     details. You should have received a copy of the GNU General Public License\r
42     and the FreeRTOS license exception along with FreeRTOS; if not it can be\r
43     viewed here: http://www.freertos.org/a00114.html and also obtained by\r
44     writing to Real Time Engineers Ltd., contact details for whom are available\r
45     on the FreeRTOS WEB site.\r
46 \r
47     1 tab == 4 spaces!\r
48 \r
49     ***************************************************************************\r
50      *                                                                       *\r
51      *    Having a problem?  Start by reading the FAQ "My application does   *\r
52      *    not run, what could be wrong?"                                     *\r
53      *                                                                       *\r
54      *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
55      *                                                                       *\r
56     ***************************************************************************\r
57 \r
58 \r
59     http://www.FreeRTOS.org - Documentation, books, training, latest versions, \r
60     license and Real Time Engineers Ltd. contact details.\r
61 \r
62     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
63     including FreeRTOS+Trace - an indispensable productivity tool, and our new\r
64     fully thread aware and reentrant UDP/IP stack.\r
65 \r
66     http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High \r
67     Integrity Systems, who sell the code with commercial support, \r
68     indemnification and middleware, under the OpenRTOS brand.\r
69     \r
70     http://www.SafeRTOS.com - High Integrity Systems also provide a safety \r
71     engineered and independently SIL3 certified version for use in safety and \r
72     mission critical applications that require provable dependability.\r
73 */\r
74 \r
75 /*\r
76  * Creates all the demo application tasks, then starts the scheduler.\r
77  * In addition to the standard demo tasks, the following tasks and tests are\r
78  * defined and/or created within this file:\r
79  *\r
80  * "Check" task -  This only executes every five seconds but has the highest\r
81  * priority so is guaranteed to get processor time.  Its main function is to \r
82  * check that all the standard demo tasks are still operational.  The check\r
83  * task will write an error message to the console should an error be detected\r
84  * within any of the demo tasks.  The check task also toggles the LED defined\r
85  * by mainCHECK_LED every 5 seconds while the system is error free, with the\r
86  * toggle rate increasing to every 500ms should an error occur.\r
87  * \r
88  * "Reg test" tasks - These fill the registers with known values, then check\r
89  * that each register still contains its expected value.  Each task uses\r
90  * different values.  The tasks run with very low priority so get preempted very\r
91  * frequently.  A register containing an unexpected value is indicative of an\r
92  * error in the context switching mechanism.\r
93  *\r
94  * See the online documentation for this demo for more information on interrupt\r
95  * usage.\r
96  */\r
97 \r
98 /* Standard includes. */\r
99 #include <stddef.h>\r
100 #include <stdio.h>\r
101 #include <string.h>\r
102 \r
103 /* Scheduler includes. */\r
104 #include "FreeRTOS.h"\r
105 #include "task.h"\r
106 #include "queue.h"\r
107 \r
108 /* Demo application includes. */\r
109 #include "partest.h"\r
110 #include "flash.h"\r
111 #include "blocktim.h"\r
112 #include "semtest.h"\r
113 #include "serial.h"\r
114 #include "comtest.h"\r
115 #include "GenQTest.h"\r
116 #include "QPeek.h"\r
117 #include "integer.h"\r
118 #include "PollQ.h"\r
119 #include "BlockQ.h"\r
120 #include "dynamic.h"\r
121 #include "countsem.h"\r
122 #include "recmutex.h"\r
123 #include "death.h"\r
124 \r
125 /*-----------------------------------------------------------*/\r
126 \r
127 #error The batch file Demo\NiosII_CycloneIII_DBC3C40_GCC\CreateProjectDirectoryStructure.bat must be executed before the project is imported into the workspace.  Failure to do this will result in the include paths stored in the project being deleted.  Remove this line after CreateProjectDirectoryStructure.bat has been executed.\r
128 \r
129 /*-----------------------------------------------------------*/\r
130 \r
131 /* The rate at which the LED controlled by the 'check' task will toggle when no\r
132 errors have been detected. */\r
133 #define mainNO_ERROR_PERIOD     ( 5000 )\r
134 \r
135 /* The rate at which the LED controlled by the 'check' task will toggle when an\r
136 error has been detected. */\r
137 #define mainERROR_PERIOD        ( 500 )\r
138 \r
139 /* The LED toggled by the Check task. */\r
140 #define mainCHECK_LED       ( 7 )\r
141 \r
142 /* The first LED used by the ComTest tasks.  One LED toggles each time a \r
143 character is transmitted, and one each time a character is received and\r
144 verified as being the expected character. */\r
145 #define mainCOMTEST_LED     ( 4 )\r
146 \r
147 /* Priority definitions for the tasks in the demo application. */\r
148 #define mainLED_TASK_PRIORITY           ( tskIDLE_PRIORITY + 1 )\r
149 #define mainCREATOR_TASK_PRIORITY       ( tskIDLE_PRIORITY + 3 )\r
150 #define mainCHECK_TASK_PRIORITY         ( tskIDLE_PRIORITY + 4 )\r
151 #define mainQUEUE_POLL_PRIORITY         ( tskIDLE_PRIORITY + 2 )\r
152 #define mainQUEUE_BLOCK_PRIORITY        ( tskIDLE_PRIORITY + 3 )\r
153 #define mainCOM_TEST_PRIORITY           ( tskIDLE_PRIORITY + 2 )\r
154 #define mainSEMAPHORE_TASK_PRIORITY     ( tskIDLE_PRIORITY + 1 )\r
155 #define mainGENERIC_QUEUE_PRIORITY      ( tskIDLE_PRIORITY )\r
156 #define mainREG_TEST_PRIORITY       ( tskIDLE_PRIORITY )\r
157 \r
158 /* Misc. */\r
159 #define mainDONT_WAIT                                           ( 0 )\r
160 \r
161 /* The parameters passed to the reg test tasks.  This is just done to check\r
162 the parameter passing mechanism is working correctly. */\r
163 #define mainREG_TEST_1_PARAMETER    ( ( void * ) 0x12345678 )\r
164 #define mainREG_TEST_2_PARAMETER    ( ( void * ) 0x87654321 )\r
165 \r
166 /*-----------------------------------------------------------*/\r
167 \r
168 /*\r
169  * Setup the processor ready for the demo.\r
170  */\r
171 static void prvSetupHardware( void );\r
172 \r
173 /*\r
174  * Execute all of the check functions to ensure the tests haven't failed.\r
175  */ \r
176 static void prvCheckTask( void *pvParameters );\r
177 \r
178 /*\r
179  * The register test (or RegTest) tasks as described at the top of this file.\r
180  */\r
181 static void prvFirstRegTestTask( void *pvParameters );\r
182 static void prvSecondRegTestTask( void *pvParameters );\r
183 \r
184 /*-----------------------------------------------------------*/\r
185 \r
186 /* Counters that are incremented on each iteration of the RegTest tasks\r
187 so long as no errors have been detected. */\r
188 volatile unsigned long ulRegTest1Counter = 0UL, ulRegTest2Counter = 0UL;\r
189 \r
190 /*-----------------------------------------------------------*/\r
191 \r
192 /*\r
193  * Create the demo tasks then start the scheduler.\r
194  */\r
195 int main( void )\r
196 {\r
197     /* Configure any hardware required for this demo. */\r
198         prvSetupHardware();\r
199     \r
200         /* Create all the other standard demo tasks.  These serve no purpose other\r
201     than to test the port and demonstrate the use of the FreeRTOS API. */\r
202         vStartLEDFlashTasks( tskIDLE_PRIORITY );\r
203         vStartIntegerMathTasks( mainGENERIC_QUEUE_PRIORITY );\r
204         vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
205         vStartBlockingQueueTasks( mainQUEUE_BLOCK_PRIORITY );\r
206         vCreateBlockTimeTasks();\r
207         vStartSemaphoreTasks( mainSEMAPHORE_TASK_PRIORITY );\r
208         vStartDynamicPriorityTasks();\r
209         vStartQueuePeekTasks();\r
210         vStartGenericQueueTasks( mainGENERIC_QUEUE_PRIORITY );\r
211         vStartCountingSemaphoreTasks();\r
212         vStartRecursiveMutexTasks();\r
213     vAltStartComTestTasks( mainCOM_TEST_PRIORITY, 0, mainCOMTEST_LED );\r
214     \r
215         /* prvCheckTask uses sprintf so requires more stack. */\r
216         xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
217     \r
218     /* The RegTest tasks as described at the top of this file. */\r
219     xTaskCreate( prvFirstRegTestTask, "Rreg1", configMINIMAL_STACK_SIZE, mainREG_TEST_1_PARAMETER, mainREG_TEST_PRIORITY, NULL );\r
220     xTaskCreate( prvSecondRegTestTask, "Rreg2", configMINIMAL_STACK_SIZE, mainREG_TEST_2_PARAMETER, mainREG_TEST_PRIORITY, NULL );\r
221 \r
222         /* This task has to be created last as it keeps account of the number of tasks\r
223         it expects to see running. */\r
224         vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );\r
225 \r
226     /* Finally start the scheduler. */\r
227         vTaskStartScheduler();\r
228     \r
229         /* Will only reach here if there is insufficient heap available to start\r
230         the scheduler. */\r
231         for( ;; );\r
232 }\r
233 /*-----------------------------------------------------------*/\r
234 \r
235 static void prvSetupHardware( void )\r
236 {\r
237     /* Setup the digital IO for the LED's. */\r
238     vParTestInitialise();\r
239 }\r
240 /*-----------------------------------------------------------*/\r
241 \r
242 void vApplicationStackOverflowHook( void )\r
243 {\r
244         /* Look at pxCurrentTCB to see which task overflowed its stack. */\r
245         for( ;; )\r
246     {\r
247                 asm( "break" );\r
248     }\r
249 }\r
250 /*-----------------------------------------------------------*/\r
251 \r
252 void _general_exception_handler( unsigned long ulCause, unsigned long ulStatus )\r
253 {\r
254         /* This overrides the definition provided by the kernel.  Other exceptions \r
255         should be handled here. */\r
256         for( ;; )\r
257     {\r
258                 asm( "break" );\r
259     }\r
260 }\r
261 /*-----------------------------------------------------------*/\r
262 \r
263 static void prvCheckTask( void *pvParameters )\r
264 {\r
265 portTickType xLastExecutionTime, ulTicksToWait = mainNO_ERROR_PERIOD;\r
266 unsigned long ulLastRegTest1 = 0UL, ulLastRegTest2 = 0UL;\r
267 const char * pcMessage;\r
268 \r
269         /* Initialise the variable used to control our iteration rate prior to\r
270         its first use. */\r
271         xLastExecutionTime = xTaskGetTickCount();\r
272 \r
273         for( ;; )\r
274         {\r
275                 /* Wait until it is time to run the tests again. */\r
276                 vTaskDelayUntil( &xLastExecutionTime, ulTicksToWait );\r
277                 \r
278                 /* Have any of the standard demo tasks detected an error in their \r
279                 operation? */\r
280                 if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
281                 {\r
282                         ulTicksToWait = mainERROR_PERIOD;\r
283                         pcMessage = "Error: Integer Maths.\n";\r
284                 }\r
285                 else if( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
286                 {\r
287                         ulTicksToWait = mainERROR_PERIOD;\r
288                         pcMessage = "Error: GenQ.\n";\r
289                 }\r
290                 else if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
291                 {\r
292                         ulTicksToWait = mainERROR_PERIOD;\r
293                         pcMessage = "Error: BlockQ.\n";\r
294                 }\r
295                 else if( xArePollingQueuesStillRunning() != pdTRUE )\r
296                 {\r
297                         ulTicksToWait = mainERROR_PERIOD;\r
298                         pcMessage = "Error: PollQ.\n";\r
299                 }\r
300                 else if( xAreQueuePeekTasksStillRunning() != pdTRUE )\r
301                 {\r
302                         ulTicksToWait = mainERROR_PERIOD;\r
303                         pcMessage = "Error: PeekQ.\n";\r
304                 }\r
305                 else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
306                 {\r
307                         ulTicksToWait = mainERROR_PERIOD;\r
308                         pcMessage = "Error: Block Time.\n";\r
309                 }\r
310                 else if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
311             {\r
312                 ulTicksToWait = mainERROR_PERIOD;\r
313                         pcMessage = "Error: Semaphore Test.\n";\r
314             }\r
315             else if( xAreComTestTasksStillRunning() != pdTRUE )\r
316             {\r
317                 ulTicksToWait = mainERROR_PERIOD;\r
318                         pcMessage = "Error: Comm Test.\n";\r
319             }\r
320                 else if( xIsCreateTaskStillRunning() != pdTRUE )\r
321                 {\r
322                         ulTicksToWait = mainERROR_PERIOD;\r
323                         pcMessage = "Error: Suicidal Tasks.\n";\r
324                 }\r
325                 else if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
326                 {\r
327                         ulTicksToWait = mainERROR_PERIOD;\r
328                         pcMessage = "Error: Dynamic Priority.\n";\r
329                 }\r
330                 else if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )\r
331                 {\r
332                         ulTicksToWait = mainERROR_PERIOD;\r
333                         pcMessage = "Error: Count Semaphore.\n";\r
334                 }\r
335                 else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
336                 {\r
337                         ulTicksToWait = mainERROR_PERIOD;\r
338                         pcMessage = "Error: Recursive Mutex.\n";\r
339                 }\r
340         else if( ulLastRegTest1 == ulRegTest1Counter )\r
341         {\r
342             /* ulRegTest1Counter is no longer being incremented, indicating\r
343             that an error has been discovered in prvFirstRegTestTask(). */\r
344             ulTicksToWait = mainERROR_PERIOD;\r
345             pcMessage = "Error: Reg Test1.\n";\r
346         }\r
347         else if( ulLastRegTest2 == ulRegTest2Counter )\r
348         {\r
349             /* ulRegTest2Counter is no longer being incremented, indicating\r
350             that an error has been discovered in prvSecondRegTestTask(). */            \r
351             ulTicksToWait = mainERROR_PERIOD;\r
352             pcMessage = "Error: Reg Test2.\n";\r
353         }\r
354                 else\r
355                 {\r
356                         pcMessage = NULL;\r
357                 }\r
358         \r
359         /* Remember the counter values this time around so a counter failing\r
360         to be incremented correctly can be spotted. */\r
361         ulLastRegTest1 = ulRegTest1Counter;\r
362         ulLastRegTest2 = ulRegTest2Counter;\r
363         \r
364         /* Print out an error message if there is one.  Mutual exclusion is \r
365         not used as this is the only task accessing stdout. */\r
366         if( pcMessage != NULL )\r
367         {\r
368             printf( pcMessage );\r
369         }\r
370         \r
371         /* Provide visual feedback of the system status.  If the LED is toggled\r
372         every 5 seconds then no errors have been found.  If the LED is toggled\r
373         every 500ms then at least one error has been found. */\r
374         vParTestToggleLED( mainCHECK_LED );\r
375         }\r
376 }\r
377 /*-----------------------------------------------------------*/\r
378 \r
379 static void prvFirstRegTestTask( void *pvParameters )\r
380 {\r
381     /* Check the parameters are passed in as expected. */\r
382     if( pvParameters != mainREG_TEST_1_PARAMETER )\r
383     {\r
384         /* Don't execute any further so an error is recognised by the check \r
385         task. */\r
386         vTaskDelete( NULL );\r
387     }\r
388     \r
389     /* Fill registers with known values, then check that each register still\r
390     contains its expected value.  An incorrect value is indicative of an error\r
391     in the context switching process. \r
392     \r
393     If no errors are found ulRegTest1Counter is incremented.  The check task\r
394     will recognise an error if ulRegTest1Counter stops being incremented. \r
395     This task also performs a manual yield in the middle of its execution, just\r
396     to increase the test coverage. */\r
397     asm volatile (\r
398         "   .extern ulRegTest1Counter           \n" \\r
399         "                                       \n" \\r
400         "   addi    r3, r0, 3                   \n" \\r
401         "   addi    r4, r0, 4                   \n" \\r
402         "   addi    r5, r0, 5                   \n" \\r
403         "   addi    r6, r0, 6                   \n" \\r
404         "   addi    r7, r0, 7                   \n" \\r
405         "   addi    r8, r0, 8                   \n" \\r
406         "   addi    r9, r0, 9                   \n" \\r
407         "   addi    r10, r0, 10                   \n" \\r
408         "   addi    r11, r0, 11                   \n" \\r
409         "   addi    r12, r0, 12                   \n" \\r
410         "   addi    r13, r0, 13                   \n" \\r
411         "   addi    r14, r0, 14                   \n" \\r
412         "   addi    r15, r0, 15                   \n" \\r
413         "   addi    r16, r0, 16                   \n" \\r
414         "   addi    r17, r0, 17                   \n" \\r
415         "   addi    r18, r0, 18                   \n" \\r
416         "   addi    r19, r0, 19                   \n" \\r
417         "   addi    r20, r0, 20                   \n" \\r
418         "   addi    r21, r0, 21                   \n" \\r
419         "   addi    r22, r0, 22                   \n" \\r
420         "   addi    r23, r0, 23                   \n" \\r
421         "   addi    r28, r0, 28                   \n" \\r
422         "   addi    r31, r0, 31                   \n" \\r
423         "RegTest1:                              \n" \\r
424         "   addi    r2, r0, 0                   \n" \\r
425         "   trap                                \n" \\r
426         "   bne     r2, r0, RegTest1Error       \n" \\r
427         "   addi    r2, r0, 3                   \n" \\r
428         "   bne     r2, r3, RegTest1Error       \n" \\r
429         "   addi    r2, r0, 4                   \n" \\r
430         "   bne     r2, r4, RegTest1Error       \n" \\r
431         "   addi    r2, r0, 5                   \n" \\r
432         "   bne     r2, r5, RegTest1Error       \n" \\r
433         "   addi    r2, r0, 6                   \n" \\r
434         "   bne     r2, r6, RegTest1Error       \n" \\r
435         "   addi    r2, r0, 7                   \n" \\r
436         "   bne     r2, r7, RegTest1Error       \n" \\r
437         "   addi    r2, r0, 8                   \n" \\r
438         "   bne     r2, r8, RegTest1Error       \n" \\r
439         "   addi    r2, r0, 9                   \n" \\r
440         "   bne     r2, r9, RegTest1Error       \n" \\r
441         "   addi    r2, r0, 10                   \n" \\r
442         "   bne     r2, r10, RegTest1Error       \n" \\r
443         "   addi    r2, r0, 11                   \n" \\r
444         "   bne     r2, r11, RegTest1Error       \n" \\r
445         "   addi    r2, r0, 12                   \n" \\r
446         "   bne     r2, r12, RegTest1Error       \n" \\r
447         "   addi    r2, r0, 13                   \n" \\r
448         "   bne     r2, r13, RegTest1Error       \n" \\r
449         "   addi    r2, r0, 14                   \n" \\r
450         "   bne     r2, r14, RegTest1Error       \n" \\r
451         "   addi    r2, r0, 15                   \n" \\r
452         "   bne     r2, r15, RegTest1Error       \n" \\r
453         "   addi    r2, r0, 16                   \n" \\r
454         "   bne     r2, r16, RegTest1Error       \n" \\r
455         "   addi    r2, r0, 17                   \n" \\r
456         "   bne     r2, r17, RegTest1Error       \n" \\r
457         "   addi    r2, r0, 18                   \n" \\r
458         "   bne     r2, r18, RegTest1Error       \n" \\r
459         "   addi    r2, r0, 19                   \n" \\r
460         "   bne     r2, r19, RegTest1Error       \n" \\r
461         "   addi    r2, r0, 20                   \n" \\r
462         "   bne     r2, r20, RegTest1Error       \n" \\r
463         "   addi    r2, r0, 21                   \n" \\r
464         "   bne     r2, r21, RegTest1Error       \n" \\r
465         "   addi    r2, r0, 22                   \n" \\r
466         "   bne     r2, r22, RegTest1Error       \n" \\r
467         "   addi    r2, r0, 23                   \n" \\r
468         "   bne     r2, r23, RegTest1Error       \n" \\r
469         "   addi    r2, r0, 28                   \n" \\r
470         "   bne     r2, r28, RegTest1Error       \n" \\r
471         "   addi    r2, r0, 31                   \n" \\r
472         "   bne     r2, r31, RegTest1Error       \n" \\r
473         "   ldw     r2, %gprel(ulRegTest1Counter)(gp)       \n" \\r
474         "   addi    r2, r2, 1                   \n" \\r
475         "   stw     r2, %gprel(ulRegTest1Counter)(gp)       \n" \\r
476         "   br      RegTest1                    \n" \\r
477         "RegTest1Error:                         \n" \\r
478         "   br      RegTest1Error               \n"\r
479     );\r
480 }\r
481 /*-----------------------------------------------------------*/\r
482 \r
483 static void prvSecondRegTestTask( void *pvParameters )\r
484 {\r
485     /* Check the parameters are passed in as expected. */\r
486     if( pvParameters != mainREG_TEST_2_PARAMETER )\r
487     {\r
488         /* Don't execute any further so an error is recognised by the check \r
489         task. */\r
490         vTaskDelete( NULL );\r
491     }\r
492     \r
493     /* Fill registers with known values, then check that each register still\r
494     contains its expected value.  An incorrect value is indicative of an error\r
495     in the context switching process. \r
496     \r
497     If no errors are found ulRegTest2Counter is incremented.  The check task\r
498     will recognise an error if ulRegTest2Counter stops being incremented. */\r
499     asm volatile (\r
500         "   .extern ulRegTest2Counter           \n" \\r
501         "                                       \n" \\r
502         "   addi    r3, r0, 3                   \n" \\r
503         "   addi    r4, r0, 4                   \n" \\r
504         "   addi    r5, r0, 5                   \n" \\r
505         "   addi    r6, r0, 6                   \n" \\r
506         "   addi    r7, r0, 7                   \n" \\r
507         "   addi    r8, r0, 8                   \n" \\r
508         "   addi    r9, r0, 9                   \n" \\r
509         "   addi    r10, r0, 10                   \n" \\r
510         "   addi    r11, r0, 11                   \n" \\r
511         "   addi    r12, r0, 12                   \n" \\r
512         "   addi    r13, r0, 13                   \n" \\r
513         "   addi    r14, r0, 14                   \n" \\r
514         "   addi    r15, r0, 15                   \n" \\r
515         "   addi    r16, r0, 16                   \n" \\r
516         "   addi    r17, r0, 17                   \n" \\r
517         "   addi    r18, r0, 18                   \n" \\r
518         "   addi    r19, r0, 19                   \n" \\r
519         "   addi    r20, r0, 20                   \n" \\r
520         "   addi    r21, r0, 21                   \n" \\r
521         "   addi    r22, r0, 22                   \n" \\r
522         "   addi    r23, r0, 23                   \n" \\r
523         "   addi    r28, r0, 28                   \n" \\r
524         "   addi    r31, r0, 31                   \n" \\r
525         "RegTest2:                              \n" \\r
526         "   addi    r2, r0, 0                   \n" \\r
527         "   bne     r2, r0, RegTest2Error       \n" \\r
528         "   addi    r2, r0, 3                   \n" \\r
529         "   bne     r2, r3, RegTest2Error       \n" \\r
530         "   addi    r2, r0, 4                   \n" \\r
531         "   bne     r2, r4, RegTest2Error       \n" \\r
532         "   addi    r2, r0, 5                   \n" \\r
533         "   bne     r2, r5, RegTest2Error       \n" \\r
534         "   addi    r2, r0, 6                   \n" \\r
535         "   bne     r2, r6, RegTest2Error       \n" \\r
536         "   addi    r2, r0, 7                   \n" \\r
537         "   bne     r2, r7, RegTest2Error       \n" \\r
538         "   addi    r2, r0, 8                   \n" \\r
539         "   bne     r2, r8, RegTest2Error       \n" \\r
540         "   addi    r2, r0, 9                   \n" \\r
541         "   bne     r2, r9, RegTest2Error       \n" \\r
542         "   addi    r2, r0, 10                   \n" \\r
543         "   bne     r2, r10, RegTest2Error       \n" \\r
544         "   addi    r2, r0, 11                   \n" \\r
545         "   bne     r2, r11, RegTest2Error       \n" \\r
546         "   addi    r2, r0, 12                   \n" \\r
547         "   bne     r2, r12, RegTest2Error       \n" \\r
548         "   addi    r2, r0, 13                   \n" \\r
549         "   bne     r2, r13, RegTest2Error       \n" \\r
550         "   addi    r2, r0, 14                   \n" \\r
551         "   bne     r2, r14, RegTest2Error       \n" \\r
552         "   addi    r2, r0, 15                   \n" \\r
553         "   bne     r2, r15, RegTest2Error       \n" \\r
554         "   addi    r2, r0, 16                   \n" \\r
555         "   bne     r2, r16, RegTest2Error       \n" \\r
556         "   addi    r2, r0, 17                   \n" \\r
557         "   bne     r2, r17, RegTest2Error       \n" \\r
558         "   addi    r2, r0, 18                   \n" \\r
559         "   bne     r2, r18, RegTest2Error       \n" \\r
560         "   addi    r2, r0, 19                   \n" \\r
561         "   bne     r2, r19, RegTest2Error       \n" \\r
562         "   addi    r2, r0, 20                   \n" \\r
563         "   bne     r2, r20, RegTest2Error       \n" \\r
564         "   addi    r2, r0, 21                   \n" \\r
565         "   bne     r2, r21, RegTest2Error       \n" \\r
566         "   addi    r2, r0, 22                   \n" \\r
567         "   bne     r2, r22, RegTest2Error       \n" \\r
568         "   addi    r2, r0, 23                   \n" \\r
569         "   bne     r2, r23, RegTest2Error       \n" \\r
570         "   addi    r2, r0, 28                   \n" \\r
571         "   bne     r2, r28, RegTest2Error       \n" \\r
572         "   addi    r2, r0, 31                   \n" \\r
573         "   bne     r2, r31, RegTest2Error       \n" \\r
574         "   ldw     r2, %gprel(ulRegTest2Counter)(gp)       \n" \\r
575         "   addi    r2, r2, 1                   \n" \\r
576         "   stw     r2, %gprel(ulRegTest2Counter)(gp)       \n" \\r
577         "   br      RegTest2                    \n" \\r
578         "RegTest2Error:                         \n" \\r
579         "   br      RegTest2Error               \n"\r
580     );\r
581 }\r
582 /*-----------------------------------------------------------*/\r
583 \r