OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [PPC405_FPU_Xilinx_Virtex4_GCC/] [RTOSDemo/] [main.c] - Blame information for rev 586

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.