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