]> git.sur5r.net Git - freertos/blob - Demo/PPC405_Xilinx_Virtex4_GCC/RTOSDemo/main.c
Add new PPC405 demo.
[freertos] / Demo / PPC405_Xilinx_Virtex4_GCC / RTOSDemo / main.c
1 /*
2         FreeRTOS.org V5.0.0 - Copyright (C) 2003-2008 Richard Barry.
3
4         This file is part of the FreeRTOS.org distribution.
5
6         FreeRTOS.org is free software; you can redistribute it and/or modify
7         it under the terms of the GNU General Public License as published by
8         the Free Software Foundation; either version 2 of the License, or
9         (at your option) any later version.
10
11         FreeRTOS.org is distributed in the hope that it will be useful,
12         but WITHOUT ANY WARRANTY; without even the implied warranty of
13         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14         GNU General Public License for more details.
15
16         You should have received a copy of the GNU General Public License
17         along with FreeRTOS.org; if not, write to the Free Software
18         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
20         A special exception to the GPL can be applied should you wish to distribute
21         a combined work that includes FreeRTOS.org, without being obliged to provide
22         the source code for any proprietary components.  See the licensing section
23         of http://www.FreeRTOS.org for full details of how and when the exception
24         can be applied.
25
26     ***************************************************************************
27     ***************************************************************************
28     *                                                                         *
29     * SAVE TIME AND MONEY!  We can port FreeRTOS.org to your own hardware,    *
30     * and even write all or part of your application on your behalf.          *
31     * See http://www.OpenRTOS.com for details of the services we provide to   *
32     * expedite your project.                                                  *
33     *                                                                         *
34     ***************************************************************************
35     ***************************************************************************
36
37         Please ensure to read the configuration and relevant port sections of the
38         online documentation.
39
40         http://www.FreeRTOS.org - Documentation, latest information, license and 
41         contact details.
42
43         http://www.SafeRTOS.com - A version that is certified for use in safety 
44         critical systems.
45
46         http://www.OpenRTOS.com - Commercial support, development, porting, 
47         licensing and training services.
48 */
49
50 /*
51  * Creates all the demo application tasks, then starts the scheduler.  The WEB
52  * documentation provides more details of the demo application tasks.
53  * 
54  * In addition to the standard demo tasks, the follow demo specific tasks are
55  * create:
56  *
57  * The "Check" task.  This only executes every three seconds but has the highest 
58  * priority so is guaranteed to get processor time.  Its main function is to 
59  * check that all the other tasks are still operational.  Most tasks maintain 
60  * a unique count that is incremented each time the task successfully completes 
61  * its function.  Should any error occur within such a task the count is 
62  * permanently halted.  The check task inspects the count of each task to ensure 
63  * it has changed since the last time the check task executed.  If all the count 
64  * variables have changed all the tasks are still executing error free, and the 
65  * check task toggles the onboard LED.  Should any task contain an error at any time 
66  * the LED toggle rate will change from 3 seconds to 500ms.
67  *
68  * The "Register Check" tasks.  These tasks fill the CPU registers with known
69  * values, then check that each register still contains the expected value, the
70  * discovery of an unexpected value being indicative of an error in the RTOS
71  * context switch mechanism.  The register check tasks operate at low priority
72  * so are switched in and out frequently.
73  *
74  */
75
76 /* Scheduler includes. */
77 #include "FreeRTOS.h"
78 #include "task.h"
79
80 /* Xilinx library includes. */
81 #include "xcache_l.h"
82 #include "xintc.h"
83
84 /* Demo application includes. */
85 #include "flash.h"
86 #include "integer.h"
87 #include "comtest2.h"
88 #include "semtest.h"
89 #include "BlockQ.h"
90 #include "dynamic.h"
91 #include "GenQTest.h"
92 #include "QPeek.h"
93 #include "blocktim.h"
94 #include "death.h"
95 #include "partest.h"
96 #include "countsem.h"
97 #include "recmutex.h"
98 #include "flop.h"
99 #include "flop-reg-test.h"
100
101 /* Priorities assigned to the demo tasks. */
102 #define mainCHECK_TASK_PRIORITY                 ( tskIDLE_PRIORITY + 4 )
103 #define mainSEM_TEST_PRIORITY                   ( tskIDLE_PRIORITY + 2 )
104 #define mainCOM_TEST_PRIORITY                   ( tskIDLE_PRIORITY + 1 )
105 #define mainQUEUE_BLOCK_PRIORITY                ( tskIDLE_PRIORITY + 1 )
106 #define mainDEATH_PRIORITY                              ( tskIDLE_PRIORITY + 1 )
107 #define mainLED_TASK_PRIORITY                   ( tskIDLE_PRIORITY + 1 )
108 #define mainGENERIC_QUEUE_PRIORITY              ( tskIDLE_PRIORITY )
109 #define mainQUEUE_POLL_PRIORITY                 ( tskIDLE_PRIORITY + 1 )
110 #define mainFLOP_PRIORITY                               ( tskIDLE_PRIORITY )
111
112 /* The first LED used by the COM test and check tasks respectively. */
113 #define mainCOM_TEST_LED                                ( 4 )
114 #define mainCHECK_TEST_LED                              ( 3 )
115
116 /* The baud rate used by the comtest tasks is set by the hardware, so the
117 baud rate parameters passed into the comtest initialisation has no effect. */
118 #define mainBAUD_SET_IN_HARDWARE                ( 0 )
119
120 /* Delay periods used by the check task.  If no errors have been found then
121 the check LED will toggle every mainNO_ERROR_CHECK_DELAY milliseconds.  If an
122 error has been found at any time then the toggle rate will increase to 
123 mainERROR_CHECK_DELAY milliseconds. */
124 #define mainNO_ERROR_CHECK_DELAY                ( ( portTickType ) 3000 / portTICK_RATE_MS  )
125 #define mainERROR_CHECK_DELAY                   ( ( portTickType ) 500 / portTICK_RATE_MS  )
126
127
128 /* 
129  * The tasks defined within this file - described within the comments at the
130  * head of this page. 
131  */
132 static void prvRegTestTask1( void *pvParameters );
133 static void prvRegTestTask2( void *pvParameters );
134 static void prvErrorChecks( void *pvParameters );
135
136 /*
137  * Called by the 'check' task to inspect all the standard demo tasks within
138  * the system, as described within the comments at the head of this page.
139  */
140 static portBASE_TYPE prvCheckOtherTasksAreStillRunning( void );
141
142 /*
143  * Perform any hardware initialisation required by the demo application.
144  */
145 static void prvSetupHardware( void );
146
147 /*-----------------------------------------------------------*/
148
149 /* xRegTestStatus will get set to pdFAIL by the regtest tasks if they
150 discover an unexpected value. */
151 static volatile unsigned portBASE_TYPE xRegTestStatus = pdPASS;
152
153 /* Counters used to ensure the regtest tasks are still running. */
154 static volatile unsigned portLONG ulRegTest1Counter = 0UL, ulRegTest2Counter = 0UL;
155
156 /*-----------------------------------------------------------*/
157
158 int main( void )
159 {
160
161         /* Must be called prior to installing any interrupt handlers! */
162         vPortSetupInterruptController();
163
164         /* In this case prvSetupHardware() just enables the caches and and
165         configures the IO ports for the LED outputs. */
166         prvSetupHardware();
167
168         /* Start the standard demo application tasks.  Note that the baud rate used
169         by the comtest tasks is set by the hardware, so the baud rate parameter
170         passed has no effect. */
171         vStartLEDFlashTasks( mainLED_TASK_PRIORITY );   
172         vStartIntegerMathTasks( tskIDLE_PRIORITY );
173         vAltStartComTestTasks( mainCOM_TEST_PRIORITY, mainBAUD_SET_IN_HARDWARE, mainCOM_TEST_LED );
174         vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
175         vStartBlockingQueueTasks ( mainQUEUE_BLOCK_PRIORITY );  
176         vStartDynamicPriorityTasks();   
177         vStartGenericQueueTasks( mainGENERIC_QUEUE_PRIORITY );
178         vStartQueuePeekTasks();
179         vCreateBlockTimeTasks();
180         vStartCountingSemaphoreTasks();
181         vStartRecursiveMutexTasks();
182
183         #if ( configUSE_FPU == 1 )\r
184         {\r
185                 /* A different project is provided that has configUSE_FPU set to 1\r
186                 in order to demonstrate all the settings required to use the floating\r
187                 point unit.  If you wish to use the floating point unit do not start\r
188                 with this project. */
189                 vStartMathTasks( mainFLOP_PRIORITY );
190                 vStartFlopRegTests();\r
191         }
192         #endif
193
194         /* Create the tasks defined within this file. */
195         xTaskCreate( prvRegTestTask1, ( signed portCHAR * ) "Regtest1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
196         xTaskCreate( prvRegTestTask2, ( signed portCHAR * ) "Regtest2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
197         xTaskCreate( prvErrorChecks, ( signed portCHAR * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
198
199         /* The suicide tasks must be started last as they record the number of other
200         tasks that exist within the system.  The value is then used to ensure at run
201         time the number of tasks that exists is within expected bounds. */
202         vCreateSuicidalTasks( mainDEATH_PRIORITY );
203
204         /* Now start the scheduler.  Following this call the created tasks should
205         be executing. */        
206         vTaskStartScheduler();
207
208         /* vTaskStartScheduler() will only return if an error occurs while the 
209         idle task is being created. */
210         for( ;; );
211
212         return 0;
213 }
214 /*-----------------------------------------------------------*/
215
216 static portBASE_TYPE prvCheckOtherTasksAreStillRunning( void )
217 {
218 portBASE_TYPE lReturn = pdPASS;
219 static unsigned portLONG ulLastRegTest1Counter= 0UL, ulLastRegTest2Counter = 0UL;
220
221         /* The demo tasks maintain a count that increments every cycle of the task
222         provided that the task has never encountered an error.  This function 
223         checks the counts maintained by the tasks to ensure they are still being
224         incremented.  A count remaining at the same value between calls therefore
225         indicates that an error has been detected. */
226
227         if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
228         {
229                 lReturn = pdFAIL;
230         }
231
232         if( xAreComTestTasksStillRunning() != pdTRUE )
233         {
234                 lReturn = pdFAIL;
235         }
236         
237         if( xAreSemaphoreTasksStillRunning() != pdTRUE )
238         {
239                 lReturn = pdFAIL;
240         }
241         
242         if( xAreBlockingQueuesStillRunning() != pdTRUE )
243         {
244                 lReturn = pdFAIL;
245         }
246         
247         if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
248         {
249                 lReturn = pdFAIL;
250         }
251         
252         if( xIsCreateTaskStillRunning() != pdTRUE )
253         {
254                 lReturn = pdFAIL;
255         }
256         
257         if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
258         {
259                 lReturn = pdFAIL;
260         }
261         
262         if( xAreGenericQueueTasksStillRunning() != pdTRUE )
263         {
264                 lReturn = pdFAIL;
265         }
266         
267         if( xAreQueuePeekTasksStillRunning() != pdTRUE )
268         {
269                 lReturn = pdFAIL;
270         }
271
272         if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )
273         {
274                 lReturn = pdFAIL;
275         }
276
277         if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
278         {
279                 lReturn = pdFAIL;
280         }
281
282         #if ( configUSE_FPU == 1 )
283                 if( xAreMathsTaskStillRunning() != pdTRUE )
284                 {
285                         lReturn = pdFAIL;
286                 }
287
288                 if( xAreFlopRegisterTestsStillRunning() != pdTRUE )
289                 {
290                         lReturn = pdFAIL;
291                 }
292         #endif
293
294         /* Have the register test tasks found any errors? */
295         if( xRegTestStatus != pdPASS )
296         {
297                 lReturn = pdFAIL;
298         }
299
300         /* Are the register test tasks still looping? */
301         if( ulLastRegTest1Counter == ulRegTest1Counter )
302         {
303                 lReturn = pdFAIL;
304         }
305         else
306         {
307                 ulLastRegTest1Counter = ulRegTest1Counter;
308         }
309
310         if( ulLastRegTest2Counter == ulRegTest2Counter )
311         {
312                 lReturn = pdFAIL;
313         }
314         else
315         {
316                 ulLastRegTest2Counter = ulRegTest2Counter;
317         }
318
319         return lReturn;
320 }
321 /*-----------------------------------------------------------*/
322
323 static void prvErrorChecks( void *pvParameters )
324 {
325 portTickType xDelayPeriod = mainNO_ERROR_CHECK_DELAY, xLastExecutionTime;
326 volatile unsigned portBASE_TYPE uxFreeStack;
327 \r
328         /* Just to remove compiler warning. */
329         ( void ) pvParameters;
330
331         /* This call is just to demonstrate the use of the function - nothing is
332         done with the value.  You would expect the stack high water mark to be
333         lower (the function to return a larger value) here at function entry than
334         later following calls to other functions. */
335         uxFreeStack = uxTaskGetStackHighWaterMark( NULL );
336
337         /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()
338         works correctly. */
339         xLastExecutionTime = xTaskGetTickCount();
340
341         /* Cycle for ever, delaying then checking all the other tasks are still
342         operating without error. */
343         for( ;; )
344         {
345                 /* Again just for demo purposes - uxFreeStack should have a lower value
346                 here than following the call to uxTaskGetStackHighWaterMark() on the
347                 task entry. */
348                 uxFreeStack = uxTaskGetStackHighWaterMark( NULL );
349
350                 /* Wait until it is time to check again.  The time we wait here depends
351                 on whether an error has been detected or not.  When an error is 
352                 detected the time is shortened resulting in a faster LED flash rate. */
353                 vTaskDelayUntil( &xLastExecutionTime, xDelayPeriod );
354
355                 /* See if the other tasks are all ok. */
356                 if( prvCheckOtherTasksAreStillRunning() != pdPASS )
357                 {
358                         /* An error occurred in one of the tasks so shorten the delay 
359                         period - which has the effect of increasing the frequency of the
360                         LED toggle. */
361                         xDelayPeriod = mainERROR_CHECK_DELAY;
362                 }
363
364                 /* Flash! */
365                 vParTestToggleLED( mainCHECK_TEST_LED );
366         }
367 }
368 /*-----------------------------------------------------------*/
369
370 static void prvSetupHardware( void )
371 {
372         XCache_EnableICache( 0x80000000 );
373         XCache_EnableDCache( 0x80000000 );
374
375         /* Setup the IO port for use with the LED outputs. */
376         vParTestInitialise();
377 }
378 /*-----------------------------------------------------------*/
379
380 void prvRegTest1Pass( void )
381 {
382         /* Called from the inline assembler - this cannot be static
383         otherwise it can get optimised away. */
384         ulRegTest1Counter++;
385 }
386 /*-----------------------------------------------------------*/
387
388 void prvRegTest2Pass( void )
389 {
390         /* Called from the inline assembler - this cannot be static
391         otherwise it can get optimised away. */
392         ulRegTest2Counter++;
393 }
394 /*-----------------------------------------------------------*/
395
396 void prvRegTestFail( void )
397 {
398         /* Called from the inline assembler - this cannot be static
399         otherwise it can get optimised away. */
400         xRegTestStatus = pdFAIL;
401 }
402 /*-----------------------------------------------------------*/
403
404 static void prvRegTestTask1( void *pvParameters )
405 {\r
406         /* Just to remove compiler warning. */
407         ( void ) pvParameters;
408
409         /* The first register test task as described at the top of this file.  The
410         values used in the registers are different to those use in the second 
411         register test task.  Also, unlike the second register test task, this task
412         yields between setting the register values and subsequently checking the
413         register values. */
414         asm volatile
415         (
416                 "RegTest1Start:                                 \n\t" \
417                 "                                                               \n\t" \
418                 "       li              0, 301                          \n\t" \
419                 "       mtspr   256, 0  #USPRG0         \n\t" \
420                 "       li              0, 501                          \n\t" \
421                 "       mtspr   8, 0    #LR                     \n\t" \
422                 "       li              0, 4                            \n\t" \
423                 "       mtspr   1, 0    #XER            \n\t" \
424                 "                                                               \n\t" \
425                 "       li              0, 1                            \n\t" \
426                 "       li              2, 2                            \n\t" \
427                 "       li              3, 3                            \n\t" \
428                 "       li              4,      4                               \n\t" \
429                 "       li              5,      5                               \n\t" \
430                 "       li              6,      6                               \n\t" \
431                 "       li              7,      7                               \n\t" \
432                 "       li              8,      8                               \n\t" \
433                 "       li              9,      9                               \n\t" \
434                 "       li              10,     10                              \n\t" \
435                 "       li              11,     11                              \n\t" \
436                 "       li              12,     12                              \n\t" \
437                 "       li              13,     13                              \n\t" \
438                 "       li              14,     14                              \n\t" \
439                 "       li              15,     15                              \n\t" \
440                 "       li              16,     16                              \n\t" \
441                 "       li              17,     17                              \n\t" \
442                 "       li              18,     18                              \n\t" \
443                 "       li              19,     19                              \n\t" \
444                 "       li              20,     20                              \n\t" \
445                 "       li              21,     21                              \n\t" \
446                 "       li              22,     22                              \n\t" \
447                 "       li              23,     23                              \n\t" \
448                 "       li              24,     24                              \n\t" \
449                 "       li              25,     25                              \n\t" \
450                 "       li              26,     26                              \n\t" \
451                 "       li              27,     27                              \n\t" \
452                 "       li              28,     28                              \n\t" \
453                 "       li              29,     29                              \n\t" \
454                 "       li              30,     30                              \n\t" \
455                 "       li              31,     31                              \n\t" \
456                 "                                                               \n\t" \
457                 "       sc                                                      \n\t" \
458                 "       nop                                                     \n\t" \
459                 "                                                               \n\t" \
460                 "       cmpwi   0, 1                            \n\t" \
461                 "       bne     RegTest1Fail                    \n\t" \
462                 "       cmpwi   2, 2                            \n\t" \
463                 "       bne     RegTest1Fail                    \n\t" \
464                 "       cmpwi   3, 3                            \n\t" \
465                 "       bne     RegTest1Fail                    \n\t" \
466                 "       cmpwi   4, 4                            \n\t" \
467                 "       bne     RegTest1Fail                    \n\t" \
468                 "       cmpwi   5, 5                            \n\t" \
469                 "       bne     RegTest1Fail                    \n\t" \
470                 "       cmpwi   6, 6                            \n\t" \
471                 "       bne     RegTest1Fail                    \n\t" \
472                 "       cmpwi   7, 7                            \n\t" \
473                 "       bne     RegTest1Fail                    \n\t" \
474                 "       cmpwi   8, 8                            \n\t" \
475                 "       bne     RegTest1Fail                    \n\t" \
476                 "       cmpwi   9, 9                            \n\t" \
477                 "       bne     RegTest1Fail                    \n\t" \
478                 "       cmpwi   10, 10                          \n\t" \
479                 "       bne     RegTest1Fail                    \n\t" \
480                 "       cmpwi   11, 11                          \n\t" \
481                 "       bne     RegTest1Fail                    \n\t" \
482                 "       cmpwi   12, 12                          \n\t" \
483                 "       bne     RegTest1Fail                    \n\t" \
484                 "       cmpwi   13, 13                          \n\t" \
485                 "       bne     RegTest1Fail                    \n\t" \
486                 "       cmpwi   14, 14                          \n\t" \
487                 "       bne     RegTest1Fail                    \n\t" \
488                 "       cmpwi   15, 15                          \n\t" \
489                 "       bne     RegTest1Fail                    \n\t" \
490                 "       cmpwi   16, 16                          \n\t" \
491                 "       bne     RegTest1Fail                    \n\t" \
492                 "       cmpwi   17, 17                          \n\t" \
493                 "       bne     RegTest1Fail                    \n\t" \
494                 "       cmpwi   18, 18                          \n\t" \
495                 "       bne     RegTest1Fail                    \n\t" \
496                 "       cmpwi   19, 19                          \n\t" \
497                 "       bne     RegTest1Fail                    \n\t" \
498                 "       cmpwi   20, 20                          \n\t" \
499                 "       bne     RegTest1Fail                    \n\t" \
500                 "       cmpwi   21, 21                          \n\t" \
501                 "       bne     RegTest1Fail                    \n\t" \
502                 "       cmpwi   22, 22                          \n\t" \
503                 "       bne     RegTest1Fail                    \n\t" \
504                 "       cmpwi   23, 23                          \n\t" \
505                 "       bne     RegTest1Fail                    \n\t" \
506                 "       cmpwi   24, 24                          \n\t" \
507                 "       bne     RegTest1Fail                    \n\t" \
508                 "       cmpwi   25, 25                          \n\t" \
509                 "       bne     RegTest1Fail                    \n\t" \
510                 "       cmpwi   26, 26                          \n\t" \
511                 "       bne     RegTest1Fail                    \n\t" \
512                 "       cmpwi   27, 27                          \n\t" \
513                 "       bne     RegTest1Fail                    \n\t" \
514                 "       cmpwi   28, 28                          \n\t" \
515                 "       bne     RegTest1Fail                    \n\t" \
516                 "       cmpwi   29, 29                          \n\t" \
517                 "       bne     RegTest1Fail                    \n\t" \
518                 "       cmpwi   30, 30                          \n\t" \
519                 "       bne     RegTest1Fail                    \n\t" \
520                 "       cmpwi   31, 31                          \n\t" \
521                 "       bne     RegTest1Fail                    \n\t" \
522                 "                                                               \n\t" \
523                 "       mfspr   0, 256  #USPRG0         \n\t" \
524                 "       cmpwi   0, 301                          \n\t" \
525                 "       bne     RegTest1Fail                    \n\t" \
526                 "       mfspr   0, 8    #LR                     \n\t" \
527                 "       cmpwi   0, 501                          \n\t" \
528                 "       bne     RegTest1Fail                    \n\t" \
529                 "       mfspr   0, 1    #XER            \n\t" \
530                 "       cmpwi   0, 4                            \n\t" \
531                 "       bne     RegTest1Fail                    \n\t" \
532                 "                                                               \n\t" \
533                 "       bl prvRegTest1Pass                      \n\t" \
534                 "       b RegTest1Start                         \n\t" \
535                 "                                                               \n\t" \
536                 "RegTest1Fail:                                  \n\t" \
537                 "                                                               \n\t" \
538                 "                                                               \n\t" \
539                 "       bl prvRegTestFail                       \n\t" \
540                 "       b RegTest1Start                         \n\t" \
541         );
542 }
543 /*-----------------------------------------------------------*/
544
545 static void prvRegTestTask2( void *pvParameters )
546 {\r
547         /* Just to remove compiler warning. */
548         ( void ) pvParameters;
549
550         /* The second register test task as described at the top of this file.  
551         Note that this task fills the registers with different values to the
552         first register test task. */
553         asm volatile
554         (
555                 "RegTest2Start:                                 \n\t" \
556                 "                                                               \n\t" \
557                 "       li              0, 300                          \n\t" \
558                 "       mtspr   256, 0  #USPRG0         \n\t" \
559                 "       li              0, 500                          \n\t" \
560                 "       mtspr   8, 0    #LR                     \n\t" \
561                 "       li              0, 4                            \n\t" \
562                 "       mtspr   1, 0    #XER            \n\t" \
563                 "                                                               \n\t" \
564                 "       li              0, 11                           \n\t" \
565                 "       li              2, 12                           \n\t" \
566                 "       li              3, 13                           \n\t" \
567                 "       li              4,      14                              \n\t" \
568                 "       li              5,      15                              \n\t" \
569                 "       li              6,      16                              \n\t" \
570                 "       li              7,      17                              \n\t" \
571                 "       li              8,      18                              \n\t" \
572                 "       li              9,      19                              \n\t" \
573                 "       li              10,     110                             \n\t" \
574                 "       li              11,     111                             \n\t" \
575                 "       li              12,     112                             \n\t" \
576                 "       li              13,     113                             \n\t" \
577                 "       li              14,     114                             \n\t" \
578                 "       li              15,     115                             \n\t" \
579                 "       li              16,     116                             \n\t" \
580                 "       li              17,     117                             \n\t" \
581                 "       li              18,     118                             \n\t" \
582                 "       li              19,     119                             \n\t" \
583                 "       li              20,     120                             \n\t" \
584                 "       li              21,     121                             \n\t" \
585                 "       li              22,     122                             \n\t" \
586                 "       li              23,     123                             \n\t" \
587                 "       li              24,     124                             \n\t" \
588                 "       li              25,     125                             \n\t" \
589                 "       li              26,     126                             \n\t" \
590                 "       li              27,     127                             \n\t" \
591                 "       li              28,     128                             \n\t" \
592                 "       li              29,     129                             \n\t" \
593                 "       li              30,     130                             \n\t" \
594                 "       li              31,     131                             \n\t" \
595                 "                                                               \n\t" \
596                 "       cmpwi   0, 11                           \n\t" \
597                 "       bne     RegTest2Fail                    \n\t" \
598                 "       cmpwi   2, 12                           \n\t" \
599                 "       bne     RegTest2Fail                    \n\t" \
600                 "       cmpwi   3, 13                           \n\t" \
601                 "       bne     RegTest2Fail                    \n\t" \
602                 "       cmpwi   4, 14                           \n\t" \
603                 "       bne     RegTest2Fail                    \n\t" \
604                 "       cmpwi   5, 15                           \n\t" \
605                 "       bne     RegTest2Fail                    \n\t" \
606                 "       cmpwi   6, 16                           \n\t" \
607                 "       bne     RegTest2Fail                    \n\t" \
608                 "       cmpwi   7, 17                           \n\t" \
609                 "       bne     RegTest2Fail                    \n\t" \
610                 "       cmpwi   8, 18                           \n\t" \
611                 "       bne     RegTest2Fail                    \n\t" \
612                 "       cmpwi   9, 19                           \n\t" \
613                 "       bne     RegTest2Fail                    \n\t" \
614                 "       cmpwi   10, 110                         \n\t" \
615                 "       bne     RegTest2Fail                    \n\t" \
616                 "       cmpwi   11, 111                         \n\t" \
617                 "       bne     RegTest2Fail                    \n\t" \
618                 "       cmpwi   12, 112                         \n\t" \
619                 "       bne     RegTest2Fail                    \n\t" \
620                 "       cmpwi   13, 113                         \n\t" \
621                 "       bne     RegTest2Fail                    \n\t" \
622                 "       cmpwi   14, 114                         \n\t" \
623                 "       bne     RegTest2Fail                    \n\t" \
624                 "       cmpwi   15, 115                         \n\t" \
625                 "       bne     RegTest2Fail                    \n\t" \
626                 "       cmpwi   16, 116                         \n\t" \
627                 "       bne     RegTest2Fail                    \n\t" \
628                 "       cmpwi   17, 117                         \n\t" \
629                 "       bne     RegTest2Fail                    \n\t" \
630                 "       cmpwi   18, 118                         \n\t" \
631                 "       bne     RegTest2Fail                    \n\t" \
632                 "       cmpwi   19, 119                         \n\t" \
633                 "       bne     RegTest2Fail                    \n\t" \
634                 "       cmpwi   20, 120                         \n\t" \
635                 "       bne     RegTest2Fail                    \n\t" \
636                 "       cmpwi   21, 121                         \n\t" \
637                 "       bne     RegTest2Fail                    \n\t" \
638                 "       cmpwi   22, 122                         \n\t" \
639                 "       bne     RegTest2Fail                    \n\t" \
640                 "       cmpwi   23, 123                         \n\t" \
641                 "       bne     RegTest2Fail                    \n\t" \
642                 "       cmpwi   24, 124                         \n\t" \
643                 "       bne     RegTest2Fail                    \n\t" \
644                 "       cmpwi   25, 125                         \n\t" \
645                 "       bne     RegTest2Fail                    \n\t" \
646                 "       cmpwi   26, 126                         \n\t" \
647                 "       bne     RegTest2Fail                    \n\t" \
648                 "       cmpwi   27, 127                         \n\t" \
649                 "       bne     RegTest2Fail                    \n\t" \
650                 "       cmpwi   28, 128                         \n\t" \
651                 "       bne     RegTest2Fail                    \n\t" \
652                 "       cmpwi   29, 129                         \n\t" \
653                 "       bne     RegTest2Fail                    \n\t" \
654                 "       cmpwi   30, 130                         \n\t" \
655                 "       bne     RegTest2Fail                    \n\t" \
656                 "       cmpwi   31, 131                         \n\t" \
657                 "       bne     RegTest2Fail                    \n\t" \
658                 "                                                               \n\t" \
659                 "       mfspr   0, 256  #USPRG0         \n\t" \
660                 "       cmpwi   0, 300                          \n\t" \
661                 "       bne     RegTest2Fail                    \n\t" \
662                 "       mfspr   0, 8    #LR                     \n\t" \
663                 "       cmpwi   0, 500                          \n\t" \
664                 "       bne     RegTest2Fail                    \n\t" \
665                 "       mfspr   0, 1    #XER            \n\t" \
666                 "       cmpwi   0, 4                            \n\t" \
667                 "       bne     RegTest2Fail                    \n\t" \
668                 "                                                               \n\t" \
669                 "       bl prvRegTest2Pass                      \n\t" \
670                 "       b RegTest2Start                         \n\t" \
671                 "                                                               \n\t" \
672                 "RegTest2Fail:                                  \n\t" \
673                 "                                                               \n\t" \
674                 "                                                               \n\t" \
675                 "       bl prvRegTestFail                       \n\t" \
676                 "       b RegTest2Start                         \n\t" \
677         );
678 }
679 /*-----------------------------------------------------------*/
680
681 /* This hook function will get called if there is a suspected stack overflow.
682 An overflow can cause the task name to be corrupted, in which case the task
683 handle needs to be used to determine the offending task. */
684 void vApplicationStackOverflowHook( xTaskHandle xTask, signed portCHAR *pcTaskName );
685 void vApplicationStackOverflowHook( xTaskHandle xTask, signed portCHAR *pcTaskName )
686 {
687 /* To prevent the optimiser removing the variables. */
688 volatile xTaskHandle xTaskIn = xTask;
689 volatile signed portCHAR *pcTaskNameIn = pcTaskName;
690 \r
691         /* Remove compiler warnings. */\r
692         ( void ) xTaskIn;\r
693         ( void ) pcTaskNameIn;\r
694
695         /* The following three calls are simply to stop compiler warnings about the
696         functions not being used - they are called from the inline assembly. */
697         prvRegTest1Pass();
698         prvRegTest2Pass();
699         prvRegTestFail();
700
701         for( ;; );
702 }
703
704
705