]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/MB91460_Softune/SRC/main.c
Update version number.
[freertos] / FreeRTOS / Demo / MB91460_Softune / SRC / main.c
1 /*\r
2     FreeRTOS V7.5.1 - 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 /*\r
67  * Creates all the demo application tasks, then starts the scheduler.  The WEB\r
68  * documentation provides more details of the demo application tasks.\r
69  * \r
70  * In addition to the standard demo tasks, the follow demo specific tasks are\r
71  * create:\r
72  *\r
73  * The "Check" task.  This only executes every three seconds but has the highest \r
74  * priority so is guaranteed to get processor time.  Its main function is to \r
75  * check that all the other tasks are still operational.  Most tasks maintain \r
76  * a unique count that is incremented each time the task successfully completes \r
77  * its function.  Should any error occur within such a task the count is \r
78  * permanently halted.  The check task inspects the count of each task to ensure \r
79  * it has changed since the last time the check task executed.  If all the count \r
80  * variables have changed all the tasks are still executing error free, and the \r
81  * check task toggles the onboard LED.  Should any task contain an error at any time \r
82  * the LED toggle rate will change from 3 seconds to 500ms.\r
83  *\r
84  * The "Register Check" tasks.  These tasks fill the CPU registers with known\r
85  * values, then check that each register still contains the expected value 0 the\r
86  * discovery of an unexpected value being indicative of an error in the RTOS\r
87  * context switch mechanism.  The register check tasks operate at low priority\r
88  * so are switched in and out frequently.\r
89  *\r
90  * The "Trace Utility" task.  This can be used to obtain trace and debug \r
91  * information via UART5.\r
92  */\r
93 \r
94 \r
95 /* Hardware specific includes. */\r
96 #include "mb91467d.h"\r
97 #include "vectors.h"\r
98 #include "watchdog.h"\r
99 \r
100 /* Scheduler includes. */\r
101 #include "FreeRTOS.h"\r
102 #include "task.h"\r
103 \r
104 /* Demo app includes. */\r
105 #include "flash.h"\r
106 #include "integer.h"\r
107 #include "comtest2.h"\r
108 #include "semtest.h"\r
109 #include "BlockQ.h"\r
110 #include "dynamic.h"\r
111 #include "flop.h"\r
112 #include "GenQTest.h"\r
113 #include "QPeek.h"\r
114 #include "blocktim.h"\r
115 #include "death.h"\r
116 #include "taskutility.h"\r
117 #include "partest.h"\r
118 #include "crflash.h"\r
119         \r
120 /* Demo task priorities. */\r
121 #define mainWATCHDOG_TASK_PRIORITY              ( tskIDLE_PRIORITY + 5 )\r
122 #define mainCHECK_TASK_PRIORITY                 ( tskIDLE_PRIORITY + 4 )\r
123 #define mainUTILITY_TASK_PRIORITY               ( tskIDLE_PRIORITY )\r
124 #define mainSEM_TEST_PRIORITY                   ( tskIDLE_PRIORITY + 3 )\r
125 #define mainCOM_TEST_PRIORITY                   ( tskIDLE_PRIORITY + 2 )\r
126 #define mainQUEUE_BLOCK_PRIORITY                ( tskIDLE_PRIORITY + 2 )\r
127 #define mainDEATH_PRIORITY                              ( tskIDLE_PRIORITY + 1 )\r
128 #define mainLED_TASK_PRIORITY                   ( tskIDLE_PRIORITY + 1 )\r
129 #define mainGENERIC_QUEUE_PRIORITY              ( tskIDLE_PRIORITY )\r
130 \r
131 /* Baud rate used by the COM test tasks. */\r
132 #define mainCOM_TEST_BAUD_RATE                  ( ( unsigned portLONG ) 19200 )\r
133 \r
134 /* The frequency at which the 'Check' tasks executes.  See the comments at the \r
135 top of the page.  When the system is operating error free the 'Check' task\r
136 toggles an LED every three seconds.  If an error is discovered in any task the\r
137 rate is increased to 500 milliseconds.  [in this case the '*' characters on the \r
138 LCD represent LEDs]*/\r
139 #define mainNO_ERROR_CHECK_DELAY                ( ( portTickType ) 3000 / portTICK_RATE_MS  )\r
140 #define mainERROR_CHECK_DELAY                   ( ( portTickType ) 500 / portTICK_RATE_MS  )\r
141 \r
142 /* The total number of LEDs available. */\r
143 #define mainNO_CO_ROUTINE_LEDs  ( 8 )\r
144 \r
145 /* The first LED used by the comtest tasks. */\r
146 #define mainCOM_TEST_LED                ( 0x05 )\r
147 \r
148 /* The LED used by the check task. */\r
149 #define mainCHECK_TEST_LED              ( 0x07 )\r
150 \r
151 /* The number of interrupt levels to use. */\r
152 #define mainINTERRUPT_LEVELS    ( 31 )\r
153 \r
154 /* The number of 'flash' co-routines to create - each toggles a different LED. */\r
155 #define mainNUM_FLASH_CO_ROUTINES       ( 8 )\r
156 \r
157 /*---------------------------------------------------------------------------*/\r
158 \r
159 /* \r
160  * The function that implements the Check task.  See the comments at the head\r
161  * of the page for implementation details.\r
162  */ \r
163 static void prvErrorChecks( void *pvParameters );\r
164 \r
165 /*\r
166  * Called by the Check task.  Returns pdPASS if all the other tasks are found\r
167  * to be operating without error - otherwise returns pdFAIL.\r
168  */\r
169 static portSHORT prvCheckOtherTasksAreStillRunning( void );\r
170 \r
171 /* \r
172  * Setup the microcontroller as used by this demo. \r
173  */\r
174 static void prvSetupHardware( void );\r
175 \r
176 /*\r
177  * Tasks that test the context switch mechanism by filling the CPU registers\r
178  * with known values then checking that each register contains the value\r
179  * expected.  Each of the two tasks use different values, and as low priority\r
180  * tasks, get swapped in and out regularly.\r
181  */\r
182 static void vFirstRegisterTestTask( void *pvParameters );\r
183 static void vSecondRegisterTestTask( void *pvParameters );\r
184 \r
185 /*---------------------------------------------------------------------------*/\r
186 \r
187 /* The variable that is set to true should an error be found in one of the \r
188 register test tasks. */\r
189 unsigned portLONG ulRegTestError = pdFALSE;\r
190 \r
191 /*---------------------------------------------------------------------------*/\r
192 \r
193 /* Start all the demo application tasks, then start the scheduler. */\r
194 void main(void)\r
195 {\r
196         /* Initialise the hardware ready for the demo. */       \r
197         prvSetupHardware();\r
198 \r
199         /* Start the standard demo application tasks. */\r
200         vStartLEDFlashTasks( mainLED_TASK_PRIORITY );   \r
201         vStartIntegerMathTasks( tskIDLE_PRIORITY );\r
202         vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED - 1 );\r
203         vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
204         vStartBlockingQueueTasks ( mainQUEUE_BLOCK_PRIORITY );  \r
205         vStartDynamicPriorityTasks();   \r
206         vStartMathTasks( tskIDLE_PRIORITY );    \r
207         vStartGenericQueueTasks( mainGENERIC_QUEUE_PRIORITY );\r
208         vStartQueuePeekTasks();\r
209         vCreateBlockTimeTasks();\r
210         vStartFlashCoRoutines( mainNUM_FLASH_CO_ROUTINES );\r
211 \r
212         /* Start the 'Check' task which is defined in this file. */\r
213         xTaskCreate( prvErrorChecks, ( signed portCHAR * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );    \r
214 \r
215         /* Start the 'Register Test' tasks as described at the top of this file. */\r
216         xTaskCreate( vFirstRegisterTestTask, ( signed portCHAR * ) "Reg1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
217         xTaskCreate( vSecondRegisterTestTask, ( signed portCHAR * ) "Reg2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );\r
218 \r
219         /* Start the task that write trace information to the UART. */  \r
220         vUtilityStartTraceTask( mainUTILITY_TASK_PRIORITY );\r
221 \r
222         /* If we are going to service the watchdog from within a task, then create\r
223         the task here. */       \r
224         #if WATCHDOG == WTC_IN_TASK     \r
225                 vStartWatchdogTask( mainWATCHDOG_TASK_PRIORITY );\r
226         #endif          \r
227         \r
228         /* The suicide tasks must be started last as they record the number of other\r
229         tasks that exist within the system.  The value is then used to ensure at run\r
230         time the number of tasks that exists is within expected bounds. */\r
231         vCreateSuicidalTasks( mainDEATH_PRIORITY );\r
232 \r
233         /* Now start the scheduler.  Following this call the created tasks should\r
234         be executing. */        \r
235         vTaskStartScheduler( );\r
236         \r
237         /* vTaskStartScheduler() will only return if an error occurs while the \r
238         idle task is being created. */\r
239         for( ;; );\r
240 }\r
241 /*-----------------------------------------------------------*/\r
242 \r
243 static void prvErrorChecks( void *pvParameters )\r
244 {\r
245 portTickType xDelayPeriod = mainNO_ERROR_CHECK_DELAY, xLastExecutionTime;\r
246 \r
247         /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()\r
248         works correctly. */\r
249         xLastExecutionTime = xTaskGetTickCount();\r
250 \r
251         /* Cycle for ever, delaying then checking all the other tasks are still\r
252         operating without error. */\r
253         for( ;; )\r
254         {\r
255                 /* Wait until it is time to check again.  The time we wait here depends\r
256                 on whether an error has been detected or not.  When an error is \r
257                 detected the time is shortened resulting in a faster LED flash rate. */\r
258                 /* Perform this check every mainCHECK_DELAY milliseconds. */\r
259                 vTaskDelayUntil( &xLastExecutionTime, xDelayPeriod );\r
260 \r
261                 /* See if the other tasks are all ok. */\r
262                 if( prvCheckOtherTasksAreStillRunning() != pdPASS )\r
263                 {\r
264                         /* An error occurred in one of the tasks so shorten the delay \r
265                         period - which has the effect of increasing the frequency of the\r
266                         LED toggle. */\r
267                         xDelayPeriod = mainERROR_CHECK_DELAY;\r
268                 }\r
269 \r
270                 /* Flash! */\r
271                 vParTestToggleLED( mainCHECK_TEST_LED );\r
272         }\r
273 }\r
274 /*-----------------------------------------------------------*/\r
275 \r
276 static portSHORT prvCheckOtherTasksAreStillRunning( void )\r
277 {\r
278 portBASE_TYPE lReturn = pdPASS;\r
279 \r
280         /* The demo tasks maintain a count that increments every cycle of the task\r
281         provided that the task has never encountered an error.  This function \r
282         checks the counts maintained by the tasks to ensure they are still being\r
283         incremented.  A count remaining at the same value between calls therefore\r
284         indicates that an error has been detected. */\r
285 \r
286         if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
287         {\r
288                 lReturn = pdFAIL;\r
289         }\r
290 \r
291         if( xAreComTestTasksStillRunning() != pdTRUE )\r
292         {\r
293                 lReturn = pdFAIL;\r
294         }\r
295         \r
296         if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
297         {\r
298                 lReturn = pdFAIL;\r
299         }\r
300         \r
301         if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
302         {\r
303                 lReturn = pdFAIL;\r
304         }\r
305         \r
306         if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
307         {\r
308                 lReturn = pdFAIL;\r
309         }\r
310         \r
311         if( xAreMathsTaskStillRunning() != pdTRUE )\r
312         {\r
313                 lReturn = pdFAIL;\r
314         }\r
315         \r
316         if( xIsCreateTaskStillRunning() != pdTRUE )\r
317         {\r
318                 lReturn = pdFAIL;\r
319         }\r
320         \r
321         if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
322         {\r
323                 lReturn = pdFAIL;\r
324         }\r
325         \r
326         if ( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
327         {\r
328                 lReturn = pdFAIL;\r
329         }\r
330         \r
331         if ( xAreQueuePeekTasksStillRunning() != pdTRUE )\r
332         {\r
333                 lReturn = pdFAIL;\r
334         }\r
335 \r
336         /* Have the register test tasks found any errors? */\r
337         if( ulRegTestError != pdFALSE )\r
338         {\r
339                 lReturn = pdFAIL;\r
340         }\r
341 \r
342         return lReturn;\r
343 }\r
344 /*-----------------------------------------------------------*/\r
345 \r
346 static void prvSetupHardware( void )\r
347 {\r
348         /* Allow all interrupt levels. */\r
349         __set_il( mainINTERRUPT_LEVELS );\r
350 \r
351         /* Initialise interrupts. */\r
352         InitIrqLevels();\r
353 \r
354         /* Initialise the ports used by the LEDs. */\r
355         vParTestInitialise();\r
356 \r
357         /* If we are going to use the watchdog, then initialise it now. */\r
358         #if WATCHDOG != WTC_NONE        \r
359                 InitWatchdog();\r
360         #endif\r
361 }\r
362 /*-----------------------------------------------------------*/\r
363 \r
364 /* Idle hook function. */\r
365 #if configUSE_IDLE_HOOK == 1\r
366         void vApplicationIdleHook( void )\r
367         {\r
368                 /* Are we using the idle task to kick the watchdog?  See watchdog.h\r
369                 for watchdog kicking options. Note this is for demonstration only\r
370                 and is not a suggested method of servicing the watchdog in a real\r
371                 application. */\r
372                 #if WATCHDOG == WTC_IN_IDLE\r
373                         Kick_Watchdog();\r
374                 #endif\r
375 \r
376                 vCoRoutineSchedule();\r
377         }\r
378 #else\r
379         #if WATCHDOG == WTC_IN_IDLE\r
380                 #error configUSE_IDLE_HOOK must be set to 1 in FreeRTOSConfig.h if the watchdog is being cleared in the idle task hook.\r
381         #endif\r
382 #endif\r
383 \r
384 /*-----------------------------------------------------------*/\r
385 \r
386 /* Tick hook function. */\r
387 #if configUSE_TICK_HOOK == 1\r
388         void vApplicationTickHook( void )\r
389         {\r
390                 /* Are we using the tick to kick the watchdog?  See watchdog.h\r
391                 for watchdog kicking options.  Note this is for demonstration\r
392                 only and is not a suggested method of servicing the watchdog in\r
393                 a real application. */\r
394                 #if WATCHDOG == WTC_IN_TICK\r
395                         Kick_Watchdog();\r
396                 #endif\r
397         }\r
398 #else\r
399         #if WATCHDOG == WTC_IN_TICK\r
400                 #error configUSE_TICK_HOOK must be set to 1 in FreeRTOSConfig.h if the watchdog is being cleared in the tick hook.\r
401         #endif\r
402 #endif\r
403 /*-----------------------------------------------------------*/\r
404 \r
405 static void vFirstRegisterTestTask( void *pvParameters )\r
406 {\r
407 extern volatile unsigned portLONG ulCriticalNesting;\r
408 \r
409         /* Fills the registers with known values (different to the values\r
410         used in vSecondRegisterTestTask()), then checks that the registers still\r
411         all contain the expected value.  This is done to test the context save\r
412         and restore mechanism as this task is swapped onto and off of the CPU. */\r
413 \r
414         for( ;; )\r
415         {\r
416                 #pragma asm\r
417                         ;Load known values into each register.\r
418                         LDI     #0x11111111, R0\r
419                         LDI     #0x22222222, R1\r
420                         LDI     #0x33333333, R2\r
421                         LDI #0x44444444, R3\r
422                         LDI     #0x55555555, R4\r
423                         LDI     #0x66666666, R5\r
424                         LDI     #0x77777777, R6\r
425                         LDI     #0x88888888, R7\r
426                         LDI     #0x99999999, R8\r
427                         LDI     #0xaaaaaaaa, R9\r
428                         LDI     #0xbbbbbbbb, R10\r
429                         LDI     #0xcccccccc, R11\r
430                         LDI     #0xdddddddd, R12\r
431                         \r
432                         ;Check each register still contains the expected value.\r
433                         LDI #0x11111111, R13\r
434                         CMP R13, R0\r
435                         BNE First_Set_Error\r
436 \r
437                         LDI #0x22222222, R13\r
438                         CMP R13, R1\r
439                         BNE First_Set_Error\r
440 \r
441                         LDI #0x33333333, R13\r
442                         CMP R13, R2\r
443                         BNE First_Set_Error\r
444 \r
445                         LDI #0x44444444, R13\r
446                         CMP R13, R3\r
447                         BNE First_Set_Error\r
448 \r
449                         LDI #0x55555555, R13\r
450                         CMP R13, R4\r
451                         BNE First_Set_Error\r
452 \r
453                         LDI #0x66666666, R13\r
454                         CMP R13, R5\r
455                         BNE First_Set_Error\r
456 \r
457                         LDI #0x77777777, R13\r
458                         CMP R13, R6\r
459                         BNE First_Set_Error\r
460 \r
461                         LDI #0x88888888, R13\r
462                         CMP R13, R7\r
463                         BNE First_Set_Error\r
464 \r
465                         LDI #0x99999999, R13\r
466                         CMP R13, R8\r
467                         BNE First_Set_Error\r
468 \r
469                         LDI #0xaaaaaaaa, R13\r
470                         CMP R13, R9\r
471                         BNE First_Set_Error\r
472 \r
473                         LDI #0xbbbbbbbb, R13\r
474                         CMP R13, R10\r
475                         BNE First_Set_Error\r
476 \r
477                         LDI #0xcccccccc, R13\r
478                         CMP R13, R11\r
479                         BNE First_Set_Error\r
480 \r
481                         LDI #0xdddddddd, R13\r
482                         CMP R13, R12\r
483                         BNE First_Set_Error\r
484 \r
485                         BRA First_Start_Next_Loop\r
486 \r
487                 First_Set_Error:\r
488 \r
489                         ; Latch that an error has occurred.\r
490                         LDI #_ulRegTestError, R0                        \r
491                         LDI #0x00000001, R1\r
492                         ST R1, @R0\r
493 \r
494 \r
495                 First_Start_Next_Loop:\r
496 \r
497 \r
498                 #pragma endasm\r
499         }\r
500 }\r
501 /*-----------------------------------------------------------*/\r
502 \r
503 static void vSecondRegisterTestTask( void *pvParameters )\r
504 {\r
505 extern volatile unsigned portLONG ulCriticalNesting;\r
506 \r
507         /* Fills the registers with known values (different to the values\r
508         used in vFirstRegisterTestTask()), then checks that the registers still\r
509         all contain the expected value.  This is done to test the context save\r
510         and restore mechanism as this task is swapped onto and off of the CPU. */\r
511 \r
512         for( ;; )\r
513         {\r
514                 #pragma asm\r
515                         ;Load known values into each register.\r
516                         LDI     #0x11111111, R1\r
517                         LDI     #0x22222222, R2\r
518                         INT #40H\r
519                         LDI     #0x33333333, R3\r
520                         LDI #0x44444444, R4\r
521                         LDI     #0x55555555, R5\r
522                         LDI     #0x66666666, R6\r
523                         LDI     #0x77777777, R7\r
524                         LDI     #0x88888888, R8\r
525                         LDI     #0x99999999, R9\r
526                         INT #40H\r
527                         LDI     #0xaaaaaaaa, R10\r
528                         LDI     #0xbbbbbbbb, R11\r
529                         LDI     #0xcccccccc, R12\r
530                         LDI     #0xdddddddd, R0\r
531                         \r
532                         ;Check each register still contains the expected value.\r
533                         LDI #0x11111111, R13\r
534                         CMP R13, R1\r
535                         BNE Second_Set_Error\r
536 \r
537                         LDI #0x22222222, R13\r
538                         CMP R13, R2\r
539                         BNE Second_Set_Error\r
540 \r
541                         LDI #0x33333333, R13\r
542                         CMP R13, R3\r
543                         BNE Second_Set_Error\r
544 \r
545                         LDI #0x44444444, R13\r
546                         CMP R13, R4\r
547                         BNE Second_Set_Error\r
548 \r
549                         LDI #0x55555555, R13\r
550                         CMP R13, R5\r
551                         BNE Second_Set_Error\r
552 \r
553                         INT #40H\r
554 \r
555                         LDI #0x66666666, R13\r
556                         CMP R13, R6\r
557                         BNE Second_Set_Error\r
558 \r
559                         LDI #0x77777777, R13\r
560                         CMP R13, R7\r
561                         BNE Second_Set_Error\r
562 \r
563                         LDI #0x88888888, R13\r
564                         CMP R13, R8\r
565                         BNE Second_Set_Error\r
566 \r
567                         LDI #0x99999999, R13\r
568                         CMP R13, R9\r
569                         BNE Second_Set_Error\r
570 \r
571                         INT #40H\r
572 \r
573                         LDI #0xaaaaaaaa, R13\r
574                         CMP R13, R10\r
575                         BNE Second_Set_Error\r
576 \r
577                         LDI #0xbbbbbbbb, R13\r
578                         CMP R13, R11\r
579                         BNE Second_Set_Error\r
580 \r
581                         LDI #0xcccccccc, R13\r
582                         CMP R13, R12\r
583                         BNE Second_Set_Error\r
584 \r
585                         LDI #0xdddddddd, R13\r
586                         CMP R13, R0\r
587                         BNE Second_Set_Error\r
588 \r
589                         BRA Second_Start_Next_Loop\r
590 \r
591                 Second_Set_Error:\r
592 \r
593                         ; Latch that an error has occurred.\r
594                         LDI #_ulRegTestError, R0                        \r
595                         LDI #0x00000001, R1\r
596                         ST R1, @R0\r
597 \r
598 \r
599                 Second_Start_Next_Loop:\r
600 \r
601 \r
602                 #pragma endasm\r
603         }\r
604 }\r
605 /*-----------------------------------------------------------*/\r
606 \r
607 \r