2 FreeRTOS V7.1.1 - Copyright (C) 2012 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 ***************************************************************************
\r
46 * Having a problem? Start by reading the FAQ "My application does *
\r
47 * not run, what could be wrong? *
\r
49 * http://www.FreeRTOS.org/FAQHelp.html *
\r
51 ***************************************************************************
\r
54 http://www.FreeRTOS.org - Documentation, training, latest information,
\r
55 license and contact details.
\r
57 http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
\r
58 including FreeRTOS+Trace - an indispensable productivity tool.
\r
60 Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
\r
61 the code with commercial support, indemnification, and middleware, under
\r
62 the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
\r
63 provide a safety engineered and independently SIL3 certified version under
\r
64 the SafeRTOS brand: http://www.SafeRTOS.com.
\r
67 /* ****************************************************************************
\r
68 * This project includes a lot of tasks and tests and is therefore complex.
\r
69 * If you would prefer a much simpler project to get started with then select
\r
70 * the 'Blinky' build configuration within the HEW IDE. The Blinky
\r
71 * configuration builds main-blinky.c in place of this file.
\r
72 * ****************************************************************************
\r
74 * Creates all the demo application tasks, then starts the scheduler. The web
\r
75 * documentation provides more details of the standard demo application tasks,
\r
76 * which provide no particular functionality but do provide a good example of
\r
77 * how to use the FreeRTOS API. The tasks defined in flop.c are included in the
\r
78 * set of standard demo tasks to ensure the floating point unit gets some
\r
81 * In addition to the standard demo tasks, the following tasks and tests are
\r
82 * defined and/or created within this file:
\r
84 * Webserver ("uIP") task - This serves a number of dynamically generated WEB
\r
85 * pages to a standard WEB browser. The IP and MAC addresses are configured by
\r
86 * constants defined at the bottom of FreeRTOSConfig.h. Use either a standard
\r
87 * Ethernet cable to connect through a hug, or a cross over (point to point)
\r
88 * cable to connect directly. Ensure the IP address used is compatible with the
\r
89 * IP address of the machine running the browser - the easiest way to achieve
\r
90 * this is to ensure the first three octets of the IP addresses are the same.
\r
92 * "Reg test" tasks - These fill the registers with known values, then check
\r
93 * that each register still contains its expected value. Each task uses
\r
94 * different values. The tasks run with very low priority so get preempted
\r
95 * very frequently. A check variable is incremented on each iteration of the
\r
96 * test loop. A register containing an unexpected value is indicative of an
\r
97 * error in the context switching mechanism and will result in a branch to a
\r
98 * null loop - which in turn will prevent the check variable from incrementing
\r
99 * any further and allow the check task (described below) to determine that an
\r
100 * error has occurred. The nature of the reg test tasks necessitates that they
\r
101 * are written in assembly code.
\r
103 * "Check" timer - The check software timer period is initially set to five
\r
104 * seconds. The callback function associated with the check software timer
\r
105 * checks that all the standard demo tasks, and the register check tasks, are
\r
106 * not only still executing, but are executing without reporting any errors. If
\r
107 * the check software timer discovers that a task has either stalled, or
\r
108 * reported an error, then it changes its own execution period from the initial
\r
109 * five seconds, to just 200ms. The check software timer callback function
\r
110 * also toggles LED3 each time it is called. This provides a visual indication
\r
111 * of the system status: If LED3 toggles every five seconds, then no issues
\r
112 * have been discovered. If the LED toggles every 200ms, then an issue has been
\r
113 * discovered with at least one task.
\r
115 * "High frequency timer test" - A high frequency periodic interrupt is
\r
116 * generated using a timer - the interrupt is assigned a priority above
\r
117 * configMAX_SYSCALL_INTERRUPT_PRIORITY so should not be effected by anything
\r
118 * the kernel is doing. The frequency and priority of the interrupt, in
\r
119 * combination with other standard tests executed in this demo, should result
\r
120 * in interrupts nesting at least 3 and probably 4 deep. This test is only
\r
121 * included in build configurations that have the optimiser switched on. In
\r
122 * optimised builds the count of high frequency ticks is used as the time base
\r
123 * for the run time stats.
\r
125 * *NOTE 1* If LED3 is toggling every 5 seconds then all the demo application
\r
126 * tasks are executing as expected and no errors have been reported in any
\r
127 * tasks. The toggle rate increasing to 200ms indicates that at least one task
\r
128 * has reported unexpected behaviour.
\r
130 * *NOTE 2* vApplicationSetupTimerInterrupt() is called by the kernel to let
\r
131 * the application set up a timer to generate the tick interrupt. In this
\r
132 * example a compare match timer is used for this purpose.
\r
134 * *NOTE 3* The CPU must be in Supervisor mode when the scheduler is started.
\r
135 * The PowerON_Reset_PC() supplied in resetprg.c with this demo has
\r
136 * Change_PSW_PM_to_UserMode() commented out to ensure this is the case.
\r
138 * *NOTE 4* The IntQueue common demo tasks test interrupt nesting and make use
\r
139 * of all the 8bit timers (as two cascaded 16bit units).
\r
144 #include <string.h>
\r
146 /* Kernel includes. */
\r
147 #include "FreeRTOS.h"
\r
149 #include "timers.h"
\r
150 #include "semphr.h"
\r
152 /* Standard demo includes. */
\r
153 #include "partest.h"
\r
154 #include "flash_timer.h"
\r
155 #include "IntQueue.h"
\r
156 #include "BlockQ.h"
\r
158 #include "integer.h"
\r
159 #include "blocktim.h"
\r
160 #include "semtest.h"
\r
162 #include "GenQTest.h"
\r
164 #include "recmutex.h"
\r
167 /* Values that are passed into the reg test tasks using the task parameter. The
\r
168 tasks check that the values are passed in correctly. */
\r
169 #define mainREG_TEST_1_PARAMETER ( 0x12121212UL )
\r
170 #define mainREG_TEST_2_PARAMETER ( 0x12345678UL )
\r
172 /* Priorities at which the tasks are created. */
\r
173 #define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
\r
174 #define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 )
\r
175 #define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )
\r
176 #define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
\r
177 #define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
\r
178 #define mainuIP_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
\r
179 #define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY )
\r
180 #define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )
\r
181 #define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY )
\r
183 /* The WEB server uses string handling functions, which in turn use a bit more
\r
184 stack than most of the other tasks. */
\r
185 #define mainuIP_STACK_SIZE ( configMINIMAL_STACK_SIZE * 3 )
\r
187 /* The LED toggled by the check timer. */
\r
188 #define mainCHECK_LED ( 3 )
\r
190 /* The rate at which mainCHECK_LED will toggle when all the tasks are running
\r
191 without error. Controlled by the check timer as described at the top of this
\r
193 #define mainNO_ERROR_CHECK_TIMER_PERIOD_MS ( 5000 / portTICK_RATE_MS )
\r
195 /* The rate at which mainCHECK_LED will toggle when an error has been reported
\r
196 by at least one task. Controlled by the check timer as described at the top of
\r
198 #define mainERROR_CHECK_TIMER_PERIOD_MS ( 200 / portTICK_RATE_MS )
\r
200 /* A block time of zero simply means "don't block". */
\r
201 #define mainDONT_BLOCK ( 0UL )
\r
203 /* A set of timers are created, each of which toggles and LED. This specifies
\r
204 the number of timers to create. */
\r
205 #define mainNUMBER_OF_LEDS_TO_FLASH ( 3 )
\r
208 * vApplicationMallocFailedHook() will only be called if
\r
209 * configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook
\r
210 * function that will execute if a call to pvPortMalloc() fails.
\r
211 * pvPortMalloc() is called internally by the kernel whenever a task, queue or
\r
212 * semaphore is created. It is also called by various parts of the demo
\r
215 void vApplicationMallocFailedHook( void );
\r
218 * vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set to 1
\r
219 * in FreeRTOSConfig.h. It is a hook function that is called on each iteration
\r
220 * of the idle task. It is essential that code added to this hook function
\r
221 * never attempts to block in any way (for example, call xQueueReceive() with
\r
222 * a block time specified). If the application makes use of the vTaskDelete()
\r
223 * API function (as this demo application does) then it is also important that
\r
224 * vApplicationIdleHook() is permitted to return to its calling function because
\r
225 * it is the responsibility of the idle task to clean up memory allocated by the
\r
226 * kernel to any task that has since been deleted.
\r
228 void vApplicationIdleHook( void );
\r
231 * vApplicationStackOverflowHook() will only be called if
\r
232 * configCHECK_FOR_STACK_OVERFLOW is set to a non-zero value. The handle and
\r
233 * name of the offending task should be passed in the function parameters, but
\r
234 * it is possible that the stack overflow will have corrupted these - in which
\r
235 * case pxCurrentTCB can be inspected to find the same information.
\r
237 void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName );
\r
240 * The reg test tasks as described at the top of this file.
\r
242 static void prvRegTest1Task( void *pvParameters );
\r
243 static void prvRegTest2Task( void *pvParameters );
\r
246 * The actual implementation of the reg test functionality, which, because of
\r
247 * the direct register access, have to be in assembly.
\r
249 static void prvRegTest1Implementation( void );
\r
250 static void prvRegTest2Implementation( void );
\r
253 * The check timer callback function, as described at the top of this file.
\r
255 static void prvCheckTimerCallback( xTimerHandle xTimer );
\r
258 * Contains the implementation of the WEB server.
\r
260 extern void vuIP_Task( void *pvParameters );
\r
262 /*-----------------------------------------------------------*/
\r
264 /* Variables that are incremented on each iteration of the reg test tasks -
\r
265 provided the tasks have not reported any errors. The check task inspects these
\r
266 variables to ensure they are still incrementing as expected. If a variable
\r
267 stops incrementing then it is likely that its associate task has stalled. */
\r
268 unsigned long ulRegTest1CycleCount = 0UL, ulRegTest2CycleCount = 0UL;
\r
270 /* The status message that is displayed at the bottom of the "task stats" web
\r
271 page, which is served by the uIP task. This will report any errors picked up
\r
272 by the reg test task. */
\r
273 const char *pcStatusMessage = "All tasks executing without error.";
\r
275 /*-----------------------------------------------------------*/
\r
279 xTimerHandle xCheckTimer;
\r
280 extern void HardwareSetup( void );
\r
282 /* Turn all LEDs off. */
\r
283 vParTestInitialise();
\r
285 /* Start the reg test tasks which test the context switching mechanism. */
\r
286 xTaskCreate( prvRegTest1Task, "RegTst1", configMINIMAL_STACK_SIZE, ( void * ) mainREG_TEST_1_PARAMETER, tskIDLE_PRIORITY, NULL );
\r
287 xTaskCreate( prvRegTest2Task, "RegTst2", configMINIMAL_STACK_SIZE, ( void * ) mainREG_TEST_2_PARAMETER, tskIDLE_PRIORITY, NULL );
\r
289 /* The web server task. */
\r
290 xTaskCreate( vuIP_Task, "uIP", mainuIP_STACK_SIZE, NULL, mainuIP_TASK_PRIORITY, NULL );
\r
292 /* Create the standard demo tasks. */
\r
293 vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
\r
294 vCreateBlockTimeTasks();
\r
295 vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
\r
296 vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
\r
297 vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );
\r
298 vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );
\r
299 vStartQueuePeekTasks();
\r
300 vStartRecursiveMutexTasks();
\r
301 vStartInterruptQueueTasks();
\r
302 vStartMathTasks( mainFLOP_TASK_PRIORITY );
\r
304 /* Create the timers used to toggle the LEDs. */
\r
305 vStartLEDFlashTimers( mainNUMBER_OF_LEDS_TO_FLASH );
\r
307 /* Create the software timer that performs the 'check' functionality,
\r
308 as described at the top of this file. */
\r
309 xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
\r
310 ( mainNO_ERROR_CHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 5000ms (5s). */
\r
311 pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
\r
312 ( void * ) 0, /* The ID is not used, so can be set to anything. */
\r
313 prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
\r
316 if( xCheckTimer != NULL )
\r
318 xTimerStart( xCheckTimer, mainDONT_BLOCK );
\r
321 /* The suicide tasks must be created last as they need to know how many
\r
322 tasks were running prior to their creation in order to ascertain whether
\r
323 or not the correct/expected number of tasks are running at any given time. */
\r
324 vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
\r
326 /* Start the tasks running. */
\r
327 vTaskStartScheduler();
\r
329 /* If all is well, the scheduler will now be running, and the following line
\r
330 will never be reached. If the following line does execute, then there was
\r
331 insufficient FreeRTOS heap memory available for the idle and/or timer tasks
\r
332 to be created. See the memory management section on the FreeRTOS web site
\r
333 for more details. */
\r
336 /*-----------------------------------------------------------*/
\r
338 static void prvCheckTimerCallback( xTimerHandle xTimer )
\r
340 static long lChangedTimerPeriodAlready = pdFALSE;
\r
341 static unsigned long ulLastRegTest1CycleCount = 0, ulLastRegTest2CycleCount = 0;
\r
342 long lErrorFound = pdFALSE;
\r
344 /* If this is being executed then the kernel has been started. Start the
\r
345 high frequency timer test as described at the top of this file. This is
\r
346 only included in the optimised build configuration - otherwise it takes up
\r
347 too much CPU time and can disrupt other tests. */
\r
348 #ifdef INCLUDE_HIGH_FREQUENCY_TIMER_TEST
\r
349 vSetupHighFrequencyTimer();
\r
352 /* Check the standard demo tasks are running without error. */
\r
353 if( xAreGenericQueueTasksStillRunning() != pdTRUE )
\r
355 lErrorFound = pdTRUE;
\r
356 pcStatusMessage = "Error: GenQueue";
\r
358 else if( xAreQueuePeekTasksStillRunning() != pdTRUE )
\r
360 lErrorFound = pdTRUE;
\r
361 pcStatusMessage = "Error: QueuePeek";
\r
363 else if( xAreBlockingQueuesStillRunning() != pdTRUE )
\r
365 lErrorFound = pdTRUE;
\r
366 pcStatusMessage = "Error: BlockQueue";
\r
368 else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
\r
370 lErrorFound = pdTRUE;
\r
371 pcStatusMessage = "Error: BlockTime";
\r
373 else if( xAreSemaphoreTasksStillRunning() != pdTRUE )
\r
375 lErrorFound = pdTRUE;
\r
376 pcStatusMessage = "Error: SemTest";
\r
378 else if( xArePollingQueuesStillRunning() != pdTRUE )
\r
380 lErrorFound = pdTRUE;
\r
381 pcStatusMessage = "Error: PollQueue";
\r
383 else if( xIsCreateTaskStillRunning() != pdTRUE )
\r
385 lErrorFound = pdTRUE;
\r
386 pcStatusMessage = "Error: Death";
\r
388 else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
\r
390 lErrorFound = pdTRUE;
\r
391 pcStatusMessage = "Error: IntMath";
\r
393 else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
\r
395 lErrorFound = pdTRUE;
\r
396 pcStatusMessage = "Error: RecMutex";
\r
398 else if( xAreIntQueueTasksStillRunning() != pdPASS )
\r
400 lErrorFound = pdTRUE;
\r
401 pcStatusMessage = "Error: IntQueue";
\r
403 else if( xAreMathsTaskStillRunning() != pdPASS )
\r
405 lErrorFound = pdTRUE;
\r
406 pcStatusMessage = "Error: Flop";
\r
409 /* Check the reg test tasks are still cycling. They will stop incrementing
\r
410 their loop counters if they encounter an error. */
\r
411 if( ulRegTest1CycleCount == ulLastRegTest1CycleCount )
\r
413 lErrorFound = pdTRUE;
\r
414 pcStatusMessage = "Error: RegTest1";
\r
417 if( ulRegTest2CycleCount == ulLastRegTest2CycleCount )
\r
419 lErrorFound = pdTRUE;
\r
420 pcStatusMessage = "Error: RegTest2";
\r
423 ulLastRegTest1CycleCount = ulRegTest1CycleCount;
\r
424 ulLastRegTest2CycleCount = ulRegTest2CycleCount;
\r
426 /* Toggle the check LED to give an indication of the system status. If
\r
427 the LED toggles every mainNO_ERROR_CHECK_TIMER_PERIOD_MS milliseconds then
\r
428 everything is ok. A faster toggle indicates an error. */
\r
429 vParTestToggleLED( mainCHECK_LED );
\r
431 /* Have any errors been latch in lErrorFound? If so, shorten the
\r
432 period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds.
\r
433 This will result in an increase in the rate at which mainCHECK_LED
\r
435 if( lErrorFound != pdFALSE )
\r
437 if( lChangedTimerPeriodAlready == pdFALSE )
\r
439 lChangedTimerPeriodAlready = pdTRUE;
\r
441 /* This call to xTimerChangePeriod() uses a zero block time.
\r
442 Functions called from inside of a timer callback function must
\r
443 *never* attempt to block. */
\r
444 xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK );
\r
448 /*-----------------------------------------------------------*/
\r
450 /* The RX port uses this callback function to configure its tick interrupt.
\r
451 This allows the application to choose the tick interrupt source. */
\r
452 void vApplicationSetupTimerInterrupt( void )
\r
454 /* Enable compare match timer 0. */
\r
457 /* Interrupt on compare match. */
\r
458 CMT0.CMCR.BIT.CMIE = 1;
\r
460 /* Set the compare match value. */
\r
461 CMT0.CMCOR = ( unsigned short ) ( ( ( configPERIPHERAL_CLOCK_HZ / configTICK_RATE_HZ ) -1 ) / 8 );
\r
463 /* Divide the PCLK by 8. */
\r
464 CMT0.CMCR.BIT.CKS = 0;
\r
466 /* Enable the interrupt... */
\r
467 _IEN( _CMT0_CMI0 ) = 1;
\r
469 /* ...and set its priority to the application defined kernel priority. */
\r
470 _IPR( _CMT0_CMI0 ) = configKERNEL_INTERRUPT_PRIORITY;
\r
472 /* Start the timer. */
\r
473 CMT.CMSTR0.BIT.STR0 = 1;
\r
475 /*-----------------------------------------------------------*/
\r
477 /* This function is explained by the comments above its prototype at the top
\r
479 void vApplicationMallocFailedHook( void )
\r
483 /*-----------------------------------------------------------*/
\r
485 /* This function is explained by the comments above its prototype at the top
\r
487 void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName )
\r
491 /*-----------------------------------------------------------*/
\r
493 /* This function is explained by the comments above its prototype at the top
\r
495 void vApplicationIdleHook( void )
\r
498 /*-----------------------------------------------------------*/
\r
500 /* This function is explained in the comments at the top of this file. */
\r
501 static void prvRegTest1Task( void *pvParameters )
\r
503 if( ( ( unsigned long ) pvParameters ) != mainREG_TEST_1_PARAMETER )
\r
505 /* The parameter did not contain the expected value. */
\r
508 /* Stop the tick interrupt so its obvious something has gone wrong. */
\r
509 taskDISABLE_INTERRUPTS();
\r
513 /* This is an inline asm function that never returns. */
\r
514 prvRegTest1Implementation();
\r
516 /*-----------------------------------------------------------*/
\r
518 /* This function is explained in the comments at the top of this file. */
\r
519 static void prvRegTest2Task( void *pvParameters )
\r
521 if( ( ( unsigned long ) pvParameters ) != mainREG_TEST_2_PARAMETER )
\r
523 /* The parameter did not contain the expected value. */
\r
526 /* Stop the tick interrupt so its obvious something has gone wrong. */
\r
527 taskDISABLE_INTERRUPTS();
\r
531 /* This is an inline asm function that never returns. */
\r
532 prvRegTest2Implementation();
\r
534 /*-----------------------------------------------------------*/
\r
536 /* This function is explained in the comments at the top of this file. */
\r
537 #pragma inline_asm prvRegTest1Implementation
\r
538 static void prvRegTest1Implementation( void )
\r
540 ; Put a known value in each register.
\r
557 ; Loop, checking each itteration that each register still contains the
\r
561 ; Push the registers that are going to get clobbered.
\r
564 ; Increment the loop counter to show this task is still getting CPU time.
\r
565 MOV.L #_ulRegTest1CycleCount, R14
\r
570 ; Yield to extend the text coverage. Set the bit in the ITU SWINTR register.
\r
572 MOV.L #0872E0H, R15
\r
577 ; Restore the clobbered registers.
\r
580 ; Now compare each register to ensure it still contains the value that was
\r
581 ; set before this loop was entered.
\r
613 ; All comparisons passed, start a new itteratio of this loop.
\r
617 ; A compare failed, just loop here so the loop counter stops incrementing
\r
618 ; causing the check task to indicate the error.
\r
621 /*-----------------------------------------------------------*/
\r
623 /* This function is explained in the comments at the top of this file. */
\r
624 #pragma inline_asm prvRegTest2Implementation
\r
625 static void prvRegTest2Implementation( void )
\r
627 ; Put a known value in each register.
\r
644 ; Loop, checking on each itteration that each register still contains the
\r
648 ; Push the registers that are going to get clobbered.
\r
651 ; Increment the loop counter to show this task is still getting CPU time.
\r
652 MOV.L #_ulRegTest2CycleCount, R14
\r
657 ; Restore the clobbered registers.
\r
691 ; All comparisons passed, start a new itteratio of this loop.
\r
695 ; A compare failed, just loop here so the loop counter stops incrementing
\r
696 ; - causing the check task to indicate the error.
\r
699 /*-----------------------------------------------------------*/
\r
701 char *pcGetTaskStatusMessage( void )
\r
703 /* Not bothered about a critical section here although technically because of
\r
704 the task priorities the pointer could change it will be atomic if not near
\r
705 atomic and its not critical. */
\r
706 return ( char * ) pcStatusMessage;
\r
708 /*-----------------------------------------------------------*/
\r