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