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