]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RX100-RSK_GCC_e2studio/RTOSDemo/main_full.c
Commit 3 RX100 low power demos.
[freertos] / FreeRTOS / Demo / RX100-RSK_GCC_e2studio / RTOSDemo / main_full.c
1 /*\r
2     FreeRTOS V7.4.0 - Copyright (C) 2013 Real Time Engineers Ltd.\r
3 \r
4     FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME.  PLEASE VISIT\r
5     http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
6 \r
7     ***************************************************************************\r
8      *                                                                       *\r
9      *    FreeRTOS tutorial books are available in pdf and paperback.        *\r
10      *    Complete, revised, and edited pdf reference manuals are also       *\r
11      *    available.                                                         *\r
12      *                                                                       *\r
13      *    Purchasing FreeRTOS documentation will not only help you, by       *\r
14      *    ensuring you get running as quickly as possible and with an        *\r
15      *    in-depth knowledge of how to use FreeRTOS, it will also help       *\r
16      *    the FreeRTOS project to continue with its mission of providing     *\r
17      *    professional grade, cross platform, de facto standard solutions    *\r
18      *    for microcontrollers - completely free of charge!                  *\r
19      *                                                                       *\r
20      *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *\r
21      *                                                                       *\r
22      *    Thank you for using FreeRTOS, and thank you for your support!      *\r
23      *                                                                       *\r
24     ***************************************************************************\r
25 \r
26 \r
27     This file is part of the FreeRTOS distribution.\r
28 \r
29     FreeRTOS is free software; you can redistribute it and/or modify it under\r
30     the terms of the GNU General Public License (version 2) as published by the\r
31     Free Software Foundation AND MODIFIED BY the FreeRTOS exception.\r
32 \r
33     >>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to\r
34     distribute a combined work that includes FreeRTOS without being obliged to\r
35     provide the source code for proprietary components outside of the FreeRTOS\r
36     kernel.\r
37 \r
38     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
39     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
40     FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\r
41     details. You should have received a copy of the GNU General Public License\r
42     and the FreeRTOS license exception along with FreeRTOS; if not itcan be\r
43     viewed here: http://www.freertos.org/a00114.html and also obtained by\r
44     writing to Real Time Engineers Ltd., contact details for whom are available\r
45     on the FreeRTOS WEB site.\r
46 \r
47     1 tab == 4 spaces!\r
48 \r
49     ***************************************************************************\r
50      *                                                                       *\r
51      *    Having a problem?  Start by reading the FAQ "My application does   *\r
52      *    not run, what could be wrong?"                                     *\r
53      *                                                                       *\r
54      *    http://www.FreeRTOS.org/FAQHelp.html                               *\r
55      *                                                                       *\r
56     ***************************************************************************\r
57 \r
58 \r
59     http://www.FreeRTOS.org - Documentation, books, training, latest versions,\r
60     license and Real Time Engineers Ltd. contact details.\r
61 \r
62     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
63     including FreeRTOS+Trace - an indispensable productivity tool, and our new\r
64     fully thread aware and reentrant UDP/IP stack.\r
65 \r
66     http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High\r
67     Integrity Systems, who sell the code with commercial support,\r
68     indemnification and middleware, under the OpenRTOS brand.\r
69 \r
70     http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
71     engineered and independently SIL3 certified version for use in safety and\r
72     mission critical applications that require provable dependability.\r
73 */\r
74 \r
75 /* ****************************************************************************\r
76  * This project includes a lot of tasks and tests and is therefore complex.\r
77  * If you would prefer a much simpler project to get started with then select\r
78  * the 'low power' demo by setting configCREATE_LOW_POWER_DEMO to 1 in\r
79  * FreeRTOSConfig.h.  When configCREATE_LOW_POWER_DEMO is set to 1 main() will\r
80  * call main_low_power() instead of main_full().\r
81  * ****************************************************************************\r
82  *\r
83  * Creates all the demo application tasks, then starts the scheduler.  The web\r
84  * documentation provides more details of the standard demo application tasks,\r
85  * which provide no particular functionality but do provide a good example of\r
86  * how to use the FreeRTOS API.\r
87  *\r
88  * In addition to the standard demo tasks, the following tasks and tests are\r
89  * defined and/or created within this file:\r
90  *\r
91  * "Reg test" tasks - These fill the registers with known values, then\r
92  * repeatedly check that each register still contains its expected value for\r
93  * the lifetime of the tasks.  Each task uses different values.  The tasks run\r
94  * with very low priority so get preempted very frequently.  A check variable\r
95  * is incremented on each iteration of the test loop.  A register containing an\r
96  * unexpected value is indicative of an error in the context switching\r
97  * mechanism and will result in a branch to a null loop - which in turn will\r
98  * prevent the check variable from incrementing any further and allow the check\r
99  * timer (described below) to determine that an error has occurred.  The nature\r
100  * of the reg test tasks necessitates that they are written in assembly code.\r
101  *\r
102  * "Check Timer" and Callback Function - The check timer period is initially\r
103  * set to three seconds.  The check timer callback function checks that all the\r
104  * standard demo tasks are not only still executing, but are executing without\r
105  * reporting any errors.  If the check timer discovers that a task has either\r
106  * stalled, or reported an error, then it changes its own period from the\r
107  * initial three seconds, to just 200ms.  The check timer callback function\r
108  * also toggles LED 0 each time it is called.  This provides a visual\r
109  * indication of the system status:  If the LED toggles every three seconds,\r
110  * then no issues have been discovered.  If the LED toggles every 200ms, then\r
111  * an issue has been discovered with at least one task.\r
112  *\r
113  * *NOTE 1* The CPU must be in Supervisor mode when the scheduler is started.\r
114  * The PowerON_Reset_PC() supplied in resetprg.c with this demo has\r
115  * Change_PSW_PM_to_UserMode() commented out to ensure this is the case.\r
116 */\r
117 \r
118 /* Standard includes. */\r
119 #include <string.h>\r
120 \r
121 /* Hardware specific includes. */\r
122 #include "iodefine.h"\r
123 \r
124 /* Kernel includes. */\r
125 #include "FreeRTOS.h"\r
126 #include "task.h"\r
127 #include "timers.h"\r
128 #include "semphr.h"\r
129 \r
130 /* Standard demo includes. */\r
131 #include "partest.h"\r
132 #include "death.h"\r
133 #include "blocktim.h"\r
134 #include "GenQTest.h"\r
135 #include "recmutex.h"\r
136 \r
137 /* The code in this file is only built when configCREATE_LOW_POWER_DEMO is set\r
138 to 0, otherwise the code in main_low_power.c is used. */\r
139 #if configCREATE_LOW_POWER_DEMO == 0\r
140 \r
141 \r
142 /* Values that are passed into the reg test tasks using the task parameter.\r
143 The tasks check that the values are passed in correctly. */\r
144 #define mainREG_TEST_1_PARAMETER        ( 0x12121212UL )\r
145 #define mainREG_TEST_2_PARAMETER        ( 0x12345678UL )\r
146 \r
147 /* Priorities at which the standard demo tasks are created. */\r
148 #define mainGEN_QUEUE_TASK_PRIORITY     ( tskIDLE_PRIORITY )\r
149 #define mainCREATOR_TASK_PRIORITY   ( tskIDLE_PRIORITY + 3 )\r
150 \r
151 /* The LED toggled by the check timer. */\r
152 #define mainCHECK_LED                           ( 0 )\r
153 \r
154 /* The period at which the check timer will expire, in ms, provided no errors\r
155 have been reported by any of the standard demo tasks.  ms are converted to the\r
156 equivalent in ticks using the portTICK_RATE_MS constant. */\r
157 #define mainCHECK_TIMER_PERIOD_MS                       ( 3000UL / portTICK_RATE_MS )\r
158 \r
159 /* The period at which the check timer will expire, in ms, if an error has been\r
160 reported in one of the standard demo tasks.  ms are converted to the equivalent\r
161 in ticks using the portTICK_RATE_MS constant. */\r
162 #define mainERROR_CHECK_TIMER_PERIOD_MS         ( 200UL / portTICK_RATE_MS )\r
163 \r
164 /* A block time of zero simple means "Don't Block". */\r
165 #define mainDONT_BLOCK                          ( 0UL )\r
166 \r
167 /*\r
168  * The reg test tasks as described at the top of this file.\r
169  */\r
170 static void prvRegTest1Task( void *pvParameters );\r
171 static void prvRegTest2Task( void *pvParameters );\r
172 \r
173 /*\r
174  * The actual implementation of the reg test functionality, which, because of\r
175  * the direct register access, have to be in assembly.\r
176  */\r
177 static void prvRegTest1Implementation( void ) __attribute__(( naked ));\r
178 static void prvRegTest2Implementation( void ) __attribute__(( naked ));\r
179 \r
180 /*\r
181  * The check timer callback function, as described at the top of this file.\r
182  */\r
183 static void prvCheckTimerCallback( xTimerHandle xTimer );\r
184 \r
185 \r
186 /*-----------------------------------------------------------*/\r
187 \r
188 /* Variables that are incremented on each iteration of the reg test tasks -\r
189 provided the tasks have not reported any errors.  The check timer inspects these\r
190 variables to ensure they are still incrementing as expected.  If a variable\r
191 stops incrementing then it is likely that its associated task has stalled. */\r
192 unsigned long ulRegTest1CycleCount = 0UL, ulRegTest2CycleCount = 0UL;\r
193 \r
194 /* The check timer.  This uses prvCheckTimerCallback() as its callback\r
195 function. */\r
196 static xTimerHandle xCheckTimer = NULL;\r
197 \r
198 /*-----------------------------------------------------------*/\r
199 \r
200 void main_full( void )\r
201 {\r
202         /* Start the reg test tasks which test the context switching mechanism. */\r
203         xTaskCreate( prvRegTest1Task, "RegTst1", configMINIMAL_STACK_SIZE, ( void * ) mainREG_TEST_1_PARAMETER, tskIDLE_PRIORITY, NULL );\r
204         xTaskCreate( prvRegTest2Task, "RegTst2", configMINIMAL_STACK_SIZE, ( void * ) mainREG_TEST_2_PARAMETER, tskIDLE_PRIORITY, NULL );\r
205 \r
206         /* Create the standard demo tasks. */\r
207         vCreateBlockTimeTasks();\r
208         vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );\r
209         vStartRecursiveMutexTasks();\r
210 \r
211         /* The suicide tasks must be created last as they need to know how many\r
212         tasks were running prior to their creation in order to ascertain whether\r
213         or not the correct/expected number of tasks are running at any given time. */\r
214         vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );\r
215 \r
216         /* Create the software timer that performs the 'check' functionality,\r
217         as described at the top of this file. */\r
218         xCheckTimer = xTimerCreate( ( const signed char * ) "CheckTimer",/* A text name, purely to help debugging. */\r
219                                                                 ( mainCHECK_TIMER_PERIOD_MS ),          /* The timer period, in this case 5000ms (5s). */\r
220                                                                 pdTRUE,                                                         /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */\r
221                                                                 ( void * ) 0,                                           /* The ID is not used, so can be set to anything. */\r
222                                                                 prvCheckTimerCallback                           /* The callback function that inspects the status of all the other tasks. */\r
223                                                           );\r
224 \r
225         configASSERT( xCheckTimer );\r
226 \r
227         /* Start the check timer.  It will actually start when the scheduler is\r
228         started. */\r
229         xTimerStart( xCheckTimer, mainDONT_BLOCK );\r
230 \r
231         /* Start the tasks running. */\r
232         vTaskStartScheduler();\r
233 \r
234         /* If all is well execution will never reach here as the scheduler will be\r
235         running.  If this null loop is reached then it is likely there was\r
236         insufficient FreeRTOS heap available for the idle task and/or timer task to\r
237         be created.  See http://www.freertos.org/a00111.html. */\r
238         for( ;; );\r
239 }\r
240 /*-----------------------------------------------------------*/\r
241 \r
242 static void prvCheckTimerCallback( xTimerHandle xTimer )\r
243 {\r
244 static long lChangedTimerPeriodAlready = pdFALSE, lErrorStatus = pdPASS;\r
245 static volatile unsigned long ulLastRegTest1CycleCount = 0UL, ulLastRegTest2CycleCount = 0UL;\r
246 \r
247         /* Remove compiler warnings about unused parameters. */\r
248         ( void ) xTimer;\r
249 \r
250         /* Check the standard demo tasks are running without error. */\r
251         if( xAreGenericQueueTasksStillRunning() != pdTRUE )\r
252         {\r
253                 lErrorStatus = pdFAIL;\r
254         }\r
255         else if( xIsCreateTaskStillRunning() != pdTRUE )\r
256         {\r
257                 lErrorStatus = pdFAIL;\r
258         }\r
259         else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )\r
260         {\r
261                 lErrorStatus = pdFAIL;\r
262         }\r
263         else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )\r
264         {\r
265                 lErrorStatus = pdFAIL;\r
266         }\r
267 \r
268         /* Check the reg test tasks are still cycling.  They will stop incrementing\r
269         their loop counters if they encounter an error. */\r
270         if( ulRegTest1CycleCount == ulLastRegTest1CycleCount )\r
271         {\r
272                 lErrorStatus = pdFAIL;\r
273         }\r
274 \r
275         if( ulRegTest2CycleCount == ulLastRegTest2CycleCount )\r
276         {\r
277                 lErrorStatus = pdFAIL;\r
278         }\r
279 \r
280         /* Remember the loop counter values this time around so they can be checked\r
281         again the next time this callback function executes. */\r
282         ulLastRegTest1CycleCount = ulRegTest1CycleCount;\r
283         ulLastRegTest2CycleCount = ulRegTest2CycleCount;\r
284 \r
285         /* Toggle the check LED to give an indication of the system status.  If\r
286         the LED toggles every three seconds then everything is ok.  A faster toggle\r
287         indicates an error. */\r
288         vParTestToggleLED( mainCHECK_LED );\r
289 \r
290         /* Was an error detected this time through the callback execution? */\r
291         if( lErrorStatus != pdPASS )\r
292         {\r
293                 if( lChangedTimerPeriodAlready == pdFALSE )\r
294                 {\r
295                         lChangedTimerPeriodAlready = pdTRUE;\r
296 \r
297                         /* This call to xTimerChangePeriod() uses a zero block time.\r
298                         Functions called from inside of a timer callback function must\r
299                         *never* attempt to block. */\r
300                         xTimerChangePeriod( xCheckTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK );\r
301                 }\r
302         }\r
303 }\r
304 /*-----------------------------------------------------------*/\r
305 \r
306 /* This function is explained in the comments at the top of this file. */\r
307 static void prvRegTest1Task( void *pvParameters )\r
308 {\r
309         if( ( ( unsigned long ) pvParameters ) != mainREG_TEST_1_PARAMETER )\r
310         {\r
311                 /* The parameter did not contain the expected value. */\r
312                 for( ;; )\r
313                 {\r
314                         /* Stop the tick interrupt so its obvious something has gone wrong. */\r
315                         taskDISABLE_INTERRUPTS();\r
316                 }\r
317         }\r
318 \r
319         /* This is an inline asm function that never returns. */\r
320         prvRegTest1Implementation();\r
321 }\r
322 /*-----------------------------------------------------------*/\r
323 \r
324 /* This function is explained in the comments at the top of this file. */\r
325 static void prvRegTest2Task( void *pvParameters )\r
326 {\r
327         if( ( ( unsigned long ) pvParameters ) != mainREG_TEST_2_PARAMETER )\r
328         {\r
329                 /* The parameter did not contain the expected value. */\r
330                 for( ;; )\r
331                 {\r
332                         /* Stop the tick interrupt so its obvious something has gone wrong. */\r
333                         taskDISABLE_INTERRUPTS();\r
334                 }\r
335         }\r
336 \r
337         /* This is an inline asm function that never returns. */\r
338         prvRegTest2Implementation();\r
339 }\r
340 /*-----------------------------------------------------------*/\r
341 \r
342 /* This function is explained in the comments at the top of this file. */\r
343 static void prvRegTest1Implementation( void )\r
344 {\r
345         __asm volatile\r
346         (\r
347                 /* Set each register to a known value. */\r
348                 "       MOV.L   #0x33333333, R15                        \n\t"\r
349                 "       MVTACHI R15                                                     \n\t"\r
350                 "       MOV.L   #0x44444444, R15                        \n\t"\r
351                 "       MVTACLO R15                                                     \n\t"\r
352                 "       MOV.L   #1, R1                                          \n\t"\r
353                 "       MOV.L   #2, R2                                          \n\t"\r
354                 "       MOV.L   #3, R3                                          \n\t"\r
355                 "       MOV.L   #4, R4                                          \n\t"\r
356                 "       MOV.L   #5, R5                                          \n\t"\r
357                 "       MOV.L   #6, R6                                          \n\t"\r
358                 "       MOV.L   #7, R7                                          \n\t"\r
359                 "       MOV.L   #8, R8                                          \n\t"\r
360                 "       MOV.L   #9, R9                                          \n\t"\r
361                 "       MOV.L   #10, R10                                        \n\t"\r
362                 "       MOV.L   #11, R11                                        \n\t"\r
363                 "       MOV.L   #12, R12                                        \n\t"\r
364                 "       MOV.L   #13, R13                                        \n\t"\r
365                 "       MOV.L   #14, R14                                        \n\t"\r
366                 "       MOV.L   #15, R15                                        \n\t"\r
367                 "                                                                               \n\t"\r
368                 /* Loop, checking each iteration that each register still contains the\r
369                 expected value. */\r
370                 "TestLoop1:                                                             \n\t"\r
371                 "                                                                               \n\t"\r
372                 /* Push the registers that are going to get clobbered. */\r
373                 "       PUSHM   R14-R15                                         \n\t"\r
374                 "                                                                               \n\t"\r
375                 /* Increment the loop counter to show this task is still getting CPU\r
376                 time. */\r
377                 "       MOV.L   #_ulRegTest1CycleCount, R14     \n\t"\r
378                 "       MOV.L   [ R14 ], R15                            \n\t"\r
379                 "       ADD             #1, R15                                         \n\t"\r
380                 "       MOV.L   R15, [ R14 ]                            \n\t"\r
381                 "                                                                               \n\t"\r
382                 /* Yield to extend the text coverage.  Set the bit in the ITU SWINTR\r
383                 register. */\r
384                 "       MOV.L   #1, R14                                         \n\t"\r
385                 "       MOV.L   #0872E0H, R15                           \n\t"\r
386                 "       MOV.B   R14, [R15]                                      \n\t"\r
387                 "       NOP                                                                     \n\t"\r
388                 "       NOP                                                                     \n\t"\r
389                 "                                                                               \n\t"\r
390                 /* Check the accumulator value. */\r
391                 "       MVFACHI R15                                                     \n\t"\r
392                 "       CMP             #0x33333333, R15                        \n\t"\r
393                 "       BNE             RegTest2Error                           \n\t"\r
394                 "       MVFACMI R15                                                     \n\t"\r
395                 "       CMP             #0x33334444, R15                        \n\t"\r
396                 "       BNE             RegTest2Error                           \n\t"\r
397                 "                                                                               \n\t"\r
398                 /* Restore the clobbered registers. */\r
399                 "       POPM    R14-R15                                         \n\t"\r
400                 "                                                                               \n\t"\r
401                 /* Now compare each register to ensure it still contains the value that\r
402                 was set before this loop was entered. */\r
403                 "       CMP             #1, R1                                          \n\t"\r
404                 "       BNE             RegTest1Error                           \n\t"\r
405                 "       CMP             #2, R2                                          \n\t"\r
406                 "       BNE             RegTest1Error                           \n\t"\r
407                 "       CMP             #3, R3                                          \n\t"\r
408                 "       BNE             RegTest1Error                           \n\t"\r
409                 "       CMP             #4, R4                                          \n\t"\r
410                 "       BNE             RegTest1Error                           \n\t"\r
411                 "       CMP             #5, R5                                          \n\t"\r
412                 "       BNE             RegTest1Error                           \n\t"\r
413                 "       CMP             #6, R6                                          \n\t"\r
414                 "       BNE             RegTest1Error                           \n\t"\r
415                 "       CMP             #7, R7                                          \n\t"\r
416                 "       BNE             RegTest1Error                           \n\t"\r
417                 "       CMP             #8, R8                                          \n\t"\r
418                 "       BNE             RegTest1Error                           \n\t"\r
419                 "       CMP             #9, R9                                          \n\t"\r
420                 "       BNE             RegTest1Error                           \n\t"\r
421                 "       CMP             #10, R10                                        \n\t"\r
422                 "       BNE             RegTest1Error                           \n\t"\r
423                 "       CMP             #11, R11                                        \n\t"\r
424                 "       BNE             RegTest1Error                           \n\t"\r
425                 "       CMP             #12, R12                                        \n\t"\r
426                 "       BNE             RegTest1Error                           \n\t"\r
427                 "       CMP             #13, R13                                        \n\t"\r
428                 "       BNE             RegTest1Error                           \n\t"\r
429                 "       CMP             #14, R14                                        \n\t"\r
430                 "       BNE             RegTest1Error                           \n\t"\r
431                 "       CMP             #15, R15                                        \n\t"\r
432                 "       BNE             RegTest1Error                           \n\t"\r
433                 "                                                                               \n\t"\r
434                 /* All comparisons passed, start a new iteration of this loop. */\r
435                 "       BRA             TestLoop1                                       \n\t"\r
436                 "                                                                               \n\t"\r
437                 /* A compare failed, just loop here so the loop counter stops\r
438                 incrementing causing the check timer to indicate the error. */\r
439                 "RegTest1Error:                                                 \n\t"\r
440                 "       BRA RegTest1Error                                       "\r
441         );\r
442 }\r
443 /*-----------------------------------------------------------*/\r
444 \r
445 /* This function is explained in the comments at the top of this file. */\r
446 static void prvRegTest2Implementation( void )\r
447 {\r
448         __asm volatile\r
449         (\r
450                 /* Set each register to a known value. */\r
451                 "       MOV.L   #0x11111111, R15                        \n\t"\r
452                 "       MVTACHI R15                                                     \n\t"\r
453                 "       MOV.L   #0x22222222, R15                        \n\t"\r
454                 "       MVTACLO R15                                                     \n\t"\r
455                 "       MOV.L   #100, R1                                        \n\t"\r
456                 "       MOV.L   #200, R2                                        \n\t"\r
457                 "       MOV.L   #300, R3                                        \n\t"\r
458                 "       MOV.L   #400, R4                                        \n\t"\r
459                 "       MOV.L   #500, R5                                        \n\t"\r
460                 "       MOV.L   #600, R6                                        \n\t"\r
461                 "       MOV.L   #700, R7                                        \n\t"\r
462                 "       MOV.L   #800, R8                                        \n\t"\r
463                 "       MOV.L   #900, R9                                        \n\t"\r
464                 "       MOV.L   #1000, R10                                      \n\t"\r
465                 "       MOV.L   #1001, R11                                      \n\t"\r
466                 "       MOV.L   #1002, R12                                      \n\t"\r
467                 "       MOV.L   #1003, R13                                      \n\t"\r
468                 "       MOV.L   #1004, R14                                      \n\t"\r
469                 "       MOV.L   #1005, R15                                      \n\t"\r
470                 "                                                                               \n\t"\r
471                 /* Loop, checking each iteration that each register still contains the\r
472                 expected value. */\r
473                 "TestLoop2:                                                             \n\t"\r
474                 "                                                                               \n\t"\r
475                 /* Push the registers that are going to get clobbered. */\r
476                 "       PUSHM   R14-R15                                         \n\t"\r
477                 "                                                                               \n\t"\r
478                 /* Increment the loop counter to show this task is still getting CPU\r
479                 time. */\r
480                 "       MOV.L   #_ulRegTest2CycleCount, R14     \n\t"\r
481                 "       MOV.L   [ R14 ], R15                            \n\t"\r
482                 "       ADD             #1, R15                                         \n\t"\r
483                 "       MOV.L   R15, [ R14 ]                            \n\t"\r
484                 "                                                                               \n\t"\r
485                 /* Check the accumulator value. */\r
486                 "       MVFACHI R15                                                     \n\t"\r
487                 "       CMP             #0x11111111, R15                        \n\t"\r
488                 "       BNE             RegTest2Error                           \n\t"\r
489                 "       MVFACMI R15                                                     \n\t"\r
490                 "       CMP             #0x11112222, R15                        \n\t"\r
491                 "       BNE             RegTest2Error                           \n\t"\r
492                 "                                                                               \n\t"\r
493                 /* Restore the clobbered registers. */\r
494                 "       POPM    R14-R15                                         \n\t"\r
495                 "                                                                               \n\t"\r
496                 /* Now compare each register to ensure it still contains the value that\r
497                 was set before this loop was entered. */\r
498                 "       CMP             #100, R1                                        \n\t"\r
499                 "       BNE             RegTest2Error                           \n\t"\r
500                 "       CMP             #200, R2                                        \n\t"\r
501                 "       BNE             RegTest2Error                           \n\t"\r
502                 "       CMP             #300, R3                                        \n\t"\r
503                 "       BNE             RegTest2Error                           \n\t"\r
504                 "       CMP             #400, R4                                        \n\t"\r
505                 "       BNE             RegTest2Error                           \n\t"\r
506                 "       CMP             #500, R5                                        \n\t"\r
507                 "       BNE             RegTest2Error                           \n\t"\r
508                 "       CMP             #600, R6                                        \n\t"\r
509                 "       BNE             RegTest2Error                           \n\t"\r
510                 "       CMP             #700, R7                                        \n\t"\r
511                 "       BNE             RegTest2Error                           \n\t"\r
512                 "       CMP             #800, R8                                        \n\t"\r
513                 "       BNE             RegTest2Error                           \n\t"\r
514                 "       CMP             #900, R9                                        \n\t"\r
515                 "       BNE             RegTest2Error                           \n\t"\r
516                 "       CMP             #1000, R10                                      \n\t"\r
517                 "       BNE             RegTest2Error                           \n\t"\r
518                 "       CMP             #1001, R11                                      \n\t"\r
519                 "       BNE             RegTest2Error                           \n\t"\r
520                 "       CMP             #1002, R12                                      \n\t"\r
521                 "       BNE             RegTest2Error                           \n\t"\r
522                 "       CMP             #1003, R13                                      \n\t"\r
523                 "       BNE             RegTest2Error                           \n\t"\r
524                 "       CMP             #1004, R14                                      \n\t"\r
525                 "       BNE             RegTest2Error                           \n\t"\r
526                 "       CMP             #1005, R15                                      \n\t"\r
527                 "       BNE             RegTest2Error                           \n\t"\r
528                 "                                                                               \n\t"\r
529                 /* All comparisons passed, start a new iteration of this loop. */\r
530                 "       BRA             TestLoop2                                       \n\t"\r
531                 "                                                                               \n\t"\r
532                 /* A compare failed, just loop here so the loop counter stops\r
533                 incrementing causing the check timer to indicate the error. */\r
534                 "RegTest2Error:                                                 \n\t"\r
535                 "       BRA RegTest2Error                                       "\r
536         );\r
537 }\r
538 /*-----------------------------------------------------------*/\r
539 \r
540 #endif /* configCREATE_LOW_POWER_DEMO */\r