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