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