2 FreeRTOS V7.0.1 - Copyright (C) 2011 Real Time Engineers Ltd.
\r
5 ***************************************************************************
\r
7 * FreeRTOS tutorial books are available in pdf and paperback. *
\r
8 * Complete, revised, and edited pdf reference manuals are also *
\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
18 * >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
\r
20 * Thank you for using FreeRTOS, and thank you for your support! *
\r
22 ***************************************************************************
\r
25 This file is part of the FreeRTOS distribution.
\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
44 http://www.FreeRTOS.org - Documentation, latest information, license and
\r
47 http://www.SafeRTOS.com - A version that is certified for use in safety
\r
50 http://www.OpenRTOS.com - Commercial support, development, porting,
\r
51 licensing and training services.
\r
54 /* ****************************************************************************
\r
55 * This project includes a lot of tasks and tests and is therefore complex.
\r
56 * If you would prefer a much simpler project to get started with then select
\r
57 * the 'Blinky' build configuration within the HEW IDE.
\r
58 * ****************************************************************************
\r
60 * Creates all the demo application tasks, then starts the scheduler. The web
\r
61 * documentation provides more details of the standard demo application tasks,
\r
62 * which provide no particular functionality but do provide a good example of
\r
63 * how to use the FreeRTOS API. The tasks defined in flop.c are included in the
\r
64 * set of standard demo tasks to ensure the floating point unit gets some
\r
67 * In addition to the standard demo tasks, the following tasks and tests are
\r
68 * defined and/or created within this file:
\r
70 * Webserver ("uIP") task - This serves a number of dynamically generated WEB
\r
71 * pages to a standard WEB browser. The IP and MAC addresses are configured by
\r
72 * constants defined at the bottom of FreeRTOSConfig.h. Use either a standard
\r
73 * Ethernet cable to connect through a hug, or a cross over (point to point)
\r
74 * cable to connect directly. Ensure the IP address used is compatible with the
\r
75 * IP address of the machine running the browser - the easiest way to achieve
\r
76 * this is to ensure the first three octets of the IP addresses are the same.
\r
78 * "Reg test" tasks - These fill the registers with known values, then check
\r
79 * that each register still contains its expected value. Each task uses
\r
80 * different values. The tasks run with very low priority so get preempted
\r
81 * very frequently. A check variable is incremented on each iteration of the
\r
82 * test loop. A register containing an unexpected value is indicative of an
\r
83 * error in the context switching mechanism and will result in a branch to a
\r
84 * null loop - which in turn will prevent the check variable from incrementing
\r
85 * any further and allow the check task (described below) to determine that an
\r
86 * error has occurred. The nature of the reg test tasks necessitates that they
\r
87 * are written in assembly code.
\r
89 * "Check" task - This only executes every five seconds but has a high priority
\r
90 * to ensure it gets processor time. Its main function is to check that all the
\r
91 * standard demo tasks are still operational. While no errors have been
\r
92 * discovered the check task will toggle LED 5 every 5 seconds - the toggle
\r
93 * rate increasing to 200ms being a visual indication that at least one task has
\r
94 * reported unexpected behaviour.
\r
96 * "High frequency timer test" - A high frequency periodic interrupt is
\r
97 * generated using a timer - the interrupt is assigned a priority above
\r
98 * configMAX_SYSCALL_INTERRUPT_PRIORITY so should not be effected by anything
\r
99 * the kernel is doing. The frequency and priority of the interrupt, in
\r
100 * combination with other standard tests executed in this demo, should result
\r
101 * in interrupts nesting at least 3 and probably 4 deep. This test is only
\r
102 * included in build configurations that have the optimiser switched on. In
\r
103 * optimised builds the count of high frequency ticks is used as the time base
\r
104 * for the run time stats.
\r
106 * *NOTE 1* If LED5 is toggling every 5 seconds then all the demo application
\r
107 * tasks are executing as expected and no errors have been reported in any
\r
108 * tasks. The toggle rate increasing to 200ms indicates that at least one task
\r
109 * has reported unexpected behaviour.
\r
111 * *NOTE 2* vApplicationSetupTimerInterrupt() is called by the kernel to let
\r
112 * the application set up a timer to generate the tick interrupt. In this
\r
113 * example a compare match timer is used for this purpose.
\r
115 * *NOTE 3* The CPU must be in Supervisor mode when the scheduler is started.
\r
116 * The PowerON_Reset_PC() supplied in resetprg.c with this demo has
\r
117 * Change_PSW_PM_to_UserMode() commented out to ensure this is the case.
\r
119 * *NOTE 4* The IntQueue common demo tasks test interrupt nesting and make use
\r
120 * of all the 8bit timers (as two cascaded 16bit units).
\r
123 /* Hardware specific includes. */
\r
124 #include "iodefine.h"
\r
126 /* Kernel includes. */
\r
127 #include "FreeRTOS.h"
\r
130 /* Standard demo includes. */
\r
131 #include "partest.h"
\r
133 #include "IntQueue.h"
\r
134 #include "BlockQ.h"
\r
136 #include "integer.h"
\r
137 #include "blocktim.h"
\r
138 #include "semtest.h"
\r
140 #include "GenQTest.h"
\r
142 #include "recmutex.h"
\r
145 /* Values that are passed into the reg test tasks using the task parameter. The
\r
146 tasks check that the values are passed in correctly. */
\r
147 #define mainREG_TEST_1_PARAMETER ( 0x12121212UL )
\r
148 #define mainREG_TEST_2_PARAMETER ( 0x12345678UL )
\r
150 /* Priorities at which the tasks are created. */
\r
151 #define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
\r
152 #define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 )
\r
153 #define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )
\r
154 #define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
\r
155 #define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
\r
156 #define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
\r
157 #define mainuIP_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
\r
158 #define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY )
\r
159 #define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )
\r
160 #define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY )
\r
162 /* The WEB server uses string handling functions, which in turn use a bit more
\r
163 stack than most of the other tasks. */
\r
164 #define mainuIP_STACK_SIZE ( configMINIMAL_STACK_SIZE * 3 )
\r
166 /* The LED toggled by the check task. */
\r
167 #define mainCHECK_LED ( 5 )
\r
169 /* The rate at which mainCHECK_LED will toggle when all the tasks are running
\r
170 without error. Controlled by the check task as described at the top of this
\r
172 #define mainNO_ERROR_CYCLE_TIME ( 5000 / portTICK_RATE_MS )
\r
174 /* The rate at which mainCHECK_LED will toggle when an error has been reported
\r
175 by at least one task. Controlled by the check task as described at the top of
\r
177 #define mainERROR_CYCLE_TIME ( 200 / portTICK_RATE_MS )
\r
181 * vApplicationMallocFailedHook() will only be called if
\r
182 * configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook
\r
183 * function that will execute if a call to pvPortMalloc() fails.
\r
184 * pvPortMalloc() is called internally by the kernel whenever a task, queue or
\r
185 * semaphore is created. It is also called by various parts of the demo
\r
188 void vApplicationMallocFailedHook( void );
\r
191 * vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set to 1
\r
192 * in FreeRTOSConfig.h. It is a hook function that is called on each iteration
\r
193 * of the idle task. It is essential that code added to this hook function
\r
194 * never attempts to block in any way (for example, call xQueueReceive() with
\r
195 * a block time specified). If the application makes use of the vTaskDelete()
\r
196 * API function (as this demo application does) then it is also important that
\r
197 * vApplicationIdleHook() is permitted to return to its calling function because
\r
198 * it is the responsibility of the idle task to clean up memory allocated by the
\r
199 * kernel to any task that has since been deleted.
\r
201 void vApplicationIdleHook( void );
\r
204 * vApplicationStackOverflowHook() will only be called if
\r
205 * configCHECK_FOR_STACK_OVERFLOW is set to a non-zero value. The handle and
\r
206 * name of the offending task should be passed in the function parameters, but
\r
207 * it is possible that the stack overflow will have corrupted these - in which
\r
208 * case pxCurrentTCB can be inspected to find the same information.
\r
210 void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName );
\r
213 * The reg test tasks as described at the top of this file.
\r
215 static void prvRegTest1Task( void *pvParameters );
\r
216 static void prvRegTest2Task( void *pvParameters );
\r
219 * The actual implementation of the reg test functionality, which, because of
\r
220 * the direct register access, have to be in assembly.
\r
222 static void prvRegTest1Implementation( void ) __attribute__((naked));
\r
223 static void prvRegTest2Implementation( void ) __attribute__((naked));
\r
227 * The check task as described at the top of this file.
\r
229 static void prvCheckTask( void *pvParameters );
\r
232 * Contains the implementation of the WEB server.
\r
234 extern void vuIP_Task( void *pvParameters );
\r
236 /*-----------------------------------------------------------*/
\r
238 /* Variables that are incremented on each iteration of the reg test tasks -
\r
239 provided the tasks have not reported any errors. The check task inspects these
\r
240 variables to ensure they are still incrementing as expected. If a variable
\r
241 stops incrementing then it is likely that its associate task has stalled. */
\r
242 unsigned long ulRegTest1CycleCount = 0UL, ulRegTest2CycleCount = 0UL;
\r
244 /* The status message that is displayed at the bottom of the "task stats" web
\r
245 page, which is served by the uIP task. This will report any errors picked up
\r
246 by the reg test task. */
\r
247 static const char *pcStatusMessage = NULL;
\r
249 /*-----------------------------------------------------------*/
\r
253 extern void HardwareSetup( void );
\r
255 /* Renesas provided CPU configuration routine. The clocks are configured in
\r
259 /* Turn all LEDs off. */
\r
260 vParTestInitialise();
\r
262 /* Start the reg test tasks which test the context switching mechanism. */
\r
263 xTaskCreate( prvRegTest1Task, ( signed char * ) "RegTst1", configMINIMAL_STACK_SIZE, ( void * ) mainREG_TEST_1_PARAMETER, tskIDLE_PRIORITY, NULL );
\r
264 xTaskCreate( prvRegTest2Task, ( signed char * ) "RegTst2", configMINIMAL_STACK_SIZE, ( void * ) mainREG_TEST_2_PARAMETER, tskIDLE_PRIORITY, NULL );
\r
266 /* The web server task. */
\r
267 xTaskCreate( vuIP_Task, ( signed char * ) "uIP", mainuIP_STACK_SIZE, NULL, mainuIP_TASK_PRIORITY, NULL );
\r
269 /* Start the check task as described at the top of this file. */
\r
270 xTaskCreate( prvCheckTask, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
\r
272 /* Create the standard demo tasks. */
\r
273 vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
\r
274 vCreateBlockTimeTasks();
\r
275 vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
\r
276 vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
\r
277 vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );
\r
278 vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );
\r
279 vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY );
\r
280 vStartQueuePeekTasks();
\r
281 vStartRecursiveMutexTasks();
\r
282 vStartInterruptQueueTasks();
\r
283 vStartMathTasks( mainFLOP_TASK_PRIORITY );
\r
285 /* The suicide tasks must be created last as they need to know how many
\r
286 tasks were running prior to their creation in order to ascertain whether
\r
287 or not the correct/expected number of tasks are running at any given time. */
\r
288 vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
\r
290 /* Start the tasks running. */
\r
291 vTaskStartScheduler();
\r
293 /* If all is well we will never reach here as the scheduler will now be
\r
294 running. If we do reach here then it is likely that there was insufficient
\r
295 heap available for the idle task to be created. */
\r
300 /*-----------------------------------------------------------*/
\r
302 static void prvCheckTask( void *pvParameters )
\r
304 static volatile unsigned long ulLastRegTest1CycleCount = 0UL, ulLastRegTest2CycleCount = 0UL;
\r
305 portTickType xNextWakeTime, xCycleFrequency = mainNO_ERROR_CYCLE_TIME;
\r
306 extern void vSetupHighFrequencyTimer( void );
\r
308 /* If this is being executed then the kernel has been started. Start the high
\r
309 frequency timer test as described at the top of this file. This is only
\r
310 included in the optimised build configuration - otherwise it takes up too much
\r
312 #ifdef INCLUDE_HIGH_FREQUENCY_TIMER_TEST
\r
313 vSetupHighFrequencyTimer();
\r
316 /* Initialise xNextWakeTime - this only needs to be done once. */
\r
317 xNextWakeTime = xTaskGetTickCount();
\r
321 /* Place this task in the blocked state until it is time to run again. */
\r
322 vTaskDelayUntil( &xNextWakeTime, xCycleFrequency );
\r
324 /* Check the standard demo tasks are running without error. */
\r
325 if( xAreGenericQueueTasksStillRunning() != pdTRUE )
\r
327 pcStatusMessage = "Error: GenQueue";
\r
329 else if( xAreQueuePeekTasksStillRunning() != pdTRUE )
\r
331 pcStatusMessage = "Error: QueuePeek\r\n";
\r
333 else if( xAreBlockingQueuesStillRunning() != pdTRUE )
\r
335 pcStatusMessage = "Error: BlockQueue\r\n";
\r
337 else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
\r
339 pcStatusMessage = "Error: BlockTime\r\n";
\r
341 else if( xAreSemaphoreTasksStillRunning() != pdTRUE )
\r
343 pcStatusMessage = "Error: SemTest\r\n";
\r
345 else if( xArePollingQueuesStillRunning() != pdTRUE )
\r
347 pcStatusMessage = "Error: PollQueue\r\n";
\r
349 else if( xIsCreateTaskStillRunning() != pdTRUE )
\r
351 pcStatusMessage = "Error: Death\r\n";
\r
353 else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
\r
355 pcStatusMessage = "Error: IntMath\r\n";
\r
357 else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
\r
359 pcStatusMessage = "Error: RecMutex\r\n";
\r
361 else if( xAreIntQueueTasksStillRunning() != pdPASS )
\r
363 pcStatusMessage = "Error: IntQueue\r\n";
\r
365 else if( xAreMathsTaskStillRunning() != pdPASS )
\r
367 pcStatusMessage = "Error: Flop\r\n";
\r
370 /* Check the reg test tasks are still cycling. They will stop incrementing
\r
371 their loop counters if they encounter an error. */
\r
372 if( ulRegTest1CycleCount == ulLastRegTest1CycleCount )
\r
374 pcStatusMessage = "Error: RegTest1\r\n";
\r
377 if( ulRegTest2CycleCount == ulLastRegTest2CycleCount )
\r
379 pcStatusMessage = "Error: RegTest2\r\n";
\r
382 ulLastRegTest1CycleCount = ulRegTest1CycleCount;
\r
383 ulLastRegTest2CycleCount = ulRegTest2CycleCount;
\r
385 /* Toggle the check LED to give an indication of the system status. If
\r
386 the LED toggles every 5 seconds then everything is ok. A faster toggle
\r
387 indicates an error. */
\r
388 vParTestToggleLED( mainCHECK_LED );
\r
390 /* Ensure the LED toggles at a faster rate if an error has occurred. */
\r
391 if( pcStatusMessage != NULL )
\r
393 /* Increase the rate at which this task cycles, which will increase the
\r
394 rate at which mainCHECK_LED flashes to give visual feedback that an error
\r
396 xCycleFrequency = mainERROR_CYCLE_TIME;
\r
400 /*-----------------------------------------------------------*/
\r
402 /* The RX port uses this callback function to configure its tick interrupt.
\r
403 This allows the application to choose the tick interrupt source. */
\r
404 void vApplicationSetupTimerInterrupt( void )
\r
406 /* Enable compare match timer 0. */
\r
409 /* Interrupt on compare match. */
\r
410 CMT0.CMCR.BIT.CMIE = 1;
\r
412 /* Set the compare match value. */
\r
413 CMT0.CMCOR = ( unsigned short ) ( ( ( configPERIPHERAL_CLOCK_HZ / configTICK_RATE_HZ ) -1 ) / 8 );
\r
415 /* Divide the PCLK by 8. */
\r
416 CMT0.CMCR.BIT.CKS = 0;
\r
418 /* Enable the interrupt... */
\r
419 _IEN( _CMT0_CMI0 ) = 1;
\r
421 /* ...and set its priority to the application defined kernel priority. */
\r
422 _IPR( _CMT0_CMI0 ) = configKERNEL_INTERRUPT_PRIORITY;
\r
424 /* Start the timer. */
\r
425 CMT.CMSTR0.BIT.STR0 = 1;
\r
427 /*-----------------------------------------------------------*/
\r
429 /* This function is explained by the comments above its prototype at the top
\r
431 void vApplicationMallocFailedHook( void )
\r
435 /*-----------------------------------------------------------*/
\r
437 /* This function is explained by the comments above its prototype at the top
\r
439 void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName )
\r
443 /*-----------------------------------------------------------*/
\r
445 /* This function is explained by the comments above its prototype at the top
\r
447 void vApplicationIdleHook( void )
\r
450 /*-----------------------------------------------------------*/
\r
452 /* This function is explained in the comments at the top of this file. */
\r
453 static void prvRegTest1Task( void *pvParameters )
\r
455 if( ( ( unsigned long ) pvParameters ) != mainREG_TEST_1_PARAMETER )
\r
457 /* The parameter did not contain the expected value. */
\r
460 /* Stop the tick interrupt so its obvious something has gone wrong. */
\r
461 taskDISABLE_INTERRUPTS();
\r
465 /* This is an asm function that never returns. */
\r
466 prvRegTest1Implementation();
\r
468 /*-----------------------------------------------------------*/
\r
470 /* This function is explained in the comments at the top of this file. */
\r
471 static void prvRegTest2Task( void *pvParameters )
\r
473 if( ( ( unsigned long ) pvParameters ) != mainREG_TEST_2_PARAMETER )
\r
475 /* The parameter did not contain the expected value. */
\r
478 /* Stop the tick interrupt so its obvious something has gone wrong. */
\r
479 taskDISABLE_INTERRUPTS();
\r
483 /* This is an asm function that never returns. */
\r
484 prvRegTest2Implementation();
\r
486 /*-----------------------------------------------------------*/
\r
488 char *pcGetTaskStatusMessage( void )
\r
490 /* Not bothered about a critical section here although technically because of
\r
491 the task priorities the pointer could change it will be atomic if not near
\r
492 atomic and its not critical. */
\r
493 if( pcStatusMessage == NULL )
\r
495 return "All tasks running without error";
\r
499 return ( char * ) pcStatusMessage;
\r
502 /*-----------------------------------------------------------*/
\r
504 /* This function is explained in the comments at the top of this file. */
\r
505 static void prvRegTest1Implementation( void )
\r
509 /* Put a known value in each register. */
\r
519 "MOV #10, R10 \n" \
\r
520 "MOV #11, R11 \n" \
\r
521 "MOV #12, R12 \n" \
\r
522 "MOV #13, R13 \n" \
\r
523 "MOV #14, R14 \n" \
\r
524 "MOV #15, R15 \n" \
\r
526 /* Loop, checking each itteration that each register still contains the
\r
530 /* Push the registers that are going to get clobbered. */
\r
531 "PUSHM R14-R15 \n" \
\r
533 /* Increment the loop counter to show this task is still getting CPU time. */
\r
534 "MOV #_ulRegTest1CycleCount, R14 \n" \
\r
535 "MOV [ R14 ], R15 \n" \
\r
537 "MOV R15, [ R14 ] \n" \
\r
539 /* Yield to extend the test coverage. Set the bit in the ITU SWINTR register. */
\r
541 "MOV #0872E0H, R15 \n" \
\r
542 "MOV.B R14, [R15] \n" \
\r
546 /* Restore the clobbered registers. */
\r
547 "POPM R14-R15 \n" \
\r
549 /* Now compare each register to ensure it still contains the value that was
\r
550 set before this loop was entered. */
\r
552 "BNE RegTest1Error \n" \
\r
554 "BNE RegTest1Error \n" \
\r
556 "BNE RegTest1Error \n" \
\r
558 "BNE RegTest1Error \n" \
\r
560 "BNE RegTest1Error \n" \
\r
562 "BNE RegTest1Error \n" \
\r
564 "BNE RegTest1Error \n" \
\r
566 "BNE RegTest1Error \n" \
\r
568 "BNE RegTest1Error \n" \
\r
569 "CMP #10, R10 \n" \
\r
570 "BNE RegTest1Error \n" \
\r
571 "CMP #11, R11 \n" \
\r
572 "BNE RegTest1Error \n" \
\r
573 "CMP #12, R12 \n" \
\r
574 "BNE RegTest1Error \n" \
\r
575 "CMP #13, R13 \n" \
\r
576 "BNE RegTest1Error \n" \
\r
577 "CMP #14, R14 \n" \
\r
578 "BNE RegTest1Error \n" \
\r
579 "CMP #15, R15 \n" \
\r
580 "BNE RegTest1Error \n" \
\r
582 /* All comparisons passed, start a new itteratio of this loop. */
\r
583 "BRA TestLoop1 \n" \
\r
585 "RegTest1Error: \n" \
\r
586 /* A compare failed, just loop here so the loop counter stops incrementing
\r
587 - causing the check task to indicate the error. */
\r
588 "BRA RegTest1Error "
\r
591 /*-----------------------------------------------------------*/
\r
593 /* This function is explained in the comments at the top of this file. */
\r
594 static void prvRegTest2Implementation( void )
\r
598 /* Put a known value in each register. */
\r
599 "MOV #10H, R1 \n" \
\r
600 "MOV #20H, R2 \n" \
\r
601 "MOV #30H, R3 \n" \
\r
602 "MOV #40H, R4 \n" \
\r
603 "MOV #50H, R5 \n" \
\r
604 "MOV #60H, R6 \n" \
\r
605 "MOV #70H, R7 \n" \
\r
606 "MOV #80H, R8 \n" \
\r
607 "MOV #90H, R9 \n" \
\r
608 "MOV #100H, R10 \n" \
\r
609 "MOV #110H, R11 \n" \
\r
610 "MOV #120H, R12 \n" \
\r
611 "MOV #130H, R13 \n" \
\r
612 "MOV #140H, R14 \n" \
\r
613 "MOV #150H, R15 \n" \
\r
615 /* Loop, checking each itteration that each register still contains the
\r
619 /* Push the registers that are going to get clobbered. */
\r
620 "PUSHM R14-R15 \n" \
\r
622 /* Increment the loop counter to show this task is still getting CPU time. */
\r
623 "MOV #_ulRegTest2CycleCount, R14 \n" \
\r
624 "MOV [ R14 ], R15 \n" \
\r
626 "MOV R15, [ R14 ] \n" \
\r
628 /* Restore the clobbered registers. */
\r
629 "POPM R14-R15 \n" \
\r
631 /* Now compare each register to ensure it still contains the value that was
\r
632 set before this loop was entered. */
\r
633 "CMP #10H, R1 \n" \
\r
634 "BNE RegTest2Error \n" \
\r
635 "CMP #20H, R2 \n" \
\r
636 "BNE RegTest2Error \n" \
\r
637 "CMP #30H, R3 \n" \
\r
638 "BNE RegTest2Error \n" \
\r
639 "CMP #40H, R4 \n" \
\r
640 "BNE RegTest2Error \n" \
\r
641 "CMP #50H, R5 \n" \
\r
642 "BNE RegTest2Error \n" \
\r
643 "CMP #60H, R6 \n" \
\r
644 "BNE RegTest2Error \n" \
\r
645 "CMP #70H, R7 \n" \
\r
646 "BNE RegTest2Error \n" \
\r
647 "CMP #80H, R8 \n" \
\r
648 "BNE RegTest2Error \n" \
\r
649 "CMP #90H, R9 \n" \
\r
650 "BNE RegTest2Error \n" \
\r
651 "CMP #100H, R10 \n" \
\r
652 "BNE RegTest2Error \n" \
\r
653 "CMP #110H, R11 \n" \
\r
654 "BNE RegTest2Error \n" \
\r
655 "CMP #120H, R12 \n" \
\r
656 "BNE RegTest2Error \n" \
\r
657 "CMP #130H, R13 \n" \
\r
658 "BNE RegTest2Error \n" \
\r
659 "CMP #140H, R14 \n" \
\r
660 "BNE RegTest2Error \n" \
\r
661 "CMP #150H, R15 \n" \
\r
662 "BNE RegTest2Error \n" \
\r
664 /* All comparisons passed, start a new itteratio of this loop. */
\r
665 "BRA TestLoop2 \n" \
\r
667 "RegTest2Error: \n" \
\r
668 /* A compare failed, just loop here so the loop counter stops incrementing
\r
669 - causing the check task to indicate the error. */
\r
670 "BRA RegTest2Error "
\r