]> git.sur5r.net Git - freertos/blob - Demo/TriCore_TC1782_TriBoard_GCC/RTOSDemo/main.c
385a29fe8d8ce78ace88f6dd8ea87ab281664f7c
[freertos] / Demo / TriCore_TC1782_TriBoard_GCC / RTOSDemo / main.c
1 /*\r
2     FreeRTOS V7.0.2 - Copyright (C) 2011 Real Time Engineers Ltd.\r
3 \r
4 \r
5     ***************************************************************************\r
6      *                                                                       *\r
7      *    FreeRTOS tutorial books are available in pdf and paperback.        *\r
8      *    Complete, revised, and edited pdf reference manuals are also       *\r
9      *    available.                                                         *\r
10      *                                                                       *\r
11      *    Purchasing FreeRTOS documentation will not only help you, by       *\r
12      *    ensuring you get running as quickly as possible and with an        *\r
13      *    in-depth knowledge of how to use FreeRTOS, it will also help       *\r
14      *    the FreeRTOS project to continue with its mission of providing     *\r
15      *    professional grade, cross platform, de facto standard solutions    *\r
16      *    for microcontrollers - completely free of charge!                  *\r
17      *                                                                       *\r
18      *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *\r
19      *                                                                       *\r
20      *    Thank you for using FreeRTOS, and thank you for your support!      *\r
21      *                                                                       *\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 modification to the GPL is included to allow you to\r
31     distribute a combined work that includes FreeRTOS without being obliged to\r
32     provide the source code for proprietary components outside of the FreeRTOS\r
33     kernel.  FreeRTOS is distributed in the hope that it will be useful, but\r
34     WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
35     or 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 /* Standard includes. */\r
55 #include <stdlib.h>\r
56 #include <string.h>\r
57 \r
58 /* Scheduler includes. */\r
59 #include "FreeRTOS.h"\r
60 #include "task.h"\r
61 #include "croutine.h"\r
62 \r
63 /* Demo application includes. */\r
64 #include "partest.h"\r
65 #include "flash.h"\r
66 #include "integer.h"\r
67 #include "PollQ.h"\r
68 #include "comtest2.h"\r
69 #include "semtest.h"\r
70 #include "dynamic.h"\r
71 #include "BlockQ.h"\r
72 #include "blocktim.h"\r
73 #include "countsem.h"\r
74 #include "GenQTest.h"\r
75 #include "recmutex.h"\r
76 #include "serial.h"\r
77 /*-----------------------------------------------------------*/\r
78 \r
79 /* Constants for the ComTest tasks. */\r
80 #define mainCOM_TEST_BAUD_RATE  ( ( unsigned long ) 115200 )\r
81 #define mainCOM_TEST_LED                ( 5 )\r
82 \r
83 /* Priorities for the demo application tasks. */\r
84 #define mainLED_TASK_PRIORITY           ( ( tskIDLE_PRIORITY + 1 ) | portPRIVILEGE_BIT )\r
85 #define mainCOM_TEST_PRIORITY           ( ( tskIDLE_PRIORITY + 2 ) | portPRIVILEGE_BIT )\r
86 #define mainQUEUE_POLL_PRIORITY         ( tskIDLE_PRIORITY + 2 )\r
87 #define mainCHECK_TASK_PRIORITY         ( ( tskIDLE_PRIORITY + 4 ) | portPRIVILEGE_BIT )\r
88 #define mainSEM_TEST_PRIORITY           ( tskIDLE_PRIORITY + 1 )\r
89 #define mainBLOCK_Q_PRIORITY            ( tskIDLE_PRIORITY + 2 )\r
90 \r
91 /* The rate at which the on board LED will toggle when there is/is not an\r
92 error. */\r
93 #define mainNO_ERROR_FLASH_PERIOD       ( ( portTickType ) 5000 / portTICK_RATE_MS      )\r
94 #define mainERROR_FLASH_PERIOD          ( ( portTickType ) 500 / portTICK_RATE_MS  )\r
95 #define mainON_BOARD_LED_BIT            ( ( unsigned long ) 7 )\r
96 #define mainREG_TEST_TASKS                      1\r
97 /*-----------------------------------------------------------*/\r
98 \r
99 /*\r
100  * Checks that all the demo application tasks are still executing without error\r
101  * - as described at the top of the file.\r
102  */\r
103 static long prvCheckOtherTasksAreStillRunning( void );\r
104 \r
105 /*\r
106  * The task that executes at the highest priority and calls\r
107  * prvCheckOtherTasksAreStillRunning().  See the description at the top\r
108  * of the file.\r
109  */\r
110 static void vErrorChecks( void *pvParameters );\r
111 /*-----------------------------------------------------------*/\r
112 \r
113 /*\r
114  * Configure the processor for use with the Olimex demo board.  This includes\r
115  * setup for the I/O, system clock, and access timings.\r
116  */\r
117 static void prvSetupHardware( void );\r
118 \r
119 /*\r
120  * Function to create the heavily restricted RegTest tasks.\r
121  */\r
122 static void vStartRegTestTasks( unsigned portBASE_TYPE uxPriority );\r
123 \r
124 #if mainREG_TEST_TASKS == 1\r
125 \r
126 /*\r
127  * Writes to and checks the value of each register that is used in the context\r
128  * of a task.\r
129  */\r
130 static void vRegTask1( void *pvParameters );\r
131 static void vRegTask2( void *pvParameters );\r
132 \r
133 /*\r
134  * Specific check to see if the Register test functions are still operating.\r
135  */\r
136 static portBASE_TYPE xAreRegTestTasksStillRunning( void );\r
137 \r
138 #endif /* mainREG_TEST_TASKS */\r
139 /*-----------------------------------------------------------*/\r
140 \r
141 /* Used by the register test tasks to indicated liveness. */\r
142 static unsigned long ulRegisterTest1Count = 0;\r
143 static unsigned long ulRegisterTest2Count = 0;\r
144 /*-----------------------------------------------------------*/\r
145 \r
146 /*\r
147  * Starts all the other tasks, then starts the scheduler.\r
148  */\r
149 int main( void )\r
150 {\r
151         /* Setup the hardware for use with the TriCore evaluation board. */\r
152         prvSetupHardware();\r
153 \r
154         /* Start the demo/test application tasks. */\r
155         vStartIntegerMathTasks( tskIDLE_PRIORITY );\r
156         vStartLEDFlashTasks( mainLED_TASK_PRIORITY );\r
157         vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );\r
158         vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );\r
159         vStartDynamicPriorityTasks();\r
160         vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );\r
161         vCreateBlockTimeTasks();\r
162         vStartCountingSemaphoreTasks();\r
163         vStartGenericQueueTasks( tskIDLE_PRIORITY );\r
164         vStartRecursiveMutexTasks();\r
165         vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainCOM_TEST_BAUD_RATE, mainCOM_TEST_LED );\r
166         vStartRegTestTasks( tskIDLE_PRIORITY );\r
167 \r
168         /* Start the check task - which is defined in this file. */\r
169         xTaskCreate( vErrorChecks, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );\r
170 \r
171         /* Now all the tasks have been started - start the scheduler. */\r
172         vTaskStartScheduler();\r
173 \r
174         /* Should never reach here! */\r
175         for( ;; );\r
176 }\r
177 /*-----------------------------------------------------------*/\r
178 \r
179 static void vErrorChecks( void *pvParameters )\r
180 {\r
181 portTickType xDelayPeriod = mainNO_ERROR_FLASH_PERIOD;\r
182 \r
183         /* Just to stop compiler warnings. */\r
184         ( void ) pvParameters;\r
185 \r
186         /* Cycle for ever, delaying then checking all the other tasks are still\r
187         operating without error.  If an error is detected then the delay period\r
188         is decreased from mainNO_ERROR_FLASH_PERIOD to mainERROR_FLASH_PERIOD so\r
189         the on board LED flash rate will increase. */\r
190 \r
191         for( ;; )\r
192         {\r
193                 /* Delay until it is time to execute again. */\r
194                 vTaskDelay( xDelayPeriod );\r
195 \r
196                 /* Check all the standard demo application tasks are executing without\r
197                 error.  */\r
198                 if( prvCheckOtherTasksAreStillRunning() != pdPASS )\r
199                 {\r
200                         /* An error has been detected in one of the tasks - flash faster. */\r
201                         xDelayPeriod = mainERROR_FLASH_PERIOD;\r
202                 }\r
203 \r
204                 /* The toggle rate of the LED depends on how long this task delays for.\r
205                 An error reduces the delay period and so increases the toggle rate. */\r
206                 vParTestToggleLED( mainON_BOARD_LED_BIT );\r
207         }\r
208 }\r
209 /*-----------------------------------------------------------*/\r
210 \r
211 static long prvCheckOtherTasksAreStillRunning( void )\r
212 {\r
213 long lReturn = pdPASS;\r
214 \r
215         /* Check all the demo tasks (other than the flash tasks) to ensure\r
216         that they are all still running, and that none of them have detected\r
217         an error. */\r
218 \r
219         if( xAreIntegerMathsTaskStillRunning() != pdTRUE )\r
220         {\r
221                 lReturn = pdFAIL;\r
222         }\r
223 \r
224         if( xAreComTestTasksStillRunning() != pdTRUE )\r
225         {\r
226                 lReturn = pdFAIL;\r
227         }\r
228 \r
229         if( xArePollingQueuesStillRunning() != pdTRUE )\r
230         {\r
231                 lReturn = pdFAIL;\r
232         }\r
233 \r
234         if( xAreSemaphoreTasksStillRunning() != pdTRUE )\r
235         {\r
236                 lReturn = pdFAIL;\r
237         }\r
238 \r
239         if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )\r
240         {\r
241                 lReturn = pdFAIL;\r
242         }\r
243 \r
244         if( xAreBlockingQueuesStillRunning() != pdTRUE )\r
245         {\r
246                 lReturn = pdFAIL;\r
247         }\r
248 \r
249         if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
250         {\r
251                 lReturn = pdFAIL;\r
252         }\r
253 \r
254         if ( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
255         {\r
256                 lReturn = pdFAIL;\r
257         }\r
258 \r
259         if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
260         {\r
261                 lReturn = pdFAIL;\r
262         }\r
263 \r
264         if( xAreRegTestTasksStillRunning() != pdTRUE )\r
265         {\r
266                 lReturn = pdFAIL;\r
267         }\r
268 \r
269         return lReturn;\r
270 }\r
271 /*-----------------------------------------------------------*/\r
272 \r
273 static void prvSetupHardware( void )\r
274 {\r
275 extern void set_cpu_frequency(void);\r
276 \r
277         /* Set-up the PLL. */\r
278         set_cpu_frequency();\r
279 \r
280         /* Initialise LED outputs. */\r
281         vParTestInitialise();\r
282 }\r
283 /*-----------------------------------------------------------*/\r
284 \r
285 void vApplicationMallocFailedHook( void )\r
286 {\r
287         /* This function will be called if a call to pvPortMalloc() fails to return\r
288         the requested memory.  pvPortMalloc() is called internally by the scheduler\r
289         whenever a task, queue or semaphore is created. */\r
290         _debug();\r
291         for( ;; );\r
292 }\r
293 /*-----------------------------------------------------------*/\r
294 \r
295 void vApplicationTickHook( void )\r
296 {\r
297         /*\r
298          * This function will be called whenever the system tick is incremented.\r
299          * Note that it is executed as part of an interrupt and as such should\r
300          * not block nor be used for any long running execution.\r
301          */\r
302         vParTestToggleLED( mainON_BOARD_LED_BIT - 1 );\r
303 }\r
304 /*-----------------------------------------------------------*/\r
305 \r
306 void vApplicationIdleHook( void )\r
307 {\r
308         /*\r
309          * This function will be called during the normal execution of the IDLE task.\r
310          */\r
311 }\r
312 /*-----------------------------------------------------------*/\r
313 \r
314 #if mainREG_TEST_TASKS == 1\r
315 \r
316 static void vStartRegTestTasks( unsigned portBASE_TYPE uxPriority )\r
317 {\r
318         (void)xTaskCreate( vRegTask1, ( signed char * ) "Reg 1", configMINIMAL_STACK_SIZE, &ulRegisterTest1Count, uxPriority, NULL );\r
319         (void)xTaskCreate( vRegTask2, ( signed char * ) "Reg 2", configMINIMAL_STACK_SIZE, &ulRegisterTest2Count, uxPriority, NULL );\r
320 }\r
321 /*-----------------------------------------------------------*/\r
322 \r
323 portBASE_TYPE xAreRegTestTasksStillRunning( void )\r
324 {\r
325 static unsigned long ulPreviousRegisterTest1Count = 0;\r
326 static unsigned long ulPreviousRegisterTest2Count = 0;\r
327 portBASE_TYPE xReturn = pdFALSE;\r
328 \r
329         /* Check to see if the Counts have changed since the last check. */\r
330         xReturn = ( ulPreviousRegisterTest1Count != ulRegisterTest1Count );\r
331         xReturn = xReturn && ( ulPreviousRegisterTest2Count != ulRegisterTest2Count );\r
332 \r
333         /* Record the last count. */\r
334         ulPreviousRegisterTest1Count = ulRegisterTest1Count;\r
335         ulPreviousRegisterTest2Count = ulRegisterTest2Count;\r
336 \r
337         return xReturn;\r
338 }\r
339 /*-----------------------------------------------------------*/\r
340 \r
341 /*\r
342  * Set all of the registers that are used as part of the task context\r
343  * to known values and test that those values are maintained across\r
344  * context switches.\r
345  */\r
346 void vRegTask1( void *pvParameters )\r
347 {\r
348         /* Make space on the stack for the parameter and a counter. */\r
349         __asm volatile( " sub.a %sp, 4                  \n"\r
350                                         " st.a [%sp], %a4               \n"\r
351                                         " mov %d15, 0                   \n"\r
352                                         " st.w [%sp]4, %d15             \n" );\r
353 \r
354         for (;;)\r
355         {\r
356                 /* Change all of the Context sensitive registers (except SP and RA). */\r
357                 __asm volatile(\r
358                                 " mov %d0, 0            \n"\r
359                                 " mov %d1, 1            \n"\r
360                                 " mov %d2, 2            \n"\r
361                                 " mov %d3, 3            \n"\r
362                                 " mov %d4, 4            \n"\r
363                                 " mov %d5, 5            \n"\r
364                                 " mov %d6, 6            \n"\r
365                                 " mov %d7, 7            \n"\r
366                                 " mov %d8, 8            \n"\r
367                                 " mov %d9, 9            \n"\r
368                                 " mov %d10, 10          \n"\r
369                                 " mov %d11, 11          \n"\r
370                                 " mov %d12, 12          \n"\r
371                                 " mov %d13, 13          \n"\r
372                                 " mov %d14, 14          \n"\r
373                                 " mov %d15, 15          \n"\r
374                                 " mov.a %a2, 2          \n"\r
375                                 " mov.a %a3, 3          \n"\r
376                                 " mov.a %a4, 4          \n"\r
377                                 " mov.a %a5, 5          \n"\r
378                                 " mov.a %a6, 6          \n"\r
379                                 " mov.a %a7, 7          \n"\r
380                                 " mov.a %a12, 12        \n"\r
381                                 " mov.a %a13, 13        \n"\r
382                                 " mov.a %a14, 14        \n" );\r
383                 /* Yield to force a context switch. */\r
384                 taskYIELD();\r
385                 /* Check the values of the registers. */\r
386                 __asm(  " eq %d0, %d0, 0                                        \n" \\r
387                                 " jne %d0, 1, _task1_loop                       \n" \\r
388                                 " eq %d1, %d1, 1                                        \n" \\r
389                                 " jne %d1, 1, _task1_loop                       \n" \\r
390                                 " eq %d2, %d2, 2                                        \n" \\r
391                                 " jne %d2, 1, _task1_loop                       \n" \\r
392                                 " eq %d3, %d3, 3                                        \n" \\r
393                                 " jne %d3, 1, _task1_loop                       \n" \\r
394                                 " eq %d4, %d4, 4                                        \n" \\r
395                                 " jne %d4, 1, _task1_loop                       \n" \\r
396                                 " eq %d5, %d5, 5                                        \n" \\r
397                                 " jne %d5, 1, _task1_loop                       \n" \\r
398                                 " eq %d6, %d6, 6                                        \n" \\r
399                                 " jne %d6, 1, _task1_loop                       \n" \\r
400                                 " eq %d7, %d7, 7                                        \n" \\r
401                                 " jne %d7, 1, _task1_loop                       \n" \\r
402                                 " eq %d8, %d8, 8                                        \n" \\r
403                                 " jne %d8, 1, _task1_loop                       \n" \\r
404                                 " eq %d9, %d9, 9                                        \n" \\r
405                                 " jne %d9, 1, _task1_loop                       \n" \\r
406                                 " eq %d10, %d10, 10                                     \n" \\r
407                                 " jne %d10, 1, _task1_loop                      \n" \\r
408                                 " eq %d11, %d11, 11                                     \n" \\r
409                                 " jne %d11, 1, _task1_loop                      \n" \\r
410                                 " eq %d12, %d12, 12                                     \n" \\r
411                                 " jne %d12, 1, _task1_loop                      \n" \\r
412                                 " eq %d13, %d13, 13                                     \n" \\r
413                                 " jne %d13, 1, _task1_loop                      \n" \\r
414                                 " eq %d14, %d14, 14                                     \n" \\r
415                                 " jne %d14, 1, _task1_loop                      \n" \\r
416                                 " eq %d15, %d15, 15                                     \n" \\r
417                                 " jne %d15, 1, _task1_loop                      \n" \\r
418                                 " mov.a %a15, 2                                         \n" \\r
419                                 " jne.a %a15, %a2, _task1_loop          \n" \\r
420                                 " mov.a %a15, 3                                         \n" \\r
421                                 " jne.a %a15, %a3, _task1_loop          \n" \\r
422                                 " mov.a %a15, 4                                         \n" \\r
423                                 " jne.a %a15, %a4, _task1_loop          \n" \\r
424                                 " mov.a %a15, 5                                         \n" \\r
425                                 " jne.a %a15, %a5, _task1_loop          \n" \\r
426                                 " mov.a %a15, 6                                         \n" \\r
427                                 " jne.a %a15, %a6, _task1_loop          \n" \\r
428                                 " mov.a %a15, 7                                         \n" \\r
429                                 " jne.a %a15, %a7, _task1_loop          \n" \\r
430                                 " mov.a %a15, 12                                        \n" \\r
431                                 " jne.a %a15, %a12, _task1_loop         \n" \\r
432                                 " mov.a %a15, 13                                        \n" \\r
433                                 " jne.a %a15, %a13, _task1_loop         \n" \\r
434                                 " mov.a %a15, 14                                        \n" \\r
435                                 " jne.a %a15, %a14, _task1_loop         \n" \\r
436                                 " j _task1_skip                                         \n"     \\r
437                                 "_task1_loop:                                           \n"     \\r
438                                 "       debug                                                   \n"     \\r
439                                 " j _task1_loop                                         \n"     \\r
440                                 "_task1_skip:                                           \n" );\r
441 \r
442                 /* Load the parameter address from the stack and modify the value. */\r
443                 __asm volatile(                                                         \\r
444                                 " ld.w %d15, [%sp]4                                     \n"     \\r
445                                 " add %d15, %d15, 1                                     \n"     \\r
446                                 " st.w [%sp]4, %d15                                     \n"     \\r
447                                 " ld.a %a4, [%sp]                                       \n"     \\r
448                                 " st.w [%a4], %d15                                      \n"     );\r
449         }\r
450 \r
451         /* The parameter is used but in the assembly. */\r
452         (void)pvParameters;\r
453 }\r
454 /*-----------------------------------------------------------*/\r
455 \r
456 /*\r
457  * Set all of the registers that are used as part of the task context\r
458  * to known values and test that those values are maintained across\r
459  * context switches.\r
460  */\r
461 void vRegTask2( void *pvParameters )\r
462 {\r
463         /* Make space on the stack for the parameter and a counter. */\r
464         __asm volatile( " sub.a %sp, 4          \n" \\r
465                                         " st.a [%sp], %a4       \n" \\r
466                                         " mov %d15, 0           \n" \\r
467                                         " st.w [%sp]4, %d15     \n" );\r
468 \r
469         for (;;)\r
470         {\r
471                 /* Change all of the Context sensitive registers (except SP and RA). */\r
472                 __asm(  " mov %d0, 7            \n" \\r
473                                 " mov %d1, 6            \n" \\r
474                                 " mov %d2, 5            \n" \\r
475                                 " mov %d3, 4            \n" \\r
476                                 " mov %d4, 3            \n" \\r
477                                 " mov %d5, 2            \n" \\r
478                                 " mov %d6, 1            \n" \\r
479                                 " mov %d7, 0            \n" \\r
480                                 " mov %d8, 15           \n" \\r
481                                 " mov %d9, 14           \n" \\r
482                                 " mov %d10, 13          \n" \\r
483                                 " mov %d11, 12          \n" \\r
484                                 " mov %d12, 11          \n" \\r
485                                 " mov %d13, 10          \n" \\r
486                                 " mov %d14, 9           \n" \\r
487                                 " mov %d15, 8           \n" \\r
488                                 " mov.a %a2, 14         \n" \\r
489                                 " mov.a %a3, 13         \n" \\r
490                                 " mov.a %a4, 12         \n" \\r
491                                 " mov.a %a5, 7          \n" \\r
492                                 " mov.a %a6, 6          \n" \\r
493                                 " mov.a %a7, 5          \n" \\r
494                                 " mov.a %a12, 4         \n" \\r
495                                 " mov.a %a13, 3         \n" \\r
496                                 " mov.a %a14, 2         \n" );\r
497                 /* Yield to force a context switch. */\r
498                 taskYIELD();\r
499                 /* Check the values of the registers. */\r
500                 __asm(  " eq %d0, %d0, 7                                \n" \\r
501                                 " jne %d0, 1, _task2_loop               \n" \\r
502                                 " eq %d1, %d1, 6                                \n" \\r
503                                 " jne %d1, 1, _task2_loop               \n" \\r
504                                 " eq %d2, %d2, 5                                \n" \\r
505                                 " jne %d2, 1, _task2_loop               \n" \\r
506                                 " eq %d3, %d3, 4                                \n" \\r
507                                 " jne %d3, 1, _task2_loop               \n" \\r
508                                 " eq %d4, %d4, 3                                \n" \\r
509                                 " jne %d4, 1, _task2_loop               \n" \\r
510                                 " eq %d5, %d5, 2                                \n" \\r
511                                 " jne %d5, 1, _task2_loop               \n" \\r
512                                 " eq %d6, %d6, 1                                \n" \\r
513                                 " jne %d6, 1, _task2_loop               \n" \\r
514                                 " eq %d7, %d7, 0                                \n" \\r
515                                 " jne %d7, 1, _task2_loop               \n" \\r
516                                 " eq %d8, %d8, 15                               \n" \\r
517                                 " jne %d8, 1, _task2_loop               \n" \\r
518                                 " eq %d9, %d9, 14                               \n" \\r
519                                 " jne %d9, 1, _task2_loop               \n" \\r
520                                 " eq %d10, %d10, 13                             \n" \\r
521                                 " jne %d10, 1, _task2_loop              \n" \\r
522                                 " eq %d11, %d11, 12                             \n" \\r
523                                 " jne %d11, 1, _task2_loop              \n" \\r
524                                 " eq %d12, %d12, 11                             \n" \\r
525                                 " jne %d12, 1, _task2_loop              \n" \\r
526                                 " eq %d13, %d13, 10                             \n" \\r
527                                 " jne %d13, 1, _task2_loop              \n" \\r
528                                 " eq %d14, %d14, 9                              \n" \\r
529                                 " jne %d14, 1, _task2_loop              \n" \\r
530                                 " eq %d15, %d15, 8                              \n" \\r
531                                 " jne %d15, 1, _task2_loop              \n" \\r
532                                 " mov.a %a15, 14                                \n" \\r
533                                 " jne.a %a15, %a2, _task2_loop  \n" \\r
534                                 " mov.a %a15, 13                                \n" \\r
535                                 " jne.a %a15, %a3, _task2_loop  \n" \\r
536                                 " mov.a %a15, 12                                \n" \\r
537                                 " jne.a %a15, %a4, _task2_loop  \n" \\r
538                                 " mov.a %a15, 7                                 \n" \\r
539                                 " jne.a %a15, %a5, _task2_loop  \n" \\r
540                                 " mov.a %a15, 6                                 \n" \\r
541                                 " jne.a %a15, %a6, _task2_loop  \n" \\r
542                                 " mov.a %a15, 5                                 \n" \\r
543                                 " jne.a %a15, %a7, _task2_loop  \n" \\r
544                                 " mov.a %a15, 4                                 \n" \\r
545                                 " jne.a %a15, %a12, _task2_loop \n" \\r
546                                 " mov.a %a15, 3                                 \n" \\r
547                                 " jne.a %a15, %a13, _task2_loop \n" \\r
548                                 " mov.a %a15, 2                                 \n" \\r
549                                 " jne.a %a15, %a14, _task2_loop \n" \\r
550                                 " j _task2_skip \n"     \\r
551                                 "_task2_loop:   \n"     \\r
552                                 " j _task2_loop \n"     \\r
553                                 "_task2_skip:   \n"     );\r
554 \r
555                 /* Load the parameter address from the stack and modify the value. */\r
556                 __asm volatile(                                                         \\r
557                                 " ld.w %d15, [%sp]4                             \n"     \\r
558                                 " add %d15, %d15, 1                             \n"     \\r
559                                 " st.w [%sp]4, %d15                             \n"     \\r
560                                 " ld.a %a4, [%sp]                               \n"     \\r
561                                 " st.w [%a4], %d15                              \n"     );\r
562         }\r
563 \r
564         /* The parameter is used but in the assembly. */\r
565         (void)pvParameters;\r
566 }\r
567 /*-----------------------------------------------------------*/\r
568 #endif /* mainREG_TEST_TASKS */\r