OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [AVR_ATMega323_IAR/] [regtest.c] - Blame information for rev 610

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 589 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
/* Scheduler include files. */
55
#include "FreeRTOS.h"
56
#include "task.h"
57
 
58
/* Demo file headers. */
59
#include "regtest.h"
60
 
61
/*
62
 * Test tasks that sets registers to known values, then checks to ensure the
63
 * values remain as expected.  Test 1 and test 2 use different values.
64
 */
65
static void prvRegisterCheck1( void *pvParameters );
66
static void prvRegisterCheck2( void *pvParameters );
67
 
68
/* Set to a non zero value should an error be found. */
69
portBASE_TYPE xRegTestError = pdFALSE;
70
 
71
/*-----------------------------------------------------------*/
72
 
73
void vStartRegTestTasks( void )
74
{
75
        xTaskCreate( prvRegisterCheck1, "Reg1", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
76
        xTaskCreate( prvRegisterCheck2, "Reg2", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL );
77
}
78
/*-----------------------------------------------------------*/
79
 
80
portBASE_TYPE xAreRegTestTasksStillRunning( void )
81
{
82
portBASE_TYPE xReturn;
83
 
84
        /* If a register was found to contain an unexpected value then the
85
        xRegTestError variable would have been set to a non zero value. */
86
        if( xRegTestError == pdFALSE )
87
        {
88
                xReturn = pdTRUE;
89
        }
90
        else
91
        {
92
                xReturn = pdFALSE;
93
        }
94
 
95
        return xReturn;
96
}
97
/*-----------------------------------------------------------*/
98
 
99
static void prvRegisterCheck1( void *pvParameters )
100
{
101
        ( void ) pvParameters;
102
 
103
        for( ;; )
104
        {
105
                asm(    "LDI    r31,    5"              );
106
                asm(    "MOV    r0,             r31"    );
107
                asm(    "LDI    r31,    6"              );
108
                asm(    "MOV    r1,             r31"    );
109
                asm(    "LDI    r31,    7"              );
110
                asm(    "MOV    r2,             r31"    );
111
                asm(    "LDI    r31,    8"              );
112
                asm(    "MOV    r3,             r31"    );
113
                asm(    "LDI    r31,    9"              );
114
                asm(    "MOV    r4,             r31"    );
115
                asm(    "LDI    r31,    10"             );
116
                asm(    "MOV    r5,             r31"    );
117
                asm(    "LDI    r31,    11"             );
118
                asm(    "MOV    r6,             r31"    );
119
                asm(    "LDI    r31,    12"             );
120
                asm(    "MOV    r7,             r31"    );
121
                asm(    "LDI    r31,    13"             );
122
                asm(    "MOV    r8,             r31"    );
123
                asm(    "LDI    r31,    14"             );
124
                asm(    "MOV    r9,             r31"    );
125
                asm(    "LDI    r31,    15"             );
126
                asm(    "MOV    r10,    r31"    );
127
                asm(    "LDI    r31,    16"             );
128
                asm(    "MOV    r11,    r31"    );
129
                asm(    "LDI    r31,    17"             );
130
                asm(    "MOV    r12,    r31"    );
131
                asm(    "LDI    r31,    18"             );
132
                asm(    "MOV    r13,    r31"    );
133
                asm(    "LDI    r31,    19"             );
134
                asm(    "MOV    r14,    r31"    );
135
                asm(    "LDI    r31,    20"             );
136
                asm(    "MOV    r15,    r31"    );
137
                asm(    "LDI    r16,    21"             );
138
                asm(    "LDI    r17,    22"             );
139
                asm(    "LDI    r18,    23"             );
140
                asm(    "LDI    r19,    24"             );
141
                asm(    "LDI    r20,    25"             );
142
                asm(    "LDI    r21,    26"             );
143
                asm(    "LDI    r22,    27"             );
144
                asm(    "LDI    r23,    28"             );
145
                asm(    "LDI    r24,    29"             );
146
                asm(    "LDI    r25,    30"             );
147
                asm(    "LDI    r26,    31"             );
148
                asm(    "LDI    r27,    32"             );
149
                asm(    "LDI    r30,    33"             );
150
 
151
                asm(    "LDI    r31,    5"                      );
152
                asm(    "CPSE   r31,    r0"                     );
153
                asm(    "STS    xRegTestError, r0"      );
154
                asm(    "LDI    r31,    6"                      );
155
                asm(    "CPSE   r31,    r1"                     );
156
                asm(    "STS    xRegTestError, r0"      );
157
                asm(    "LDI    r31,    7"                      );
158
                asm(    "CPSE   r31,    r2"                     );
159
                asm(    "STS    xRegTestError, r0"      );
160
                asm(    "LDI    r31,    8"                      );
161
                asm(    "CPSE   r31,    r3"                     );
162
                asm(    "STS    xRegTestError, r0"      );
163
                asm(    "LDI    r31,    9"                      );
164
                asm(    "CPSE   r31,    r4"                     );
165
                asm(    "STS    xRegTestError, r0"      );
166
                asm(    "LDI    r31,    10"                     );
167
                asm(    "CPSE   r31,    r5"                     );
168
                asm(    "STS    xRegTestError, r0"      );
169
                asm(    "LDI    r31,    11"                     );
170
                asm(    "CPSE   r31,    r6"                     );
171
                asm(    "STS    xRegTestError, r0"      );
172
                asm(    "LDI    r31,    12"                     );
173
                asm(    "CPSE   r31,    r7"                     );
174
                asm(    "STS    xRegTestError, r0"      );
175
                asm(    "LDI    r31,    13"                     );
176
                asm(    "CPSE   r31,    r8"                     );
177
                asm(    "STS    xRegTestError, r0"      );
178
                asm(    "LDI    r31,    14"                     );
179
                asm(    "CPSE   r31,    r9"                     );
180
                asm(    "STS    xRegTestError, r0"      );
181
                asm(    "LDI    r31,    15"                     );
182
                asm(    "CPSE   r31,    r10"            );
183
                asm(    "STS    xRegTestError, r0"      );
184
                asm(    "LDI    r31,    16"                     );
185
                asm(    "CPSE   r31,    r11"            );
186
                asm(    "STS    xRegTestError, r0"      );
187
                asm(    "LDI    r31,    17"                     );
188
                asm(    "CPSE   r31,    r12"            );
189
                asm(    "STS    xRegTestError, r0"      );
190
                asm(    "LDI    r31,    18"                     );
191
                asm(    "CPSE   r31,    r13"            );
192
                asm(    "STS    xRegTestError, r0"      );
193
                asm(    "LDI    r31,    19"                     );
194
                asm(    "CPSE   r31,    r14"            );
195
                asm(    "STS    xRegTestError, r0"      );
196
                asm(    "LDI    r31,    20"                     );
197
                asm(    "CPSE   r31,    r15"            );
198
                asm(    "STS    xRegTestError, r0"      );
199
                asm(    "LDI    r31,    21"                     );
200
                asm(    "CPSE   r31,    r16"            );
201
                asm(    "STS    xRegTestError, r0"      );
202
                asm(    "LDI    r31,    22"                     );
203
                asm(    "CPSE   r31,    r17"            );
204
                asm(    "STS    xRegTestError, r0"      );
205
                asm(    "LDI    r31,    23"                     );
206
                asm(    "CPSE   r31,    r18"            );
207
                asm(    "STS    xRegTestError, r0"      );
208
                asm(    "LDI    r31,    24"                     );
209
                asm(    "CPSE   r31,    r19"            );
210
                asm(    "STS    xRegTestError, r0"      );
211
                asm(    "LDI    r31,    25"                     );
212
                asm(    "CPSE   r31,    r20"            );
213
                asm(    "STS    xRegTestError, r0"      );
214
                asm(    "LDI    r31,    26"                     );
215
                asm(    "CPSE   r31,    r21"            );
216
                asm(    "STS    xRegTestError, r0"      );
217
                asm(    "LDI    r31,    27"                     );
218
                asm(    "CPSE   r31,    r22"            );
219
                asm(    "STS    xRegTestError, r0"      );
220
                asm(    "LDI    r31,    28"                     );
221
                asm(    "CPSE   r31,    r23"            );
222
                asm(    "STS    xRegTestError, r0"      );
223
                asm(    "LDI    r31,    29"                     );
224
                asm(    "CPSE   r31,    r24"            );
225
                asm(    "STS    xRegTestError, r0"      );
226
                asm(    "LDI    r31,    30"                     );
227
                asm(    "CPSE   r31,    r25"            );
228
                asm(    "STS    xRegTestError, r0"      );
229
                asm(    "LDI    r31,    31"                     );
230
                asm(    "CPSE   r31,    r26"            );
231
                asm(    "STS    xRegTestError, r0"      );
232
                asm(    "LDI    r31,    32"                     );
233
                asm(    "CPSE   r31,    r27"            );
234
                asm(    "STS    xRegTestError, r0"      );
235
                asm(    "LDI    r31,    33"                     );
236
                asm(    "CPSE   r31,    r30"            );
237
                asm(    "STS    xRegTestError, r0"      );
238
        }
239
}
240
/*-----------------------------------------------------------*/
241
 
242
static void prvRegisterCheck2( void *pvParameters )
243
{
244
        ( void ) pvParameters;
245
 
246
        for( ;; )
247
        {
248
                asm(    "LDI    r31,    1"              );
249
                asm(    "MOV    r0,             r31"    );
250
                asm(    "LDI    r31,    2"              );
251
                asm(    "MOV    r1,             r31"    );
252
                asm(    "LDI    r31,    3"              );
253
                asm(    "MOV    r2,             r31"    );
254
                asm(    "LDI    r31,    4"              );
255
                asm(    "MOV    r3,             r31"    );
256
                asm(    "LDI    r31,    5"              );
257
                asm(    "MOV    r4,             r31"    );
258
                asm(    "LDI    r31,    6"              );
259
                asm(    "MOV    r5,             r31"    );
260
                asm(    "LDI    r31,    7"              );
261
                asm(    "MOV    r6,             r31"    );
262
                asm(    "LDI    r31,    8"              );
263
                asm(    "MOV    r7,             r31"    );
264
                asm(    "LDI    r31,    9"              );
265
                asm(    "MOV    r8,             r31"    );
266
                asm(    "LDI    r31,    10"             );
267
                asm(    "MOV    r9,             r31"    );
268
                asm(    "LDI    r31,    11"             );
269
                asm(    "MOV    r10,    r31"    );
270
                asm(    "LDI    r31,    12"             );
271
                asm(    "MOV    r11,    r31"    );
272
                asm(    "LDI    r31,    13"             );
273
                asm(    "MOV    r12,    r31"    );
274
                asm(    "LDI    r31,    14"             );
275
                asm(    "MOV    r13,    r31"    );
276
                asm(    "LDI    r31,    15"             );
277
                asm(    "MOV    r14,    r31"    );
278
                asm(    "LDI    r31,    16"             );
279
                asm(    "MOV    r15,    r31"    );
280
                asm(    "LDI    r16,    17"             );
281
                asm(    "LDI    r17,    18"             );
282
                asm(    "LDI    r18,    19"             );
283
                asm(    "LDI    r19,    20"             );
284
                asm(    "LDI    r20,    21"             );
285
                asm(    "LDI    r21,    22"             );
286
                asm(    "LDI    r22,    23"             );
287
                asm(    "LDI    r23,    24"             );
288
                asm(    "LDI    r24,    25"             );
289
                asm(    "LDI    r25,    26"             );
290
                asm(    "LDI    r26,    27"             );
291
                asm(    "LDI    r27,    28"             );
292
                asm(    "LDI    r30,    29"             );
293
 
294
                asm(    "LDI    r31,    1"                      );
295
                asm(    "CPSE   r31,    r0"                     );
296
                asm(    "STS    xRegTestError, r0"      );
297
                asm(    "LDI    r31,    2"                      );
298
                asm(    "CPSE   r31,    r1"                     );
299
                asm(    "STS    xRegTestError, r0"      );
300
                asm(    "LDI    r31,    3"                      );
301
                asm(    "CPSE   r31,    r2"                     );
302
                asm(    "STS    xRegTestError, r0"      );
303
                asm(    "LDI    r31,    4"                      );
304
                asm(    "CPSE   r31,    r3"                     );
305
                asm(    "STS    xRegTestError, r0"      );
306
                asm(    "LDI    r31,    5"                      );
307
                asm(    "CPSE   r31,    r4"                     );
308
                asm(    "STS    xRegTestError, r0"      );
309
                asm(    "LDI    r31,    6"                      );
310
                asm(    "CPSE   r31,    r5"                     );
311
                asm(    "STS    xRegTestError, r0"      );
312
                asm(    "LDI    r31,    7"                      );
313
                asm(    "CPSE   r31,    r6"                     );
314
                asm(    "STS    xRegTestError, r0"      );
315
                asm(    "LDI    r31,    8"                      );
316
                asm(    "CPSE   r31,    r7"                     );
317
                asm(    "STS    xRegTestError, r0"      );
318
                asm(    "LDI    r31,    9"                      );
319
                asm(    "CPSE   r31,    r8"                     );
320
                asm(    "STS    xRegTestError, r0"      );
321
                asm(    "LDI    r31,    10"                     );
322
                asm(    "CPSE   r31,    r9"                     );
323
                asm(    "STS    xRegTestError, r0"      );
324
                asm(    "LDI    r31,    11"                     );
325
                asm(    "CPSE   r31,    r10"            );
326
                asm(    "STS    xRegTestError, r0"      );
327
                asm(    "LDI    r31,    12"                     );
328
                asm(    "CPSE   r31,    r11"            );
329
                asm(    "STS    xRegTestError, r0"      );
330
                asm(    "LDI    r31,    13"                     );
331
                asm(    "CPSE   r31,    r12"            );
332
                asm(    "STS    xRegTestError, r0"      );
333
                asm(    "LDI    r31,    14"                     );
334
                asm(    "CPSE   r31,    r13"            );
335
                asm(    "STS    xRegTestError, r0"      );
336
                asm(    "LDI    r31,    15"                     );
337
                asm(    "CPSE   r31,    r14"            );
338
                asm(    "STS    xRegTestError, r0"      );
339
                asm(    "LDI    r31,    16"                     );
340
                asm(    "CPSE   r31,    r15"            );
341
                asm(    "STS    xRegTestError, r0"      );
342
                asm(    "LDI    r31,    17"                     );
343
                asm(    "CPSE   r31,    r16"            );
344
                asm(    "STS    xRegTestError, r0"      );
345
                asm(    "LDI    r31,    18"                     );
346
                asm(    "CPSE   r31,    r17"            );
347
                asm(    "STS    xRegTestError, r0"      );
348
                asm(    "LDI    r31,    19"                     );
349
                asm(    "CPSE   r31,    r18"            );
350
                asm(    "STS    xRegTestError, r0"      );
351
                asm(    "LDI    r31,    20"                     );
352
                asm(    "CPSE   r31,    r19"            );
353
                asm(    "STS    xRegTestError, r0"      );
354
                asm(    "LDI    r31,    21"                     );
355
                asm(    "CPSE   r31,    r20"            );
356
                asm(    "STS    xRegTestError, r0"      );
357
                asm(    "LDI    r31,    22"                     );
358
                asm(    "CPSE   r31,    r21"            );
359
                asm(    "STS    xRegTestError, r0"      );
360
                asm(    "LDI    r31,    23"                     );
361
                asm(    "CPSE   r31,    r22"            );
362
                asm(    "STS    xRegTestError, r0"      );
363
                asm(    "LDI    r31,    24"                     );
364
                asm(    "CPSE   r31,    r23"            );
365
                asm(    "STS    xRegTestError, r0"      );
366
                asm(    "LDI    r31,    25"                     );
367
                asm(    "CPSE   r31,    r24"            );
368
                asm(    "STS    xRegTestError, r0"      );
369
                asm(    "LDI    r31,    26"                     );
370
                asm(    "CPSE   r31,    r25"            );
371
                asm(    "STS    xRegTestError, r0"      );
372
                asm(    "LDI    r31,    27"                     );
373
                asm(    "CPSE   r31,    r26"            );
374
                asm(    "STS    xRegTestError, r0"      );
375
                asm(    "LDI    r31,    28"                     );
376
                asm(    "CPSE   r31,    r27"            );
377
                asm(    "STS    xRegTestError, r0"      );
378
                asm(    "LDI    r31,    29"                     );
379
                asm(    "CPSE   r31,    r30"            );
380
                asm(    "STS    xRegTestError, r0"      );
381
        }
382
}
383
 

powered by: WebSVN 2.1.0

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