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