2 FreeRTOS V8.2.0rc1 - Copyright (C) 2014 Real Time Engineers Ltd.
\r
5 VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
\r
7 This file is part of the FreeRTOS distribution.
\r
9 FreeRTOS is free software; you can redistribute it and/or modify it under
\r
10 the terms of the GNU General Public License (version 2) as published by the
\r
11 Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
\r
13 >>! NOTE: The modification to the GPL is included to allow you to !<<
\r
14 >>! distribute a combined work that includes FreeRTOS without being !<<
\r
15 >>! obliged to provide the source code for proprietary components !<<
\r
16 >>! outside of the FreeRTOS kernel. !<<
\r
18 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
\r
19 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
\r
20 FOR A PARTICULAR PURPOSE. Full license text is available on the following
\r
21 link: http://www.freertos.org/a00114.html
\r
25 ***************************************************************************
\r
27 * Having a problem? Start by reading the FAQ "My application does *
\r
28 * not run, what could be wrong?". Have you defined configASSERT()? *
\r
30 * http://www.FreeRTOS.org/FAQHelp.html *
\r
32 ***************************************************************************
\r
34 ***************************************************************************
\r
36 * FreeRTOS provides completely free yet professionally developed, *
\r
37 * robust, strictly quality controlled, supported, and cross *
\r
38 * platform software that is more than just the market leader, it *
\r
39 * is the industry's de facto standard. *
\r
41 * Help yourself get started quickly while simultaneously helping *
\r
42 * to support the FreeRTOS project by purchasing a FreeRTOS *
\r
43 * tutorial book, reference manual, or both: *
\r
44 * http://www.FreeRTOS.org/Documentation *
\r
46 ***************************************************************************
\r
48 ***************************************************************************
\r
50 * Investing in training allows your team to be as productive as *
\r
51 * possible as early as possible, lowering your overall development *
\r
52 * cost, and enabling you to bring a more robust product to market *
\r
53 * earlier than would otherwise be possible. Richard Barry is both *
\r
54 * the architect and key author of FreeRTOS, and so also the world's *
\r
55 * leading authority on what is the world's most popular real time *
\r
56 * kernel for deeply embedded MCU designs. Obtaining your training *
\r
57 * from Richard ensures your team will gain directly from his in-depth *
\r
58 * product knowledge and years of usage experience. Contact Real Time *
\r
59 * Engineers Ltd to enquire about the FreeRTOS Masterclass, presented *
\r
60 * by Richard Barry: http://www.FreeRTOS.org/contact
\r
62 ***************************************************************************
\r
64 ***************************************************************************
\r
66 * You are receiving this top quality software for free. Please play *
\r
67 * fair and reciprocate by reporting any suspected issues and *
\r
68 * participating in the community forum: *
\r
69 * http://www.FreeRTOS.org/support *
\r
73 ***************************************************************************
\r
75 http://www.FreeRTOS.org - Documentation, books, training, latest versions,
\r
76 license and Real Time Engineers Ltd. contact details.
\r
78 http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
\r
79 including FreeRTOS+Trace - an indispensable productivity tool, a DOS
\r
80 compatible FAT file system, and our tiny thread aware UDP/IP stack.
\r
82 http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
\r
83 Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
\r
85 http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
\r
86 Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
\r
87 licenses offer ticketed support, indemnification and commercial middleware.
\r
89 http://www.SafeRTOS.com - High Integrity Systems also provide a safety
\r
90 engineered and independently SIL3 certified version for use in safety and
\r
91 mission critical applications that require provable dependability.
\r
96 /* ****************************************************************************
\r
97 * This project includes a lot of tasks and tests and is therefore complex.
\r
98 * If you would prefer a much simpler project to get started with then select
\r
99 * the 'Blinky' build configuration within the HEW IDE.
\r
100 * ****************************************************************************
\r
102 * Creates all the demo application tasks, then starts the scheduler. The web
\r
103 * documentation provides more details of the standard demo application tasks,
\r
104 * which provide no particular functionality but do provide a good example of
\r
105 * how to use the FreeRTOS API. The tasks defined in flop.c are included in the
\r
106 * set of standard demo tasks to ensure the floating point unit gets some
\r
109 * In addition to the standard demo tasks, the following tasks and tests are
\r
110 * defined and/or created within this file:
\r
112 * Webserver ("uIP") task - This serves a number of dynamically generated WEB
\r
113 * pages to a standard WEB browser. The IP and MAC addresses are configured by
\r
114 * constants defined at the bottom of FreeRTOSConfig.h. Use either a standard
\r
115 * Ethernet cable to connect through a hug, or a cross over (point to point)
\r
116 * cable to connect directly. Ensure the IP address used is compatible with the
\r
117 * IP address of the machine running the browser - the easiest way to achieve
\r
118 * this is to ensure the first three octets of the IP addresses are the same.
\r
120 * "Reg test" tasks - These fill the registers with known values, then check
\r
121 * that each register still contains its expected value. Each task uses
\r
122 * different values. The tasks run with very low priority so get preempted
\r
123 * very frequently. A check variable is incremented on each iteration of the
\r
124 * test loop. A register containing an unexpected value is indicative of an
\r
125 * error in the context switching mechanism and will result in a branch to a
\r
126 * null loop - which in turn will prevent the check variable from incrementing
\r
127 * any further and allow the check task (described below) to determine that an
\r
128 * error has occurred. The nature of the reg test tasks necessitates that they
\r
129 * are written in assembly code.
\r
131 * "Check" task - This only executes every five seconds but has a high priority
\r
132 * to ensure it gets processor time. Its main function is to check that all the
\r
133 * standard demo tasks are still operational. While no errors have been
\r
134 * discovered the check task will toggle LED 5 every 5 seconds - the toggle
\r
135 * rate increasing to 200ms being a visual indication that at least one task has
\r
136 * reported unexpected behaviour.
\r
138 * "High frequency timer test" - A high frequency periodic interrupt is
\r
139 * generated using a timer - the interrupt is assigned a priority above
\r
140 * configMAX_SYSCALL_INTERRUPT_PRIORITY so should not be effected by anything
\r
141 * the kernel is doing. The frequency and priority of the interrupt, in
\r
142 * combination with other standard tests executed in this demo, should result
\r
143 * in interrupts nesting at least 3 and probably 4 deep. This test is only
\r
144 * included in build configurations that have the optimiser switched on. In
\r
145 * optimised builds the count of high frequency ticks is used as the time base
\r
146 * for the run time stats.
\r
148 * *NOTE 1* If LED5 is toggling every 5 seconds then all the demo application
\r
149 * tasks are executing as expected and no errors have been reported in any
\r
150 * tasks. The toggle rate increasing to 200ms indicates that at least one task
\r
151 * has reported unexpected behaviour.
\r
153 * *NOTE 2* vApplicationSetupTimerInterrupt() is called by the kernel to let
\r
154 * the application set up a timer to generate the tick interrupt. In this
\r
155 * example a compare match timer is used for this purpose.
\r
157 * *NOTE 3* The CPU must be in Supervisor mode when the scheduler is started.
\r
158 * The PowerON_Reset_PC() supplied in resetprg.c with this demo has
\r
159 * Change_PSW_PM_to_UserMode() commented out to ensure this is the case.
\r
161 * *NOTE 4* The IntQueue common demo tasks test interrupt nesting and make use
\r
162 * of all the 8bit timers (as two cascaded 16bit units).
\r
165 /* Hardware specific includes. */
\r
166 #include "iodefine.h"
\r
168 /* Kernel includes. */
\r
169 #include "FreeRTOS.h"
\r
172 /* Standard demo includes. */
\r
173 #include "partest.h"
\r
175 #include "IntQueue.h"
\r
176 #include "BlockQ.h"
\r
178 #include "integer.h"
\r
179 #include "blocktim.h"
\r
180 #include "semtest.h"
\r
182 #include "GenQTest.h"
\r
184 #include "recmutex.h"
\r
187 /* Values that are passed into the reg test tasks using the task parameter. The
\r
188 tasks check that the values are passed in correctly. */
\r
189 #define mainREG_TEST_1_PARAMETER ( 0x12121212UL )
\r
190 #define mainREG_TEST_2_PARAMETER ( 0x12345678UL )
\r
192 /* Priorities at which the tasks are created. */
\r
193 #define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
\r
194 #define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 )
\r
195 #define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )
\r
196 #define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
\r
197 #define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
\r
198 #define mainFLASH_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
\r
199 #define mainuIP_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
\r
200 #define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY )
\r
201 #define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )
\r
202 #define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY )
\r
204 /* The WEB server uses string handling functions, which in turn use a bit more
\r
205 stack than most of the other tasks. */
\r
206 #define mainuIP_STACK_SIZE ( configMINIMAL_STACK_SIZE * 3 )
\r
208 /* The LED toggled by the check task. */
\r
209 #define mainCHECK_LED ( 5 )
\r
211 /* The rate at which mainCHECK_LED will toggle when all the tasks are running
\r
212 without error. Controlled by the check task as described at the top of this
\r
214 #define mainNO_ERROR_CYCLE_TIME ( 5000 / portTICK_PERIOD_MS )
\r
216 /* The rate at which mainCHECK_LED will toggle when an error has been reported
\r
217 by at least one task. Controlled by the check task as described at the top of
\r
219 #define mainERROR_CYCLE_TIME ( 200 / portTICK_PERIOD_MS )
\r
223 * vApplicationMallocFailedHook() will only be called if
\r
224 * configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook
\r
225 * function that will execute if a call to pvPortMalloc() fails.
\r
226 * pvPortMalloc() is called internally by the kernel whenever a task, queue or
\r
227 * semaphore is created. It is also called by various parts of the demo
\r
230 void vApplicationMallocFailedHook( void );
\r
233 * vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set to 1
\r
234 * in FreeRTOSConfig.h. It is a hook function that is called on each iteration
\r
235 * of the idle task. It is essential that code added to this hook function
\r
236 * never attempts to block in any way (for example, call xQueueReceive() with
\r
237 * a block time specified). If the application makes use of the vTaskDelete()
\r
238 * API function (as this demo application does) then it is also important that
\r
239 * vApplicationIdleHook() is permitted to return to its calling function because
\r
240 * it is the responsibility of the idle task to clean up memory allocated by the
\r
241 * kernel to any task that has since been deleted.
\r
243 void vApplicationIdleHook( void );
\r
246 * vApplicationStackOverflowHook() will only be called if
\r
247 * configCHECK_FOR_STACK_OVERFLOW is set to a non-zero value. The handle and
\r
248 * name of the offending task should be passed in the function parameters, but
\r
249 * it is possible that the stack overflow will have corrupted these - in which
\r
250 * case pxCurrentTCB can be inspected to find the same information.
\r
252 void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName );
\r
255 * The reg test tasks as described at the top of this file.
\r
257 static void prvRegTest1Task( void *pvParameters );
\r
258 static void prvRegTest2Task( void *pvParameters );
\r
261 * The actual implementation of the reg test functionality, which, because of
\r
262 * the direct register access, have to be in assembly.
\r
264 static void prvRegTest1Implementation( void ) __attribute__((naked));
\r
265 static void prvRegTest2Implementation( void ) __attribute__((naked));
\r
269 * The check task as described at the top of this file.
\r
271 static void prvCheckTask( void *pvParameters );
\r
274 * Contains the implementation of the WEB server.
\r
276 extern void vuIP_Task( void *pvParameters );
\r
278 /*-----------------------------------------------------------*/
\r
280 /* Variables that are incremented on each iteration of the reg test tasks -
\r
281 provided the tasks have not reported any errors. The check task inspects these
\r
282 variables to ensure they are still incrementing as expected. If a variable
\r
283 stops incrementing then it is likely that its associate task has stalled. */
\r
284 unsigned long ulRegTest1CycleCount = 0UL, ulRegTest2CycleCount = 0UL;
\r
286 /* The status message that is displayed at the bottom of the "task stats" web
\r
287 page, which is served by the uIP task. This will report any errors picked up
\r
288 by the reg test task. */
\r
289 static const char *pcStatusMessage = NULL;
\r
291 /*-----------------------------------------------------------*/
\r
295 extern void HardwareSetup( void );
\r
297 /* Renesas provided CPU configuration routine. The clocks are configured in
\r
301 /* Turn all LEDs off. */
\r
302 vParTestInitialise();
\r
304 /* Start the reg test tasks which test the context switching mechanism. */
\r
305 xTaskCreate( prvRegTest1Task, "RegTst1", configMINIMAL_STACK_SIZE, ( void * ) mainREG_TEST_1_PARAMETER, tskIDLE_PRIORITY, NULL );
\r
306 xTaskCreate( prvRegTest2Task, "RegTst2", configMINIMAL_STACK_SIZE, ( void * ) mainREG_TEST_2_PARAMETER, tskIDLE_PRIORITY, NULL );
\r
308 /* The web server task. */
\r
309 xTaskCreate( vuIP_Task, "uIP", mainuIP_STACK_SIZE, NULL, mainuIP_TASK_PRIORITY, NULL );
\r
311 /* Start the check task as described at the top of this file. */
\r
312 xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
\r
314 /* Create the standard demo tasks. */
\r
315 vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
\r
316 vCreateBlockTimeTasks();
\r
317 vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
\r
318 vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
\r
319 vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );
\r
320 vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );
\r
321 vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY );
\r
322 vStartQueuePeekTasks();
\r
323 vStartRecursiveMutexTasks();
\r
324 vStartInterruptQueueTasks();
\r
325 vStartMathTasks( mainFLOP_TASK_PRIORITY );
\r
327 /* The suicide tasks must be created last as they need to know how many
\r
328 tasks were running prior to their creation in order to ascertain whether
\r
329 or not the correct/expected number of tasks are running at any given time. */
\r
330 vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
\r
332 /* Start the tasks running. */
\r
333 vTaskStartScheduler();
\r
335 /* If all is well we will never reach here as the scheduler will now be
\r
336 running. If we do reach here then it is likely that there was insufficient
\r
337 heap available for the idle task to be created. */
\r
342 /*-----------------------------------------------------------*/
\r
344 static void prvCheckTask( void *pvParameters )
\r
346 static volatile unsigned long ulLastRegTest1CycleCount = 0UL, ulLastRegTest2CycleCount = 0UL;
\r
347 TickType_t xNextWakeTime, xCycleFrequency = mainNO_ERROR_CYCLE_TIME;
\r
348 extern void vSetupHighFrequencyTimer( void );
\r
350 /* If this is being executed then the kernel has been started. Start the high
\r
351 frequency timer test as described at the top of this file. This is only
\r
352 included in the optimised build configuration - otherwise it takes up too much
\r
354 #ifdef INCLUDE_HIGH_FREQUENCY_TIMER_TEST
\r
355 vSetupHighFrequencyTimer();
\r
358 /* Initialise xNextWakeTime - this only needs to be done once. */
\r
359 xNextWakeTime = xTaskGetTickCount();
\r
363 /* Place this task in the blocked state until it is time to run again. */
\r
364 vTaskDelayUntil( &xNextWakeTime, xCycleFrequency );
\r
366 /* Check the standard demo tasks are running without error. */
\r
367 if( xAreGenericQueueTasksStillRunning() != pdTRUE )
\r
369 pcStatusMessage = "Error: GenQueue";
\r
371 else if( xAreQueuePeekTasksStillRunning() != pdTRUE )
\r
373 pcStatusMessage = "Error: QueuePeek\r\n";
\r
375 else if( xAreBlockingQueuesStillRunning() != pdTRUE )
\r
377 pcStatusMessage = "Error: BlockQueue\r\n";
\r
379 else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
\r
381 pcStatusMessage = "Error: BlockTime\r\n";
\r
383 else if( xAreSemaphoreTasksStillRunning() != pdTRUE )
\r
385 pcStatusMessage = "Error: SemTest\r\n";
\r
387 else if( xArePollingQueuesStillRunning() != pdTRUE )
\r
389 pcStatusMessage = "Error: PollQueue\r\n";
\r
391 else if( xIsCreateTaskStillRunning() != pdTRUE )
\r
393 pcStatusMessage = "Error: Death\r\n";
\r
395 else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
\r
397 pcStatusMessage = "Error: IntMath\r\n";
\r
399 else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
\r
401 pcStatusMessage = "Error: RecMutex\r\n";
\r
403 else if( xAreIntQueueTasksStillRunning() != pdPASS )
\r
405 pcStatusMessage = "Error: IntQueue\r\n";
\r
407 else if( xAreMathsTaskStillRunning() != pdPASS )
\r
409 pcStatusMessage = "Error: Flop\r\n";
\r
412 /* Check the reg test tasks are still cycling. They will stop incrementing
\r
413 their loop counters if they encounter an error. */
\r
414 if( ulRegTest1CycleCount == ulLastRegTest1CycleCount )
\r
416 pcStatusMessage = "Error: RegTest1\r\n";
\r
419 if( ulRegTest2CycleCount == ulLastRegTest2CycleCount )
\r
421 pcStatusMessage = "Error: RegTest2\r\n";
\r
424 ulLastRegTest1CycleCount = ulRegTest1CycleCount;
\r
425 ulLastRegTest2CycleCount = ulRegTest2CycleCount;
\r
427 /* Toggle the check LED to give an indication of the system status. If
\r
428 the LED toggles every 5 seconds then everything is ok. A faster toggle
\r
429 indicates an error. */
\r
430 vParTestToggleLED( mainCHECK_LED );
\r
432 /* Ensure the LED toggles at a faster rate if an error has occurred. */
\r
433 if( pcStatusMessage != NULL )
\r
435 /* Increase the rate at which this task cycles, which will increase the
\r
436 rate at which mainCHECK_LED flashes to give visual feedback that an error
\r
438 xCycleFrequency = mainERROR_CYCLE_TIME;
\r
442 /*-----------------------------------------------------------*/
\r
444 /* The RX port uses this callback function to configure its tick interrupt.
\r
445 This allows the application to choose the tick interrupt source. */
\r
446 void vApplicationSetupTimerInterrupt( void )
\r
448 /* Enable compare match timer 0. */
\r
451 /* Interrupt on compare match. */
\r
452 CMT0.CMCR.BIT.CMIE = 1;
\r
454 /* Set the compare match value. */
\r
455 CMT0.CMCOR = ( unsigned short ) ( ( ( configPERIPHERAL_CLOCK_HZ / configTICK_RATE_HZ ) -1 ) / 8 );
\r
457 /* Divide the PCLK by 8. */
\r
458 CMT0.CMCR.BIT.CKS = 0;
\r
460 /* Enable the interrupt... */
\r
461 _IEN( _CMT0_CMI0 ) = 1;
\r
463 /* ...and set its priority to the application defined kernel priority. */
\r
464 _IPR( _CMT0_CMI0 ) = configKERNEL_INTERRUPT_PRIORITY;
\r
466 /* Start the timer. */
\r
467 CMT.CMSTR0.BIT.STR0 = 1;
\r
469 /*-----------------------------------------------------------*/
\r
471 /* This function is explained by the comments above its prototype at the top
\r
473 void vApplicationMallocFailedHook( void )
\r
477 /*-----------------------------------------------------------*/
\r
479 /* This function is explained by the comments above its prototype at the top
\r
481 void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
\r
485 /*-----------------------------------------------------------*/
\r
487 /* This function is explained by the comments above its prototype at the top
\r
489 void vApplicationIdleHook( void )
\r
492 /*-----------------------------------------------------------*/
\r
494 /* This function is explained in the comments at the top of this file. */
\r
495 static void prvRegTest1Task( void *pvParameters )
\r
497 if( ( ( unsigned long ) pvParameters ) != mainREG_TEST_1_PARAMETER )
\r
499 /* The parameter did not contain the expected value. */
\r
502 /* Stop the tick interrupt so its obvious something has gone wrong. */
\r
503 taskDISABLE_INTERRUPTS();
\r
507 /* This is an asm function that never returns. */
\r
508 prvRegTest1Implementation();
\r
510 /*-----------------------------------------------------------*/
\r
512 /* This function is explained in the comments at the top of this file. */
\r
513 static void prvRegTest2Task( void *pvParameters )
\r
515 if( ( ( unsigned long ) pvParameters ) != mainREG_TEST_2_PARAMETER )
\r
517 /* The parameter did not contain the expected value. */
\r
520 /* Stop the tick interrupt so its obvious something has gone wrong. */
\r
521 taskDISABLE_INTERRUPTS();
\r
525 /* This is an asm function that never returns. */
\r
526 prvRegTest2Implementation();
\r
528 /*-----------------------------------------------------------*/
\r
530 char *pcGetTaskStatusMessage( void )
\r
532 /* Not bothered about a critical section here although technically because of
\r
533 the task priorities the pointer could change it will be atomic if not near
\r
534 atomic and its not critical. */
\r
535 if( pcStatusMessage == NULL )
\r
537 return "All tasks running without error";
\r
541 return ( char * ) pcStatusMessage;
\r
544 /*-----------------------------------------------------------*/
\r
546 /* This function is explained in the comments at the top of this file. */
\r
547 static void prvRegTest1Implementation( void )
\r
551 /* Put a known value in each register. */
\r
561 "MOV #10, R10 \n" \
\r
562 "MOV #11, R11 \n" \
\r
563 "MOV #12, R12 \n" \
\r
564 "MOV #13, R13 \n" \
\r
565 "MOV #14, R14 \n" \
\r
566 "MOV #15, R15 \n" \
\r
568 /* Loop, checking each itteration that each register still contains the
\r
572 /* Push the registers that are going to get clobbered. */
\r
573 "PUSHM R14-R15 \n" \
\r
575 /* Increment the loop counter to show this task is still getting CPU time. */
\r
576 "MOV #_ulRegTest1CycleCount, R14 \n" \
\r
577 "MOV [ R14 ], R15 \n" \
\r
579 "MOV R15, [ R14 ] \n" \
\r
581 /* Yield to extend the test coverage. Set the bit in the ITU SWINTR register. */
\r
583 "MOV #0872E0H, R15 \n" \
\r
584 "MOV.B R14, [R15] \n" \
\r
588 /* Restore the clobbered registers. */
\r
589 "POPM R14-R15 \n" \
\r
591 /* Now compare each register to ensure it still contains the value that was
\r
592 set before this loop was entered. */
\r
594 "BNE RegTest1Error \n" \
\r
596 "BNE RegTest1Error \n" \
\r
598 "BNE RegTest1Error \n" \
\r
600 "BNE RegTest1Error \n" \
\r
602 "BNE RegTest1Error \n" \
\r
604 "BNE RegTest1Error \n" \
\r
606 "BNE RegTest1Error \n" \
\r
608 "BNE RegTest1Error \n" \
\r
610 "BNE RegTest1Error \n" \
\r
611 "CMP #10, R10 \n" \
\r
612 "BNE RegTest1Error \n" \
\r
613 "CMP #11, R11 \n" \
\r
614 "BNE RegTest1Error \n" \
\r
615 "CMP #12, R12 \n" \
\r
616 "BNE RegTest1Error \n" \
\r
617 "CMP #13, R13 \n" \
\r
618 "BNE RegTest1Error \n" \
\r
619 "CMP #14, R14 \n" \
\r
620 "BNE RegTest1Error \n" \
\r
621 "CMP #15, R15 \n" \
\r
622 "BNE RegTest1Error \n" \
\r
624 /* All comparisons passed, start a new itteratio of this loop. */
\r
625 "BRA TestLoop1 \n" \
\r
627 "RegTest1Error: \n" \
\r
628 /* A compare failed, just loop here so the loop counter stops incrementing
\r
629 - causing the check task to indicate the error. */
\r
630 "BRA RegTest1Error "
\r
633 /*-----------------------------------------------------------*/
\r
635 /* This function is explained in the comments at the top of this file. */
\r
636 static void prvRegTest2Implementation( void )
\r
640 /* Put a known value in each register. */
\r
641 "MOV #10H, R1 \n" \
\r
642 "MOV #20H, R2 \n" \
\r
643 "MOV #30H, R3 \n" \
\r
644 "MOV #40H, R4 \n" \
\r
645 "MOV #50H, R5 \n" \
\r
646 "MOV #60H, R6 \n" \
\r
647 "MOV #70H, R7 \n" \
\r
648 "MOV #80H, R8 \n" \
\r
649 "MOV #90H, R9 \n" \
\r
650 "MOV #100H, R10 \n" \
\r
651 "MOV #110H, R11 \n" \
\r
652 "MOV #120H, R12 \n" \
\r
653 "MOV #130H, R13 \n" \
\r
654 "MOV #140H, R14 \n" \
\r
655 "MOV #150H, R15 \n" \
\r
657 /* Loop, checking each itteration that each register still contains the
\r
661 /* Push the registers that are going to get clobbered. */
\r
662 "PUSHM R14-R15 \n" \
\r
664 /* Increment the loop counter to show this task is still getting CPU time. */
\r
665 "MOV #_ulRegTest2CycleCount, R14 \n" \
\r
666 "MOV [ R14 ], R15 \n" \
\r
668 "MOV R15, [ R14 ] \n" \
\r
670 /* Restore the clobbered registers. */
\r
671 "POPM R14-R15 \n" \
\r
673 /* Now compare each register to ensure it still contains the value that was
\r
674 set before this loop was entered. */
\r
675 "CMP #10H, R1 \n" \
\r
676 "BNE RegTest2Error \n" \
\r
677 "CMP #20H, R2 \n" \
\r
678 "BNE RegTest2Error \n" \
\r
679 "CMP #30H, R3 \n" \
\r
680 "BNE RegTest2Error \n" \
\r
681 "CMP #40H, R4 \n" \
\r
682 "BNE RegTest2Error \n" \
\r
683 "CMP #50H, R5 \n" \
\r
684 "BNE RegTest2Error \n" \
\r
685 "CMP #60H, R6 \n" \
\r
686 "BNE RegTest2Error \n" \
\r
687 "CMP #70H, R7 \n" \
\r
688 "BNE RegTest2Error \n" \
\r
689 "CMP #80H, R8 \n" \
\r
690 "BNE RegTest2Error \n" \
\r
691 "CMP #90H, R9 \n" \
\r
692 "BNE RegTest2Error \n" \
\r
693 "CMP #100H, R10 \n" \
\r
694 "BNE RegTest2Error \n" \
\r
695 "CMP #110H, R11 \n" \
\r
696 "BNE RegTest2Error \n" \
\r
697 "CMP #120H, R12 \n" \
\r
698 "BNE RegTest2Error \n" \
\r
699 "CMP #130H, R13 \n" \
\r
700 "BNE RegTest2Error \n" \
\r
701 "CMP #140H, R14 \n" \
\r
702 "BNE RegTest2Error \n" \
\r
703 "CMP #150H, R15 \n" \
\r
704 "BNE RegTest2Error \n" \
\r
706 /* All comparisons passed, start a new itteratio of this loop. */
\r
707 "BRA TestLoop2 \n" \
\r
709 "RegTest2Error: \n" \
\r
710 /* A compare failed, just loop here so the loop counter stops incrementing
\r
711 - causing the check task to indicate the error. */
\r
712 "BRA RegTest2Error "
\r