2 FreeRTOS V7.4.2 - Copyright (C) 2013 Real Time Engineers Ltd.
\r
4 FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
\r
5 http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
\r
7 ***************************************************************************
\r
9 * FreeRTOS tutorial books are available in pdf and paperback. *
\r
10 * Complete, revised, and edited pdf reference manuals are also *
\r
13 * Purchasing FreeRTOS documentation will not only help you, by *
\r
14 * ensuring you get running as quickly as possible and with an *
\r
15 * in-depth knowledge of how to use FreeRTOS, it will also help *
\r
16 * the FreeRTOS project to continue with its mission of providing *
\r
17 * professional grade, cross platform, de facto standard solutions *
\r
18 * for microcontrollers - completely free of charge! *
\r
20 * >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
\r
22 * Thank you for using FreeRTOS, and thank you for your support! *
\r
24 ***************************************************************************
\r
27 This file is part of the FreeRTOS distribution.
\r
29 FreeRTOS is free software; you can redistribute it and/or modify it under
\r
30 the terms of the GNU General Public License (version 2) as published by the
\r
31 Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
\r
33 >>>>>>NOTE<<<<<< The modification to the GPL is included to allow you to
\r
34 distribute a combined work that includes FreeRTOS without being obliged to
\r
35 provide the source code for proprietary components outside of the FreeRTOS
\r
38 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
\r
39 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
\r
40 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
\r
41 details. You should have received a copy of the GNU General Public License
\r
42 and the FreeRTOS license exception along with FreeRTOS; if not it can be
\r
43 viewed here: http://www.freertos.org/a00114.html and also obtained by
\r
44 writing to Real Time Engineers Ltd., contact details for whom are available
\r
45 on the FreeRTOS WEB site.
\r
49 ***************************************************************************
\r
51 * Having a problem? Start by reading the FAQ "My application does *
\r
52 * not run, what could be wrong?" *
\r
54 * http://www.FreeRTOS.org/FAQHelp.html *
\r
56 ***************************************************************************
\r
59 http://www.FreeRTOS.org - Documentation, books, training, latest versions,
\r
60 license and Real Time Engineers Ltd. contact details.
\r
62 http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
\r
63 including FreeRTOS+Trace - an indispensable productivity tool, and our new
\r
64 fully thread aware and reentrant UDP/IP stack.
\r
66 http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
\r
67 Integrity Systems, who sell the code with commercial support,
\r
68 indemnification and middleware, under the OpenRTOS brand.
\r
70 http://www.SafeRTOS.com - High Integrity Systems also provide a safety
\r
71 engineered and independently SIL3 certified version for use in safety and
\r
72 mission critical applications that require provable dependability.
\r
75 /* ****************************************************************************
\r
76 * This project includes a lot of tasks and tests and is therefore complex.
\r
77 * If you would prefer a much simpler project to get started with then select
\r
78 * the 'Blinky' build configuration within the HEW IDE. The Blinky
\r
79 * configuration builds main-blinky.c in place of this file.
\r
80 * ****************************************************************************
\r
82 * Creates all the demo application tasks, then starts the scheduler. The web
\r
83 * documentation provides more details of the standard demo application tasks,
\r
84 * which provide no particular functionality but do provide a good example of
\r
85 * how to use the FreeRTOS API. The tasks defined in flop.c are included in the
\r
86 * set of standard demo tasks to ensure the floating point unit gets some
\r
89 * In addition to the standard demo tasks, the following tasks and tests are
\r
90 * defined and/or created within this file:
\r
92 * Webserver ("uIP") task - This serves a number of dynamically generated WEB
\r
93 * pages to a standard WEB browser. The IP and MAC addresses are configured by
\r
94 * constants defined at the bottom of FreeRTOSConfig.h. Use either a standard
\r
95 * Ethernet cable to connect through a hug, or a cross over (point to point)
\r
96 * cable to connect directly. Ensure the IP address used is compatible with the
\r
97 * IP address of the machine running the browser - the easiest way to achieve
\r
98 * this is to ensure the first three octets of the IP addresses are the same.
\r
100 * "Reg test" tasks - These fill the registers with known values, then check
\r
101 * that each register still contains its expected value. Each task uses
\r
102 * different values. The tasks run with very low priority so get preempted
\r
103 * very frequently. A check variable is incremented on each iteration of the
\r
104 * test loop. A register containing an unexpected value is indicative of an
\r
105 * error in the context switching mechanism and will result in a branch to a
\r
106 * null loop - which in turn will prevent the check variable from incrementing
\r
107 * any further and allow the check task (described below) to determine that an
\r
108 * error has occurred. The nature of the reg test tasks necessitates that they
\r
109 * are written in assembly code.
\r
111 * "Check" timer - The check software timer period is initially set to five
\r
112 * seconds. The callback function associated with the check software timer
\r
113 * checks that all the standard demo tasks, and the register check tasks, are
\r
114 * not only still executing, but are executing without reporting any errors. If
\r
115 * the check software timer discovers that a task has either stalled, or
\r
116 * reported an error, then it changes its own execution period from the initial
\r
117 * five seconds, to just 200ms. The check software timer callback function
\r
118 * also toggles LED3 each time it is called. This provides a visual indication
\r
119 * of the system status: If LED3 toggles every five seconds, then no issues
\r
120 * have been discovered. If the LED toggles every 200ms, then an issue has been
\r
121 * discovered with at least one task.
\r
123 * "High frequency timer test" - A high frequency periodic interrupt is
\r
124 * generated using a timer - the interrupt is assigned a priority above
\r
125 * configMAX_SYSCALL_INTERRUPT_PRIORITY so should not be effected by anything
\r
126 * the kernel is doing. The frequency and priority of the interrupt, in
\r
127 * combination with other standard tests executed in this demo, should result
\r
128 * in interrupts nesting at least 3 and probably 4 deep. This test is only
\r
129 * included in build configurations that have the optimiser switched on. In
\r
130 * optimised builds the count of high frequency ticks is used as the time base
\r
131 * for the run time stats.
\r
133 * *NOTE 1* If LED3 is toggling every 5 seconds then all the demo application
\r
134 * tasks are executing as expected and no errors have been reported in any
\r
135 * tasks. The toggle rate increasing to 200ms indicates that at least one task
\r
136 * has reported unexpected behaviour.
\r
138 * *NOTE 2* vApplicationSetupTimerInterrupt() is called by the kernel to let
\r
139 * the application set up a timer to generate the tick interrupt. In this
\r
140 * example a compare match timer is used for this purpose.
\r
142 * *NOTE 3* The CPU must be in Supervisor mode when the scheduler is started.
\r
143 * The PowerON_Reset_PC() supplied in resetprg.c with this demo has
\r
144 * Change_PSW_PM_to_UserMode() commented out to ensure this is the case.
\r
146 * *NOTE 4* The IntQueue common demo tasks test interrupt nesting and make use
\r
147 * of all the 8bit timers (as two cascaded 16bit units).
\r
152 #include <string.h>
\r
154 /* Kernel includes. */
\r
155 #include "FreeRTOS.h"
\r
157 #include "timers.h"
\r
158 #include "semphr.h"
\r
160 /* Standard demo includes. */
\r
161 #include "partest.h"
\r
162 #include "flash_timer.h"
\r
163 #include "IntQueue.h"
\r
164 #include "BlockQ.h"
\r
166 #include "integer.h"
\r
167 #include "blocktim.h"
\r
168 #include "semtest.h"
\r
170 #include "GenQTest.h"
\r
172 #include "recmutex.h"
\r
175 /* Values that are passed into the reg test tasks using the task parameter. The
\r
176 tasks check that the values are passed in correctly. */
\r
177 #define mainREG_TEST_1_PARAMETER ( 0x12121212UL )
\r
178 #define mainREG_TEST_2_PARAMETER ( 0x12345678UL )
\r
180 /* Priorities at which the tasks are created. */
\r
181 #define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
\r
182 #define mainQUEUE_POLL_PRIORITY ( tskIDLE_PRIORITY + 1 )
\r
183 #define mainSEM_TEST_PRIORITY ( tskIDLE_PRIORITY + 1 )
\r
184 #define mainBLOCK_Q_PRIORITY ( tskIDLE_PRIORITY + 2 )
\r
185 #define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3 )
\r
186 #define mainuIP_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
\r
187 #define mainINTEGER_TASK_PRIORITY ( tskIDLE_PRIORITY )
\r
188 #define mainGEN_QUEUE_TASK_PRIORITY ( tskIDLE_PRIORITY )
\r
189 #define mainFLOP_TASK_PRIORITY ( tskIDLE_PRIORITY )
\r
191 /* The WEB server uses string handling functions, which in turn use a bit more
\r
192 stack than most of the other tasks. */
\r
193 #define mainuIP_STACK_SIZE ( configMINIMAL_STACK_SIZE * 3 )
\r
195 /* The LED toggled by the check timer. */
\r
196 #define mainCHECK_LED ( 3 )
\r
198 /* The rate at which mainCHECK_LED will toggle when all the tasks are running
\r
199 without error. Controlled by the check timer as described at the top of this
\r
201 #define mainNO_ERROR_CHECK_TIMER_PERIOD_MS ( 5000 / portTICK_RATE_MS )
\r
203 /* The rate at which mainCHECK_LED will toggle when an error has been reported
\r
204 by at least one task. Controlled by the check timer as described at the top of
\r
206 #define mainERROR_CHECK_TIMER_PERIOD_MS ( 200 / portTICK_RATE_MS )
\r
208 /* A block time of zero simply means "don't block". */
\r
209 #define mainDONT_BLOCK ( 0UL )
\r
211 /* A set of timers are created, each of which toggles and LED. This specifies
\r
212 the number of timers to create. */
\r
213 #define mainNUMBER_OF_LEDS_TO_FLASH ( 3 )
\r
216 * vApplicationMallocFailedHook() will only be called if
\r
217 * configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook
\r
218 * function that will execute if a call to pvPortMalloc() fails.
\r
219 * pvPortMalloc() is called internally by the kernel whenever a task, queue or
\r
220 * semaphore is created. It is also called by various parts of the demo
\r
223 void vApplicationMallocFailedHook( void );
\r
226 * vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set to 1
\r
227 * in FreeRTOSConfig.h. It is a hook function that is called on each iteration
\r
228 * of the idle task. It is essential that code added to this hook function
\r
229 * never attempts to block in any way (for example, call xQueueReceive() with
\r
230 * a block time specified). If the application makes use of the vTaskDelete()
\r
231 * API function (as this demo application does) then it is also important that
\r
232 * vApplicationIdleHook() is permitted to return to its calling function because
\r
233 * it is the responsibility of the idle task to clean up memory allocated by the
\r
234 * kernel to any task that has since been deleted.
\r
236 void vApplicationIdleHook( void );
\r
239 * vApplicationStackOverflowHook() will only be called if
\r
240 * configCHECK_FOR_STACK_OVERFLOW is set to a non-zero value. The handle and
\r
241 * name of the offending task should be passed in the function parameters, but
\r
242 * it is possible that the stack overflow will have corrupted these - in which
\r
243 * case pxCurrentTCB can be inspected to find the same information.
\r
245 void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName );
\r
248 * The reg test tasks as described at the top of this file.
\r
250 static void prvRegTest1Task( void *pvParameters );
\r
251 static void prvRegTest2Task( void *pvParameters );
\r
254 * The actual implementation of the reg test functionality, which, because of
\r
255 * the direct register access, have to be in assembly.
\r
257 static void prvRegTest1Implementation( void );
\r
258 static void prvRegTest2Implementation( void );
\r
261 * The check timer callback function, as described at the top of this file.
\r
263 static void prvCheckTimerCallback( xTimerHandle xTimer );
\r
266 * Contains the implementation of the WEB server.
\r
268 extern void vuIP_Task( void *pvParameters );
\r
270 /*-----------------------------------------------------------*/
\r
272 /* Variables that are incremented on each iteration of the reg test tasks -
\r
273 provided the tasks have not reported any errors. The check task inspects these
\r
274 variables to ensure they are still incrementing as expected. If a variable
\r
275 stops incrementing then it is likely that its associate task has stalled. */
\r
276 unsigned long ulRegTest1CycleCount = 0UL, ulRegTest2CycleCount = 0UL;
\r
278 /* The status message that is displayed at the bottom of the "task stats" web
\r
279 page, which is served by the uIP task. This will report any errors picked up
\r
280 by the reg test task. */
\r
281 const char *pcStatusMessage = "All tasks executing without error.";
\r
283 /*-----------------------------------------------------------*/
\r
287 xTimerHandle xCheckTimer;
\r
288 extern void HardwareSetup( void );
\r
290 /* Turn all LEDs off. */
\r
291 vParTestInitialise();
\r
293 /* Start the reg test tasks which test the context switching mechanism. */
\r
294 xTaskCreate( prvRegTest1Task, "RegTst1", configMINIMAL_STACK_SIZE, ( void * ) mainREG_TEST_1_PARAMETER, tskIDLE_PRIORITY, NULL );
\r
295 xTaskCreate( prvRegTest2Task, "RegTst2", configMINIMAL_STACK_SIZE, ( void * ) mainREG_TEST_2_PARAMETER, tskIDLE_PRIORITY, NULL );
\r
297 /* The web server task. */
\r
298 xTaskCreate( vuIP_Task, "uIP", mainuIP_STACK_SIZE, NULL, mainuIP_TASK_PRIORITY, NULL );
\r
300 /* Create the standard demo tasks. */
\r
301 vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
\r
302 vCreateBlockTimeTasks();
\r
303 vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
\r
304 vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
\r
305 vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );
\r
306 vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );
\r
307 vStartQueuePeekTasks();
\r
308 vStartRecursiveMutexTasks();
\r
309 vStartInterruptQueueTasks();
\r
310 vStartMathTasks( mainFLOP_TASK_PRIORITY );
\r
312 /* Create the timers used to toggle the LEDs. */
\r
313 vStartLEDFlashTimers( mainNUMBER_OF_LEDS_TO_FLASH );
\r
315 /* Create the software timer that performs the 'check' functionality,
\r
316 as described at the top of this file. */
\r
317 xCheckTimer = xTimerCreate( "CheckTimer", /* A text name, purely to help debugging. */
\r
318 ( mainNO_ERROR_CHECK_TIMER_PERIOD_MS ), /* The timer period, in this case 5000ms (5s). */
\r
319 pdTRUE, /* This is an auto-reload timer, so xAutoReload is set to pdTRUE. */
\r
320 ( void * ) 0, /* The ID is not used, so can be set to anything. */
\r
321 prvCheckTimerCallback /* The callback function that inspects the status of all the other tasks. */
\r
324 if( xCheckTimer != NULL )
\r
326 xTimerStart( xCheckTimer, mainDONT_BLOCK );
\r
329 /* The suicide tasks must be created last as they need to know how many
\r
330 tasks were running prior to their creation in order to ascertain whether
\r
331 or not the correct/expected number of tasks are running at any given time. */
\r
332 vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
\r
334 /* Start the tasks running. */
\r
335 vTaskStartScheduler();
\r
337 /* If all is well, the scheduler will now be running, and the following line
\r
338 will never be reached. If the following line does execute, then there was
\r
339 insufficient FreeRTOS heap memory available for the idle and/or timer tasks
\r
340 to be created. See the memory management section on the FreeRTOS web site
\r
341 for more details. */
\r
344 /*-----------------------------------------------------------*/
\r
346 static void prvCheckTimerCallback( xTimerHandle xTimer )
\r
348 static long lChangedTimerPeriodAlready = pdFALSE;
\r
349 static unsigned long ulLastRegTest1CycleCount = 0, ulLastRegTest2CycleCount = 0;
\r
350 long lErrorFound = pdFALSE;
\r
352 /* If this is being executed then the kernel has been started. Start the
\r
353 high frequency timer test as described at the top of this file. This is
\r
354 only included in the optimised build configuration - otherwise it takes up
\r
355 too much CPU time and can disrupt other tests. */
\r
356 #ifdef INCLUDE_HIGH_FREQUENCY_TIMER_TEST
\r
357 vSetupHighFrequencyTimer();
\r
360 /* Check the standard demo tasks are running without error. */
\r
361 if( xAreGenericQueueTasksStillRunning() != pdTRUE )
\r
363 lErrorFound = pdTRUE;
\r
364 pcStatusMessage = "Error: GenQueue";
\r
366 else if( xAreQueuePeekTasksStillRunning() != pdTRUE )
\r
368 lErrorFound = pdTRUE;
\r
369 pcStatusMessage = "Error: QueuePeek";
\r
371 else if( xAreBlockingQueuesStillRunning() != pdTRUE )
\r
373 lErrorFound = pdTRUE;
\r
374 pcStatusMessage = "Error: BlockQueue";
\r
376 else if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
\r
378 lErrorFound = pdTRUE;
\r
379 pcStatusMessage = "Error: BlockTime";
\r
381 else if( xAreSemaphoreTasksStillRunning() != pdTRUE )
\r
383 lErrorFound = pdTRUE;
\r
384 pcStatusMessage = "Error: SemTest";
\r
386 else if( xArePollingQueuesStillRunning() != pdTRUE )
\r
388 lErrorFound = pdTRUE;
\r
389 pcStatusMessage = "Error: PollQueue";
\r
391 else if( xIsCreateTaskStillRunning() != pdTRUE )
\r
393 lErrorFound = pdTRUE;
\r
394 pcStatusMessage = "Error: Death";
\r
396 else if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
\r
398 lErrorFound = pdTRUE;
\r
399 pcStatusMessage = "Error: IntMath";
\r
401 else if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
\r
403 lErrorFound = pdTRUE;
\r
404 pcStatusMessage = "Error: RecMutex";
\r
406 else if( xAreIntQueueTasksStillRunning() != pdPASS )
\r
408 lErrorFound = pdTRUE;
\r
409 pcStatusMessage = "Error: IntQueue";
\r
411 else if( xAreMathsTaskStillRunning() != pdPASS )
\r
413 lErrorFound = pdTRUE;
\r
414 pcStatusMessage = "Error: Flop";
\r
417 /* Check the reg test tasks are still cycling. They will stop incrementing
\r
418 their loop counters if they encounter an error. */
\r
419 if( ulRegTest1CycleCount == ulLastRegTest1CycleCount )
\r
421 lErrorFound = pdTRUE;
\r
422 pcStatusMessage = "Error: RegTest1";
\r
425 if( ulRegTest2CycleCount == ulLastRegTest2CycleCount )
\r
427 lErrorFound = pdTRUE;
\r
428 pcStatusMessage = "Error: RegTest2";
\r
431 ulLastRegTest1CycleCount = ulRegTest1CycleCount;
\r
432 ulLastRegTest2CycleCount = ulRegTest2CycleCount;
\r
434 /* Toggle the check LED to give an indication of the system status. If
\r
435 the LED toggles every mainNO_ERROR_CHECK_TIMER_PERIOD_MS milliseconds then
\r
436 everything is ok. A faster toggle indicates an error. */
\r
437 vParTestToggleLED( mainCHECK_LED );
\r
439 /* Have any errors been latch in lErrorFound? If so, shorten the
\r
440 period of the check timer to mainERROR_CHECK_TIMER_PERIOD_MS milliseconds.
\r
441 This will result in an increase in the rate at which mainCHECK_LED
\r
443 if( lErrorFound != pdFALSE )
\r
445 if( lChangedTimerPeriodAlready == pdFALSE )
\r
447 lChangedTimerPeriodAlready = pdTRUE;
\r
449 /* This call to xTimerChangePeriod() uses a zero block time.
\r
450 Functions called from inside of a timer callback function must
\r
451 *never* attempt to block. */
\r
452 xTimerChangePeriod( xTimer, ( mainERROR_CHECK_TIMER_PERIOD_MS ), mainDONT_BLOCK );
\r
456 /*-----------------------------------------------------------*/
\r
458 /* The RX port uses this callback function to configure its tick interrupt.
\r
459 This allows the application to choose the tick interrupt source. */
\r
460 void vApplicationSetupTimerInterrupt( void )
\r
462 /* Enable compare match timer 0. */
\r
465 /* Interrupt on compare match. */
\r
466 CMT0.CMCR.BIT.CMIE = 1;
\r
468 /* Set the compare match value. */
\r
469 CMT0.CMCOR = ( unsigned short ) ( ( ( configPERIPHERAL_CLOCK_HZ / configTICK_RATE_HZ ) -1 ) / 8 );
\r
471 /* Divide the PCLK by 8. */
\r
472 CMT0.CMCR.BIT.CKS = 0;
\r
474 /* Enable the interrupt... */
\r
475 _IEN( _CMT0_CMI0 ) = 1;
\r
477 /* ...and set its priority to the application defined kernel priority. */
\r
478 _IPR( _CMT0_CMI0 ) = configKERNEL_INTERRUPT_PRIORITY;
\r
480 /* Start the timer. */
\r
481 CMT.CMSTR0.BIT.STR0 = 1;
\r
483 /*-----------------------------------------------------------*/
\r
485 /* This function is explained by the comments above its prototype at the top
\r
487 void vApplicationMallocFailedHook( void )
\r
491 /*-----------------------------------------------------------*/
\r
493 /* This function is explained by the comments above its prototype at the top
\r
495 void vApplicationStackOverflowHook( xTaskHandle pxTask, signed char *pcTaskName )
\r
499 /*-----------------------------------------------------------*/
\r
501 /* This function is explained by the comments above its prototype at the top
\r
503 void vApplicationIdleHook( void )
\r
506 /*-----------------------------------------------------------*/
\r
508 /* This function is explained in the comments at the top of this file. */
\r
509 static void prvRegTest1Task( void *pvParameters )
\r
511 if( ( ( unsigned long ) pvParameters ) != mainREG_TEST_1_PARAMETER )
\r
513 /* The parameter did not contain the expected value. */
\r
516 /* Stop the tick interrupt so its obvious something has gone wrong. */
\r
517 taskDISABLE_INTERRUPTS();
\r
521 /* This is an inline asm function that never returns. */
\r
522 prvRegTest1Implementation();
\r
524 /*-----------------------------------------------------------*/
\r
526 /* This function is explained in the comments at the top of this file. */
\r
527 static void prvRegTest2Task( void *pvParameters )
\r
529 if( ( ( unsigned long ) pvParameters ) != mainREG_TEST_2_PARAMETER )
\r
531 /* The parameter did not contain the expected value. */
\r
534 /* Stop the tick interrupt so its obvious something has gone wrong. */
\r
535 taskDISABLE_INTERRUPTS();
\r
539 /* This is an inline asm function that never returns. */
\r
540 prvRegTest2Implementation();
\r
542 /*-----------------------------------------------------------*/
\r
544 /* This function is explained in the comments at the top of this file. */
\r
545 #pragma inline_asm prvRegTest1Implementation
\r
546 static void prvRegTest1Implementation( void )
\r
548 ; Put a known value in each register.
\r
565 ; Loop, checking each itteration that each register still contains the
\r
569 ; Push the registers that are going to get clobbered.
\r
572 ; Increment the loop counter to show this task is still getting CPU time.
\r
573 MOV.L #_ulRegTest1CycleCount, R14
\r
578 ; Yield to extend the text coverage. Set the bit in the ITU SWINTR register.
\r
580 MOV.L #0872E0H, R15
\r
585 ; Restore the clobbered registers.
\r
588 ; Now compare each register to ensure it still contains the value that was
\r
589 ; set before this loop was entered.
\r
621 ; All comparisons passed, start a new itteratio of this loop.
\r
625 ; A compare failed, just loop here so the loop counter stops incrementing
\r
626 ; causing the check task to indicate the error.
\r
629 /*-----------------------------------------------------------*/
\r
631 /* This function is explained in the comments at the top of this file. */
\r
632 #pragma inline_asm prvRegTest2Implementation
\r
633 static void prvRegTest2Implementation( void )
\r
635 ; Put a known value in each register.
\r
652 ; Loop, checking on each itteration that each register still contains the
\r
656 ; Push the registers that are going to get clobbered.
\r
659 ; Increment the loop counter to show this task is still getting CPU time.
\r
660 MOV.L #_ulRegTest2CycleCount, R14
\r
665 ; Restore the clobbered registers.
\r
699 ; All comparisons passed, start a new itteratio of this loop.
\r
703 ; A compare failed, just loop here so the loop counter stops incrementing
\r
704 ; - causing the check task to indicate the error.
\r
707 /*-----------------------------------------------------------*/
\r
709 char *pcGetTaskStatusMessage( void )
\r
711 /* Not bothered about a critical section here although technically because of
\r
712 the task priorities the pointer could change it will be atomic if not near
\r
713 atomic and its not critical. */
\r
714 return ( char * ) pcStatusMessage;
\r
716 /*-----------------------------------------------------------*/
\r