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