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

Subversion Repositories openrisc

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

Go to most recent revision | 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 long 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
        {
189
                /* A different project is provided that has configUSE_FPU set to 1
190
                in order to demonstrate all the settings required to use the floating
191
                point unit.  If you wish to use the floating point unit do not start
192
                with this project. */
193
                vStartMathTasks( mainFLOP_PRIORITY );
194
                vStartFlopRegTests();
195
        }
196
        #endif
197
 
198
        /* Create the tasks defined within this file. */
199
        xTaskCreate( prvRegTestTask1, ( signed char * ) "Regtest1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
200
        xTaskCreate( prvRegTestTask2, ( signed char * ) "Regtest2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
201
        xTaskCreate( prvErrorChecks, ( signed char * ) "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );
202
 
203
        /* The suicide tasks must be started last as they record the number of other
204
        tasks that exist within the system.  The value is then used to ensure at run
205
        time the number of tasks that exists is within expected bounds. */
206
        vCreateSuicidalTasks( mainDEATH_PRIORITY );
207
 
208
        /* Now start the scheduler.  Following this call the created tasks should
209
        be executing. */
210
        vTaskStartScheduler();
211
 
212
        /* vTaskStartScheduler() will only return if an error occurs while the
213
        idle task is being created. */
214
        for( ;; );
215
 
216
        return 0;
217
}
218
/*-----------------------------------------------------------*/
219
 
220
static portBASE_TYPE prvCheckOtherTasksAreStillRunning( void )
221
{
222
portBASE_TYPE lReturn = pdPASS;
223
static unsigned long ulLastRegTest1Counter= 0UL, ulLastRegTest2Counter = 0UL;
224
 
225
        /* The demo tasks maintain a count that increments every cycle of the task
226
        provided that the task has never encountered an error.  This function
227
        checks the counts maintained by the tasks to ensure they are still being
228
        incremented.  A count remaining at the same value between calls therefore
229
        indicates that an error has been detected. */
230
 
231
        if( xAreIntegerMathsTaskStillRunning() != pdTRUE )
232
        {
233
                lReturn = pdFAIL;
234
        }
235
 
236
        if( xAreComTestTasksStillRunning() != pdTRUE )
237
        {
238
                lReturn = pdFAIL;
239
        }
240
 
241
        if( xAreSemaphoreTasksStillRunning() != pdTRUE )
242
        {
243
                lReturn = pdFAIL;
244
        }
245
 
246
        if( xAreBlockingQueuesStillRunning() != pdTRUE )
247
        {
248
                lReturn = pdFAIL;
249
        }
250
 
251
        if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
252
        {
253
                lReturn = pdFAIL;
254
        }
255
 
256
        if( xIsCreateTaskStillRunning() != pdTRUE )
257
        {
258
                lReturn = pdFAIL;
259
        }
260
 
261
        if( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
262
        {
263
                lReturn = pdFAIL;
264
        }
265
 
266
        if( xAreGenericQueueTasksStillRunning() != pdTRUE )
267
        {
268
                lReturn = pdFAIL;
269
        }
270
 
271
        if( xAreQueuePeekTasksStillRunning() != pdTRUE )
272
        {
273
                lReturn = pdFAIL;
274
        }
275
 
276
        if( xAreCountingSemaphoreTasksStillRunning() != pdTRUE )
277
        {
278
                lReturn = pdFAIL;
279
        }
280
 
281
        if( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
282
        {
283
                lReturn = pdFAIL;
284
        }
285
 
286
        #if ( configUSE_FPU == 1 )
287
                if( xAreMathsTaskStillRunning() != pdTRUE )
288
                {
289
                        lReturn = pdFAIL;
290
                }
291
 
292
                if( xAreFlopRegisterTestsStillRunning() != pdTRUE )
293
                {
294
                        lReturn = pdFAIL;
295
                }
296
        #endif
297
 
298
        /* Have the register test tasks found any errors? */
299
        if( xRegTestStatus != pdPASS )
300
        {
301
                lReturn = pdFAIL;
302
        }
303
 
304
        /* Are the register test tasks still looping? */
305
        if( ulLastRegTest1Counter == ulRegTest1Counter )
306
        {
307
                lReturn = pdFAIL;
308
        }
309
        else
310
        {
311
                ulLastRegTest1Counter = ulRegTest1Counter;
312
        }
313
 
314
        if( ulLastRegTest2Counter == ulRegTest2Counter )
315
        {
316
                lReturn = pdFAIL;
317
        }
318
        else
319
        {
320
                ulLastRegTest2Counter = ulRegTest2Counter;
321
        }
322
 
323
        return lReturn;
324
}
325
/*-----------------------------------------------------------*/
326
 
327
static void prvErrorChecks( void *pvParameters )
328
{
329
portTickType xDelayPeriod = mainNO_ERROR_CHECK_DELAY, xLastExecutionTime;
330
volatile unsigned portBASE_TYPE uxFreeStack;
331
 
332
        /* Just to remove compiler warning. */
333
        ( void ) pvParameters;
334
 
335
        /* This call is just to demonstrate the use of the function - nothing is
336
        done with the value.  You would expect the stack high water mark to be
337
        lower (the function to return a larger value) here at function entry than
338
        later following calls to other functions. */
339
        uxFreeStack = uxTaskGetStackHighWaterMark( NULL );
340
 
341
        /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()
342
        works correctly. */
343
        xLastExecutionTime = xTaskGetTickCount();
344
 
345
        /* Cycle for ever, delaying then checking all the other tasks are still
346
        operating without error. */
347
        for( ;; )
348
        {
349
                /* Again just for demo purposes - uxFreeStack should have a lower value
350
                here than following the call to uxTaskGetStackHighWaterMark() on the
351
                task entry. */
352
                uxFreeStack = uxTaskGetStackHighWaterMark( NULL );
353
 
354
                /* Wait until it is time to check again.  The time we wait here depends
355
                on whether an error has been detected or not.  When an error is
356
                detected the time is shortened resulting in a faster LED flash rate. */
357
                vTaskDelayUntil( &xLastExecutionTime, xDelayPeriod );
358
 
359
                /* See if the other tasks are all ok. */
360
                if( prvCheckOtherTasksAreStillRunning() != pdPASS )
361
                {
362
                        /* An error occurred in one of the tasks so shorten the delay
363
                        period - which has the effect of increasing the frequency of the
364
                        LED toggle. */
365
                        xDelayPeriod = mainERROR_CHECK_DELAY;
366
                }
367
 
368
                /* Flash! */
369
                vParTestToggleLED( mainCHECK_TEST_LED );
370
        }
371
}
372
/*-----------------------------------------------------------*/
373
 
374
static void prvSetupHardware( void )
375
{
376
        XCache_EnableICache( 0x80000000 );
377
        XCache_EnableDCache( 0x80000000 );
378
 
379
        /* Setup the IO port for use with the LED outputs. */
380
        vParTestInitialise();
381
}
382
/*-----------------------------------------------------------*/
383
 
384
void prvRegTest1Pass( void )
385
{
386
        /* Called from the inline assembler - this cannot be static
387
        otherwise it can get optimised away. */
388
        ulRegTest1Counter++;
389
}
390
/*-----------------------------------------------------------*/
391
 
392
void prvRegTest2Pass( void )
393
{
394
        /* Called from the inline assembler - this cannot be static
395
        otherwise it can get optimised away. */
396
        ulRegTest2Counter++;
397
}
398
/*-----------------------------------------------------------*/
399
 
400
void prvRegTestFail( void )
401
{
402
        /* Called from the inline assembler - this cannot be static
403
        otherwise it can get optimised away. */
404
        xRegTestStatus = pdFAIL;
405
}
406
/*-----------------------------------------------------------*/
407
 
408
static void prvRegTestTask1( void *pvParameters )
409
{
410
        /* Just to remove compiler warning. */
411
        ( void ) pvParameters;
412
 
413
        /* The first register test task as described at the top of this file.  The
414
        values used in the registers are different to those use in the second
415
        register test task.  Also, unlike the second register test task, this task
416
        yields between setting the register values and subsequently checking the
417
        register values. */
418
        asm volatile
419
        (
420
                "RegTest1Start:                                 \n\t" \
421
                "                                                               \n\t" \
422
                "       li              0, 301                          \n\t" \
423
                "       mtspr   256, 0  #USPRG0         \n\t" \
424
                "       li              0, 501                          \n\t" \
425
                "       mtspr   8, 0    #LR                     \n\t" \
426
                "       li              0, 4                            \n\t" \
427
                "       mtspr   1, 0    #XER            \n\t" \
428
                "                                                               \n\t" \
429
                "       li              0, 1                            \n\t" \
430
                "       li              2, 2                            \n\t" \
431
                "       li              3, 3                            \n\t" \
432
                "       li              4,      4                               \n\t" \
433
                "       li              5,      5                               \n\t" \
434
                "       li              6,      6                               \n\t" \
435
                "       li              7,      7                               \n\t" \
436
                "       li              8,      8                               \n\t" \
437
                "       li              9,      9                               \n\t" \
438
                "       li              10,     10                              \n\t" \
439
                "       li              11,     11                              \n\t" \
440
                "       li              12,     12                              \n\t" \
441
                "       li              13,     13                              \n\t" \
442
                "       li              14,     14                              \n\t" \
443
                "       li              15,     15                              \n\t" \
444
                "       li              16,     16                              \n\t" \
445
                "       li              17,     17                              \n\t" \
446
                "       li              18,     18                              \n\t" \
447
                "       li              19,     19                              \n\t" \
448
                "       li              20,     20                              \n\t" \
449
                "       li              21,     21                              \n\t" \
450
                "       li              22,     22                              \n\t" \
451
                "       li              23,     23                              \n\t" \
452
                "       li              24,     24                              \n\t" \
453
                "       li              25,     25                              \n\t" \
454
                "       li              26,     26                              \n\t" \
455
                "       li              27,     27                              \n\t" \
456
                "       li              28,     28                              \n\t" \
457
                "       li              29,     29                              \n\t" \
458
                "       li              30,     30                              \n\t" \
459
                "       li              31,     31                              \n\t" \
460
                "                                                               \n\t" \
461
                "       sc                                                      \n\t" \
462
                "       nop                                                     \n\t" \
463
                "                                                               \n\t" \
464
                "       cmpwi   0, 1                            \n\t" \
465
                "       bne     RegTest1Fail                    \n\t" \
466
                "       cmpwi   2, 2                            \n\t" \
467
                "       bne     RegTest1Fail                    \n\t" \
468
                "       cmpwi   3, 3                            \n\t" \
469
                "       bne     RegTest1Fail                    \n\t" \
470
                "       cmpwi   4, 4                            \n\t" \
471
                "       bne     RegTest1Fail                    \n\t" \
472
                "       cmpwi   5, 5                            \n\t" \
473
                "       bne     RegTest1Fail                    \n\t" \
474
                "       cmpwi   6, 6                            \n\t" \
475
                "       bne     RegTest1Fail                    \n\t" \
476
                "       cmpwi   7, 7                            \n\t" \
477
                "       bne     RegTest1Fail                    \n\t" \
478
                "       cmpwi   8, 8                            \n\t" \
479
                "       bne     RegTest1Fail                    \n\t" \
480
                "       cmpwi   9, 9                            \n\t" \
481
                "       bne     RegTest1Fail                    \n\t" \
482
                "       cmpwi   10, 10                          \n\t" \
483
                "       bne     RegTest1Fail                    \n\t" \
484
                "       cmpwi   11, 11                          \n\t" \
485
                "       bne     RegTest1Fail                    \n\t" \
486
                "       cmpwi   12, 12                          \n\t" \
487
                "       bne     RegTest1Fail                    \n\t" \
488
                "       cmpwi   13, 13                          \n\t" \
489
                "       bne     RegTest1Fail                    \n\t" \
490
                "       cmpwi   14, 14                          \n\t" \
491
                "       bne     RegTest1Fail                    \n\t" \
492
                "       cmpwi   15, 15                          \n\t" \
493
                "       bne     RegTest1Fail                    \n\t" \
494
                "       cmpwi   16, 16                          \n\t" \
495
                "       bne     RegTest1Fail                    \n\t" \
496
                "       cmpwi   17, 17                          \n\t" \
497
                "       bne     RegTest1Fail                    \n\t" \
498
                "       cmpwi   18, 18                          \n\t" \
499
                "       bne     RegTest1Fail                    \n\t" \
500
                "       cmpwi   19, 19                          \n\t" \
501
                "       bne     RegTest1Fail                    \n\t" \
502
                "       cmpwi   20, 20                          \n\t" \
503
                "       bne     RegTest1Fail                    \n\t" \
504
                "       cmpwi   21, 21                          \n\t" \
505
                "       bne     RegTest1Fail                    \n\t" \
506
                "       cmpwi   22, 22                          \n\t" \
507
                "       bne     RegTest1Fail                    \n\t" \
508
                "       cmpwi   23, 23                          \n\t" \
509
                "       bne     RegTest1Fail                    \n\t" \
510
                "       cmpwi   24, 24                          \n\t" \
511
                "       bne     RegTest1Fail                    \n\t" \
512
                "       cmpwi   25, 25                          \n\t" \
513
                "       bne     RegTest1Fail                    \n\t" \
514
                "       cmpwi   26, 26                          \n\t" \
515
                "       bne     RegTest1Fail                    \n\t" \
516
                "       cmpwi   27, 27                          \n\t" \
517
                "       bne     RegTest1Fail                    \n\t" \
518
                "       cmpwi   28, 28                          \n\t" \
519
                "       bne     RegTest1Fail                    \n\t" \
520
                "       cmpwi   29, 29                          \n\t" \
521
                "       bne     RegTest1Fail                    \n\t" \
522
                "       cmpwi   30, 30                          \n\t" \
523
                "       bne     RegTest1Fail                    \n\t" \
524
                "       cmpwi   31, 31                          \n\t" \
525
                "       bne     RegTest1Fail                    \n\t" \
526
                "                                                               \n\t" \
527
                "       mfspr   0, 256  #USPRG0         \n\t" \
528
                "       cmpwi   0, 301                          \n\t" \
529
                "       bne     RegTest1Fail                    \n\t" \
530
                "       mfspr   0, 8    #LR                     \n\t" \
531
                "       cmpwi   0, 501                          \n\t" \
532
                "       bne     RegTest1Fail                    \n\t" \
533
                "       mfspr   0, 1    #XER            \n\t" \
534
                "       cmpwi   0, 4                            \n\t" \
535
                "       bne     RegTest1Fail                    \n\t" \
536
                "                                                               \n\t" \
537
                "       bl prvRegTest1Pass                      \n\t" \
538
                "       b RegTest1Start                         \n\t" \
539
                "                                                               \n\t" \
540
                "RegTest1Fail:                                  \n\t" \
541
                "                                                               \n\t" \
542
                "                                                               \n\t" \
543
                "       bl prvRegTestFail                       \n\t" \
544
                "       b RegTest1Start                         \n\t" \
545
        );
546
}
547
/*-----------------------------------------------------------*/
548
 
549
static void prvRegTestTask2( void *pvParameters )
550
{
551
        /* Just to remove compiler warning. */
552
        ( void ) pvParameters;
553
 
554
        /* The second register test task as described at the top of this file.
555
        Note that this task fills the registers with different values to the
556
        first register test task. */
557
        asm volatile
558
        (
559
                "RegTest2Start:                                 \n\t" \
560
                "                                                               \n\t" \
561
                "       li              0, 300                          \n\t" \
562
                "       mtspr   256, 0  #USPRG0         \n\t" \
563
                "       li              0, 500                          \n\t" \
564
                "       mtspr   8, 0    #LR                     \n\t" \
565
                "       li              0, 4                            \n\t" \
566
                "       mtspr   1, 0    #XER            \n\t" \
567
                "                                                               \n\t" \
568
                "       li              0, 11                           \n\t" \
569
                "       li              2, 12                           \n\t" \
570
                "       li              3, 13                           \n\t" \
571
                "       li              4,      14                              \n\t" \
572
                "       li              5,      15                              \n\t" \
573
                "       li              6,      16                              \n\t" \
574
                "       li              7,      17                              \n\t" \
575
                "       li              8,      18                              \n\t" \
576
                "       li              9,      19                              \n\t" \
577
                "       li              10,     110                             \n\t" \
578
                "       li              11,     111                             \n\t" \
579
                "       li              12,     112                             \n\t" \
580
                "       li              13,     113                             \n\t" \
581
                "       li              14,     114                             \n\t" \
582
                "       li              15,     115                             \n\t" \
583
                "       li              16,     116                             \n\t" \
584
                "       li              17,     117                             \n\t" \
585
                "       li              18,     118                             \n\t" \
586
                "       li              19,     119                             \n\t" \
587
                "       li              20,     120                             \n\t" \
588
                "       li              21,     121                             \n\t" \
589
                "       li              22,     122                             \n\t" \
590
                "       li              23,     123                             \n\t" \
591
                "       li              24,     124                             \n\t" \
592
                "       li              25,     125                             \n\t" \
593
                "       li              26,     126                             \n\t" \
594
                "       li              27,     127                             \n\t" \
595
                "       li              28,     128                             \n\t" \
596
                "       li              29,     129                             \n\t" \
597
                "       li              30,     130                             \n\t" \
598
                "       li              31,     131                             \n\t" \
599
                "                                                               \n\t" \
600
                "       cmpwi   0, 11                           \n\t" \
601
                "       bne     RegTest2Fail                    \n\t" \
602
                "       cmpwi   2, 12                           \n\t" \
603
                "       bne     RegTest2Fail                    \n\t" \
604
                "       cmpwi   3, 13                           \n\t" \
605
                "       bne     RegTest2Fail                    \n\t" \
606
                "       cmpwi   4, 14                           \n\t" \
607
                "       bne     RegTest2Fail                    \n\t" \
608
                "       cmpwi   5, 15                           \n\t" \
609
                "       bne     RegTest2Fail                    \n\t" \
610
                "       cmpwi   6, 16                           \n\t" \
611
                "       bne     RegTest2Fail                    \n\t" \
612
                "       cmpwi   7, 17                           \n\t" \
613
                "       bne     RegTest2Fail                    \n\t" \
614
                "       cmpwi   8, 18                           \n\t" \
615
                "       bne     RegTest2Fail                    \n\t" \
616
                "       cmpwi   9, 19                           \n\t" \
617
                "       bne     RegTest2Fail                    \n\t" \
618
                "       cmpwi   10, 110                         \n\t" \
619
                "       bne     RegTest2Fail                    \n\t" \
620
                "       cmpwi   11, 111                         \n\t" \
621
                "       bne     RegTest2Fail                    \n\t" \
622
                "       cmpwi   12, 112                         \n\t" \
623
                "       bne     RegTest2Fail                    \n\t" \
624
                "       cmpwi   13, 113                         \n\t" \
625
                "       bne     RegTest2Fail                    \n\t" \
626
                "       cmpwi   14, 114                         \n\t" \
627
                "       bne     RegTest2Fail                    \n\t" \
628
                "       cmpwi   15, 115                         \n\t" \
629
                "       bne     RegTest2Fail                    \n\t" \
630
                "       cmpwi   16, 116                         \n\t" \
631
                "       bne     RegTest2Fail                    \n\t" \
632
                "       cmpwi   17, 117                         \n\t" \
633
                "       bne     RegTest2Fail                    \n\t" \
634
                "       cmpwi   18, 118                         \n\t" \
635
                "       bne     RegTest2Fail                    \n\t" \
636
                "       cmpwi   19, 119                         \n\t" \
637
                "       bne     RegTest2Fail                    \n\t" \
638
                "       cmpwi   20, 120                         \n\t" \
639
                "       bne     RegTest2Fail                    \n\t" \
640
                "       cmpwi   21, 121                         \n\t" \
641
                "       bne     RegTest2Fail                    \n\t" \
642
                "       cmpwi   22, 122                         \n\t" \
643
                "       bne     RegTest2Fail                    \n\t" \
644
                "       cmpwi   23, 123                         \n\t" \
645
                "       bne     RegTest2Fail                    \n\t" \
646
                "       cmpwi   24, 124                         \n\t" \
647
                "       bne     RegTest2Fail                    \n\t" \
648
                "       cmpwi   25, 125                         \n\t" \
649
                "       bne     RegTest2Fail                    \n\t" \
650
                "       cmpwi   26, 126                         \n\t" \
651
                "       bne     RegTest2Fail                    \n\t" \
652
                "       cmpwi   27, 127                         \n\t" \
653
                "       bne     RegTest2Fail                    \n\t" \
654
                "       cmpwi   28, 128                         \n\t" \
655
                "       bne     RegTest2Fail                    \n\t" \
656
                "       cmpwi   29, 129                         \n\t" \
657
                "       bne     RegTest2Fail                    \n\t" \
658
                "       cmpwi   30, 130                         \n\t" \
659
                "       bne     RegTest2Fail                    \n\t" \
660
                "       cmpwi   31, 131                         \n\t" \
661
                "       bne     RegTest2Fail                    \n\t" \
662
                "                                                               \n\t" \
663
                "       mfspr   0, 256  #USPRG0         \n\t" \
664
                "       cmpwi   0, 300                          \n\t" \
665
                "       bne     RegTest2Fail                    \n\t" \
666
                "       mfspr   0, 8    #LR                     \n\t" \
667
                "       cmpwi   0, 500                          \n\t" \
668
                "       bne     RegTest2Fail                    \n\t" \
669
                "       mfspr   0, 1    #XER            \n\t" \
670
                "       cmpwi   0, 4                            \n\t" \
671
                "       bne     RegTest2Fail                    \n\t" \
672
                "                                                               \n\t" \
673
                "       bl prvRegTest2Pass                      \n\t" \
674
                "       b RegTest2Start                         \n\t" \
675
                "                                                               \n\t" \
676
                "RegTest2Fail:                                  \n\t" \
677
                "                                                               \n\t" \
678
                "                                                               \n\t" \
679
                "       bl prvRegTestFail                       \n\t" \
680
                "       b RegTest2Start                         \n\t" \
681
        );
682
}
683
/*-----------------------------------------------------------*/
684
 
685
/* This hook function will get called if there is a suspected stack overflow.
686
An overflow can cause the task name to be corrupted, in which case the task
687
handle needs to be used to determine the offending task. */
688
void vApplicationStackOverflowHook( xTaskHandle xTask, signed char *pcTaskName );
689
void vApplicationStackOverflowHook( xTaskHandle xTask, signed char *pcTaskName )
690
{
691
/* To prevent the optimiser removing the variables. */
692
volatile xTaskHandle xTaskIn = xTask;
693
volatile signed char *pcTaskNameIn = pcTaskName;
694
 
695
        /* Remove compiler warnings. */
696
        ( void ) xTaskIn;
697
        ( void ) pcTaskNameIn;
698
 
699
        /* The following three calls are simply to stop compiler warnings about the
700
        functions not being used - they are called from the inline assembly. */
701
        prvRegTest1Pass();
702
        prvRegTest2Pass();
703
        prvRegTestFail();
704
 
705
        for( ;; );
706
}
707
 
708
 
709
 

powered by: WebSVN 2.1.0

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