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