2 FreeRTOS V9.0.0rc2 - Copyright (C) 2016 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 ***************************************************************************
\r
14 >>! NOTE: The modification to the GPL is included to allow you to !<<
\r
15 >>! distribute a combined work that includes FreeRTOS without being !<<
\r
16 >>! obliged to provide the source code for proprietary components !<<
\r
17 >>! outside of the FreeRTOS kernel. !<<
\r
18 ***************************************************************************
\r
20 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
\r
21 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
\r
22 FOR A PARTICULAR PURPOSE. Full license text is available on the following
\r
23 link: http://www.freertos.org/a00114.html
\r
25 ***************************************************************************
\r
27 * FreeRTOS provides completely free yet professionally developed, *
\r
28 * robust, strictly quality controlled, supported, and cross *
\r
29 * platform software that is more than just the market leader, it *
\r
30 * is the industry's de facto standard. *
\r
32 * Help yourself get started quickly while simultaneously helping *
\r
33 * to support the FreeRTOS project by purchasing a FreeRTOS *
\r
34 * tutorial book, reference manual, or both: *
\r
35 * http://www.FreeRTOS.org/Documentation *
\r
37 ***************************************************************************
\r
39 http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
\r
40 the FAQ page "My application does not run, what could be wrong?". Have you
\r
41 defined configASSERT()?
\r
43 http://www.FreeRTOS.org/support - In return for receiving this top quality
\r
44 embedded software for free we request you assist our global community by
\r
45 participating in the support forum.
\r
47 http://www.FreeRTOS.org/training - Investing in training allows your team to
\r
48 be as productive as possible as early as possible. Now you can receive
\r
49 FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
\r
50 Ltd, and the world's leading authority on the world's leading RTOS.
\r
52 http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
\r
53 including FreeRTOS+Trace - an indispensable productivity tool, a DOS
\r
54 compatible FAT file system, and our tiny thread aware UDP/IP stack.
\r
56 http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
\r
57 Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
\r
59 http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
\r
60 Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
\r
61 licenses offer ticketed support, indemnification and commercial middleware.
\r
63 http://www.SafeRTOS.com - High Integrity Systems also provide a safety
\r
64 engineered and independently SIL3 certified version for use in safety and
\r
65 mission critical applications that require provable dependability.
\r
70 /* ****************************************************************************
\r
71 * This project includes a lot of tasks and tests and is therefore complex.
\r
72 * If you would prefer a much simpler project to get started with then select
\r
73 * the 'Blinky' build configuration within the HEW IDE. The Blinky
\r
74 * configuration builds main-blinky.c in place of this file.
\r
75 * ****************************************************************************
\r
77 * Creates all the demo application tasks, then starts the scheduler. The web
\r
78 * documentation provides more details of the standard demo application tasks,
\r
79 * which provide no particular functionality but do provide a good example of
\r
80 * how to use the FreeRTOS API. The tasks defined in flop.c are included in the
\r
81 * set of standard demo tasks to ensure the floating point unit gets some
\r
84 * In addition to the standard demo tasks, the following tasks and tests are
\r
85 * defined and/or created within this file:
\r
87 * Webserver ("uIP") task - This serves a number of dynamically generated WEB
\r
88 * pages to a standard WEB browser. The IP and MAC addresses are configured by
\r
89 * constants defined at the bottom of FreeRTOSConfig.h. Use either a standard
\r
90 * Ethernet cable to connect through a hug, or a cross over (point to point)
\r
91 * cable to connect directly. Ensure the IP address used is compatible with the
\r
92 * IP address of the machine running the browser - the easiest way to achieve
\r
93 * this is to ensure the first three octets of the IP addresses are the same.
\r
95 * "Reg test" tasks - These fill the registers with known values, then check
\r
96 * that each register still contains its expected value. Each task uses
\r
97 * different values. The tasks run with very low priority so get preempted
\r
98 * very frequently. A check variable is incremented on each iteration of the
\r
99 * test loop. A register containing an unexpected value is indicative of an
\r
100 * error in the context switching mechanism and will result in a branch to a
\r
101 * null loop - which in turn will prevent the check variable from incrementing
\r
102 * any further and allow the check task (described below) to determine that an
\r
103 * error has occurred. The nature of the reg test tasks necessitates that they
\r
104 * are written in assembly code.
\r
106 * "Check" timer - The check software timer period is initially set to five
\r
107 * seconds. The callback function associated with the check software timer
\r
108 * checks that all the standard demo tasks, and the register check tasks, are
\r
109 * not only still executing, but are executing without reporting any errors. If
\r
110 * the check software timer discovers that a task has either stalled, or
\r
111 * reported an error, then it changes its own execution period from the initial
\r
112 * five seconds, to just 200ms. The check software timer callback function
\r
113 * also toggles LED3 each time it is called. This provides a visual indication
\r
114 * of the system status: If LED3 toggles every five seconds, then no issues
\r
115 * have been discovered. If the LED toggles every 200ms, then an issue has been
\r
116 * discovered with at least one task.
\r
118 * "High frequency timer test" - A high frequency periodic interrupt is
\r
119 * generated using a timer - the interrupt is assigned a priority above
\r
120 * configMAX_SYSCALL_INTERRUPT_PRIORITY so should not be effected by anything
\r
121 * the kernel is doing. The frequency and priority of the interrupt, in
\r
122 * combination with other standard tests executed in this demo, should result
\r
123 * in interrupts nesting at least 3 and probably 4 deep. This test is only
\r
124 * included in build configurations that have the optimiser switched on. In
\r
125 * optimised builds the count of high frequency ticks is used as the time base
\r
126 * for the run time stats.
\r
128 * *NOTE 1* If LED3 is toggling every 5 seconds then all the demo application
\r
129 * tasks are executing as expected and no errors have been reported in any
\r
130 * tasks. The toggle rate increasing to 200ms indicates that at least one task
\r
131 * has reported unexpected behaviour.
\r
133 * *NOTE 2* vApplicationSetupTimerInterrupt() is called by the kernel to let
\r
134 * the application set up a timer to generate the tick interrupt. In this
\r
135 * example a compare match timer is used for this purpose.
\r
137 * *NOTE 3* The CPU must be in Supervisor mode when the scheduler is started.
\r
138 * The PowerON_Reset_PC() supplied in resetprg.c with this demo has
\r
139 * Change_PSW_PM_to_UserMode() commented out to ensure this is the case.
\r
141 * *NOTE 4* The IntQueue common demo tasks test interrupt nesting and make use
\r
142 * of all the 8bit timers (as two cascaded 16bit units).
\r
147 #include <string.h>
\r
149 /* Kernel includes. */
\r
150 #include "FreeRTOS.h"
\r
152 #include "timers.h"
\r
153 #include "semphr.h"
\r
155 /* Standard demo includes. */
\r
156 #include "partest.h"
\r
157 #include "flash_timer.h"
\r
158 #include "IntQueue.h"
\r
159 #include "BlockQ.h"
\r
161 #include "integer.h"
\r
162 #include "blocktim.h"
\r
163 #include "semtest.h"
\r
165 #include "GenQTest.h"
\r
167 #include "recmutex.h"
\r
170 /* Values that are passed into the reg test tasks using the task parameter. The
\r
171 tasks check that the values are passed in correctly. */
\r
172 #define mainREG_TEST_1_PARAMETER ( 0x12121212UL )
\r
173 #define mainREG_TEST_2_PARAMETER ( 0x12345678UL )
\r
175 /* Priorities at which the tasks are created. */
\r
176 #define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
\r
177 #define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 )
\r
178 #define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )
\r
179 #define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
\r
180 #define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
\r
181 #define mainuIP_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
\r
182 #define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY )
\r
183 #define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )
\r
184 #define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY )
\r
186 /* The WEB server uses string handling functions, which in turn use a bit more
\r
187 stack than most of the other tasks. */
\r
188 #define mainuIP_STACK_SIZE ( configMINIMAL_STACK_SIZE * 3 )
\r
190 /* The LED toggled by the check timer. */
\r
191 #define mainCHECK_LED ( 3 )
\r
193 /* The rate at which mainCHECK_LED will toggle when all the tasks are running
\r
194 without error. Controlled by the check timer as described at the top of this
\r
196 #define mainNO_ERROR_CHECK_TIMER_PERIOD_MS ( 5000 / portTICK_PERIOD_MS )
\r
198 /* The rate at which mainCHECK_LED will toggle when an error has been reported
\r
199 by at least one task. Controlled by the check timer as described at the top of
\r
201 #define mainERROR_CHECK_TIMER_PERIOD_MS ( 200 / portTICK_PERIOD_MS )
\r
203 /* A block time of zero simply means "don't block". */
\r
204 #define mainDONT_BLOCK ( 0UL )
\r
206 /* A set of timers are created, each of which toggles and LED. This specifies
\r
207 the number of timers to create. */
\r
208 #define mainNUMBER_OF_LEDS_TO_FLASH ( 3 )
\r
211 * vApplicationMallocFailedHook() will only be called if
\r
212 * configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook
\r
213 * function that will execute if a call to pvPortMalloc() fails.
\r
214 * pvPortMalloc() is called internally by the kernel whenever a task, queue or
\r
215 * semaphore is created. It is also called by various parts of the demo
\r
218 void vApplicationMallocFailedHook( void );
\r
221 * vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set to 1
\r
222 * in FreeRTOSConfig.h. It is a hook function that is called on each iteration
\r
223 * of the idle task. It is essential that code added to this hook function
\r
224 * never attempts to block in any way (for example, call xQueueReceive() with
\r
225 * a block time specified). If the application makes use of the vTaskDelete()
\r
226 * API function (as this demo application does) then it is also important that
\r
227 * vApplicationIdleHook() is permitted to return to its calling function because
\r
228 * it is the responsibility of the idle task to clean up memory allocated by the
\r
229 * kernel to any task that has since been deleted.
\r
231 void vApplicationIdleHook( void );
\r
234 * vApplicationStackOverflowHook() will only be called if
\r
235 * configCHECK_FOR_STACK_OVERFLOW is set to a non-zero value. The handle and
\r
236 * name of the offending task should be passed in the function parameters, but
\r
237 * it is possible that the stack overflow will have corrupted these - in which
\r
238 * case pxCurrentTCB can be inspected to find the same information.
\r
240 void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName );
\r
243 * The reg test tasks as described at the top of this file.
\r
245 static void prvRegTest1Task( void *pvParameters );
\r
246 static void prvRegTest2Task( void *pvParameters );
\r
249 * The actual implementation of the reg test functionality, which, because of
\r
250 * the direct register access, have to be in assembly.
\r
252 static void prvRegTest1Implementation( void );
\r
253 static void prvRegTest2Implementation( void );
\r
256 * The check timer callback function, as described at the top of this file.
\r
258 static void prvCheckTimerCallback( TimerHandle_t xTimer );
\r
261 * Contains the implementation of the WEB server.
\r
263 extern void vuIP_Task( void *pvParameters );
\r
265 /*-----------------------------------------------------------*/
\r
267 /* Variables that are incremented on each iteration of the reg test tasks -
\r
268 provided the tasks have not reported any errors. The check task inspects these
\r
269 variables to ensure they are still incrementing as expected. If a variable
\r
270 stops incrementing then it is likely that its associate task has stalled. */
\r
271 unsigned long ulRegTest1CycleCount = 0UL, ulRegTest2CycleCount = 0UL;
\r
273 /* The status message that is displayed at the bottom of the "task stats" web
\r
274 page, which is served by the uIP task. This will report any errors picked up
\r
275 by the reg test task. */
\r
276 const char *pcStatusMessage = "All tasks executing without error.";
\r
278 /*-----------------------------------------------------------*/
\r
282 TimerHandle_t xCheckTimer;
\r
283 extern void HardwareSetup( void );
\r
285 /* Turn all LEDs off. */
\r
286 vParTestInitialise();
\r
288 /* Start the reg test tasks which test the context switching mechanism. */
\r
289 xTaskCreate( prvRegTest1Task, "RegTst1", configMINIMAL_STACK_SIZE, ( void * ) mainREG_TEST_1_PARAMETER, tskIDLE_PRIORITY, NULL );
\r
290 xTaskCreate( prvRegTest2Task, "RegTst2", configMINIMAL_STACK_SIZE, ( void * ) mainREG_TEST_2_PARAMETER, tskIDLE_PRIORITY, NULL );
\r
292 /* The web server task. */
\r
293 xTaskCreate( vuIP_Task, "uIP", mainuIP_STACK_SIZE, NULL, mainuIP_TASK_PRIORITY, NULL );
\r
295 /* Create the standard demo tasks. */
\r
296 vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
\r
297 vCreateBlockTimeTasks();
\r
298 vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
\r
299 vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
\r
300 vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );
\r
301 vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );
\r
302 vStartQueuePeekTasks();
\r
303 vStartRecursiveMutexTasks();
\r
304 vStartInterruptQueueTasks();
\r
305 vStartMathTasks( mainFLOP_TASK_PRIORITY );
\r
307 /* Create the timers used to toggle the LEDs. */
\r
308 vStartLEDFlashTimers( mainNUMBER_OF_LEDS_TO_FLASH );
\r
310 /* Create the software timer that performs the 'check' functionality,
\r
311 as described at the top of this file. */
\r
312 xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
\r
313 ( mainNO_ERROR_CHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 5000ms (5s). */
\r
314 pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
\r
315 ( void * ) 0, /* The ID is not used, so can be set to anything. */
\r
316 prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
\r
319 if( xCheckTimer != NULL )
\r
321 xTimerStart( xCheckTimer, mainDONT_BLOCK );
\r
324 /* The suicide tasks must be created last as they need to know how many
\r
325 tasks were running prior to their creation in order to ascertain whether
\r
326 or not the correct/expected number of tasks are running at any given time. */
\r
327 vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
\r
329 /* Start the tasks running. */
\r
330 vTaskStartScheduler();
\r
332 /* If all is well, the scheduler will now be running, and the following line
\r
333 will never be reached. If the following line does execute, then there was
\r
334 insufficient FreeRTOS heap memory available for the idle and/or timer tasks
\r
335 to be created. See the memory management section on the FreeRTOS web site
\r
336 for more details. */
\r
339 /*-----------------------------------------------------------*/
\r
341 static void prvCheckTimerCallback( TimerHandle_t xTimer )
\r
343 static long lChangedTimerPeriodAlready = pdFALSE;
\r
344 static unsigned long ulLastRegTest1CycleCount = 0, ulLastRegTest2CycleCount = 0;
\r
345 long lErrorFound = pdFALSE;
\r
347 /* If this is being executed then the kernel has been started. Start the
\r
348 high frequency timer test as described at the top of this file. This is
\r
349 only included in the optimised build configuration - otherwise it takes up
\r
350 too much CPU time and can disrupt other tests. */
\r
351 #ifdef INCLUDE_HIGH_FREQUENCY_TIMER_TEST
\r
352 vSetupHighFrequencyTimer();
\r
355 /* Check the standard demo tasks are running without error. */
\r
356 if( xAreGenericQueueTasksStillRunning() != pdTRUE )
\r
358 lErrorFound = pdTRUE;
\r
359 pcStatusMessage = "Error: GenQueue";
\r
361 else if( xAreQueuePeekTasksStillRunning() != pdTRUE )
\r
363 lErrorFound = pdTRUE;
\r
364 pcStatusMessage = "Error: QueuePeek";
\r
366 else if( xAreBlockingQueuesStillRunning() != pdTRUE )
\r
368 lErrorFound = pdTRUE;
\r
369 pcStatusMessage = "Error: BlockQueue";
\r
371 else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
\r
373 lErrorFound = pdTRUE;
\r
374 pcStatusMessage = "Error: BlockTime";
\r
376 else if( xAreSemaphoreTasksStillRunning() != pdTRUE )
\r
378 lErrorFound = pdTRUE;
\r
379 pcStatusMessage = "Error: SemTest";
\r
381 else if( xArePollingQueuesStillRunning() != pdTRUE )
\r
383 lErrorFound = pdTRUE;
\r
384 pcStatusMessage = "Error: PollQueue";
\r
386 else if( xIsCreateTaskStillRunning() != pdTRUE )
\r
388 lErrorFound = pdTRUE;
\r
389 pcStatusMessage = "Error: Death";
\r
391 else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
\r
393 lErrorFound = pdTRUE;
\r
394 pcStatusMessage = "Error: IntMath";
\r
396 else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
\r
398 lErrorFound = pdTRUE;
\r
399 pcStatusMessage = "Error: RecMutex";
\r
401 else if( xAreIntQueueTasksStillRunning() != pdPASS )
\r
403 lErrorFound = pdTRUE;
\r
404 pcStatusMessage = "Error: IntQueue";
\r
406 else if( xAreMathsTaskStillRunning() != pdPASS )
\r
408 lErrorFound = pdTRUE;
\r
409 pcStatusMessage = "Error: Flop";
\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 lErrorFound = pdTRUE;
\r
417 pcStatusMessage = "Error: RegTest1";
\r
420 if( ulRegTest2CycleCount == ulLastRegTest2CycleCount )
\r
422 lErrorFound = pdTRUE;
\r
423 pcStatusMessage = "Error: RegTest2";
\r
426 ulLastRegTest1CycleCount = ulRegTest1CycleCount;
\r
427 ulLastRegTest2CycleCount = ulRegTest2CycleCount;
\r
429 /* Toggle the check LED to give an indication of the system status. If
\r
430 the LED toggles every mainNO_ERROR_CHECK_TIMER_PERIOD_MS milliseconds then
\r
431 everything is ok. A faster toggle indicates an error. */
\r
432 vParTestToggleLED( mainCHECK_LED );
\r
434 /* Have any errors been latch in lErrorFound? If so, shorten the
\r
435 period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds.
\r
436 This will result in an increase in the rate at which mainCHECK_LED
\r
438 if( lErrorFound != pdFALSE )
\r
440 if( lChangedTimerPeriodAlready == pdFALSE )
\r
442 lChangedTimerPeriodAlready = pdTRUE;
\r
444 /* This call to xTimerChangePeriod() uses a zero block time.
\r
445 Functions called from inside of a timer callback function must
\r
446 *never* attempt to block. */
\r
447 xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK );
\r
451 /*-----------------------------------------------------------*/
\r
453 /* The RX port uses this callback function to configure its tick interrupt.
\r
454 This allows the application to choose the tick interrupt source. */
\r
455 void vApplicationSetupTimerInterrupt( void )
\r
457 /* Enable compare match timer 0. */
\r
460 /* Interrupt on compare match. */
\r
461 CMT0.CMCR.BIT.CMIE = 1;
\r
463 /* Set the compare match value. */
\r
464 CMT0.CMCOR = ( unsigned short ) ( ( ( configPERIPHERAL_CLOCK_HZ / configTICK_RATE_HZ ) -1 ) / 8 );
\r
466 /* Divide the PCLK by 8. */
\r
467 CMT0.CMCR.BIT.CKS = 0;
\r
469 /* Enable the interrupt... */
\r
470 _IEN( _CMT0_CMI0 ) = 1;
\r
472 /* ...and set its priority to the application defined kernel priority. */
\r
473 _IPR( _CMT0_CMI0 ) = configKERNEL_INTERRUPT_PRIORITY;
\r
475 /* Start the timer. */
\r
476 CMT.CMSTR0.BIT.STR0 = 1;
\r
478 /*-----------------------------------------------------------*/
\r
480 /* This function is explained by the comments above its prototype at the top
\r
482 void vApplicationMallocFailedHook( void )
\r
486 /*-----------------------------------------------------------*/
\r
488 /* This function is explained by the comments above its prototype at the top
\r
490 void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )
\r
494 /*-----------------------------------------------------------*/
\r
496 /* This function is explained by the comments above its prototype at the top
\r
498 void vApplicationIdleHook( void )
\r
501 /*-----------------------------------------------------------*/
\r
503 /* This function is explained in the comments at the top of this file. */
\r
504 static void prvRegTest1Task( void *pvParameters )
\r
506 if( ( ( unsigned long ) pvParameters ) != mainREG_TEST_1_PARAMETER )
\r
508 /* The parameter did not contain the expected value. */
\r
511 /* Stop the tick interrupt so its obvious something has gone wrong. */
\r
512 taskDISABLE_INTERRUPTS();
\r
516 /* This is an inline asm function that never returns. */
\r
517 prvRegTest1Implementation();
\r
519 /*-----------------------------------------------------------*/
\r
521 /* This function is explained in the comments at the top of this file. */
\r
522 static void prvRegTest2Task( void *pvParameters )
\r
524 if( ( ( unsigned long ) pvParameters ) != mainREG_TEST_2_PARAMETER )
\r
526 /* The parameter did not contain the expected value. */
\r
529 /* Stop the tick interrupt so its obvious something has gone wrong. */
\r
530 taskDISABLE_INTERRUPTS();
\r
534 /* This is an inline asm function that never returns. */
\r
535 prvRegTest2Implementation();
\r
537 /*-----------------------------------------------------------*/
\r
539 /* This function is explained in the comments at the top of this file. */
\r
540 #pragma inline_asm prvRegTest1Implementation
\r
541 static void prvRegTest1Implementation( void )
\r
543 ; Put a known value in each register.
\r
560 ; Loop, checking each iteration that each register still contains the
\r
564 ; Push the registers that are going to get clobbered.
\r
567 ; Increment the loop counter to show this task is still getting CPU time.
\r
568 MOV.L #_ulRegTest1CycleCount, R14
\r
573 ; Yield to extend the text coverage. Set the bit in the ITU SWINTR register.
\r
575 MOV.L #0872E0H, R15
\r
580 ; Restore the clobbered registers.
\r
583 ; Now compare each register to ensure it still contains the value that was
\r
584 ; set before this loop was entered.
\r
616 ; All comparisons passed, start a new itteratio of this loop.
\r
620 ; A compare failed, just loop here so the loop counter stops incrementing
\r
621 ; causing the check task to indicate the error.
\r
624 /*-----------------------------------------------------------*/
\r
626 /* This function is explained in the comments at the top of this file. */
\r
627 #pragma inline_asm prvRegTest2Implementation
\r
628 static void prvRegTest2Implementation( void )
\r
630 ; Put a known value in each register.
\r
647 ; Loop, checking on each iteration that each register still contains the
\r
651 ; Push the registers that are going to get clobbered.
\r
654 ; Increment the loop counter to show this task is still getting CPU time.
\r
655 MOV.L #_ulRegTest2CycleCount, R14
\r
660 ; Restore the clobbered registers.
\r
694 ; All comparisons passed, start a new itteratio of this loop.
\r
698 ; A compare failed, just loop here so the loop counter stops incrementing
\r
699 ; - causing the check task to indicate the error.
\r
702 /*-----------------------------------------------------------*/
\r
704 char *pcGetTaskStatusMessage( void )
\r
706 /* Not bothered about a critical section here although technically because of
\r
707 the task priorities the pointer could change it will be atomic if not near
\r
708 atomic and its not critical. */
\r
709 return ( char * ) pcStatusMessage;
\r
711 /*-----------------------------------------------------------*/
\r